Esempio n. 1
0
  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;
  }