public boolean invoke(MOB mob, Vector commands, Physical givenTarget, boolean auto, int asLevel) { if (commands.size() < 1) { mob.tell("Chant to whom?"); return false; } String mobName = CMParms.combine(commands, 0).trim().toUpperCase(); MOB target = getTarget(mob, commands, givenTarget); Room newRoom = mob.location(); if (target != null) { newRoom = target.location(); if ((!CMLib.flags().isAnimalIntelligence(target)) || (target.amFollowing() != mob)) { mob.tell("You have no animal follower named '" + mobName + "' here."); return false; } } else { mob.tell("You have no animal follower named '" + mobName + "' here."); return false; } if (!super.invoke(mob, commands, givenTarget, auto, asLevel)) return false; boolean success = proficiencyCheck(mob, 0, auto); if (success) { CMMsg msg = CMClass.getMsg( mob, target, this, verbalCastCode(mob, target, auto), auto ? "" : "^S<S-NAME> chant(s) to <T-NAMESELF>, invoking the a mystical connection.^?"); CMMsg msg2 = CMClass.getMsg(mob, target, this, verbalCastCode(mob, target, auto), null); if ((mob.location().okMessage(mob, msg)) && ((newRoom == mob.location()) || (newRoom.okMessage(mob, msg2)))) { mob.location().send(mob, msg); if (newRoom != mob.location()) newRoom.send(target, msg2); spy = target; beneficialAffect(mob, spy, asLevel, 0); Ability A = spy.fetchEffect(ID()); if (A != null) { mob.addNonUninvokableEffect((Ability) A.copyOf()); A.setAffectedOne(spy); } } } else beneficialVisualFizzle( mob, target, "<S-NAME> chant(s) to <T-NAMESELF>, but the magic fades."); // return whether it worked return success; }
public ChameleonList<Ability> getClanLevelEffects(final MOB mob, final Integer level) { if (level == null) return getEmptyClanLevelEffects(mob); final DefaultClanGovernment myGovt = this; final List<Ability> myList = getClanLevelEffectsList(mob, level); final List<Ability> finalV = new Vector<Ability>(myList.size()); for (final Ability A : myList) { Ability finalA = (Ability) A.copyOf(); finalA.makeNonUninvokable(); finalA.setSavable(false); // must come AFTER the above finalA.setAffectedOne(mob); finalV.add(finalA); } final ChameleonList<Ability> finalFinalV; if (mob == null) { finalFinalV = new ChameleonList<Ability>( finalV, new ChameleonList.Signaler<Ability>(myList) { public boolean isDeprecated() { return false; } public void rebuild(final ChameleonList<Ability> me) {} }); } else { finalFinalV = new ChameleonList<Ability>( finalV, new ChameleonList.Signaler<Ability>(myList) { public boolean isDeprecated() { if ((mob == null) || (mob.amDestroyed())) return true; final Clan C = mob.getMyClan(); if (C == null) return true; if ((C.getGovernment() != myGovt) || (getClanLevelEffectsList(mob, Integer.valueOf(C.getClanLevel())) != oldReferenceListRef.get())) return true; return false; } public void rebuild(final ChameleonList<Ability> me) { final Clan C = (mob != null) ? mob.getMyClan() : null; if ((mob == null) || (mob.amDestroyed()) || (C == null)) me.changeMeInto(getEmptyClanLevelEffects(mob)); else me.changeMeInto( C.getGovernment() .getClanLevelEffects(mob, Integer.valueOf(C.getClanLevel()))); } }); } return finalFinalV; }