Example #1
0
 public boolean tick(Tickable ticking, int tickID) {
   if (tickID == Tickable.TICKID_MOB) {
     Room R = CMLib.map().roomLocation(affected);
     if ((R != null)
         && (invoker != null)
         && ((!R.isInhabitant(invoker)) || (!invoker.isInCombat()))) {
       unInvoke();
       return false;
     }
   }
   return super.tick(ticking, tickID);
 }
Example #2
0
  public boolean invoke(MOB mob, Vector commands, Physical givenTarget, boolean auto, int asLevel) {
    if (!super.invoke(mob, commands, givenTarget, auto, asLevel)) return false;

    boolean success = (!mob.isInCombat()) || proficiencyCheck(mob, 0, auto);
    if (success) {
      int AUTO = auto ? CMMsg.MASK_ALWAYS : 0;
      Room recalledRoom = mob.location();
      Room recallRoom = mob.getStartRoom();
      CMMsg msg =
          CMClass.getMsg(
              mob,
              recalledRoom,
              this,
              verbalCastCode(mob, recalledRoom, auto),
              CMMsg.MASK_MAGIC | AUTO | CMMsg.MSG_LEAVE,
              verbalCastCode(mob, recalledRoom, auto),
              auto
                  ? "<S-NAME> disappear(s) into the Java Plane!"
                  : "<S-NAME> recall(s) body and spirit to the Java Plane!");
      CMMsg msg2 =
          CMClass.getMsg(
              mob,
              recallRoom,
              this,
              verbalCastCode(mob, recallRoom, auto),
              CMMsg.MASK_MAGIC | AUTO | CMMsg.MASK_MOVE | CMMsg.MSG_ENTER,
              verbalCastCode(mob, recallRoom, auto),
              null);
      if ((recalledRoom.okMessage(mob, msg)) && (recallRoom.okMessage(mob, msg2))) {
        recalledRoom.send(mob, msg);
        recallRoom.send(mob, msg2);
        if (recalledRoom.isInhabitant(mob)) recallRoom.bringMobHere(mob, false);
        for (int f = 0; f < mob.numFollowers(); f++) {
          MOB follower = mob.fetchFollower(f);

          msg =
              CMClass.getMsg(
                  follower,
                  recalledRoom,
                  this,
                  verbalCastCode(mob, recalledRoom, auto),
                  CMMsg.MASK_MAGIC | AUTO | CMMsg.MSG_LEAVE,
                  verbalCastCode(mob, recalledRoom, auto),
                  auto
                      ? "<S-NAME> disappear(s) into the Java Plane!"
                      : "<S-NAME> <S-IS-ARE> sucked into the vortex created by "
                          + mob.name()
                          + "s recall.");
          if ((follower != null)
              && (follower.isMonster())
              && (!follower.isPossessing())
              && (follower.location() == recalledRoom)
              && (recalledRoom.isInhabitant(follower))
              && (recalledRoom.okMessage(follower, msg))) {
            msg2 =
                CMClass.getMsg(
                    follower,
                    recallRoom,
                    this,
                    verbalCastCode(mob, recallRoom, auto),
                    CMMsg.MASK_MAGIC | AUTO | CMMsg.MASK_MOVE | CMMsg.MSG_ENTER,
                    verbalCastCode(mob, recallRoom, auto),
                    null);
            if (recallRoom.okMessage(follower, msg2)) {
              recallRoom.send(follower, msg2);
              if (recalledRoom.isInhabitant(follower)) recallRoom.bringMobHere(follower, false);
            }
          }
        }
      }
    } else
      beneficialWordsFizzle(
          mob, null, "<S-NAME> attempt(s) to recall, but <S-HIS-HER> plea goes unheard.");

    // return whether it worked
    return success;
  }