public boolean invoke(MOB mob, Vector commands, Physical givenTarget, boolean auto, int asLevel) { Physical target = null; if (commands.size() > 0) { String s = CMParms.combine(commands, 0); if (s.equalsIgnoreCase("room")) target = mob.location(); else if (s.equalsIgnoreCase("here")) target = mob.location(); else if (CMLib.english().containsString(mob.location().ID(), s) || CMLib.english().containsString(mob.location().name(), s) || CMLib.english().containsString(mob.location().displayText(), s)) target = mob.location(); } if (target == null) target = getTarget(mob, commands, givenTarget); if (target == null) return false; if ((target instanceof Room) && (target.fetchEffect(ID()) != null)) { mob.tell("This place is already under a summoning ward."); 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 ? "<T-NAME> seem(s) magically protected." : "^S<S-NAME> invoke(s) a summoning ward upon <T-NAMESELF>.^?"); if (target instanceof Room) quality = Ability.QUALITY_MALICIOUS; if (mob.location().okMessage(mob, msg)) { mob.location().send(mob, msg); if ((target instanceof Room) && ((CMLib.law().doesOwnThisProperty(mob, ((Room) target))))) { target.addNonUninvokableEffect((Ability) this.copyOf()); CMLib.database().DBUpdateRoom((Room) target); } else { beneficialAffect(mob, target, asLevel, 0); if (target instanceof Room) { Spell_SummoningWard A = (Spell_SummoningWard) target.fetchEffect(ID()); if (A != null) A.quality = Ability.QUALITY_MALICIOUS; } } } } else beneficialWordsFizzle( mob, target, "<S-NAME> attempt(s) to invoke a summoning ward, but fail(s)."); quality = Ability.QUALITY_INDIFFERENT; return success; }
public List<Ability> returnOffensiveAffects(MOB caster, Physical fromMe) { MOB newMOB = CMClass.getFactoryMOB(); MOB newerMOB = CMClass.getFactoryMOB(); Vector offenders = new Vector(1); CMMsg msg = CMClass.getMsg(newMOB, newerMOB, null, CMMsg.MSG_LOOK, null); for (int a = 0; a < fromMe.numEffects(); a++) // personal { Ability A = fromMe.fetchEffect(a); if (A != null) { newMOB.recoverPhyStats(); A.affectPhyStats(newMOB, newMOB.phyStats()); if ((!CMLib.flags().canSee(newMOB)) || (!A.okMessage(newMOB, msg))) if ((A.invoker() == null) || ((A.invoker() != null) && (A.invoker().phyStats().level()) <= (caster.phyStats().level() + 1 + (2 * getXLEVELLevel(caster))))) offenders.addElement(A); } } newMOB.destroy(); newerMOB.destroy(); return offenders; }