Beispiel #1
0
 public void unInvoke() {
   // undo the affects of this spell
   if ((affected == null) || (!(affected instanceof MOB))) return;
   if (canBeUninvoked()) {
     if (invoker != null) {
       Ability A = invoker.fetchEffect(this.ID());
       if (A != null) invoker.delEffect(A);
       invoker.tell("Your connection with '" + spy.name() + "' fades.");
     }
   }
   super.unInvoke();
 }
Beispiel #2
0
  public void executeMsg(final Environmental myHost, final CMMsg msg) {
    try {
      super.executeMsg(myHost, msg);
      if (spy == null) return;
      if (invoker == null) return;

      if ((msg.amISource(spy))
          && ((msg.sourceMinor() == CMMsg.TYP_LOOK) || (msg.sourceMinor() == CMMsg.TYP_EXAMINE))
          && (msg.target() != null)
          && ((invoker.location() != spy.location()) || (!(msg.target() instanceof Room)))) {
        disable = true;
        CMMsg newAffect = CMClass.getMsg(invoker, msg.target(), msg.sourceMinor(), null);
        msg.target().executeMsg(invoker, newAffect);
      } else if ((!msg.amISource(invoker))
          && (invoker.location() != spy.location())
          && (msg.source().location() == spy.location())
          && (msg.othersCode() != CMMsg.NO_EFFECT)
          && (msg.othersMessage() != null)
          && (!disable)) {
        disable = true;
        invoker.executeMsg(invoker, msg);
      } else if (msg.amISource(invoker)
          && (!disable)
          && (msg.sourceMinor() == CMMsg.TYP_SPEAK)
          && (msg.sourceMessage() != null)
          && ((msg.sourceMajor() & CMMsg.MASK_MAGIC) == 0)) {
        int start = msg.sourceMessage().indexOf("\'");
        int end = msg.sourceMessage().lastIndexOf("\'");
        if ((start > 0) && (end > start)) {
          String msg2 = msg.sourceMessage().substring(start + 1, end).trim();
          if (msg2.length() > 0)
            spy.enqueCommand(CMParms.parse(msg2.trim()), Command.METAFLAG_FORCED, 0);
        }
      }
    } finally {
      disable = false;
      if ((spy != null)
          && ((spy.amFollowing() != invoker)
              || (spy.amDead())
              || (!CMLib.flags().isInTheGame(spy, false))
              || (!CMLib.flags().isInTheGame(invoker, true)))) unInvoke();
    }
  }
 public void unInvoke() {
   if (PlantsLocation == null) return;
   if (littlePlants == null) return;
   if (canBeUninvoked())
     PlantsLocation.showHappens(
         CMMsg.MSG_OK_VISUAL,
         littlePlants.name()
             + " wither"
             + (littlePlants.name().startsWith("s") ? "" : "s")
             + " away.");
   super.unInvoke();
   if (canBeUninvoked()) {
     Item plants = littlePlants; // protects against uninvoke loops!
     littlePlants = null;
     plants.destroy();
     PlantsLocation.recoverRoomStats();
     PlantsLocation = null;
   }
 }