예제 #1
0
  @Override
  public boolean invoke(
      MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) {
    MOB target = CMLib.players().getLoadPlayer(CMParms.combine(commands, 0));
    if (target == null) target = getTargetAnywhere(mob, commands, givenTarget, false, true, false);
    if (target == null) return false;

    final Archon_Record A = (Archon_Record) target.fetchEffect(ID());
    if (A != null) {
      target.delEffect(A);
      if (target.playerStats() != null) target.playerStats().setLastUpdated(0);
      mob.tell(L("@x1 will no longer be recorded.", target.Name()));
      return true;
    }

    if (!super.invoke(mob, commands, givenTarget, auto, asLevel)) return false;

    final boolean success = proficiencyCheck(mob, 0, auto);

    if (success) {
      final CMMsg msg =
          CMClass.getMsg(
              mob,
              target,
              this,
              CMMsg.MASK_MOVE | CMMsg.TYP_JUSTICE | (auto ? CMMsg.MASK_ALWAYS : 0),
              L("^F<S-NAME> begin(s) recording <T-NAMESELF>.^?"));
      CMLib.color().fixSourceFightColor(msg);
      if (mob.location().okMessage(mob, msg)) {
        mob.location().send(mob, msg);
        final String filename = "/" + target.Name() + System.currentTimeMillis() + ".log";
        final CMFile file = new CMFile(filename, null, CMFile.FLAG_LOGERRORS);
        if (!file.canWrite()) {
          if (!CMSecurity.isASysOp(mob) || (CMSecurity.isASysOp(target)))
            Log.sysOut("Record", mob.Name() + " failed to start recording " + target.name() + ".");
        } else {
          if (!CMSecurity.isASysOp(mob) || (CMSecurity.isASysOp(target)))
            Log.sysOut(
                "Record",
                mob.Name() + " started recording " + target.name() + " to /" + filename + ".");
          final Archon_Record A2 = (Archon_Record) copyOf();
          final Session F = (Session) CMClass.getCommon("FakeSession");
          F.initializeSession(null, Thread.currentThread().getThreadGroup().getName(), filename);
          if (target.session() == null) target.setSession(F);
          A2.sess = F;
          target.addNonUninvokableEffect(A2);
          mob.tell(L("Enter RECORD @x1 again to stop recording.", target.Name()));
        }
      }
    } else
      return beneficialVisualFizzle(
          mob, target, L("<S-NAME> attempt(s) to hush <T-NAMESELF>, but fail(s)."));
    return success;
  }
예제 #2
0
  @Override
  public String healthText(MOB viewer, MOB mob) {
    final double pct = (CMath.div(mob.curState().getHitPoints(), mob.maxState().getHitPoints()));

    if (pct < .10) return L("^r@x1^r is near destruction!^N", mob.name(viewer));
    else if (pct < .20) return L("^r@x1^r is massively shredded and damaged.^N", mob.name(viewer));
    else if (pct < .30) return L("^r@x1^r is extremely shredded and damaged.^N", mob.name(viewer));
    else if (pct < .40) return L("^y@x1^y is very shredded and damaged.^N", mob.name(viewer));
    else if (pct < .50) return L("^y@x1^y is shredded and damaged.^N", mob.name(viewer));
    else if (pct < .60) return L("^p@x1^p is shredded and slightly damaged.^N", mob.name(viewer));
    else if (pct < .70) return L("^p@x1^p has lost numerous leaves.^N", mob.name(viewer));
    else if (pct < .80) return L("^g@x1^g has lost some leaves.^N", mob.name(viewer));
    else if (pct < .90) return L("^g@x1^g has lost a few leaves.^N", mob.name(viewer));
    else if (pct < .99) return L("^g@x1^g is no longer in perfect condition.^N", mob.name(viewer));
    else return L("^c@x1^c is in perfect condition.^N", mob.name(viewer));
  }
예제 #3
0
파일: Stone.java 프로젝트: kingdavid127/MUD
  @Override
  public String healthText(MOB viewer, MOB mob) {
    final double pct = (CMath.div(mob.curState().getHitPoints(), mob.maxState().getHitPoints()));

    if (pct < .10) return L("^r@x1^r is almost broken!^N", mob.name(viewer));
    else if (pct < .20) return L("^r@x1^r is massively cracked and damaged.^N", mob.name(viewer));
    else if (pct < .30) return L("^r@x1^r is extremely cracked and damaged.^N", mob.name(viewer));
    else if (pct < .40) return L("^y@x1^y is very cracked and damaged.^N", mob.name(viewer));
    else if (pct < .50) return L("^y@x1^y is cracked and damaged.^N", mob.name(viewer));
    else if (pct < .60) return L("^p@x1^p is cracked and slightly damaged.^N", mob.name(viewer));
    else if (pct < .70) return L("^p@x1^p is showing numerous cracks.^N", mob.name(viewer));
    else if (pct < .80) return L("^g@x1^g is showing some crachs.^N", mob.name(viewer));
    else if (pct < .90) return L("^g@x1^g is showing small cracks.^N", mob.name(viewer));
    else if (pct < .99) return L("^g@x1^g is no longer in perfect condition.^N", mob.name(viewer));
    else return L("^c@x1^c is in perfect condition.^N", mob.name(viewer));
  }
예제 #4
0
파일: Wake.java 프로젝트: Cocanuta/Marble
 public boolean execute(MOB mob, Vector commands, int metaFlags) throws java.io.IOException {
   if (commands != null) commands.removeElementAt(0);
   if ((commands == null) || (commands.size() == 0)) {
     if (!CMLib.flags().isSleeping(mob)) mob.tell("You aren't sleeping!?");
     else {
       CMMsg msg =
           CMClass.getMsg(mob, null, null, CMMsg.MSG_STAND, "<S-NAME> awake(s) and stand(s) up.");
       if (mob.location().okMessage(mob, msg)) mob.location().send(mob, msg);
     }
   } else {
     String whom = CMParms.combine(commands, 0);
     MOB M = mob.location().fetchInhabitant(whom);
     if ((M == null) || (!CMLib.flags().canBeSeenBy(M, mob))) {
       mob.tell("You don't see '" + whom + "' here.");
       return false;
     }
     if (!CMLib.flags().isSleeping(M)) {
       mob.tell(M.name() + " is awake!");
       return false;
     }
     CMMsg msg =
         CMClass.getMsg(
             mob, M, null, CMMsg.MSG_NOISYMOVEMENT, "<S-NAME> attempt(s) to wake <T-NAME> up.");
     if (mob.location().okMessage(mob, msg)) {
       mob.location().send(mob, msg);
       execute(M, null, metaFlags | Command.METAFLAG_ORDER);
     }
   }
   return false;
 }
예제 #5
0
파일: Follow.java 프로젝트: Cocanuta/Marble
 public boolean processFollow(MOB mob, MOB tofollow, boolean quiet) {
   if (mob == null) return false;
   Room R = mob.location();
   if (R == null) return false;
   if (tofollow != null) {
     if (tofollow == mob) {
       return nofollow(mob, true, false);
     }
     if (mob.getGroupMembers(new HashSet<MOB>()).contains(tofollow)) {
       if (!quiet) mob.tell("You are already a member of " + tofollow.name() + "'s group!");
       return false;
     }
     if (nofollow(mob, false, false)) {
       CMMsg msg =
           CMClass.getMsg(
               mob,
               tofollow,
               null,
               CMMsg.MSG_FOLLOW,
               quiet ? null : "<S-NAME> follow(s) <T-NAMESELF>.");
       if (R.okMessage(mob, msg)) R.send(mob, msg);
       else return false;
     } else return false;
   } else return nofollow(mob, !quiet, quiet);
   return true;
 }
예제 #6
0
  public void unInvoke() {
    // undo the affects of this spell
    if ((affected == null) || (!(affected instanceof MOB))) return;
    MOB mob = (MOB) affected;
    super.unInvoke();

    if ((canBeUninvoked()) && (mob.location() != null)) {
      if ((failed)
          || (!CMLib.flags().isSitting(mob))
          || (room == null)
          || (title == null)
          || (mob.location() != room)) mob.tell("You are no longer squatting.");
      else if (title.landOwner().length() > 0) {
        mob.tell(
            "Your squat has succeeded.  This property no longer belongs to "
                + title.landOwner()
                + ".");
        title.setLandOwner("");
        title.updateTitle();
        title.updateLot(null);
      } else if (title.landOwner().length() > 0) {
        mob.tell("Your squat has succeeded.  This property now belongs to you.");
        title.setLandOwner(mob.Name());
        title.updateTitle();
        title.updateLot(new XVector(mob.name()));
      }
    }
    failed = false;
  }
예제 #7
0
파일: Follow.java 프로젝트: Cocanuta/Marble
  public boolean execute(MOB mob, Vector commands, int metaFlags) throws java.io.IOException {
    boolean quiet = false;

    if (mob == null) return false;
    Room R = mob.location();
    if (R == null) return false;
    if ((commands.size() > 2)
        && (commands.lastElement() instanceof String)
        && (((String) commands.lastElement()).equalsIgnoreCase("UNOBTRUSIVELY"))) {
      commands.removeElementAt(commands.size() - 1);
      quiet = true;
    }
    if ((commands.size() > 1) && (commands.elementAt(1) instanceof MOB))
      return processFollow(mob, (MOB) commands.elementAt(1), quiet);

    if (commands.size() < 2) {
      mob.tell("Follow whom?");
      return false;
    }

    String whomToFollow = CMParms.combine(commands, 1);
    if ((whomToFollow.equalsIgnoreCase("self") || whomToFollow.equalsIgnoreCase("me"))
        || (mob.name().toUpperCase().startsWith(whomToFollow))) {
      nofollow(mob, true, quiet);
      return false;
    }
    MOB target = R.fetchInhabitant(whomToFollow);
    if ((target == null) || (!CMLib.flags().canBeSeenBy(target, mob))) {
      mob.tell("I don't see them here.");
      return false;
    }
    if ((target.isMonster()) && (!mob.isMonster())) {
      mob.tell("You cannot follow '" + target.name() + "'.");
      return false;
    }
    if (CMath.bset(target.getBitmap(), MOB.ATT_NOFOLLOW)) {
      mob.tell(target.name() + " is not accepting followers.");
      return false;
    }
    MOB ultiTarget = target.amUltimatelyFollowing();
    if ((ultiTarget != null) && (CMath.bset(ultiTarget.getBitmap(), MOB.ATT_NOFOLLOW))) {
      mob.tell(ultiTarget.name() + " is not accepting followers.");
      return false;
    }
    processFollow(mob, target, quiet);
    return false;
  }
예제 #8
0
파일: Orc.java 프로젝트: renokun/CoffeeMud
  @Override
  public String healthText(MOB viewer, MOB mob) {
    final double pct = (CMath.div(mob.curState().getHitPoints(), mob.maxState().getHitPoints()));

    if (pct < .10) return L("^r@x1^r is nearly defeated.^N", mob.name(viewer));
    else if (pct < .20) return L("^r@x1^r is covered in blood.^N", mob.name(viewer));
    else if (pct < .30)
      return L("^r@x1^r is bleeding badly from lots of wounds.^N", mob.name(viewer));
    else if (pct < .40)
      return L("^y@x1^y has numerous bloody wounds and gashes.^N", mob.name(viewer));
    else if (pct < .50) return L("^y@x1^y has some bloody wounds and gashes.^N", mob.name(viewer));
    else if (pct < .60) return L("^p@x1^p has a few bloody wounds.^N", mob.name(viewer));
    else if (pct < .70) return L("^p@x1^p is cut and bruised.^N", mob.name(viewer));
    else if (pct < .80) return L("^g@x1^g has some minor cuts and bruises.^N", mob.name(viewer));
    else if (pct < .90) return L("^g@x1^g has a few bruises and scratches.^N", mob.name(viewer));
    else if (pct < .99) return L("^g@x1^g has a few small bruises.^N", mob.name(viewer));
    else return L("^c@x1^c is in perfect health.^N", mob.name(viewer));
  }
예제 #9
0
  @Override
  public boolean invoke(
      MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) {
    final MOB target = this.getTarget(mob, commands, givenTarget);
    if (target == null) return false;
    if (!CMLib.flags().isAnimalIntelligence(target)) {
      mob.tell(L("@x1 is not an animal!", target.name(mob)));
      return false;
    }

    if (!target.isInCombat()) {
      mob.tell(L("@x1 doesn't seem particularly enraged at the moment.", target.name(mob)));
      return false;
    }

    if (!super.invoke(mob, commands, givenTarget, auto, asLevel)) return false;

    final boolean success = proficiencyCheck(mob, 0, auto);

    if (success) {
      final CMMsg msg =
          CMClass.getMsg(
              mob,
              target,
              this,
              verbalCastCode(mob, target, auto),
              auto
                  ? L("<T-NAME> become(s) surrounded by a natural light.")
                  : L("^S<S-NAME> chant(s) to <T-NAMESELF> for calm.^?"));
      if (mob.location().okMessage(mob, msg)) {
        mob.location().send(mob, msg);
        beneficialAffect(mob, target, asLevel, 3);
        for (int i = 0; i < mob.location().numInhabitants(); i++) {
          final MOB mob2 = mob.location().fetchInhabitant(i);
          if ((mob2.getVictim() == target) || (mob2 == target)) mob2.makePeace(true);
        }
      }
    } else
      beneficialWordsFizzle(
          mob, target, L("<S-NAME> chant(s) to <T-NAMESELF>, but nothing happens."));
    // return whether it worked
    return success;
  }
예제 #10
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();
 }
예제 #11
0
  @Override
  public boolean invoke(MOB mob, Vector commands, Physical givenTarget, boolean auto, int asLevel) {
    final MOB target = this.getTarget(mob, commands, givenTarget);
    if (target == null) return false;

    if ((!target.charStats().getMyRace().racialCategory().equals("Earth Elemental"))
        && (!target.charStats().getMyRace().racialCategory().equals("Stone Golem"))
        && (!target.charStats().getMyRace().racialCategory().equals("Metal Golem"))) {
      mob.tell(L("@x1 is not an stone/metal golem or earth elemental!", target.name(mob)));
      return false;
    }

    if (!super.invoke(mob, commands, givenTarget, auto, asLevel)) return false;

    // now see if it worked
    boolean success = proficiencyCheck(mob, 0, auto);
    if (success) {
      final String str = auto ? "" : L("^S<S-NAME> chant(s) at <T-NAMESELF>.^?");
      final CMMsg msg = CMClass.getMsg(mob, target, this, verbalCastCode(mob, target, auto), str);
      if (mob.location().okMessage(mob, msg)) {
        mob.location().send(mob, msg);
        if (msg.value() <= 0) {
          success = maliciousAffect(mob, target, asLevel, 0, -1) != null;
          if (success) {
            if (target.isInCombat()) target.makePeace();
            CMLib.commands().postFollow(target, mob, false);
            CMLib.combat().makePeaceInGroup(mob);
            if (target.amFollowing() != mob)
              mob.tell(L("@x1 seems unwilling to follow you.", target.name(mob)));
          }
        }
      }
    }
    if (!success)
      return maliciousFizzle(
          mob, target, L("<S-NAME> chant(s) at <T-NAMESELF>, but nothing happens."));

    // return whether it worked
    return success;
  }
예제 #12
0
  @Override
  public boolean invoke(MOB mob, Vector commands, Physical givenTarget, boolean auto, int asLevel) {
    final MOB target = getTarget(mob, commands, givenTarget);
    if (target == null) return false;
    Item myPlant = Druid_MyPlants.myPlant(mob.location(), mob, 0);
    if (myPlant == null) {
      if (auto) myPlant = new Chant_SummonPlants().buildPlant(mob, mob.location());
      else {
        mob.tell(L("There doesn't appear to be any of your plants here to choke with."));
        return false;
      }
    }

    if (target.getWearPositions(Wearable.WORN_NECK) == 0) {
      if (!auto) mob.tell(L("Ummm, @x1 doesn't HAVE a neck...", target.name(mob)));
      return false;
    }

    if (!super.invoke(mob, commands, givenTarget, auto, asLevel)) return false;

    final boolean success = proficiencyCheck(mob, 0, auto);
    if (success) {

      final CMMsg msg =
          CMClass.getMsg(
              mob,
              target,
              this,
              verbalCastCode(mob, target, auto),
              auto
                  ? ""
                  : L("^S<S-NAME> chant(s) at <T-NAME> while pointing at @x1!^?", myPlant.name()));
      if (mob.location().okMessage(mob, msg)) {
        mob.location().send(mob, msg);
        target.moveItemTo(myPlant);
        myPlant.setRawWornCode(Wearable.WORN_NECK);
        mob.location()
            .show(
                target,
                null,
                CMMsg.MSG_OK_VISUAL,
                L("@x1 jumps up and wraps itself around <S-YOUPOSS> neck!", myPlant.name()));
        beneficialAffect(mob, myPlant, asLevel, 5);
      }
    } else
      return maliciousFizzle(
          mob, target, L("<S-NAME> chant(s) at <T-NAME>, but the magic fizzles."));

    // return whether it worked
    return success;
  }
예제 #13
0
  public boolean invoke(MOB mob, Vector commands, Physical givenTarget, boolean auto, int asLevel) {
    MOB target = getTargetAnywhere(mob, commands, givenTarget, false, true, false);
    if (target == null) return false;

    Ability A = target.fetchEffect(ID());
    if (A != null) {
      A.unInvoke();
      mob.tell(target.Name() + " is released from his freezedness.");
      return true;
    }

    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,
              CMMsg.MASK_MOVE | CMMsg.TYP_JUSTICE | (auto ? CMMsg.MASK_ALWAYS : 0),
              auto
                  ? "A frozen chill falls upon <T-NAME>!"
                  : "^F<S-NAME> freeze(s) <T-NAMESELF>.^?");
      CMLib.color().fixSourceFightColor(msg);
      if (mob.location().okMessage(mob, msg)) {
        mob.location().send(mob, msg);
        mob.location().show(target, null, CMMsg.MSG_OK_VISUAL, "<S-NAME> <S-IS-ARE> frozen!");
        beneficialAffect(mob, target, asLevel, Ability.TICKS_ALMOST_FOREVER);
        Log.sysOut("Freeze", mob.name() + " freezed " + target.name() + ".");
      }
    } else
      return beneficialVisualFizzle(
          mob, target, "<S-NAME> attempt(s) to freeze <T-NAMESELF>, but fail(s).");
    return success;
  }
예제 #14
0
  @Override
  public boolean invoke(
      MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) {
    final MOB target = this.getTarget(mob, commands, givenTarget);
    if (target == null) return false;

    if (target.charStats().getBodyPart(Race.BODY_FOOT) == 0) {
      mob.tell(L("@x1 has no feet!", target.name(mob)));
      return false;
    }

    if (!super.invoke(mob, commands, givenTarget, auto, asLevel)) return false;

    final boolean success = proficiencyCheck(mob, 0, auto);
    if (success) {
      final CMMsg msg =
          CMClass.getMsg(
              mob,
              target,
              this,
              verbalCastCode(mob, target, auto) | CMMsg.MASK_MALICIOUS,
              auto ? "" : L("^S<S-NAME> chant(s) at <T-YOUPOSS> feet!^?"));
      final CMMsg msg2 =
          CMClass.getMsg(
              mob, target, this, verbalCastMask(mob, target, auto) | CMMsg.TYP_DISEASE, null);
      if ((mob.location().okMessage(mob, msg)) && (mob.location().okMessage(mob, msg2))) {
        mob.location().send(mob, msg);
        mob.location().send(mob, msg2);
        if ((msg.value() <= 0) && (msg2.value() <= 0)) {
          invoker = mob;
          maliciousAffect(mob, target, asLevel, Ability.TICKS_ALMOST_FOREVER, -1);
          mob.location()
              .show(
                  target,
                  null,
                  CMMsg.MSG_OK_VISUAL,
                  L("A fungus sprouts up between <S-YOUPOSS> toes!"));
        } else spreadImmunity(target);
      }
    } else
      return maliciousFizzle(
          mob, target, L("<S-NAME> chant(s) at <T-YOUPOSS> feet, but nothing happens."));

    // return whether it worked
    return success;
  }
예제 #15
0
 public boolean canBeLearnedBy(MOB teacher, MOB student) {
   if (student != null) {
     for (int a = 0; a < student.numAbilities(); a++) {
       Ability A = student.fetchAbility(a);
       if ((A != null) && (A instanceof Spell_BaseClanEq)) {
         teacher.tell(
             student.name()
                 + " already knows '"
                 + A.name()
                 + "', and may not learn another clan enchantment.");
         student.tell("You may only learn a single clan enchantment.");
         return false;
       }
     }
   }
   return super.canBeLearnedBy(teacher, student);
 }
예제 #16
0
 public String[] mobTimes() {
   long totalMOBMillis = 0;
   long topMOBMillis = 0;
   String topMOBClient = "";
   for (Session S : CMLib.sessions().toArray()) {
     totalMOBMillis += S.getTotalMillis();
     if (S.getTotalMillis() > topMOBMillis) {
       topMOBMillis = S.getTotalMillis();
       MOB M = S.mob();
       topMOBClient = (M == null) ? S.getAddress() : M.name();
     }
   }
   return new String[] {
     CMLib.english().returnTime(totalMOBMillis, 0),
     CMLib.english().returnTime(topMOBMillis, 0),
     topMOBClient
   };
 }
예제 #17
0
 @Override
 public boolean execute(MOB mob, Vector<String> commands, int metaFlags) {
   String helpStr = CMParms.combine(commands, 1);
   if (CMLib.help().getArcHelpFile().size() == 0) {
     mob.tell("No archon help is available.");
     return false;
   }
   String thisTag = null;
   if (helpStr.length() == 0) {
     StringBuffer thisBuf = Resources.getFileResource("help/arc_help.txt", true);
     if (thisBuf != null) thisTag = thisBuf.toString();
   } else thisTag = CMLib.help().getHelpText(helpStr, CMLib.help().getArcHelpFile(), mob);
   if (thisTag == null) {
     mob.tell(
         "No archon help is available on "
             + helpStr
             + " .\r\nEnter 'COMMANDS' for a command list, or 'TOPICS' for a complete list.");
     Log.errOut("Help: " + mob.name() + " wanted archon help on " + helpStr);
   } else if (!mob.isMonster()) mob.session().wraplessPrintln(thisTag);
   return false;
 }
예제 #18
0
  @Override
  public boolean invoke(
      MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) {
    final MOB target = getTargetAnywhere(mob, commands, givenTarget, false, true, false);
    if (target == null) return false;

    final Ability A = target.fetchEffect(ID());
    if (A != null) {
      A.unInvoke();
      mob.tell(L("@x1 is released from his hushing.", target.Name()));
      return true;
    }

    if (!super.invoke(mob, commands, givenTarget, auto, asLevel)) return false;

    final boolean success = proficiencyCheck(mob, 0, auto);

    if (success) {
      final CMMsg msg =
          CMClass.getMsg(
              mob,
              target,
              this,
              CMMsg.MASK_MOVE | CMMsg.TYP_JUSTICE | (auto ? CMMsg.MASK_ALWAYS : 0),
              auto ? L("Silence falls upon <T-NAME>!") : L("^F<S-NAME> hush(es) <T-NAMESELF>.^?"));
      CMLib.color().fixSourceFightColor(msg);
      if (mob.location().okMessage(mob, msg)) {
        mob.location().send(mob, msg);
        mob.location().show(target, null, CMMsg.MSG_OK_VISUAL, L("<S-NAME> <S-IS-ARE> hushed!"));
        beneficialAffect(mob, target, asLevel, Ability.TICKS_ALMOST_FOREVER);
        Log.sysOut("Banish", mob.Name() + " hushed " + target.name() + ".");
      }
    } else
      return beneficialVisualFizzle(
          mob, target, L("<S-NAME> attempt(s) to hush <T-NAMESELF>, but fail(s)."));
    return success;
  }
예제 #19
0
  @Override
  public boolean invoke(MOB mob, Vector commands, Physical givenTarget, boolean auto, int asLevel) {
    boolean announce = false;
    if (commands.size() > 0) {
      if (((String) commands.lastElement()).equals("!")) {
        commands.removeElementAt(commands.size() - 1);
        announce = true;
      }
    }
    final MOB target = getTargetAnywhere(mob, commands, givenTarget, true);
    if (target == null) return false;

    if (!super.invoke(mob, commands, givenTarget, auto, asLevel)) return false;

    final boolean success = proficiencyCheck(mob, 0, auto);

    if (success) {
      final CMMsg msg =
          CMClass.getMsg(
              mob,
              target,
              this,
              CMMsg.MASK_MOVE | CMMsg.TYP_JUSTICE | (auto ? CMMsg.MASK_ALWAYS : 0),
              auto
                  ? L("<T-NAME> <T-IS-ARE> knocked out of <T-HIS-HER> shoes!!!")
                  : L(
                      "^F**<S-NAME> BLAST(S) <T-NAMESELF>**, knocking <T-HIM-HER> out of <T-HIS-HER> shoes!!^?"));
      CMLib.color().fixSourceFightColor(msg);
      if (target.location().okMessage(mob, msg)) {
        target.location().send(mob, msg);
        if (target.curState().getHitPoints() > 2)
          target.curState().setHitPoints(target.curState().getHitPoints() / 2);
        if (target.curState().getMana() > 2)
          target.curState().setMana(target.curState().getMana() / 2);
        if (target.curState().getMovement() > 2)
          target.curState().setMovement(target.curState().getMovement() / 2);
        final Item I = target.fetchFirstWornItem(Wearable.WORN_FEET);
        if (I != null) {
          I.unWear();
          I.removeFromOwnerContainer();
          target.location().addItem(I, ItemPossessor.Expire.Player_Drop);
        }
        Log.sysOut("Banish", mob.Name() + " wrathed " + target.name() + ".");
        if (announce) {
          final Command C = CMClass.getCommand("Announce");
          try {
            C.execute(
                mob,
                new XVector(
                    "ANNOUNCE",
                    target.name()
                        + " is knocked out of "
                        + target.charStats().hisher()
                        + " shoes!!!"),
                Command.METAFLAG_FORCED);
          } catch (final Exception e) {
          }
        }
      }
    } else
      return beneficialVisualFizzle(
          mob,
          target,
          L("<S-NAME> attempt(s) to inflict <S-HIS-HER> wrath upon <T-NAMESELF>, but fail(s)."));
    return success;
  }
예제 #20
0
 @Override
 protected String songOf() {
   return (whom == null) ? L("Ode") : (L("Ode to ") + whom.name());
 }
예제 #21
0
  @Override
  public boolean invoke(
      MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) {
    timeOut = 0;
    if (auto) return false;

    final Hashtable<String, String> H = getSongs();
    if (commands.size() == 0) {
      final Song_Ode A = (Song_Ode) mob.fetchEffect(ID());
      if ((A != null) && (A.whom != null) && (A.song == null)) {
        final String str = L("^S<S-NAME> finish(es) composing the @x1.^?", A.songOf());
        final CMMsg msg =
            CMClass.getMsg(
                mob,
                null,
                this,
                (auto ? CMMsg.MASK_ALWAYS : 0) | CMMsg.MSG_DELICATE_SMALL_HANDS_ACT,
                str);
        if (mob.location().okMessage(mob, msg)) {
          mob.location().send(mob, msg);
          mob.delEffect(A);
          getSongs().put(A.whom.name(), A.composition());
          whom = null;
          return true;
        }
        return false;
      }

      final StringBuffer str = new StringBuffer("");
      for (final Enumeration<String> e = H.keys(); e.hasMoreElements(); )
        str.append(e.nextElement() + " ");
      mob.tell(L("Compose or sing an ode about whom?"));
      if (str.length() > 0)
        mob.tell(L("You presently have odes written about: @x1.", str.toString().trim()));
      return false;
    }
    String name = CMParms.combine(commands, 0);
    for (final Enumeration<String> e = H.keys(); e.hasMoreElements(); ) {
      final String key = e.nextElement();
      if (CMLib.english().containsString(key, name)) {
        invoker = mob;
        originRoom = mob.location();
        commonRoomSet = getInvokerScopeRoomSet(null);
        name = key;
        song = H.get(name);
        benefits = null;
        whom = mob.location().fetchInhabitant(name);
        if ((whom == null) || (!whom.name().equals(name))) whom = CMLib.players().getPlayer(name);
        if ((whom == null) || (!whom.name().equals(name))) {
          whom = CMClass.getMOB("StdMOB");
          whom.setName(name);
          whom.setLocation(mob.location());
        }
        return super.invoke(mob, commands, givenTarget, auto, asLevel);
      }
    }

    final MOB target = getTarget(mob, commands, givenTarget);
    if (target == null) return false;
    if (target == mob) {
      mob.tell(L("You may not compose an ode about yourself!"));
      return false;
    }

    final boolean success = proficiencyCheck(mob, 0, auto);
    if (success) {
      unsingAll(mob, mob);
      invoker = mob;
      originRoom = mob.location();
      commonRoomSet = getInvokerScopeRoomSet(null);
      whom = target;
      final String str = L("^S<S-NAME> begin(s) to compose an @x1.^?", songOf());
      final CMMsg msg =
          CMClass.getMsg(
              mob,
              null,
              this,
              (auto ? CMMsg.MASK_ALWAYS : 0) | CMMsg.MSG_DELICATE_SMALL_HANDS_ACT,
              str);
      if (mob.location().okMessage(mob, msg)) {
        mob.location().send(mob, msg);
        invoker = mob;
        final Song_Ode newOne = (Song_Ode) copyOf();
        newOne.whom = target;
        newOne.trail = new StringBuffer("");
        newOne.song = null;
        mob.addEffect(newOne);
      }
    } else
      mob.location()
          .show(mob, null, CMMsg.MSG_NOISE, L("<S-NAME> lose(s) <S-HIS-HER> inspiration."));
    return success;
  }
예제 #22
0
  public boolean tick(Tickable ticking, int tickID) {
    int realLastWeather = super.lastWeather;
    if (!super.tick(ticking, tickID)) return false;
    Area A = CMLib.map().areaLocation(ticking);
    if (A == null) return false;
    Climate C = A.getClimateObj();
    if (C == null) return false;
    lastWeather = realLastWeather;

    // handle freeze overs
    if ((coldWeather(lastWeather))
        && (coldWeather(C.weatherType(null)))
        && (lastWeather != C.weatherType(null))
        && (A.getTimeObj().getSeasonCode() == TimeClock.SEASON_WINTER)
        && (CMLib.dice().rollPercentage() < freezeOverChance)) {
      if (ticking instanceof Room) {
        Room R = (Room) ticking;
        if ((R.domainType() == Room.DOMAIN_OUTDOORS_WATERSURFACE)
            && (CMLib.dice().rollPercentage() < freezeOverChance)
            && (R instanceof Drink)
            && (((Drink) R).liquidType() == RawMaterial.RESOURCE_FRESHWATER)) {
          Ability A2 = CMClass.getAbility("Spell_IceSheet");
          if (A2 != null) {
            MOB mob = CMLib.map().getFactoryMOB(R);
            A2.invoke(mob, R, true, 0);
            mob.destroy();
          }
        }
      } else
        for (Enumeration<Room> e = A.getProperMap(); e.hasMoreElements(); ) {
          Room R = (Room) e.nextElement();
          if ((R.domainType() == Room.DOMAIN_OUTDOORS_WATERSURFACE)
              && (CMLib.dice().rollPercentage() < freezeOverChance)) {
            Ability A2 = CMClass.getAbility("Spell_IceSheet");
            if (A2 != null) {
              MOB mob = CMLib.map().getFactoryMOB(R);
              A2.invoke(mob, R, true, 0);
              mob.destroy();
            }
          }
        }
    }
    if ((botherDown--) == 1) {
      resetBotherTicks();
      switch (C.weatherType(null)) {
        case Climate.WEATHER_BLIZZARD:
        case Climate.WEATHER_SLEET:
        case Climate.WEATHER_SNOW:
        case Climate.WEATHER_HAIL:
        case Climate.WEATHER_THUNDERSTORM:
        case Climate.WEATHER_RAIN:
          for (Enumeration<Room> r = A.getProperMap(); r.hasMoreElements(); ) {
            Room R = (Room) r.nextElement();
            if (CMLib.map().hasASky(R))
              for (int i = 0; i < R.numInhabitants(); i++) {
                MOB mob = R.fetchInhabitant(i);
                if ((mob != null)
                    && (!mob.isMonster())
                    && (CMLib.flags().aliveAwakeMobile(mob, true))
                    && (CMath.bset(mob.getBitmap(), MOB.ATT_AUTOWEATHER)))
                  mob.tell(C.getWeatherDescription(A));
              }
          }
          break;
      }
    }
    if ((diseaseDown--) == 1) {
      resetDiseaseTicks();
      int coldChance = 0;
      int fluChance = 0;
      int frostBiteChance = 0;
      int heatExhaustionChance = 0;
      switch (C.weatherType(null)) {
        case Climate.WEATHER_BLIZZARD:
        case Climate.WEATHER_SLEET:
        case Climate.WEATHER_SNOW:
          coldChance = 99;
          fluChance = 25;
          frostBiteChance = 15;
          break;
        case Climate.WEATHER_HAIL:
          coldChance = 50;
          frostBiteChance = 10;
          break;
        case Climate.WEATHER_THUNDERSTORM:
        case Climate.WEATHER_RAIN:
          coldChance = 25;
          break;
        case Climate.WEATHER_WINTER_COLD:
          coldChance = 75;
          fluChance = 10;
          frostBiteChance = 5;
          break;
        case Climate.WEATHER_HEAT_WAVE:
          heatExhaustionChance = 15;
          break;
        case Climate.WEATHER_DROUGHT:
          heatExhaustionChance = 20;
          break;
      }

      for (Session S : CMLib.sessions().localOnlineIterable()) {
        if ((S.mob() == null)
            || (S.mob().location() == null)
            || (S.mob().location().getArea() != A)
            || (S.mob().isMonster())) continue;

        MOB M = S.mob();
        Room R = M.location();

        if ((R.domainConditions() & Room.CONDITION_COLD) > 0) {
          if (coldChance > 0) coldChance += 10;
          if (coldChance > 0) fluChance += 5; // yes, cold is related this way to flu
          if (frostBiteChance > 0)
            frostBiteChance = frostBiteChance + (int) Math.round(CMath.mul(frostBiteChance, 0.5));
        }
        if ((R.domainConditions() & Room.CONDITION_HOT) > 0) {
          if (heatExhaustionChance > 0) heatExhaustionChance += 10;
        }
        if ((R.domainConditions() & Room.CONDITION_WET) > 0) {
          if (coldChance > 0) coldChance += 5;
          if (heatExhaustionChance > 5) heatExhaustionChance -= 5;
          if (frostBiteChance > 0)
            frostBiteChance = frostBiteChance + (int) Math.round(CMath.mul(frostBiteChance, 0.25));
        }
        int save =
            (M.charStats().getSave(CharStats.STAT_SAVE_COLD)
                    + M.charStats().getSave(CharStats.STAT_SAVE_WATER))
                / 2;
        if ((CMLib.dice().rollPercentage() < (coldChance - save))
            && ((C.weatherType(M.location()) != Climate.WEATHER_CLEAR))) {
          long coveredPlaces = 0;
          for (int l = 0; l < ALL_COVERED_SPOTS.length; l++)
            if (M.getWearPositions(ALL_COVERED_SPOTS[l]) == 0)
              coveredPlaces = coveredPlaces | ALL_COVERED_SPOTS[l];
          Item I = null;
          for (int i = 0; i < M.numItems(); i++) {
            I = M.getItem(i);
            if ((I == null) || (I.amWearingAt(Wearable.IN_INVENTORY))) continue;
            if (I.amWearingAt(Wearable.WORN_ABOUT_BODY))
              coveredPlaces = coveredPlaces | Wearable.WORN_TORSO | Wearable.WORN_LEGS;
            for (int l = 0; l < ALL_COVERED_SPOTS.length; l++)
              if (I.amWearingAt(ALL_COVERED_SPOTS[l]))
                coveredPlaces = coveredPlaces | ALL_COVERED_SPOTS[l];
          }
          if ((coveredPlaces != ALL_COVERED_CODE)
              && (!CMSecurity.isDisabled(CMSecurity.DisFlag.AUTODISEASE))) {
            Ability COLD = CMClass.getAbility("Disease_Cold");
            if (CMLib.dice().rollPercentage()
                < (fluChance
                    + (((M.location().domainConditions() & Room.CONDITION_WET) > 0) ? 10 : 0)))
              COLD = CMClass.getAbility("Disease_Flu");
            if ((COLD != null) && (M.fetchEffect(COLD.ID()) == null)) COLD.invoke(M, M, true, 0);
          }
        }
        if ((CMLib.dice().rollPercentage() < (frostBiteChance - save))
            && ((C.weatherType(M.location()) != Climate.WEATHER_CLEAR))) {
          long unfrostedPlaces = 0;
          for (int l = 0; l < ALL_FROST_SPOTS.length; l++)
            if (M.getWearPositions(ALL_FROST_SPOTS[l]) == 0)
              unfrostedPlaces = unfrostedPlaces | ALL_FROST_SPOTS[l];
          Item I = null;
          for (int i = 0; i < M.numItems(); i++) {
            I = M.getItem(i);
            if ((I == null) || (I.amWearingAt(Wearable.IN_INVENTORY))) continue;
            for (int l = 0; l < ALL_FROST_SPOTS.length; l++)
              if (I.amWearingAt(ALL_FROST_SPOTS[l]))
                unfrostedPlaces = unfrostedPlaces | ALL_FROST_SPOTS[l];
          }
          if ((unfrostedPlaces != ALL_FROST_CODE)
              && (!CMSecurity.isDisabled(CMSecurity.DisFlag.AUTODISEASE))) {
            Ability COLD = CMClass.getAbility("Disease_FrostBite");
            if ((COLD != null) && (M.fetchEffect(COLD.ID()) == null)) COLD.invoke(M, M, true, 0);
          }
        }
        if ((heatExhaustionChance > 0)
            && (CMLib.dice().rollPercentage()
                < (heatExhaustionChance - M.charStats().getSave(CharStats.STAT_SAVE_FIRE)))
            && (C.weatherType(M.location()) != Climate.WEATHER_CLEAR)
            && (!CMSecurity.isDisabled(CMSecurity.DisFlag.AUTODISEASE))) {
          Ability COLD = CMClass.getAbility("Disease_HeatExhaustion");
          if ((COLD != null) && (M.fetchEffect(COLD.ID()) == null)) COLD.invoke(M, M, true, 0);
        }
      }
    }
    if ((rumbleDown--) == 1) {
      resetRumbleTicks();
      for (Session S : CMLib.sessions().localOnlineIterable()) {
        if ((S.mob() == null)
            || (S.mob().location() == null)
            || (S.mob().location().getArea() != A)
            || (S.mob().isMonster())
            || (!CMath.bset(S.mob().getBitmap(), MOB.ATT_AUTOWEATHER))) continue;
        Room R = S.mob().location();
        if (R != null) {
          switch (C.weatherType(null)) {
            case Climate.WEATHER_THUNDERSTORM:
              {
                if (C.weatherType(R) != Climate.WEATHER_THUNDERSTORM) {
                  if ((R.domainType() & Room.INDOORS) > 0) {
                    if ((R.getArea() != null)
                        && CMath.div(
                                R.getArea().getAreaIStats()[Area.Stats.INDOOR_ROOMS.ordinal()],
                                R.getArea().properSize())
                            < 0.90)
                      S.mob()
                          .tell(
                              "^JA thunderous rumble and CRACK of lightning can be heard outside.^?"
                                  + CMProps.msp("thunder.wav", 40));
                  } else
                    S.mob()
                        .tell(
                            "^JA thunderous rumble and CRACK of lightning can be heard.^?"
                                + CMProps.msp("thunder.wav", 40));
                } else if (R.getArea().getTimeObj().getTODCode() == TimeClock.TIME_DAY)
                  S.mob()
                      .tell(
                          "^JA thunderous rumble and CRACK of lightning can be heard as the pounding rain soaks you.^?"
                              + CMProps.msp("thunderandrain.wav", 40));
                else
                  S.mob()
                      .tell(
                          "^JA bolt of lightning streaks across the sky as the pounding rain soaks you!^?"
                              + CMProps.msp("thunderandrain.wav", 40));
                break;
              }
            case Climate.WEATHER_BLIZZARD:
              if (C.weatherType(R) == Climate.WEATHER_BLIZZARD)
                S.mob()
                    .tell(
                        "^JSwirling clouds of snow buffet you.^?"
                            + CMProps.msp("blizzard.wav", 40));
              break;
            case Climate.WEATHER_SNOW:
              if (C.weatherType(R) == Climate.WEATHER_SNOW)
                S.mob().tell("^JSnowflakes fall lightly on you.^?");
              break;
            case Climate.WEATHER_DUSTSTORM:
              if (C.weatherType(R) == Climate.WEATHER_DUSTSTORM)
                S.mob()
                    .tell(
                        "^JSwirling clouds of dust assault you.^?" + CMProps.msp("windy.wav", 40));
              break;
            case Climate.WEATHER_HAIL:
              if (C.weatherType(R) == Climate.WEATHER_HAIL)
                S.mob()
                    .tell(
                        "^JYou are being pelleted by hail! Ouch!^?" + CMProps.msp("hail.wav", 40));
              break;
            case Climate.WEATHER_RAIN:
              if (C.weatherType(R) == Climate.WEATHER_RAIN)
                S.mob().tell("^JThe rain is soaking you!^?" + CMProps.msp("rainlong.wav", 40));
              break;
            case Climate.WEATHER_SLEET:
              if (C.weatherType(R) == Climate.WEATHER_SLEET)
                S.mob()
                    .tell(
                        "^JCold and blistering sleet is soaking you numb!^?"
                            + CMProps.msp("rain.wav", 40));
              break;
            case Climate.WEATHER_WINDY:
              if (C.weatherType(R) == Climate.WEATHER_WINDY)
                S.mob().tell("^JThe wind gusts around you.^?" + CMProps.msp("wind.wav", 40));
              break;
          }
        }
      }
    }
    if ((lightningDown--) == 1) {
      resetLightningTicks();
      if (C.weatherType(null) == Climate.WEATHER_THUNDERSTORM) {
        boolean playerAround = false;
        for (Session S : CMLib.sessions().localOnlineIterable()) {
          if ((S.mob() == null)
              || (S.mob().location() == null)
              || (S.mob().location().getArea() != A)
              || (S.mob().isMonster())
              || (C.weatherType(S.mob().location()) != Climate.WEATHER_THUNDERSTORM)) continue;
          playerAround = true;
        }
        if (playerAround) {
          Room R = A.getRandomProperRoom();
          MOB M = R.fetchRandomInhabitant();
          if (M != null) {
            Ability A2 = CMClass.getAbility("Chant_SummonLightning");
            if (A2 != null) {
              A2.setMiscText("RENDER MUNDANE");
              A2.invoke(M, M, true, M.phyStats().level());
            }
          } else R = null;
          Room R2 = null;
          for (Enumeration<Room> e = A.getProperMap(); e.hasMoreElements(); ) {
            R2 = (Room) e.nextElement();
            if ((R2 != R) && (R2.numInhabitants() > 0))
              if ((A.getTimeObj().getTODCode() == TimeClock.TIME_DAY)
                  || (C.weatherType(R2) != Climate.WEATHER_THUNDERSTORM)) {
                if ((R2.domainType() & Room.INDOORS) > 0)
                  R2.showHappens(
                      CMMsg.MSG_OK_ACTION,
                      "^JA thunderous rumble and crack of lightning can be heard outside.^?"
                          + CMProps.msp("thunder2.wav", 40));
                else
                  R2.showHappens(
                      CMMsg.MSG_OK_ACTION,
                      "^JA thunderous rumble and crack of lightning can be heard.^?"
                          + CMProps.msp("thunder2.wav", 40));
              } else
                R2.showHappens(
                    CMMsg.MSG_OK_ACTION,
                    "^JYou hear a thunderous rumble as a bolt of lightning streaks across the sky!^?"
                        + CMProps.msp("thunder3.wav", 40));
          }
        }
      }
    }
    if ((tornadoDown--) == 1) {
      resetTornadoTicks();
      if ((C.weatherType(null) == Climate.WEATHER_THUNDERSTORM)
          || (C.weatherType(null) == Climate.WEATHER_WINDY)) {
        boolean playerAround = false;
        for (Session S : CMLib.sessions().localOnlineIterable()) {
          if ((S.mob() == null)
              || (S.mob().location() == null)
              || (S.mob().location().getArea() != A)
              || (S.mob().isMonster())
              || (C.weatherType(S.mob().location()) != Climate.WEATHER_THUNDERSTORM)) continue;
          playerAround = true;
        }
        if (playerAround) {
          Room R = A.getRandomProperRoom();
          MOB M = R.fetchRandomInhabitant();
          if (M != null) {
            Ability A2 = CMClass.getAbility("Chant_SummonTornado");
            if (A2 != null) {
              A2.setMiscText("RENDER MUNDANE");
              MOB mob = CMLib.map().getFactoryMOB(R);
              A2.invoke(mob, null, true, 0);
              mob.destroy();
            }
          } else R = null;
          Room R2 = null;
          for (Enumeration<Room> e = A.getProperMap(); e.hasMoreElements(); ) {
            R2 = (Room) e.nextElement();
            if ((R2 != R) && (R2.numInhabitants() > 0))
              if ((A.getTimeObj().getTODCode() == TimeClock.TIME_DAY)
                  || (C.weatherType(R2) != Climate.WEATHER_THUNDERSTORM)) {
                if ((R2.domainType() & Room.INDOORS) > 0)
                  R2.showHappens(
                      CMMsg.MSG_OK_ACTION,
                      "^JThe terrible rumble of a tornado can be heard outside.^?"
                          + CMProps.msp("tornado.wav", 40));
                else
                  R2.showHappens(
                      CMMsg.MSG_OK_ACTION,
                      "^JThe terrible rumble of a tornado can be heard.^?"
                          + CMProps.msp("tornado.wav", 40));
              } else
                R2.showHappens(
                    CMMsg.MSG_OK_ACTION,
                    "^JA huge and terrible tornado touches down somewhere near by.^?"
                        + CMProps.msp("tornado.wav", 40));
          }
        }
      }
    }
    if ((dustDown--) == 1) {
      resetDustTicks();
      if (C.weatherType(null) == Climate.WEATHER_DUSTSTORM) {
        Vector choices = new Vector();
        Room R = null;
        for (Session S : CMLib.sessions().localOnlineIterable()) {
          if ((S.mob() == null)
              || (S.mob().location() == null)
              || (S.mob().location().getArea() != A)
              || (S.mob().isMonster())
              || (C.weatherType(S.mob().location()) != Climate.WEATHER_DUSTSTORM)) continue;
          R = S.mob().location();
          if ((R != null) && (!choices.contains(R))) choices.addElement(R);
        }
        if (choices.size() > 0) {
          R = (Room) choices.elementAt(CMLib.dice().roll(1, choices.size(), -1));
          MOB M = R.fetchRandomInhabitant();
          if ((M != null)
              && (C.weatherType(R) == Climate.WEATHER_DUSTSTORM)
              && (!CMLib.flags().isSleeping(M))) {
            Ability A2 = CMClass.getAbility("Skill_Dirt");
            if (A2 != null) A2.invoke(M, M, true, 0);
          }
        }
      }
    }
    if ((hailDown--) == 1) {
      resetHailTicks();
      if (C.weatherType(null) == Climate.WEATHER_HAIL) {
        Vector choices = new Vector();
        Room R = null;
        for (Session S : CMLib.sessions().localOnlineIterable()) {
          if ((S.mob() == null)
              || (S.mob().location() == null)
              || (S.mob().location().getArea() != A)
              || (S.mob().isMonster())
              || (C.weatherType(S.mob().location()) != Climate.WEATHER_HAIL)) continue;
          R = S.mob().location();
          if ((R != null) && (!choices.contains(R))) choices.addElement(R);
        }
        if (choices.size() > 0) {
          R = (Room) choices.elementAt(CMLib.dice().roll(1, choices.size(), -1));
          MOB M = R.fetchRandomInhabitant();
          Ability A2 = CMClass.getAbility("Chant_SummonHail");
          if ((A2 != null) && (C.weatherType(R) == Climate.WEATHER_HAIL)) {
            A2.setMiscText("RENDER MUNDANE");
            A2.invoke(M, M, true, M.phyStats().level());
          }
        }
      }
    }
    if ((C.weatherType(null) == Climate.WEATHER_DROUGHT)
        && (CMLib.dice().rollPercentage() < droughtFireChance)) {
      Room R = CMLib.map().roomLocation((Environmental) ticking);
      if ((R == null) && (ticking instanceof Area)) R = ((Area) ticking).getRandomProperRoom();
      if ((R != null)
          && ((R.domainType() & Room.INDOORS) == 0)
          && (R.domainType() != Room.DOMAIN_OUTDOORS_SWAMP)
          && (R.domainType() != Room.DOMAIN_OUTDOORS_UNDERWATER)
          && (R.domainType() != Room.DOMAIN_OUTDOORS_WATERSURFACE)
          && ((R.domainConditions() & Room.CONDITION_WET) == 0)) {
        Item I = R.getRandomItem();
        if ((I != null) && (CMLib.flags().isGettable(I)))
          switch (I.material() & RawMaterial.MATERIAL_MASK) {
            case RawMaterial.MATERIAL_CLOTH:
            case RawMaterial.MATERIAL_LEATHER:
            case RawMaterial.MATERIAL_PAPER:
            case RawMaterial.MATERIAL_VEGETATION:
            case RawMaterial.MATERIAL_WOODEN:
              {
                Ability A2 = CMClass.getAbility("Burning");
                MOB mob = CMLib.map().getFactoryMOB(R);
                R.showHappens(
                    CMMsg.MSG_OK_VISUAL,
                    I.Name()
                        + " spontaneously combusts in the seering heat!"
                        + CMProps.msp("fire.wav", 40));
                A2.invoke(mob, I, true, 0);
                mob.destroy();
              }
              break;
          }
      }
    }
    if ((gustDown--) == 1) {
      resetGustTicks();
      if ((C.weatherType(null) == Climate.WEATHER_WINDY)
          || (C.weatherType(null) == Climate.WEATHER_BLIZZARD)
          || (C.weatherType(null) == Climate.WEATHER_DUSTSTORM)) {
        Vector choices = new Vector();
        Room R = null;
        for (Session S : CMLib.sessions().localOnlineIterable()) {
          if ((S.mob() == null)
              || (S.mob().location() == null)
              || (S.mob().location().getArea() != A)
              || (S.mob().isMonster())
              || ((C.weatherType(S.mob().location()) != Climate.WEATHER_WINDY)
                  && (C.weatherType(S.mob().location()) != Climate.WEATHER_BLIZZARD)
                  && (C.weatherType(S.mob().location()) != Climate.WEATHER_DUSTSTORM))) continue;
          R = S.mob().location();
          if ((R != null) && (!choices.contains(R))) choices.addElement(R);
        }
        if (choices.size() > 0) {
          R = (Room) choices.elementAt(CMLib.dice().roll(1, choices.size(), -1));
          MOB M = CMLib.map().getFactoryMOB(R);
          Ability A2 = CMClass.getAbility("Chant_WindGust");
          if (A2 != null) {
            A2.setMiscText("RENDER MUNDANE");
            A2.invoke(M, M, true, M.phyStats().level());
          }
          M.destroy();
        }
      }
    }
    if ((rustDown--) == 1) {
      resetRustTicks();
      for (Session S : CMLib.sessions().localOnlineIterable()) {
        if ((S.mob() == null)
            || (S.mob().location() == null)
            || (S.mob().location().getArea() != A)
            || (S.mob().isMonster())) continue;
        int rustChance = 0;
        switch (C.weatherType(S.mob().location())) {
          case Climate.WEATHER_BLIZZARD:
          case Climate.WEATHER_SLEET:
          case Climate.WEATHER_SNOW:
            rustChance = 5;
            break;
          case Climate.WEATHER_HAIL:
            rustChance = 5;
            break;
          case Climate.WEATHER_THUNDERSTORM:
          case Climate.WEATHER_RAIN:
            rustChance = 5;
            break;
        }

        MOB M = S.mob();
        Room R = M.location();

        switch (R.domainType()) {
          case Room.DOMAIN_INDOORS_UNDERWATER:
          case Room.DOMAIN_INDOORS_WATERSURFACE:
          case Room.DOMAIN_OUTDOORS_WATERSURFACE:
          case Room.DOMAIN_OUTDOORS_UNDERWATER:
            rustChance += 5;
            break;
          default:
            break;
        }
        if ((R.domainConditions() & Room.CONDITION_WET) > 0) rustChance += 2;
        if (CMLib.dice().rollPercentage() < rustChance) {
          int weatherType = C.weatherType(R);
          Vector rustThese = new Vector();
          for (int i = 0; i < M.numItems(); i++) {
            Item I = M.getItem(i);
            if (I == null) continue;
            if ((!I.amWearingAt(Wearable.IN_INVENTORY))
                && (((I.material() & RawMaterial.MATERIAL_MASK) == RawMaterial.MATERIAL_METAL))
                && (I.subjectToWearAndTear())
                && ((CMLib.dice().rollPercentage() > I.phyStats().ability() * 25)))
              rustThese.addElement(I);
            else if (I.amWearingAt(Wearable.WORN_ABOUT_BODY)
                && (((I.material() & RawMaterial.MATERIAL_MASK) != RawMaterial.MATERIAL_METAL))) {
              rustThese.clear();
              break;
            }
          }
          if (R != null)
            for (int i = 0; i < rustThese.size(); i++) {
              Item I = (Item) rustThese.elementAt(i);
              CMMsg msg =
                  CMClass.getMsg(
                      M,
                      I,
                      null,
                      CMMsg.MASK_ALWAYS | CMMsg.TYP_WATER,
                      (weatherType != 0) ? "<T-NAME> rusts." : "<T-NAME> rusts in the water.",
                      CMMsg.TYP_WATER,
                      null,
                      CMMsg.NO_EFFECT,
                      null);
              if (R.okMessage(M, msg)) {
                R.send(M, msg);
                if (msg.value() <= 0) {
                  I.setUsesRemaining(I.usesRemaining() - 1);
                  if (I.usesRemaining() <= 0) {
                    msg =
                        CMClass.getMsg(
                            M,
                            null,
                            null,
                            CMMsg.MSG_OK_VISUAL,
                            I.name() + " is destroyed!",
                            null,
                            I.name() + " carried by " + M.name() + " is destroyed!");
                    if (R.okMessage(M, msg)) R.send(M, msg);
                    I.destroy();
                  }
                }
              }
            }
        }
      }
    }
    if (ticking instanceof Room) lastWeather = C.weatherType((Room) ticking);
    else lastWeather = C.weatherType(null);
    return true;
  }
예제 #23
0
  @Override
  public boolean invoke(
      MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) {
    if (commands.size() < 2) {
      if (mob.isMonster() && (commands.size() == 1)) {
        final String parm = correctItem(mob);
        if (parm != null) commands.add(parm);
      }
      if (commands.size() < 2) {
        mob.tell(L("You must specify a target, and what item to swap on the target!"));
        return false;
      }
    }
    final Item I = mob.findItem(null, commands.get(commands.size() - 1));
    if ((I == null) || (!CMLib.flags().canBeSeenBy(I, mob))) {
      mob.tell(L("You don't seem to have '@x1'.", (commands.get(commands.size() - 1))));
      return false;
    }
    if (((I instanceof Armor) && (I.basePhyStats().armor() > 1))
        || ((I instanceof Weapon) && (I.basePhyStats().damage() > 1))) {
      mob.tell(L("@x1 is not buffoonish enough!", I.name(mob)));
      return false;
    }
    commands.remove(commands.size() - 1);

    final MOB target = getTarget(mob, commands, givenTarget);
    if (target == null) return false;

    final Item targetItem = targetItem(target);
    if (targetItem == null) {
      if (!freePosition(target)) {
        mob.tell(L("@x1 has no free wearing positions!", target.name(mob)));
        return false;
      }
    }

    if (!super.invoke(mob, commands, givenTarget, auto, asLevel)) return false;

    int levelDiff = target.phyStats().level() - mob.phyStats().level();

    final boolean success = proficiencyCheck(mob, 0, auto);
    if (levelDiff > 0)
      levelDiff = -(levelDiff * ((!CMLib.flags().canBeSeenBy(mob, target)) ? 5 : 15));
    else levelDiff = -(levelDiff * ((!CMLib.flags().canBeSeenBy(mob, target)) ? 1 : 2));

    if (success) {
      final CMMsg msg =
          CMClass.getMsg(
              mob,
              target,
              this,
              (CMMsg.MSG_NOISYMOVEMENT | CMMsg.MASK_DELICATE | CMMsg.MASK_MALICIOUS)
                  | (auto ? CMMsg.MASK_ALWAYS : 0),
              auto ? "" : L("<S-NAME> do(es) buffoonery to <T-NAMESELF>."));
      if (mob.location().okMessage(mob, msg)) {
        mob.location().send(mob, msg);
        long position = -1;
        if (targetItem != null) {
          position = targetItem.rawWornCode();
          targetItem.unWear();
        } else {
          final Vector<Long> free = getFreeWearingPositions(target);
          if (free.size() < 1) {
            mob.tell(L("@x1 has no free wearing positions!", target.name(mob)));
            return false;
          }
          if ((free.contains(Long.valueOf(Wearable.WORN_WIELD)))
              && ((I instanceof Weapon) || (!(I instanceof Armor)))) position = Wearable.WORN_WIELD;
          else position = free.elementAt(CMLib.dice().roll(1, free.size(), -1)).longValue();
        }
        if (position >= 0) {
          I.unWear();
          target.moveItemTo(I);
          I.wearAt(position);
        }
      }
    } else
      return beneficialVisualFizzle(
          mob, target, L("<S-NAME> attempt(s) buffoonery on <T-NAMESELF>, but fail(s)."));

    return success;
  }
예제 #24
0
  @Override
  public boolean invoke(
      MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) {
    if (commands.size() < 1) {
      mob.tell(L("Pay Off Whom?"));
      return false;
    }
    final MOB target = this.getTarget(mob, commands, givenTarget);
    if (target == null) return false;

    if ((target.charStats().getStat(CharStats.STAT_INTELLIGENCE) < 3) || (!target.isMonster())) {
      mob.tell(L("You can't pay off @x1.", target.name(mob)));
      return false;
    }

    final LegalBehavior B = CMLib.law().getLegalBehavior(mob.location());
    final Area A = (B == null) ? null : CMLib.law().getLegalObject(mob.location());
    if ((A == null) || (B == null)) {
      mob.tell(L("There's no point in paying off @x1.", target.name(mob)));
      return false;
    }

    boolean isJudge = B.isJudge(A, target);
    if ((!isJudge) && (!B.isAnyOfficer(A, target))) {
      mob.tell(L("Paying off @x1 won't help you.", target.name(mob)));
      return false;
    }

    final List<LegalWarrant> warrants = B.getWarrantsOf(A, mob);
    if ((warrants == null) || (warrants.size() == 0)) {
      mob.tell(L("Pay off @x1? Why? You aren't in any trouble.", target.name(mob)));
      return false;
    }

    if (target.fetchEffect(ID()) != null) {
      mob.tell(L("@x1 is already paid off.", target.name(mob)));
      return false;
    }

    if (!super.invoke(mob, commands, givenTarget, auto, asLevel)) return false;

    double amountRequired =
        CMLib.beanCounter().getTotalAbsoluteNativeValue(target)
            + ((double)
                    ((100l
                        - ((mob.charStats().getStat(CharStats.STAT_CHARISMA)
                                + (2l * getXLEVELLevel(mob)))
                            * 2)))
                * target.phyStats().level());
    if (isJudge) amountRequired *= 2;

    final String currency = CMLib.beanCounter().getCurrency(target);
    boolean success = proficiencyCheck(mob, 0, auto);

    if ((!success) || (CMLib.beanCounter().getTotalAbsoluteValue(mob, currency) < amountRequired)) {
      final CMMsg msg =
          CMClass.getMsg(
              mob,
              target,
              this,
              CMMsg.MSG_SPEAK,
              L(
                  "^T<S-NAME> attempt(s) to pay off <T-NAMESELF> to '@x1', but no deal is reached.^?",
                  CMParms.combine(commands, 0)));
      if (mob.location().okMessage(mob, msg)) mob.location().send(mob, msg);
      if (CMLib.beanCounter().getTotalAbsoluteValue(mob, currency) < amountRequired) {
        final String costWords = CMLib.beanCounter().nameCurrencyShort(currency, amountRequired);
        mob.tell(L("@x1 requires @x2 to do this.", target.charStats().HeShe(), costWords));
      }
      success = false;
    } else {
      final String costWords = CMLib.beanCounter().nameCurrencyShort(target, amountRequired);
      final CMMsg msg =
          CMClass.getMsg(
              mob,
              target,
              this,
              CMMsg.MSG_THIEF_ACT,
              L("^T<S-NAME> pay(s) off <T-NAMESELF>.^?", CMParms.combine(commands, 0), costWords));
      if (mob.location().okMessage(mob, msg)) {
        mob.location().send(mob, msg);
        CMLib.beanCounter().subtractMoney(mob, currency, amountRequired);
        CMLib.beanCounter().addMoney(mob, currency, amountRequired);
        if (isJudge) {
          for (LegalWarrant W : warrants) {
            if (W.punishment() > 0) W.setPunishment(W.punishment() - 1);
          }
        } else {
          clearWarrants(target, mob, mob.location(), A, B);
          super.beneficialAffect(mob, target, asLevel, 0);
        }
      }
      target.recoverPhyStats();
    }
    return success;
  }
예제 #25
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;
  }
예제 #26
0
  @Override
  public boolean invoke(MOB mob, Vector commands, Physical givenTarget, boolean auto, int asLevel) {

    if ((auto || mob.isMonster())
        && ((commands.size() < 1) || (((String) commands.firstElement()).equals(mob.name())))) {
      commands.clear();
      if (mob.numItems() > 0) commands.addElement(mob.getRandomItem());
      commands.addElement(CMLib.map().getRandomArea().Name());
    }
    final Room oldRoom = mob.location();
    if (commands.size() < 2) {
      mob.tell(L("Teleport what object to what place or person?"));
      return false;
    }
    final String objectName = (String) commands.firstElement();
    final Item target = mob.findItem(null, objectName);
    if (target == null) {
      mob.tell(L("You don't seem to have an item '@x1'.", objectName));
      return false;
    }
    if (target.amWearingAt(Wearable.IN_INVENTORY)) {
      mob.tell(L("You seem to be wearing or holding the item '@x1'.", objectName));
      return false;
    }
    String searchWhat = null;
    if (commands.size() > 2) {
      final String s = (String) commands.elementAt(1);
      if (s.equalsIgnoreCase("room")) searchWhat = "R";
      if (s.equalsIgnoreCase("area")) searchWhat = "E";
      if (s.equalsIgnoreCase("mob")) searchWhat = "M";
      if (s.equalsIgnoreCase("monster")) searchWhat = "M";
      if (s.equalsIgnoreCase("player")) searchWhat = "P";
      if (s.equalsIgnoreCase("user")) searchWhat = "P";
      if (s.equalsIgnoreCase("item")) searchWhat = "I";
      if (s.equalsIgnoreCase("object")) searchWhat = "I";
      if (searchWhat != null) commands.removeElementAt(1);
    }
    if (searchWhat == null) searchWhat = "ERIPM";
    final String destinationString = CMParms.combine(commands, 1).trim().toUpperCase();
    final List<Room> candidates =
        CMLib.map().findWorldRoomsLiberally(mob, destinationString, searchWhat, 10, 600000);
    if (candidates.size() == 0) {
      mob.tell(L("You don't know of a place called '@x1'.", destinationString.toLowerCase()));
      return false;
    }

    if (CMLib.flags().isSitting(mob) || CMLib.flags().isSleeping(mob)) {
      mob.tell(L("You need to stand up!"));
      return false;
    }

    Room newRoom = null;
    int tries = 0;
    while ((tries < 20) && (newRoom == null)) {
      newRoom = candidates.get(CMLib.dice().roll(1, candidates.size(), -1));
      if (((newRoom.roomID().length() == 0) && (CMLib.dice().rollPercentage() > 50))
          || ((newRoom.domainType() == Room.DOMAIN_OUTDOORS_AIR)
              && (CMLib.dice().rollPercentage() > 10))) {
        newRoom = null;
        continue;
      }
      final CMMsg enterMsg =
          CMClass.getMsg(
              mob,
              newRoom,
              null,
              CMMsg.MSG_ENTER,
              null,
              CMMsg.MSG_ENTER,
              null,
              CMMsg.MSG_ENTER,
              null);
      if (!newRoom.okMessage(mob, enterMsg)) newRoom = null;
      tries++;
    }

    if ((newRoom == null) || (newRoom == oldRoom)) {
      mob.tell(L("Your magic seems unable to send anything there."));
      return false;
    }

    if (!super.invoke(mob, commands, givenTarget, auto, asLevel)) return false;

    boolean success = proficiencyCheck(mob, 0, auto);

    final CMMsg msg =
        CMClass.getMsg(
            mob,
            target,
            this,
            somanticCastCode(mob, target, auto),
            L("^S<S-NAME> invoke(s) a teleportation spell upon <T-NAME>.^?"));
    if (oldRoom.okMessage(mob, msg)) {
      oldRoom.send(mob, msg);
      newRoom.bringMobHere(mob, false);
      target.unWear();
      success = CMLib.commands().postDrop(mob, target, true, false, false) && (!mob.isMine(target));
      oldRoom.bringMobHere(mob, false);
      if (success) {
        oldRoom.show(mob, target, null, CMMsg.MSG_OK_VISUAL, L("<T-NAME> vanishes!"));
        newRoom.showOthers(
            mob, target, null, CMMsg.MSG_OK_VISUAL, L("<T-NAME> appear(s) out of nowhere!"));
      } else mob.tell(L("Nothing happens."));
    }
    // return whether it worked
    return success;
  }
예제 #27
0
  @Override
  public String healthText(MOB viewer, MOB mob) {
    final double pct = (CMath.div(mob.curState().getHitPoints(), mob.maxState().getHitPoints()));

    if (pct < .10) return L("^r@x1^r is unstable and almost disintegrated!^N", mob.name(viewer));
    else if (pct < .20) return L("^r@x1^r is nearing disintegration.^N", mob.name(viewer));
    else if (pct < .30) return L("^r@x1^r is noticeably disintegrating.^N", mob.name(viewer));
    else if (pct < .40)
      return L("^y@x1^y is very damaged and slightly disintegrated.^N", mob.name(viewer));
    else if (pct < .50) return L("^y@x1^y is very damaged.^N", mob.name(viewer));
    else if (pct < .60) return L("^p@x1^p is starting to show major damage.^N", mob.name(viewer));
    else if (pct < .70) return L("^p@x1^p is definitely damaged.^N", mob.name(viewer));
    else if (pct < .80) return L("^g@x1^g is disheveled and mildly damaged.^N", mob.name(viewer));
    else if (pct < .90) return L("^g@x1^g is noticeably disheveled.^N", mob.name(viewer));
    else if (pct < .99) return L("^g@x1^g is slightly disheveled.^N", mob.name(viewer));
    else return L("^c@x1^c is in perfect condition.^N", mob.name(viewer));
  }
  @Override
  public boolean invoke(
      MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) {
    final MOB target = this.getTarget(mob, commands, givenTarget);
    if (target == null) return false;
    if ((mob.getWorshipCharID().length() == 0)
        || (CMLib.map().getDeity(mob.getWorshipCharID()) == null)) {
      if (!auto) mob.tell(L("You must worship a god to use this prayer."));
      return false;
    }
    final Deity D = CMLib.map().getDeity(mob.getWorshipCharID());
    if ((target.getWorshipCharID().length() > 0)
        && (CMLib.map().getDeity(target.getWorshipCharID()) != null)) {
      if (!auto)
        mob.tell(
            L(
                "@x1 worships @x2, and may not be converted with this prayer.",
                target.name(mob),
                target.getWorshipCharID()));
      return false;
    }
    if ((CMLib.flags().isAnimalIntelligence(target)
        || CMLib.flags().isGolem(target)
        || (D == null))) {
      if (!auto) mob.tell(L("@x1 can not be converted with this prayer.", target.name(mob)));
      return false;
    }
    if (!auto) {
      if (convertStack.contains(target)) {
        final Long L = (Long) convertStack.elementAt(convertStack.indexOf(target), 2);
        if ((System.currentTimeMillis() - L.longValue()) > CMProps.getMillisPerMudHour() * 5)
          convertStack.removeElement(target);
      }
      if (convertStack.contains(target)) {
        mob.tell(L("@x1 must wait to be undeniably faithful again.", target.name(mob)));
        return false;
      }
    }

    if (!super.invoke(mob, commands, givenTarget, auto, asLevel)) return false;

    int levelDiff =
        target.phyStats().level() - (mob.phyStats().level() + (2 * getXLEVELLevel(mob)));
    if (levelDiff < 0) levelDiff = 0;
    final boolean success = proficiencyCheck(mob, -(levelDiff * 25), auto);
    int type = verbalCastCode(mob, target, auto);
    int mal = CMMsg.MASK_MALICIOUS;
    if (auto) {
      type = CMath.unsetb(type, CMMsg.MASK_MALICIOUS);
      mal = 0;
    }
    if (success) {
      final CMMsg msg =
          CMClass.getMsg(
              mob,
              target,
              this,
              type,
              auto ? "" : L("^S<S-NAME> @x1 for <T-NAMESELF> to BELIEVE!^?", prayWord(mob)));
      final CMMsg msg2 =
          CMClass.getMsg(target, D, this, CMMsg.MSG_SERVE, L("<S-NAME> BELIEVE(S) !!!"));
      final CMMsg msg3 =
          CMClass.getMsg(
              mob,
              target,
              this,
              CMMsg.MSK_CAST_VERBAL | mal | CMMsg.TYP_MIND | (auto ? CMMsg.MASK_ALWAYS : 0),
              null);
      if ((mob.location().okMessage(mob, msg))
          && (mob.location().okMessage(mob, msg3))
          && (mob.location().okMessage(mob, msg2))) {
        mob.location().send(mob, msg);
        mob.location().send(mob, msg3);
        if ((msg.value() <= 0) && (msg3.value() <= 0)) {
          target.location().send(target, msg2);
          target.setWorshipCharID(godName);
          if (mob != target) CMLib.leveler().postExperience(mob, target, null, 25, false);
          godName = mob.getWorshipCharID();
          beneficialAffect(mob, target, asLevel, CMProps.getIntVar(CMProps.Int.TICKSPERMUDMONTH));
          convertStack.addElement(target, Long.valueOf(System.currentTimeMillis()));
        }
      }
    } else
      beneficialWordsFizzle(
          mob,
          target,
          auto ? "" : L("<S-NAME> @x1 for <T-NAMESELF>, but nothing happens.", prayWord(mob)));

    // return whether it worked
    return success;
  }
예제 #29
0
  @Override
  public String healthText(MOB viewer, MOB mob) {
    final double pct = (CMath.div(mob.curState().getHitPoints(), mob.maxState().getHitPoints()));

    if (pct < .10) return L("^r@x1^r is one unhappy little critter!^N", mob.name(viewer));
    else if (pct < .20)
      return L("^r@x1^r is covered in blood and matted hair.^N", mob.name(viewer));
    else if (pct < .30)
      return L("^r@x1^r is bleeding badly from lots of wounds.^N", mob.name(viewer));
    else if (pct < .40)
      return L("^y@x1^y has large patches of bloody matted fur.^N", mob.name(viewer));
    else if (pct < .50) return L("^y@x1^y has some bloody matted fur.^N", mob.name(viewer));
    else if (pct < .60) return L("^p@x1^p has a lot of cuts and gashes.^N", mob.name(viewer));
    else if (pct < .70) return L("^p@x1^p has a few cut patches.^N", mob.name(viewer));
    else if (pct < .80) return L("^g@x1^g has a cut patch of fur.^N", mob.name(viewer));
    else if (pct < .90) return L("^g@x1^g has some disheveled fur.^N", mob.name(viewer));
    else if (pct < .99) return L("^g@x1^g has some misplaced hairs.^N", mob.name(viewer));
    else return L("^c@x1^c is in perfect health.^N", mob.name(viewer));
  }
예제 #30
0
 public boolean execute(MOB mob, Vector commands, int metaFlags) throws java.io.IOException {
   commands.removeElementAt(0);
   MOB leader = CMLib.combat().getFollowedLeader(mob);
   List<MOB>[] done = CMLib.combat().getFormation(mob);
   if (commands.size() == 0) {
     StringBuffer str = new StringBuffer("");
     for (int i = 0; i < done.length; i++)
       if (done[i] != null) {
         if (i == 0) str.append("^xfront  - ^.^?");
         else str.append("^xrow +" + i + " - ^.^?");
         for (int i2 = 0; i2 < done[i].size(); i2++)
           str.append(((i2 > 0) ? ", " : "") + ((MOB) done[i].get(i2)).name());
         str.append("\n\r");
       }
     mob.session().colorOnlyPrintln(str.toString());
   } else if (commands.size() == 1) mob.tell("Put whom in what row?");
   else if (mob.numFollowers() == 0) mob.tell("Noone is following you!");
   else {
     String row = (String) commands.lastElement();
     if ("FRONT".startsWith(row.toUpperCase())) row = "0";
     commands.removeElementAt(commands.size() - 1);
     String name = CMParms.combine(commands, 0);
     MOB who = null;
     if (CMLib.english().containsString(mob.name(), name)
         || CMLib.english().containsString(mob.Name(), name)) {
       mob.tell("You can not move your own position.  You are always the leader of your party.");
       return false;
     }
     for (int f = 0; f < mob.numFollowers(); f++) {
       MOB M = mob.fetchFollower(f);
       if (M == null) continue;
       if (CMLib.english().containsString(M.name(), name)
           || CMLib.english().containsString(M.Name(), name)) {
         who = M;
         break;
       }
     }
     if (who == null) {
       mob.tell("There is noone following you called " + name + ".");
       return false;
     }
     if ((!CMath.isNumber(row)) || (CMath.s_int(row) < 0))
       mob.tell(
           "'"
               + row
               + "' is not a valid row in which to put "
               + who.name()
               + ".  Try number greater than 0.");
     else {
       int leaderRow = -1;
       for (int f = 0; f < done.length; f++)
         if ((done[f] != null) && (done[f].contains(leader))) {
           leaderRow = f;
           break;
         }
       if (leaderRow < 0) mob.tell("You do not exist.");
       else if (CMath.s_int(row) < leaderRow)
         mob.tell(
             "You can not place "
                 + who.name()
                 + " behind your own position, which is "
                 + leaderRow
                 + ".");
       else {
         mob.addFollower(who, CMath.s_int(row) - leaderRow);
         mob.tell("You have positioned " + who.name() + " to row " + CMath.s_int(row));
       }
     }
   }
   return false;
 }