示例#1
0
  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;
  }