예제 #1
0
 public void unInvoke() {
   // undo the affects of this spell
   MOB recheckMOB = null;
   if ((canBeUninvoked()) && (affected != null)) {
     if (affected instanceof MOB) {
       MOB mob = (MOB) affected;
       if ((mob.location() != null) && (!mob.amDead()))
         mob.location()
             .show(
                 mob, null, CMMsg.MSG_OK_VISUAL, "<S-NAME> return(s) to <S-HIS-HER> normal size.");
       recheckMOB = mob;
     } else if (affected instanceof Item) {
       Item item = (Item) affected;
       if (item.owner() != null) {
         if (item.owner() instanceof Room)
           ((Room) item.owner())
               .showHappens(CMMsg.MSG_OK_VISUAL, item.name() + " returns to its proper size.");
         else if (item.owner() instanceof MOB) {
           ((MOB) item.owner()).tell(item.name() + " returns to its proper size.");
           recheckMOB = (MOB) item.owner();
         }
       }
     }
   }
   super.unInvoke();
   if (recheckMOB != null) CMLib.utensils().confirmWearability(recheckMOB);
 }
예제 #2
0
  public boolean tick(Tickable ticking, int tickID) {
    if (!super.tick(ticking, tickID)) return false;
    if (affected == null) return false;
    if (!(affected instanceof MOB)) return true;

    MOB mob = (MOB) affected;
    if ((!mob.amDead()) && ((--diseaseTick) <= 0)) {
      diseaseTick = DISEASE_DELAY();
      if (CMLib.dice().rollPercentage() == 1) {
        int damage = mob.curState().getHitPoints() / 2;
        MOB diseaser = invoker;
        if (diseaser == null) diseaser = mob;
        CMLib.combat()
            .postDamage(
                diseaser,
                mob,
                this,
                damage,
                CMMsg.MASK_ALWAYS | CMMsg.TYP_DISEASE,
                -1,
                "<S-NAME> <S-HAS-HAVE> an asthma attack! It <DAMAGE> <S-NAME>!");
      } else mob.location().show(mob, null, CMMsg.MSG_NOISE, DISEASE_AFFECT());
      return true;
    }
    return true;
  }
예제 #3
0
  public boolean okMessage(final Environmental myHost, final CMMsg msg) {
    if (!super.okMessage(myHost, msg)) return false;

    if (!(affected instanceof MOB)) return true;

    MOB mob = (MOB) affected;
    if (!mob.isInCombat()) this.unInvoke();
    else if ((msg.amITarget(mob))
        && (msg.targetMinor() == CMMsg.TYP_DAMAGE)
        && ((msg.value()) > 0)) {
      if ((msg.tool() != null) && (!mob.amDead()) && (msg.tool() instanceof Weapon)) {
        msg.modify(
            msg.source(),
            msg.target(),
            msg.tool(),
            CMMsg.NO_EFFECT,
            null,
            CMMsg.NO_EFFECT,
            null,
            CMMsg.NO_EFFECT,
            null);
        if (!((MOB) msg.target()).amDead())
          msg.addTrailerMsg(
              CMClass.getMsg(
                  (MOB) msg.target(),
                  msg.source(),
                  CMMsg.MSG_OK_VISUAL,
                  "<S-NAME> tumble(s) around the attack from <T-NAME>."));
        if ((++hits) >= 2) unInvoke();
      }
    }
    return true;
  }
예제 #4
0
  public void executeMsg(final Environmental myHost, final CMMsg msg) {
    if (processing) return;

    if (!(affected instanceof Item)) return;
    processing = true;

    Item myItem = (Item) affected;

    if ((myItem != null)
        && (msg.targetMinor() == CMMsg.TYP_DAMAGE)
        && ((msg.value()) > 0)
        && (!myItem.amWearingAt(Wearable.IN_INVENTORY))
        && (myItem.owner() instanceof MOB)
        && (msg.target() instanceof MOB)) {
      MOB mob = (MOB) myItem.owner();
      if ((mob.isInCombat()) && (mob.location() != null) && (!mob.amDead())) {
        if ((myItem instanceof Weapon)
            && (msg.tool() == myItem)
            && (myItem.amWearingAt(Wearable.WORN_WIELD))
            && (msg.amISource(mob)))
          addMeIfNeccessary(msg.source(), (MOB) msg.target(), true, 0, maxTicks);
        else if ((msg.amITarget(mob))
            && (!myItem.amWearingAt(Wearable.WORN_WIELD))
            && (!(myItem instanceof Weapon))) addMeIfNeccessary(mob, mob, true, 0, maxTicks);
      }
    }
    processing = false;
  }
예제 #5
0
  @Override
  public boolean tick(Tickable ticking, int tickID) {

    if (!super.tick(ticking, tickID)) return false;
    if (affected == null) return false;
    if (!(affected instanceof MOB)) return true;

    final MOB mob = (MOB) affected;
    if ((!mob.amDead()) && ((--diseaseTick) <= 0)) {
      diseaseTick = DISEASE_DELAY();
      if (mob.maxState().getFatigue() > Long.MIN_VALUE / 2)
        mob.curState()
            .adjFatigue(mob.curState().getFatigue() + CharState.FATIGUED_MILLIS, mob.maxState());
      mob.location().show(mob, null, CMMsg.MSG_NOISE, DISEASE_AFFECT());
      if (!CMLib.flags().isSleeping(mob)) {
        final Command C = CMClass.getCommand("Sleep");
        try {
          if (C != null) C.execute(mob, CMParms.parse("Sleep"), Command.METAFLAG_FORCED);
        } catch (final Exception e) {
        }
      }
      return true;
    }
    return true;
  }
예제 #6
0
파일: Gaian.java 프로젝트: bbailey/ewok
 public boolean isValidClassDivider(MOB killer, MOB killed, MOB mob, HashSet followers) {
   if ((mob != null)
       && (mob != killed)
       && (!mob.amDead())
       && ((!mob.isMonster()) || (!CMLib.flags().isVegetable(mob)))
       && ((mob.getVictim() == killed) || (followers.contains(mob)) || (mob == killer)))
     return true;
   return false;
 }
예제 #7
0
 @Override
 public void unInvoke() {
   if (affected == null) return;
   final MOB mob = (MOB) affected;
   if (canBeUninvoked()) {
     if (!mob.amDead()) spreadImmunity(mob);
     mob.tell(L("The contagion fades."));
   }
   super.unInvoke();
 }
예제 #8
0
파일: Druid.java 프로젝트: kingdavid127/MUD
 @Override
 public boolean isValidClassDivider(MOB killer, MOB killed, MOB mob, Set<MOB> followers) {
   if ((mob != null)
       && (mob != killed)
       && (!mob.amDead())
       && ((!mob.isMonster()) || (!CMLib.flags().isAnimalIntelligence(mob)))
       && ((mob.getVictim() == killed) || (followers.contains(mob)) || (mob == killer)))
     return true;
   return false;
 }
예제 #9
0
  public void unInvoke() {
    // undo the affects of this spell
    if (!(affected instanceof MOB)) return;
    MOB mob = (MOB) affected;

    super.unInvoke();

    if (canBeUninvoked())
      if ((mob.location() != null) && (!mob.amDead()))
        mob.location()
            .show(mob, null, CMMsg.MSG_OK_VISUAL, "The unholy fortress around <S-NAME> fades.");
  }
예제 #10
0
  @Override
  public void unInvoke() {
    // undo the affects of this spell
    if (!(affected instanceof MOB)) return;
    final MOB M = (MOB) affected;

    super.unInvoke();

    if ((canBeUninvoked()) && (M != null) && (!M.amDead()) && (M.location() != null))
      M.location()
          .show(M, null, CMMsg.MSG_OK_VISUAL, L("The aura of strife around <S-NAME> fades."));
  }
  @Override
  public boolean okMessage(final Environmental myHost, final CMMsg msg) {
    if (affected == null) return super.okMessage(myHost, msg);

    if (affected instanceof MOB) {
      final MOB mob = (MOB) affected;
      if ((msg.amITarget(mob))
          && (!msg.amISource(mob))
          && (mob.location() != msg.source().location())
          && (msg.tool() instanceof Ability)
          && (CMath.bset(((Ability) msg.tool()).flags(), Ability.FLAG_TRANSPORTING))
          && (!mob.amDead())) {
        final Ability A = (Ability) msg.tool();
        if (((A.classificationCode() & Ability.ALL_ACODES) == Ability.ACODE_CHANT)
            || ((A.classificationCode() & Ability.ALL_ACODES) == Ability.ACODE_SPELL)
            || ((A.classificationCode() & Ability.ALL_ACODES) == Ability.ACODE_PRAYER)
            || ((A.classificationCode() & Ability.ALL_ACODES) == Ability.ACODE_SONG))
          msg.source()
              .location()
              .showHappens(
                  CMMsg.MSG_OK_VISUAL, L("Magical energy fizzles and is absorbed into the air!"));
        return false;
      }
    } else if (affected instanceof Room) {
      final Room R = (Room) affected;
      if ((msg.tool() instanceof Ability)
          && (msg.source().location() != null)
          && (msg.sourceMinor() != CMMsg.TYP_LEAVE)) {
        final boolean summon = CMath.bset(((Ability) msg.tool()).flags(), Ability.FLAG_SUMMONING);
        final boolean teleport =
            CMath.bset(((Ability) msg.tool()).flags(), Ability.FLAG_TRANSPORTING);
        final boolean shere =
            (msg.source().location() == affected)
                || ((affected instanceof Area)
                    && (((Area) affected).inMyMetroArea(msg.source().location().getArea())));
        if ((!shere)
            && (!summon)
            && (teleport)
            && (!CMLib.law().doesHavePriviledgesHere(msg.source(), R))) {
          if ((msg.source().location() != null) && (msg.source().location() != R))
            msg.source()
                .location()
                .showHappens(
                    CMMsg.MSG_OK_VISUAL, L("Magical energy fizzles and is absorbed into the air!"));
          R.showHappens(
              CMMsg.MSG_OK_VISUAL, L("Magic energy fizzles and is absorbed into the air."));
          return false;
        }
      }
    }
    return super.okMessage(myHost, msg);
  }
예제 #12
0
 public boolean tick(Tickable ticking, int tickID) {
   super.tick(ticking, tickID);
   if (tickID != Tickable.TICKID_MOB) return true;
   if (reactToM == null) {
     // dont combine this if with the above
     if ((affected instanceof MOB) && (reactToName != null))
       reactToM = ((MOB) affected).location().fetchInhabitant(reactToName);
     if (reactToM == null) return shutdownPresence((MOB) affected);
   } else if (this.affected instanceof MOB) {
     MOB affected = (MOB) this.affected;
     if ((affected.location() != reactToM.location())
         || (affected.amDead())
         || (reactToM.amDead())
         || (affected.amDestroyed())
         || (reactToM.amDestroyed())
         || (!CMLib.flags().isInTheGame(affected, true))
         || (!CMLib.flags().isInTheGame(reactToM, true))) return shutdownPresence(affected);
     initializeAllManaged(affected);
     for (CMObject O : managed) if (O instanceof Tickable) ((Tickable) O).tick(ticking, tickID);
   }
   return true;
 }
예제 #13
0
 @Override
 public void unInvoke() {
   if (!(affected instanceof MOB)) return;
   final MOB mob = (MOB) affected;
   super.unInvoke();
   if (canBeUninvoked()) {
     if (!mob.amDead()) {
       if (mob.location() != null)
         mob.location()
             .show(mob, null, CMMsg.MSG_OK_ACTION, L("<S-NAME> end(s) <S-HIS-HER> hibernation."));
       else mob.tell(L("Your hibernation ends."));
     }
   }
 }
예제 #14
0
 @Override
 public boolean tick(Tickable ticking, int tickID) {
   Item I = null;
   if (affected instanceof Item) I = (Item) affected;
   if ((canBeUninvoked())
       && (I != null)
       && (I.owner() instanceof MOB)
       && (I.amWearingAt(Wearable.WORN_NECK))) {
     final MOB mob = (MOB) I.owner();
     if ((!mob.amDead()) && (mob.isMonster()) && (CMLib.flags().isInTheGame(mob, false)))
       CMLib.commands().postRemove(mob, I, false);
   }
   return super.tick(ticking, tickID);
 }
예제 #15
0
  @Override
  public void unInvoke() {
    if (!(affected instanceof MOB)) return;
    final MOB mob = (MOB) affected;

    super.unInvoke();
    if (canBeUninvoked())
      if ((mob.location() != null) && (!mob.amDead()))
        mob.location()
            .show(
                mob,
                null,
                CMMsg.MSG_OK_VISUAL,
                L("<S-YOUPOSS> ability to breathe underwater fades."));
  }
예제 #16
0
 @Override
 public void unInvoke() {
   Item I = null;
   if (affected instanceof Item) I = (Item) affected;
   super.unInvoke();
   if ((canBeUninvoked())
       && (I != null)
       && (I.owner() instanceof MOB)
       && (!I.amWearingAt(Wearable.IN_INVENTORY))) {
     final MOB mob = (MOB) I.owner();
     if ((!mob.amDead()) && (CMLib.flags().isInTheGame(mob, false))) {
       mob.tell(L("@x1 loosens its grip on your neck and falls off.", I.name(mob)));
       I.setRawWornCode(0);
       mob.location().moveItemTo(I, ItemPossessor.Expire.Player_Drop);
     }
   }
 }
예제 #17
0
  @Override
  public boolean tick(Tickable ticking, int tickID) {
    if (!super.tick(ticking, tickID)) return false;
    if (affected == null) return false;
    if (!(affected instanceof MOB)) return true;

    final MOB mob = (MOB) affected;
    if (mob.amDead()) return true;

    if (!changed) {
      if (mob.location() == null) return true;
      final Area A = mob.location().getArea();
      if (((A.getTimeObj().getTODCode() == TimeClock.TimeOfDay.DUSK)
              || (A.getTimeObj().getTODCode() == TimeClock.TimeOfDay.NIGHT))
          && (A.getTimeObj().getMoonPhase() == TimeClock.MoonPhase.FULL)) {
        changed = true;
        mob.location()
            .show(
                mob,
                null,
                CMMsg.MSG_OK_VISUAL,
                L("<S-NAME> turn(s) into a @x1!", lycanRace().name()));
        mob.recoverCharStats();
        mob.recoverPhyStats();
        mob.recoverMaxState();
        mob.location().recoverRoomStats();
      }
    } else {
      if (mob.location() == null) return true;
      final Area A = mob.location().getArea();
      if (((A.getTimeObj().getTODCode() != TimeClock.TimeOfDay.DUSK)
              && (A.getTimeObj().getTODCode() != TimeClock.TimeOfDay.NIGHT))
          || (A.getTimeObj().getMoonPhase() != TimeClock.MoonPhase.FULL)) {
        changed = false;
        mob.location().show(mob, null, CMMsg.MSG_OK_VISUAL, L("<S-NAME> revert(s) to normal."));
        mob.recoverCharStats();
        mob.recoverPhyStats();
        mob.recoverMaxState();
        mob.location().recoverRoomStats();
        return true;
      }
      tickLycanthropically(mob);
    }
    return true;
  }
예제 #18
0
  @Override
  public boolean okMessage(final Environmental myHost, final CMMsg msg) {
    if (!(affected instanceof MOB)) return true;

    final MOB mob = (MOB) affected;
    if ((msg.amITarget(mob))
        && (CMath.bset(msg.targetMajor(), CMMsg.MASK_MALICIOUS))
        && (msg.tool() instanceof Ability)
        && (!mob.amDead())) {
      final Ability A = (Ability) msg.tool();
      if (CMath.bset(A.flags(), Ability.FLAG_PARALYZING)) {
        msg.addTrailerMsg(
            CMClass.getMsg(
                mob,
                null,
                CMMsg.MSG_OK_VISUAL,
                L("The uninhibiting barrier around <S-NAME> repels the @x1.", A.name())));
        return false;
      }
      final MOB newMOB = CMClass.getFactoryMOB();
      final CMMsg msg2 = CMClass.getMsg(newMOB, null, null, CMMsg.MSG_SIT, null);
      newMOB.recoverPhyStats();
      try {
        A.affectPhyStats(newMOB, newMOB.phyStats());
        if ((!CMLib.flags().aliveAwakeMobileUnbound(newMOB, true))
            || (CMath.bset(A.flags(), Ability.FLAG_PARALYZING))
            || (!A.okMessage(newMOB, msg2))) {
          msg.addTrailerMsg(
              CMClass.getMsg(
                  mob,
                  null,
                  CMMsg.MSG_OK_VISUAL,
                  L("The uninhibiting barrier around <S-NAME> repels the @x1.", A.name())));
          newMOB.destroy();
          return false;
        }
      } catch (final Exception e) {
      }
      newMOB.destroy();
    }
    return true;
  }
예제 #19
0
  public boolean tick(Tickable ticking, int tickID) {
    if (!super.tick(ticking, tickID)) return false;
    if (affected == null) return false;
    if (!(affected instanceof MOB)) return true;

    MOB mob = (MOB) affected;
    MOB diseaser = invoker;
    if (diseaser == null) diseaser = mob;
    if ((!mob.amDead()) && ((--diseaseTick) <= 0)) {
      diseaseTick = DISEASE_DELAY();
      mob.location().show(mob, null, CMMsg.MSG_NOISE, DISEASE_AFFECT());
      int damage = CMLib.dice().roll(2, diseaser.envStats().level() + 1, 1);
      if (CMLib.dice().rollPercentage() == 1) damage += CMLib.dice().roll(10, 10, 1);
      CMLib.combat()
          .postDamage(diseaser, mob, this, damage, CMMsg.MASK_ALWAYS | CMMsg.TYP_DISEASE, -1, null);
      catchIt(mob);
      return true;
    }
    return true;
  }
예제 #20
0
  public boolean okMessage(Environmental myHost, CMMsg msg) {
    if ((affected == null) || (!(affected instanceof MOB))) return super.okMessage(myHost, msg);

    MOB mob = (MOB) affected;
    if ((msg.amITarget(mob))
        && (CMath.bset(msg.targetCode(), CMMsg.MASK_MALICIOUS))
        && (msg.targetMinor() == CMMsg.TYP_CAST_SPELL)
        && (msg.tool() != null)
        && (msg.tool().ID().equalsIgnoreCase("Spell_MagicMissile"))
        && (!mob.amDead())
        && ((mob.fetchAbility(ID()) == null) || proficiencyCheck(null, 0, false))) {
      mob.location()
          .show(
              mob,
              msg.source(),
              CMMsg.MSG_OK_VISUAL,
              "The barrier around <S-NAME> absorbs a magic missile from <T-NAME>!");
      return false;
    }
    return super.okMessage(myHost, msg);
  }
예제 #21
0
  @Override
  public void unInvoke() {
    // undo the affects of this spell
    if (!(affected instanceof MOB)) return;
    final MOB mob = (MOB) affected;

    super.unInvoke();

    if (canBeUninvoked())
      if ((mob.location() != null)
          && (!mob.amDead())
          && (mob.getWearPositions(Wearable.WORN_FEET) > 0)) {
        spreadImmunity(mob);
        mob.location()
            .show(
                mob,
                null,
                CMMsg.MSG_OK_VISUAL,
                L("The fungus on <S-YOUPOSS> feet dies and falls off."));
      }
  }
예제 #22
0
  public void unInvoke() {
    // undo the affects of this spell
    if (!(affected instanceof MOB)) return;
    MOB mob = (MOB) affected;

    super.unInvoke();

    if ((canBeUninvoked() && (!mob.amDead()))) {
      mob.location().show(mob, null, CMMsg.MSG_OK_VISUAL, "<S-YOUPOSS> natural-will returns.");
      if (mob.amFollowing() != null) CMLib.commands().postFollow(mob, null, false);
      CMLib.commands().postStand(mob, true);
      if (mob.isMonster()) {
        if ((CMLib.dice().rollPercentage() > 50)
            || ((mob.getStartRoom() != null)
                && (mob.getStartRoom().getArea() != mob.location().getArea())
                && (CMLib.flags().isAggressiveTo(mob, null)
                    || (invoker == null)
                    || (!mob.location().isInhabitant(invoker)))))
          CMLib.tracking().wanderAway(mob, true, true);
        else if ((invoker != null) && (invoker != mob)) mob.setVictim(invoker);
      }
    }
  }
예제 #23
0
 @Override
 public boolean tick(Tickable ticking, int tickID) {
   if ((tickID == Tickable.TICKID_MOB) && (affected instanceof MOB)) {
     final MOB vic = (MOB) affected;
     if ((!vic.amDead()) && (vic.location() != null)) {
       final MOB invoker = (invoker() != null) ? invoker() : vic;
       CMLib.combat()
           .postDamage(
               invoker,
               vic,
               this,
               CMLib.dice()
                   .roll(
                       1,
                       10 + super.getXLEVELLevel(invoker()) + (2 * super.getX1Level(invoker())),
                       0),
               CMMsg.MASK_ALWAYS | CMMsg.TYP_ACID,
               -1,
               L("<T-NAME> sizzle(s) from the acid!"));
     }
   }
   return super.tick(ticking, tickID);
 }
예제 #24
0
 public String builtPrompt(MOB mob) {
   StringBuffer buf = new StringBuffer("\n\r");
   String prompt = mob.playerStats().getPrompt();
   String promptUp = null;
   int c = 0;
   while (c < prompt.length())
     if ((prompt.charAt(c) == '%') && (c < (prompt.length() - 1))) {
       switch (prompt.charAt(++c)) {
         case '-':
           if (c < (prompt.length() - 2)) {
             if (promptUp == null) promptUp = prompt.toUpperCase();
             String promptSub = promptUp.substring(c + 1);
             Wearable.CODES wcodes = Wearable.CODES.instance();
             boolean isFound = false;
             for (long code : wcodes.all())
               if (promptSub.startsWith(wcodes.nameup(code))) {
                 c += 1 + wcodes.nameup(code).length();
                 Item I = mob.fetchFirstWornItem(code);
                 if (I != null) buf.append(I.name());
                 isFound = true;
                 break;
               }
             if (!isFound) {
               CharStats.CODES ccodes = CharStats.CODES.instance();
               for (int code : ccodes.all())
                 if (promptSub.startsWith(ccodes.name(code))) {
                   c += 1 + ccodes.name(code).length();
                   buf.append(mob.charStats().getStat(code));
                   isFound = true;
                   break;
                 }
               if (!isFound)
                 for (int code : ccodes.all())
                   if (promptSub.startsWith("BASE " + ccodes.name(code))) {
                     buf.append(mob.baseCharStats().getStat(code));
                     c += 6 + ccodes.name(code).length();
                     isFound = true;
                     break;
                   }
             }
             if (!isFound) {
               for (String s : mob.envStats().getStatCodes())
                 if (promptSub.startsWith(s)) {
                   c += 1 + s.length();
                   buf.append(mob.envStats().getStat(s));
                   isFound = true;
                   break;
                 }
               if (!isFound)
                 for (String s : mob.baseEnvStats().getStatCodes())
                   if (promptSub.startsWith("BASE " + s)) {
                     c += 6 + s.length();
                     buf.append(mob.baseEnvStats().getStat(s));
                     isFound = true;
                     break;
                   }
             }
             if (!isFound) {
               for (String s : mob.curState().getStatCodes())
                 if (promptSub.startsWith(s)) {
                   c += 1 + s.length();
                   buf.append(mob.curState().getStat(s));
                   isFound = true;
                   break;
                 }
               if (!isFound)
                 for (String s : mob.maxState().getStatCodes())
                   if (promptSub.startsWith("MAX " + s)) {
                     c += 5 + s.length();
                     buf.append(mob.maxState().getStat(s));
                     isFound = true;
                     break;
                   }
               if (!isFound)
                 for (String s : mob.baseState().getStatCodes())
                   if (promptSub.startsWith("BASE " + s)) {
                     c += 6 + s.length();
                     buf.append(mob.baseState().getStat(s));
                     isFound = true;
                     break;
                   }
             }
           }
           break;
         case 'a':
           {
             buf.append(
                 CMLib.factions()
                         .getRangePercent(
                             CMLib.factions().AlignID(),
                             mob.fetchFaction(CMLib.factions().AlignID()))
                     + "%");
             c++;
             break;
           }
         case 'A':
           {
             Faction.FactionRange FR =
                 CMLib.factions()
                     .getRange(
                         CMLib.factions().AlignID(), mob.fetchFaction(CMLib.factions().AlignID()));
             buf.append(
                 (FR != null) ? FR.name() : "" + mob.fetchFaction(CMLib.factions().AlignID()));
             c++;
             break;
           }
         case 'B':
           {
             buf.append("\n\r");
             c++;
             break;
           }
         case 'c':
           {
             buf.append(mob.inventorySize());
             c++;
             break;
           }
         case 'C':
           {
             buf.append(mob.maxItems());
             c++;
             break;
           }
         case 'd':
           {
             MOB victim = mob.getVictim();
             if ((mob.isInCombat()) && (victim != null)) buf.append("" + mob.rangeToTarget());
             c++;
             break;
           }
         case 'e':
           {
             MOB victim = mob.getVictim();
             if ((mob.isInCombat())
                 && (victim != null)
                 && (CMLib.flags().canBeSeenBy(victim, mob))) buf.append(victim.displayName(mob));
             c++;
             break;
           }
         case 'E':
           {
             MOB victim = mob.getVictim();
             if ((mob.isInCombat())
                 && (victim != null)
                 && (!victim.amDead())
                 && (CMLib.flags().canBeSeenBy(victim, mob)))
               buf.append(victim.healthText(mob) + "\n\r");
             c++;
             break;
           }
         case 'g':
           {
             buf.append(
                 (int)
                     Math.round(
                         Math.floor(
                             CMLib.beanCounter().getTotalAbsoluteNativeValue(mob)
                                 / CMLib.beanCounter()
                                     .getLowestDenomination(
                                         CMLib.beanCounter().getCurrency(mob)))));
             c++;
             break;
           }
         case 'G':
           {
             buf.append(
                 CMLib.beanCounter()
                     .nameCurrencyShort(
                         mob, CMLib.beanCounter().getTotalAbsoluteNativeValue(mob)));
             c++;
             break;
           }
         case 'h':
           {
             buf.append("^<Hp^>" + mob.curState().getHitPoints() + "^</Hp^>");
             c++;
             break;
           }
         case 'H':
           {
             buf.append("^<MaxHp^>" + mob.maxState().getHitPoints() + "^</MaxHp^>");
             c++;
             break;
           }
         case 'I':
           {
             if ((CMLib.flags().isCloaked(mob))
                 && (((mob.envStats().disposition() & EnvStats.IS_NOT_SEEN) != 0)))
               buf.append("Wizinvisible");
             else if (CMLib.flags().isCloaked(mob)) buf.append("Cloaked");
             else if (!CMLib.flags().isSeen(mob)) buf.append("Undetectable");
             else if (CMLib.flags().isInvisible(mob) && CMLib.flags().isHidden(mob))
               buf.append("Hidden/Invisible");
             else if (CMLib.flags().isInvisible(mob)) buf.append("Invisible");
             else if (CMLib.flags().isHidden(mob)) buf.append("Hidden");
             c++;
             break;
           }
         case 'K':
         case 'k':
           {
             MOB tank = mob;
             if ((tank.getVictim() != null)
                 && (tank.getVictim().getVictim() != null)
                 && (tank.getVictim().getVictim() != mob)) tank = tank.getVictim().getVictim();
             if (((c + 1) < prompt.length()) && (tank != null))
               switch (prompt.charAt(c + 1)) {
                 case 'h':
                   {
                     buf.append(tank.curState().getHitPoints());
                     c++;
                     break;
                   }
                 case 'H':
                   {
                     buf.append(tank.maxState().getHitPoints());
                     c++;
                     break;
                   }
                 case 'm':
                   {
                     buf.append(tank.curState().getMana());
                     c++;
                     break;
                   }
                 case 'M':
                   {
                     buf.append(tank.maxState().getMana());
                     c++;
                     break;
                   }
                 case 'v':
                   {
                     buf.append(tank.curState().getMovement());
                     c++;
                     break;
                   }
                 case 'V':
                   {
                     buf.append(tank.maxState().getMovement());
                     c++;
                     break;
                   }
                 case 'e':
                   {
                     buf.append(tank.displayName(mob));
                     c++;
                     break;
                   }
                 case 'E':
                   {
                     if ((mob.isInCombat()) && (CMLib.flags().canBeSeenBy(tank, mob)))
                       buf.append(tank.healthText(mob) + "\n\r");
                     c++;
                     break;
                   }
               }
             c++;
             break;
           }
         case 'm':
           {
             buf.append("^<Mana^>" + mob.curState().getMana() + "^</Mana^>");
             c++;
             break;
           }
         case 'M':
           {
             buf.append("^<MaxMana^>" + mob.maxState().getMana() + "^</MaxMana^>");
             c++;
             break;
           }
         case 'r':
           {
             if (mob.location() != null) buf.append(mob.location().displayText());
             c++;
             break;
           }
         case 'R':
           {
             if ((mob.location() != null) && CMSecurity.isAllowed(mob, mob.location(), "SYSMSGS"))
               buf.append(mob.location().roomID());
             c++;
             break;
           }
         case 'v':
           {
             buf.append("^<Move^>" + mob.curState().getMovement() + "^</Move^>");
             c++;
             break;
           }
         case 'V':
           {
             buf.append("^<MaxMove^>" + mob.maxState().getMovement() + "^</MaxMove^>");
             c++;
             break;
           }
         case 'w':
           {
             buf.append(mob.envStats().weight());
             c++;
             break;
           }
         case 'W':
           {
             buf.append(mob.maxCarry());
             c++;
             break;
           }
         case 'x':
           {
             buf.append(mob.getExperience());
             c++;
             break;
           }
         case 'X':
           {
             if (mob.getExpNeededLevel() == Integer.MAX_VALUE) buf.append("N/A");
             else buf.append(mob.getExpNeededLevel());
             c++;
             break;
           }
         case 'z':
           {
             if (mob.location() != null) buf.append(mob.location().getArea().name());
             c++;
             break;
           }
         case 't':
           {
             if (mob.location() != null)
               buf.append(
                   CMStrings.capitalizeAndLower(
                       TimeClock.TOD_DESC[mob.location().getArea().getTimeObj().getTODCode()]
                           .toLowerCase()));
             c++;
             break;
           }
         case 'T':
           {
             if (mob.location() != null)
               buf.append(mob.location().getArea().getTimeObj().getTimeOfDay());
             c++;
             break;
           }
         case '@':
           {
             if (mob.location() != null)
               buf.append(
                   mob.location().getArea().getClimateObj().weatherDescription(mob.location()));
             c++;
             break;
           }
         default:
           {
             buf.append("%" + prompt.charAt(c));
             c++;
             break;
           }
       }
     } else buf.append(prompt.charAt(c++));
   return buf.toString();
 }
예제 #25
0
 @Override
 public void unInvoke() {
   final MOB M = (MOB) affected;
   super.unInvoke();
   if ((M != null) && (!M.amDead())) M.tell(L("You stop observing."));
 }