コード例 #1
0
ファイル: Swamp.java プロジェクト: renokun/CoffeeMud
 @Override
 public void executeMsg(final Environmental myHost, final CMMsg msg) {
   if ((msg.amITarget(this)
           || (msg.targetMinor() == CMMsg.TYP_ADVANCE)
           || (msg.targetMinor() == CMMsg.TYP_RETREAT))
       && (!msg.source().isMonster())
       && (msg.source().curState().getHitPoints() < msg.source().maxState().getHitPoints())
       && (CMLib.dice().rollPercentage() == 1)
       && (CMLib.dice().rollPercentage() == 1)
       && (!CMSecurity.isDisabled(CMSecurity.DisFlag.AUTODISEASE))) {
     Ability A = null;
     if (CMLib.dice().rollPercentage() > 50) A = CMClass.getAbility("Disease_Chlamydia");
     else A = CMClass.getAbility("Disease_Malaria");
     if ((A != null) && (msg.source().fetchEffect(A.ID()) == null))
       A.invoke(msg.source(), msg.source(), true, 0);
   }
   if (msg.amITarget(this) && (msg.targetMinor() == CMMsg.TYP_DRINK)) {
     final MOB mob = msg.source();
     final boolean thirsty = mob.curState().getThirst() <= 0;
     final boolean full =
         !mob.curState().adjThirst(thirstQuenched(), mob.maxState().maxThirst(mob.baseWeight()));
     if (thirsty) mob.tell(L("You are no longer thirsty."));
     else if (full) mob.tell(L("You have drunk all you can."));
     if (CMLib.dice().rollPercentage() < 10) {
       Ability A = CMClass.getAbility("Disease_Malaria");
       if ((A != null) && (msg.source().fetchEffect(A.ID()) == null))
         A.invoke(msg.source(), msg.source(), true, 0);
     }
   }
   super.executeMsg(myHost, msg);
 }
コード例 #2
0
ファイル: Cow.java プロジェクト: bozimmerman/CoffeeMud
 @Override
 public void executeMsg(final Environmental myHost, final CMMsg msg) {
   super.executeMsg(myHost, msg);
   if (msg.amITarget(this) && (msg.targetMinor() == CMMsg.TYP_DRINK)) {
     final MOB mob = msg.source();
     final boolean thirsty = mob.curState().getThirst() <= 0;
     final boolean full =
         !mob.curState().adjThirst(thirstQuenched(), mob.maxState().maxThirst(mob.baseWeight()));
     if (thirsty) mob.tell(L("You are no longer thirsty."));
     else if (full) mob.tell(L("You have drunk all you can."));
   } else if ((msg.tool() == this)
       && (msg.targetMinor() == CMMsg.TYP_FILL)
       && (msg.target() instanceof Container)
       && (((Container) msg.target()).capacity() > 0)) {
     final Container container = (Container) msg.target();
     final Item I = CMClass.getItem("GenLiquidResource");
     I.setName(L("some milk"));
     I.setDisplayText(L("some milk has been left here."));
     I.setDescription(L("It looks like milk"));
     I.setMaterial(RawMaterial.RESOURCE_MILK);
     I.setBaseValue(RawMaterial.CODES.VALUE(RawMaterial.RESOURCE_MILK));
     I.basePhyStats().setWeight(1);
     CMLib.materials().addEffectsToResource(I);
     I.recoverPhyStats();
     I.setContainer(container);
     if (container.owner() != null)
       if (container.owner() instanceof MOB) ((MOB) container.owner()).addItem(I);
       else if (container.owner() instanceof Room)
         ((Room) container.owner()).addItem(I, ItemPossessor.Expire.Resource);
   }
 }
コード例 #3
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;
  }
コード例 #4
0
ファイル: Stone.java プロジェクト: kingdavid127/MUD
 @Override
 public void affectCharState(MOB affectedMOB, CharState affectableState) {
   affectableState.setHitPoints(affectableState.getHitPoints() * 4);
   affectableState.setHunger((Integer.MAX_VALUE / 2) + 10);
   affectedMOB.curState().setHunger(affectableState.getHunger());
   affectableState.setThirst((Integer.MAX_VALUE / 2) + 10);
   affectedMOB.curState().setThirst(affectableState.getThirst());
 }
コード例 #5
0
  @Override
  public boolean tick(Tickable ticking, int tickID) {
    if (!(affected instanceof MOB)) return super.tick(ticking, tickID);

    final MOB mob = (MOB) affected;

    if (tickID != Tickable.TICKID_MOB) return true;
    if (!proficiencyCheck(null, 0, false)) return true;

    if ((!mob.isInCombat()) && (CMLib.flags().isSleeping(mob))) {
      roundsHibernating++;
      final double man =
          ((mob.charStats().getStat(CharStats.STAT_INTELLIGENCE)
              + mob.charStats().getStat(CharStats.STAT_WISDOM)));
      mob.curState()
          .adjMana(
              (int)
                  Math.round(
                      (man * .1)
                          + ((mob.phyStats().level() + (2.0 * super.getXLEVELLevel(invoker())))
                              / 2.0)),
              mob.maxState());
      mob.curState().setHunger(oldState.getHunger());
      mob.curState().setThirst(oldState.getThirst());
      final double move = mob.charStats().getStat(CharStats.STAT_STRENGTH);
      mob.curState()
          .adjMovement(
              (int)
                  Math.round(
                      (move * .1)
                          + ((mob.phyStats().level() + (2.0 * super.getXLEVELLevel(invoker())))
                              / 2.0)),
              mob.maxState());
      if (!CMLib.flags().isGolem(mob)) {
        final double hp = mob.charStats().getStat(CharStats.STAT_CONSTITUTION);
        if (!CMLib.combat()
            .postHealing(
                mob,
                mob,
                this,
                CMMsg.MASK_ALWAYS | CMMsg.TYP_CAST_SPELL,
                (int)
                    Math.round(
                        (hp * .1)
                            + ((mob.phyStats().level() + (2.0 * super.getXLEVELLevel(invoker())))
                                / 2.0)),
                null)) unInvoke();
      }
    } else {
      unInvoke();
      return false;
    }
    return super.tick(ticking, tickID);
  }
コード例 #6
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()) {
      mob.tell(L("You feel less rallied."));
      mob.recoverMaxState();
      if (mob.curState().getHitPoints() > mob.maxState().getHitPoints())
        mob.curState().setHitPoints(mob.maxState().getHitPoints());
    }
  }
コード例 #7
0
  @Override
  public boolean invoke(MOB mob, Vector commands, Physical givenTarget, boolean auto, int asLevel) {
    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,
              null,
              this,
              CMMsg.MSG_SPEAK,
              auto ? "" : L("^S<S-NAME> scream(s) a mighty RALLYING CRY!!^?"));
      if (mob.location().okMessage(mob, msg)) {
        mob.location().send(mob, msg);
        final Set<MOB> h = properTargets(mob, givenTarget, auto);
        if (h == null) return false;
        for (final Object element : h) {
          final MOB target = (MOB) element;
          target.location().show(target, null, CMMsg.MSG_OK_VISUAL, L("<S-NAME> seem(s) rallied!"));
          timesTicking = 0;
          hpUp = mob.phyStats().level() + (2 * getXLEVELLevel(mob));
          beneficialAffect(mob, target, asLevel, 0);
          target.recoverMaxState();
          if (target.fetchEffect(ID()) != null) mob.curState().adjHitPoints(hpUp, mob.maxState());
        }
      }
    } else beneficialWordsFizzle(mob, null, auto ? "" : L("<S-NAME> mumble(s) a weak rally cry."));

    // return whether it worked
    return success;
  }
コード例 #8
0
ファイル: StdWand.java プロジェクト: renokun/CoffeeMud
 public static boolean useTheWand(Ability A, MOB mob, int level) {
   int manaRequired = 5;
   final int q = CMLib.ableMapper().qualifyingLevel(mob, A);
   if (q > 0) {
     if (q < CMLib.ableMapper().qualifyingClassLevel(mob, A)) manaRequired = 0;
     else manaRequired = 5;
   } else manaRequired = 25;
   manaRequired -= (2 * level);
   if (manaRequired < 5) manaRequired = 5;
   if (manaRequired > mob.curState().getMana()) {
     mob.tell(CMLib.lang().L("You don't have enough mana."));
     return false;
   }
   mob.curState().adjMana(-manaRequired, mob.maxState());
   return true;
 }
コード例 #9
0
  @Override
  public boolean invoke(MOB mob, Vector commands, Physical givenTarget, boolean auto, int asLevel) {
    if (mob.isInCombat()) {
      mob.tell(L("You can't hibernate while in combat!"));
      return false;
    }
    if (!CMLib.flags().isSitting(mob)) {
      mob.tell(L("You must be in a sitting, restful position to hibernate."));
      return false;
    }
    // now see if it worked
    final boolean success = proficiencyCheck(mob, 0, auto);
    if (success) {
      invoker = mob;
      final CMMsg msg =
          CMClass.getMsg(
              mob,
              null,
              this,
              CMMsg.MSG_SLEEP | CMMsg.MASK_MAGIC,
              L("<S-NAME> begin(s) to hibernate..."));
      if (mob.location().okMessage(mob, msg)) {
        mob.location().send(mob, msg);
        oldState = mob.curState();
        beneficialAffect(mob, mob, asLevel, Ability.TICKS_FOREVER);
        helpProficiency(mob, 0);
      }
    } else
      return beneficialVisualFizzle(
          mob, null, L("<S-NAME> chant(s) to hibernate, but lose(s) concentration."));

    // return whether it worked
    return success;
  }
コード例 #10
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;

    if (!super.invoke(mob, commands, givenTarget, auto, asLevel)) return false;
    final boolean success = proficiencyCheck(mob, 0, auto);

    if (success) {
      invoker = mob;
      final CMMsg msg =
          CMClass.getMsg(
              mob,
              target,
              this,
              verbalCastCode(mob, target, auto),
              auto ? "" : L("^S<S-NAME> incant(s) to <T-NAMESELF>.^?"));
      if (mob.location().okMessage(mob, msg)) {
        mob.location().send(mob, msg);
        if (msg.value() <= 0) {
          target
              .curState()
              .adjThirst(
                  -150 - ((mob.phyStats().level() + (2 * getXLEVELLevel(mob))) * 100),
                  target.maxState().maxThirst(target.baseWeight()));
          mob.location()
              .show(target, null, CMMsg.MSG_OK_VISUAL, L("<S-NAME> feel(s) incredibly thirsty!"));
        }
      }
    } else
      return maliciousFizzle(
          mob, target, L("<S-NAME> incant(s) to <T-NAMESELF>, but the spell fades."));
    // return whether it worked
    return success;
  }
コード例 #11
0
ファイル: Charlatan.java プロジェクト: renokun/CoffeeMud
  @Override
  public boolean okMessage(final Environmental myHost, final CMMsg msg) {
    if (!(myHost instanceof MOB)) return super.okMessage(myHost, msg);

    final MOB myChar = (MOB) myHost;
    if (msg.tool() instanceof Ability) {
      if (msg.amISource(myChar)
          && (!myChar.isMonster())
          && (msg.sourceMinor() != CMMsg.TYP_PREINVOKE)) {
        final WeakReference<Ability> curRef = invokable;
        if ((curRef != null) && (msg.tool() == curRef.get())) {
          curRef.clear();
          final Ability A = ((Ability) msg.tool());
          final int[] usageCost = A.usageCost(myChar, false);
          if (CMath.bset(A.usageType(), Ability.USAGE_MANA))
            myChar.curState().adjMana(usageCost[Ability.USAGEINDEX_MANA] / 4, myChar.maxState());
          if (CMath.bset(A.usageType(), Ability.USAGE_MOVEMENT))
            myChar
                .curState()
                .adjMovement(usageCost[Ability.USAGEINDEX_MOVEMENT] / 4, myChar.maxState());
          if (CMath.bset(A.usageType(), Ability.USAGE_HITPOINTS))
            myChar
                .curState()
                .adjHitPoints(usageCost[Ability.USAGEINDEX_HITPOINTS] / 4, myChar.maxState());
        }
      } else if (msg.amITarget(myChar)) {
        if (((((Ability) msg.tool()).classificationCode() & Ability.ALL_ACODES)
                == Ability.ACODE_SPELL)
            && ((((Ability) msg.tool()).classificationCode() & Ability.ALL_DOMAINS)
                == Ability.DOMAIN_DIVINATION)
            && (CMLib.dice().roll(1, 100, 0) < (myChar.charStats().getClassLevel(this) * 4))) {
          myChar
              .location()
              .show(
                  msg.source(),
                  myChar,
                  CMMsg.MSG_OK_ACTION,
                  L(
                      "<T-NAME> fool(s) <S-NAMESELF>, causing <S-HIM-HER> to fizzle @x1.",
                      msg.tool().name()));
          return false;
        }
      }
    }
    return super.okMessage(myHost, msg);
  }
コード例 #12
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 (!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_MALICIOUS | verbalCastCode(mob, target, auto),
              L(
                  auto
                      ? "A light fatigue overcomes <T-NAME>."
                      : "^S<S-NAME> "
                          + prayWord(mob)
                          + " for extreme fatigue to overcome <T-NAMESELF>!^?"));
      if (mob.location().okMessage(mob, msg)) {
        mob.location().send(mob, msg);
        if (msg.value() <= 0) {
          final int harming = CMLib.dice().roll(10, adjustedLevel(mob, asLevel), 50);
          if ((target.curState().getFatigue() <= CharState.FATIGUED_MILLIS)
              && (target.maxState().getFatigue() > Long.MIN_VALUE / 2))
            target.curState().setFatigue(CharState.FATIGUED_MILLIS + 1);
          target.curState().adjMovement(-harming, target.maxState());
          target.tell(L("You feel fatigued!"));
        }
      }
    } else
      return maliciousFizzle(
          mob,
          target,
          L("<S-NAME> point(s) at <T-NAMESELF> and @x1, but nothing happens.", prayWord(mob)));

    // return whether it worked
    return success;
  }
コード例 #13
0
ファイル: Prayer_Refresh.java プロジェクト: renokun/CoffeeMud
  @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 (!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("A bright yellow glow surrounds <T-NAME>.")
                  : L(
                      "^S<S-NAME> @x1, delivering a strong touch of infusion to <T-NAMESELF>.^?",
                      prayWord(mob)));
      if (mob.location().okMessage(mob, msg)) {
        mob.location().send(mob, msg);
        target.curState().setMana(target.maxState().getMana());
        target.curState().setHitPoints(target.maxState().getHitPoints());
        target.curState().setMana(target.maxState().getMana());
        target.curState().setMovement(target.maxState().getMovement());
        target.curState().setFatigue(0);
        target.curState().setHunger(target.maxState().getHunger());
        target.curState().setThirst(target.maxState().getThirst());
        target.tell(L("You feel refreshed!"));
        lastCastHelp = 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;
  }
コード例 #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 (!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,
              somanticCastCode(mob, target, auto),
              L(auto ? "" : "^S<S-NAME> point(s) at <T-NAMESELF> and shout(s)!^?"));
      if (mob.location().okMessage(mob, msg)) {
        mob.location().send(mob, msg);
        invoker = mob;
        if (msg.value() > 0) {
          target
              .location()
              .show(target, null, CMMsg.MSG_OK_VISUAL, L("<T-NAME> become(s) exhausted!"));
          target.curState().setMovement(0);
          if (target.maxState().getFatigue() > Long.MIN_VALUE / 2)
            target
                .curState()
                .setFatigue(target.curState().getFatigue() + CharState.FATIGUED_MILLIS);
        }
      }
    } else
      return maliciousFizzle(
          mob,
          target,
          L("<S-NAME> point(s) and shout(s) at <T-NAMESELF>, but nothing more happens."));

    return success;
  }
コード例 #15
0
ファイル: Plant.java プロジェクト: bozimmerman/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 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));
  }
コード例 #16
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));
  }
コード例 #17
0
ファイル: OozeMephit.java プロジェクト: bozimmerman/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 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));
  }
コード例 #18
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));
  }
コード例 #19
0
ファイル: Rodent.java プロジェクト: bozimmerman/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 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));
  }
コード例 #20
0
ファイル: Archon_Wrath.java プロジェクト: renokun/CoffeeMud
  @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;
  }
コード例 #21
0
  @Override
  public boolean invoke(
      MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) {
    final MOB target = super.getTarget(mob, commands, givenTarget);
    if (target == null) return false;
    final Race R = target.charStats().getMyRace();
    if (R.bodyMask()[Race.BODY_HEAD] <= 0) {
      mob.tell(L("@x1 has no head!", target.name(mob)));
      return false;
    }

    LegalBehavior B = null;
    if (mob.location() != null) B = CMLib.law().getLegalBehavior(mob.location());
    List<LegalWarrant> warrants = new Vector<LegalWarrant>();
    if (B != null) warrants = B.getWarrantsOf(CMLib.law().getLegalObject(mob.location()), target);
    if ((warrants.size() == 0)
        && (!CMSecurity.isAllowed(mob, mob.location(), CMSecurity.SecFlag.ABOVELAW))) {
      mob.tell(L("You are not allowed to behead @x1 at this time.", target.Name()));
      return false;
    }

    final Item w = mob.fetchWieldedItem();
    Weapon ww = null;
    if ((w == null) || (!(w instanceof Weapon))) {
      mob.tell(L("You cannot behead without a weapon!"));
      return false;
    }
    ww = (Weapon) w;
    if ((!auto) && (!CMSecurity.isASysOp(mob))) {
      if (ww.weaponDamageType() != Weapon.TYPE_SLASHING) {
        mob.tell(L("You cannot behead with a @x1!", ww.name()));
        return false;
      }
      if (mob.isInCombat() && (mob.rangeToTarget() > 0)) {
        mob.tell(L("You are too far away to try that!"));
        return false;
      }
      if (!CMLib.flags().isBoundOrHeld(target)) {
        mob.tell(L("@x1 is not bound and would resist.", target.charStats().HeShe()));
        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 = levelDiff * 3;
    else levelDiff = 0;
    final boolean hit = (auto) || CMLib.combat().rollToHit(mob, target);
    boolean success = proficiencyCheck(mob, 0, auto) && (hit);
    if (success) {
      final CMMsg msg =
          CMClass.getMsg(
              mob,
              target,
              this,
              CMMsg.MASK_MALICIOUS
                  | CMMsg.MASK_MOVE
                  | CMMsg.MASK_SOUND
                  | CMMsg.TYP_JUSTICE
                  | (auto ? CMMsg.MASK_ALWAYS : 0),
              null);
      if (mob.location().okMessage(mob, msg)) {
        mob.location().send(mob, msg);
        target.curState().setHitPoints(1);
        final Ability A2 = target.fetchEffect("Injury");
        if (A2 != null) A2.setMiscText(mob.Name() + "/head");
        CMLib.combat()
            .postDamage(
                mob,
                target,
                ww,
                Integer.MAX_VALUE / 2,
                CMMsg.MSG_WEAPONATTACK,
                ww.weaponClassification(),
                auto
                    ? ""
                    : L(
                        "^F^<FIGHT^><S-NAME> rear(s) back and behead(s) <T-NAME>!^</FIGHT^>^?@x1",
                        CMLib.protocol().msp("decap.wav", 30)));
        mob.location().recoverRoomStats();
        final Item limb = CMClass.getItem("GenLimb");
        limb.setName(L("@x1`s head", target.Name()));
        limb.basePhyStats().setAbility(1);
        limb.setDisplayText(L("the bloody head of @x1 is sitting here.", target.Name()));
        limb.setSecretIdentity(target.name() + "`s bloody head.");
        int material = RawMaterial.RESOURCE_MEAT;
        for (int r = 0; r < R.myResources().size(); r++) {
          final Item I = R.myResources().get(r);
          final int mat = I.material() & RawMaterial.MATERIAL_MASK;
          if (((mat == RawMaterial.MATERIAL_FLESH)) || (r == R.myResources().size() - 1)) {
            material = I.material();
            break;
          }
        }
        limb.setMaterial(material);
        limb.basePhyStats().setLevel(1);
        limb.basePhyStats().setWeight(5);
        limb.recoverPhyStats();
        mob.location().addItem(limb, ItemPossessor.Expire.Player_Drop);
        for (int i = 0; i < warrants.size(); i++) {
          final LegalWarrant W = warrants.get(i);
          W.setCrime("pardoned");
          W.setOffenses(0);
        }
      } else success = false;
      if (mob.getVictim() == target) mob.makePeace(true);
      if (target.getVictim() == mob) target.makePeace(true);
    } else maliciousFizzle(mob, target, L("<S-NAME> attempt(s) a beheading and fail(s)!"));
    return success;
  }