コード例 #1
0
ファイル: Prayer_Drain.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,
              CMMsg.MSK_CAST_MALICIOUS_VERBAL | CMMsg.TYP_UNDEAD | (auto ? CMMsg.MASK_ALWAYS : 0),
              null);
      final CMMsg msg2 =
          CMClass.getMsg(
              mob,
              target,
              this,
              verbalCastCode(mob, target, auto),
              auto ? "" : L("^S<S-NAME> reach(es) at <T-NAMESELF>, @x1!^?", prayingWord(mob)));
      if ((mob.location().okMessage(mob, msg)) && (mob.location().okMessage(mob, msg2))) {
        mob.location().send(mob, msg2);
        mob.location().send(mob, msg);
        if ((msg.value() <= 0) && (msg2.value() <= 0)) {
          final int damage = CMLib.dice().roll(1, adjustedLevel(mob, asLevel), 0);
          CMLib.combat()
              .postDamage(
                  mob,
                  target,
                  this,
                  damage,
                  CMMsg.MASK_ALWAYS | CMMsg.TYP_UNDEAD,
                  Weapon.TYPE_BURSTING,
                  auto
                      ? L("<T-NAME> shudder(s) in a draining magical wake.")
                      : L("The draining grasp <DAMAGE> <T-NAME>."));
          if (mob != target)
            CMLib.combat()
                .postHealing(
                    mob, mob, this, CMMsg.MASK_ALWAYS | CMMsg.TYP_CAST_SPELL, damage, null);
        }
      }
    } else
      return maliciousFizzle(
          mob,
          target,
          L("<S-NAME> reach(es) for <T-NAMESELF>, @x1, but the spell fades.", prayingWord(mob)));

    // return whether it worked
    return success;
  }
コード例 #2
0
  @Override
  public boolean tick(Tickable ticking, int tickID) {
    if ((affected == null) || (!(affected instanceof Room))) return super.tick(ticking, tickID);

    if ((--damageTickDown) >= 0) return super.tick(ticking, tickID);
    damageTickDown = 4;

    HashSet H = null;
    if ((invoker() != null) && (invoker().location() == affected)) {
      H = new HashSet();
      invoker().getGroupMembers(H);
    }
    final Room R = (Room) affected;
    for (int i = 0; i < R.numInhabitants(); i++) {
      final MOB M = R.fetchInhabitant(i);
      if ((M != null) && ((H == null) || (!H.contains(M)))) {
        if (invoker() != null) {
          final int harming = CMLib.dice().roll(1, adjustedLevel(invoker(), 0) / 3, 1);
          CMLib.combat()
              .postDamage(
                  invoker(),
                  M,
                  this,
                  harming,
                  CMMsg.MASK_MALICIOUS | CMMsg.TYP_UNDEAD,
                  Weapon.TYPE_BURSTING,
                  L("The unholy aura <DAMAGE> <T-NAME>!"));
        } else {
          final int harming =
              CMLib.dice().roll(1, CMLib.ableMapper().lowestQualifyingLevel(ID()) / 3, 1);
          CMLib.combat()
              .postDamage(
                  M,
                  M,
                  this,
                  harming,
                  CMMsg.MASK_MALICIOUS | CMMsg.TYP_UNDEAD,
                  Weapon.TYPE_BURSTING,
                  L("The unholy aura <DAMAGE> <T-NAME>!"));
        }
        if ((!M.isInCombat())
            && (M.isMonster())
            && (M != invoker)
            && (invoker != null)
            && (M.location() == invoker.location())
            && (M.location().isInhabitant(invoker))
            && (CMLib.flags().canBeSeenBy(invoker, M)))
          CMLib.combat().postAttack(M, invoker, M.fetchWieldedItem());
      }
    }
    return super.tick(ticking, tickID);
  }
コード例 #3
0
ファイル: Plant.java プロジェクト: bozimmerman/CoffeeMud
 @Override
 public boolean tick(Tickable ticking, int tickID) {
   if (!super.tick(ticking, tickID)) return false;
   if ((tickID == Tickable.TICKID_MOB) && (ticking instanceof MOB))
     CMLib.combat().recoverTick((MOB) ticking);
   return true;
 }
コード例 #4
0
 @Override
 public void spring(MOB M) {
   if ((!sprung)
       && (CMLib.dice().rollPercentage() + (2 * getXLEVELLevel(invoker()))
           > M.charStats().getSave(CharStats.STAT_SAVE_TRAPS)))
     CMLib.combat().postDeath(invoker(), M, null);
 }
コード例 #5
0
  public boolean tick(Tickable ticking, int tickID) {
    if (!super.tick(ticking, tickID)) return false;
    if (affected == null) return false;
    if (!(affected instanceof MOB)) return true;

    MOB mob = (MOB) affected;
    if ((!mob.amDead()) && ((--diseaseTick) <= 0)) {
      diseaseTick = DISEASE_DELAY();
      if (CMLib.dice().rollPercentage() == 1) {
        int damage = mob.curState().getHitPoints() / 2;
        MOB diseaser = invoker;
        if (diseaser == null) diseaser = mob;
        CMLib.combat()
            .postDamage(
                diseaser,
                mob,
                this,
                damage,
                CMMsg.MASK_ALWAYS | CMMsg.TYP_DISEASE,
                -1,
                "<S-NAME> <S-HAS-HAVE> an asthma attack! It <DAMAGE> <S-NAME>!");
      } else mob.location().show(mob, null, CMMsg.MSG_NOISE, DISEASE_AFFECT());
      return true;
    }
    return true;
  }
コード例 #6
0
ファイル: Spell_IceLance.java プロジェクト: kingdavid127/MUD
  @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;

    // now see if it worked
    final boolean success = proficiencyCheck(mob, 0, auto);

    if (success) {
      final CMMsg msg =
          CMClass.getMsg(
              mob,
              target,
              this,
              somanticCastCode(mob, target, auto),
              L(
                      (auto ? "A " : "^S<S-NAME> incant(s) and point(s) at <T-NAMESELF>. A ")
                          + "long shard of ice streaks through the air!^?")
                  + CMLib.protocol().msp("spelldam2.wav", 40));
      final CMMsg msg2 =
          CMClass.getMsg(
              mob,
              target,
              this,
              CMMsg.MSK_CAST_MALICIOUS_VERBAL | CMMsg.TYP_COLD | (auto ? CMMsg.MASK_ALWAYS : 0),
              null);
      if ((mob.location().okMessage(mob, msg)) && (mob.location().okMessage(mob, msg2))) {
        mob.location().send(mob, msg);
        invoker = mob;

        int damage = 0;
        final int maxDie = (adjustedLevel(mob, asLevel) + (2 * super.getX1Level(mob))) / 2;
        damage += CMLib.dice().roll(maxDie, 6, 15);
        mob.location().send(mob, msg2);
        if ((msg2.value() > 0) || (msg.value() > 0))
          damage = (int) Math.round(CMath.div(damage, 2.0));

        if (target.location() == mob.location())
          CMLib.combat()
              .postDamage(
                  mob,
                  target,
                  this,
                  damage,
                  CMMsg.MASK_ALWAYS | CMMsg.TYP_COLD,
                  Weapon.TYPE_FROSTING,
                  L("The lance <DAMAGE> <T-NAME>!"));
      }
    } else
      return maliciousFizzle(
          mob,
          target,
          L("<S-NAME> incant(s) and point(s) at <T-NAMESELF>, but flub(s) the spell."));

    // return whether it worked
    return success;
  }
コード例 #7
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;
    final boolean undead = CMLib.flags().isUndead(target);

    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,
              (undead ? 0 : CMMsg.MASK_MALICIOUS) | verbalCastCode(mob, target, auto),
              L(
                      auto
                          ? "A seriously painful burst assaults <T-NAME>."
                          : "^S<S-NAME> "
                              + prayWord(mob)
                              + " for a serious burst of pain at <T-NAMESELF>!^?")
                  + CMLib.protocol().msp("spelldam1.wav", 40));
      final CMMsg msg2 =
          CMClass.getMsg(
              mob,
              target,
              this,
              CMMsg.MSK_CAST_MALICIOUS_VERBAL | CMMsg.TYP_UNDEAD | (auto ? CMMsg.MASK_ALWAYS : 0),
              null);
      final Room R = target.location();
      if ((R != null) && (R.okMessage(mob, msg)) && ((R.okMessage(mob, msg2)))) {
        R.send(mob, msg);
        R.send(mob, msg2);
        if ((msg.value() <= 0) && (msg2.value() <= 0)) {
          final int harming = CMLib.dice().roll(1, adjustedLevel(mob, asLevel) + 6, 4);
          CMLib.combat()
              .postDamage(
                  mob,
                  target,
                  this,
                  harming,
                  CMMsg.MASK_ALWAYS | CMMsg.TYP_UNDEAD,
                  Weapon.TYPE_BURSTING,
                  L("The unholy spell <DAMAGE> <T-NAME>!"));
        }
      }
    } 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;
  }
コード例 #8
0
ファイル: Spell_AcidSpray.java プロジェクト: kingdavid127/MUD
  @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;
    Room R = CMLib.map().roomLocation(target);
    if (R == null) R = mob.location();

    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
                          ? "<T-NAME> <T-IS-ARE> sprayed with acid."
                          : "^S<S-NAME> reach(es) for <T-NAMESELF>, spraying acid all over <T-HIM-HER>!^?")
                  + CMLib.protocol().msp("spelldam1.wav", 40));
      final CMMsg msg2 =
          CMClass.getMsg(
              mob,
              target,
              this,
              CMMsg.MSK_CAST_MALICIOUS_VERBAL | CMMsg.TYP_ACID | (auto ? CMMsg.MASK_ALWAYS : 0),
              null);
      if ((R.okMessage(mob, msg)) && ((R.okMessage(mob, msg2)))) {
        R.send(mob, msg);
        R.send(mob, msg2);
        invoker = mob;
        final int numDice = (adjustedLevel(mob, asLevel) + (2 * super.getX1Level(invoker()))) / 2;
        int damage = CMLib.dice().roll(2, numDice, 1);
        if ((msg2.value() > 0) || (msg.value() > 0))
          damage = (int) Math.round(CMath.div(damage, 2.0));
        CMLib.combat()
            .postDamage(
                mob,
                target,
                this,
                damage,
                CMMsg.MASK_ALWAYS | CMMsg.TYP_ACID,
                Weapon.TYPE_MELTING,
                L("The acid <DAMAGE> <T-NAME>!"));
        maliciousAffect(mob, target, asLevel, 3, -1);
      }
    } else
      return maliciousFizzle(
          mob, target, L("<S-NAME> reach(es) for <T-NAMESELF>, but nothing more happens."));

    return success;
  }
コード例 #9
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);
  }
コード例 #10
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);

    final Room R = target.location();
    if (success) {
      final Prayer_Thunderbolt newOne = (Prayer_Thunderbolt) this.copyOf();
      final CMMsg msg =
          CMClass.getMsg(
              mob,
              target,
              newOne,
              verbalCastCode(mob, target, auto),
              L(
                      auto
                          ? "<T-NAME> is filled with a holy charge!"
                          : "^S<S-NAME> " + prayForWord(mob) + " to strike down <T-NAMESELF>!^?")
                  + CMLib.protocol().msp("lightning.wav", 40));
      final CMMsg msg2 =
          CMClass.getMsg(
              mob,
              target,
              this,
              CMMsg.MSK_CAST_MALICIOUS_VERBAL | CMMsg.TYP_ELECTRIC | (auto ? CMMsg.MASK_ALWAYS : 0),
              null);
      if ((R.okMessage(mob, msg)) && ((R.okMessage(mob, msg2)))) {
        R.send(mob, msg);
        R.send(mob, msg2);
        if ((msg.value() <= 0) && (msg2.value() <= 0)) {
          final int harming =
              CMLib.dice().roll(1, adjustedLevel(mob, asLevel), adjustedLevel(mob, asLevel));
          CMLib.combat()
              .postDamage(
                  mob,
                  target,
                  this,
                  harming,
                  CMMsg.MASK_ALWAYS | CMMsg.TYP_ELECTRIC,
                  Weapon.TYPE_STRIKING,
                  L("^SThe STRIKE of @x1 <DAMAGES> <T-NAME>!^?", hisHerDiety(mob)));
        }
      }
    } else
      return maliciousFizzle(mob, target, L("<S-NAME> @x1, but nothing happens.", prayWord(mob)));

    // return whether it worked
    return success;
  }
コード例 #11
0
  @Override
  public boolean invoke(
      MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) {
    if (!mob.isInCombat()) {
      mob.tell(L("You must be in combat to do this!"));
      return false;
    }
    final MOB victim = super.getTarget(mob, commands, givenTarget);
    if (victim == null) return false;
    if (((victim == mob.getVictim()) && (mob.rangeToTarget() > 0))
        || ((victim.getVictim() == mob) && (victim.rangeToTarget() > 0))) {
      mob.tell(L("You are too far away to disarm!"));
      return false;
    }
    if (mob.fetchWieldedItem() == null) {
      mob.tell(L("You need a weapon to disarm someone!"));
      return false;
    }
    Item hisWeapon = victim.fetchWieldedItem();
    if (hisWeapon == null) hisWeapon = victim.fetchHeldItem();
    if ((hisWeapon == null)
        || (!(hisWeapon instanceof Weapon))
        || ((((Weapon) hisWeapon).weaponClassification() == Weapon.CLASS_NATURAL))) {
      mob.tell(L("@x1 is not wielding a weapon!", victim.charStats().HeShe()));
      return false;
    }

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

    int levelDiff =
        victim.phyStats().level() - (mob.phyStats().level() + (2 * getXLEVELLevel(mob)));
    if (levelDiff > 0) levelDiff = levelDiff * 5;
    else levelDiff = 0;
    final boolean hit = (auto) || CMLib.combat().rollToHit(mob, victim);
    final boolean success = proficiencyCheck(mob, -levelDiff, auto) && (hit);
    if ((success)
        && ((hisWeapon.fitsOn(Wearable.WORN_WIELD))
            || hisWeapon.fitsOn(Wearable.WORN_WIELD | Wearable.WORN_HELD))) {
      if (mob.location().show(mob, victim, this, CMMsg.MSG_NOISYMOVEMENT, null)) {
        final CMMsg msg = CMClass.getMsg(victim, hisWeapon, null, CMMsg.MSG_DROP, null);
        if (mob.location().okMessage(mob, msg)) {
          mob.location().send(victim, msg);
          mob.location()
              .show(
                  mob,
                  victim,
                  CMMsg.MSG_NOISYMOVEMENT,
                  auto ? L("<T-NAME> is disarmed!") : L("<S-NAME> disarm(s) <T-NAMESELF>!"));
        }
      }
    } else
      maliciousFizzle(mob, victim, L("<S-NAME> attempt(s) to disarm <T-NAMESELF> and fail(s)!"));
    return success;
  }
コード例 #12
0
  public boolean invoke(MOB mob, Vector commands, Physical givenTarget, boolean auto, int asLevel) {
    MOB target = this.getTarget(mob, commands, givenTarget);
    if (target == null) return false;
    Room R = CMLib.map().roomLocation(target);
    if (R == null) R = mob.location();

    if (!CMLib.flags().isAnimalIntelligence(target)) {
      mob.tell(target.name(mob) + " is not an animal!");
      return false;
    }

    // the invoke method for spells receives as
    // parameters the invoker, and the REMAINING
    // command line parameters, divided into words,
    // and added as String objects to a vector.
    if (!super.invoke(mob, commands, givenTarget, auto, asLevel)) return false;

    // now see if it worked
    boolean success = proficiencyCheck(mob, 0, auto);
    if (success) {
      // it worked, so build a copy of this ability,
      // and add it to the affects list of the
      // affected MOB. Then tell everyone else
      // what happened.
      String str = auto ? "" : "^S<S-NAME> chant(s) at <T-NAMESELF>.^?";
      CMMsg msg = CMClass.getMsg(mob, target, this, verbalCastCode(mob, target, auto), str);
      if (R.okMessage(mob, msg)) {
        R.send(mob, msg);
        if (msg.value() <= 0) {
          success =
              maliciousAffect(
                  mob,
                  target,
                  asLevel,
                  0,
                  CMMsg.MSK_CAST_VERBAL | CMMsg.TYP_MIND | (auto ? CMMsg.MASK_ALWAYS : 0));
          if (success) {
            if (target.isInCombat()) target.makePeace();
            CMLib.commands().postFollow(target, mob, false);
            CMLib.combat().makePeaceInGroup(mob);
            if (target.amFollowing() != mob)
              mob.tell(target.name(mob) + " seems unwilling to follow you.");
          }
        }
      }
    }
    if (!success)
      return maliciousFizzle(
          mob, target, "<S-NAME> chant(s) at <T-NAMESELF>, but nothing happens.");

    // return whether it worked
    return success;
  }
コード例 #13
0
 @Override
 public void spring(MOB mob) {
   final Room room = mob.location();
   if (room != null) {
     final Set<MOB> friendlySet = new HashSet<MOB>();
     if (invoker() != null) invoker().getGroupMembers(friendlySet);
     room.show(
         mob,
         affected,
         CMMsg.MSG_OK_ACTION,
         L("<T-NAME> explodes, spraying clumps of stomach acid everywhere!"));
     for (final Enumeration<MOB> m = room.inhabitants(); m.hasMoreElements(); ) {
       MOB M = m.nextElement();
       if ((M != null) && (!friendlySet.contains(M))) {
         final MOB invoker = (invoker() != null) ? invoker() : M;
         final int damage = CMLib.dice().roll(4, 5 + invoker.phyStats().level(), 0);
         CMLib.combat()
             .postDamage(
                 invoker,
                 M,
                 this,
                 damage,
                 CMMsg.MASK_MALICIOUS | CMMsg.MASK_ALWAYS | CMMsg.TYP_ACID,
                 Weapon.TYPE_MELTING,
                 L("The acid clumps <DAMAGE> <T-NAME>!"));
         if ((!M.isInCombat())
             && (M.isMonster())
             && (M != invoker)
             && (M.location() == invoker.location())
             && (M.location().isInhabitant(invoker))
             && (CMLib.flags().canBeSeenBy(invoker, M)))
           CMLib.combat().postAttack(M, invoker, M.fetchWieldedItem());
       }
     }
   }
   Physical affected = this.affected;
   unInvoke();
   if (affected instanceof Item) ((Item) affected).destroy();
 }
コード例 #14
0
 @Override
 public void affectPhyStats(Physical affected, PhyStats affectableStats) {
   super.affectPhyStats(affected, affectableStats);
   if (affected == null) return;
   if (levelsDown < 0) return;
   final int attacklevel = affectableStats.attackAdjustment() / affectableStats.level();
   affectableStats.setLevel(affectableStats.level() - (levelsDown * direction));
   if (affectableStats.level() <= 0) {
     levelsDown = -1;
     CMLib.combat().postDeath(invoker(), (MOB) affected, null);
   }
   affectableStats.setAttackAdjustment(
       affectableStats.attackAdjustment() - (attacklevel * (levelsDown * direction)));
 }
コード例 #15
0
 @Override
 public boolean tick(Tickable ticking, int tickID) {
   if (tickID != Tickable.TICKID_MISCELLANEOUS) return super.tick(ticking, tickID);
   while (killTrigger[0]) {
     final LinkedList<MOB> killThese = new LinkedList<MOB>();
     synchronized (killTrigger) {
       killThese.addAll(getDeadMOBsFrom(affected));
       killTrigger[0] = false;
     }
     for (final MOB M : killThese) {
       CMLib.combat().postDeath(null, M, null);
     }
   }
   return false;
 }
コード例 #16
0
 @Override
 public void executeMsg(final Environmental myHost, final CMMsg msg) {
   if ((msg.targetMinor() == CMMsg.TYP_ENTER)
       && (msg.target() == affected)
       && (msg.source() != invoker())
       && (!msg.source().Name().equals(text()))
       && (!sprung)
       && (invoker() != null)
       && (invoker().mayIFight(msg.source()))
       && ((canBeUninvoked())
           || (!CMLib.law().doesHavePriviledgesHere(msg.source(), (Room) affected)))
       && (CMLib.dice().rollPercentage()
           > msg.source().charStats().getSave(CharStats.STAT_SAVE_TRAPS)))
     CMLib.combat().postDeath(invoker(), msg.source(), msg);
   super.executeMsg(myHost, msg);
 }
コード例 #17
0
  public void tickLycanthropically(MOB mob) {
    if (mob == null) return;
    if (mob.location() == null) return;
    if (mob.isInCombat()) return;

    if ((CMLib.dice().rollPercentage() < 15) && ((mob.location().domainType() & Room.INDOORS) > 0))
      mob.location()
          .show(mob, null, CMMsg.MSG_NOISE, L("<S-NAME> howl(s) at the moon! ARROOOOOOOO!!!!"));
    // time to tick lycanthropically
    final MOB M = victimHere(mob.location(), mob);
    if (M != null) {
      deathTrail = null;
      CMLib.combat().postAttack(mob, M, mob.fetchWieldedItem());
      return;
    }
    if ((deathTrail != null) && (!deathTrail.contains(mob.location()))) deathTrail = null;
    if (deathTrail == null) {
      final Vector rooms = new Vector();
      if ((findVictim(mob, mob.location(), rooms, 0)) && (rooms.size() > 0)) {
        TrackingLibrary.TrackingFlags flags;
        flags =
            new TrackingLibrary.TrackingFlags()
                .plus(TrackingLibrary.TrackingFlag.OPENONLY)
                .plus(TrackingLibrary.TrackingFlag.AREAONLY)
                .plus(TrackingLibrary.TrackingFlag.NOEMPTYGRIDS)
                .plus(TrackingLibrary.TrackingFlag.NOAIR)
                .plus(TrackingLibrary.TrackingFlag.NOWATER);
        deathTrail = CMLib.tracking().findBastardTheBestWay(mob.location(), rooms, flags, 50);
        if (deathTrail != null) deathTrail.add(mob.location());
      }
    }
    if (deathTrail != null) {
      final int nextDirection =
          CMLib.tracking().trackNextDirectionFromHere(deathTrail, mob.location(), true);
      if ((nextDirection == 999) || (nextDirection == -1)) deathTrail = null;
      else if (nextDirection >= 0) {
        final Room nextRoom = mob.location().getRoomInDir(nextDirection);
        if ((nextRoom != null) && ((nextRoom.getArea() == mob.location().getArea()))
            || (!mob.isMonster())) {
          if (!CMLib.tracking().walk(mob, nextDirection, false, false)) deathTrail = null;
          else if (CMLib.dice().rollPercentage() < 15)
            mob.location().show(mob, null, CMMsg.MSG_NOISE, L("<S-NAME> sniff(s) at the air."));

        } else deathTrail = null;
      }
    }
  }
コード例 #18
0
 @Override
 public void executeMsg(final Environmental myHost, final CMMsg msg) {
   super.executeMsg(myHost, msg);
   if ((msg.source().location() != null)
       && (msg.targetMinor() == CMMsg.TYP_DAMAGE)
       && ((msg.value()) > 0)
       && (msg.tool() == this)
       && (msg.target() instanceof MOB)
       && (!((MOB) msg.target()).amDead())
       && (CMLib.flags().isEvil((MOB) msg.target()))) {
     final CMMsg msg2 =
         CMClass.getMsg(
             msg.source(),
             msg.target(),
             new HolyAvenger(),
             CMMsg.MSG_OK_ACTION,
             CMMsg.MSK_MALICIOUS_MOVE | CMMsg.TYP_UNDEAD,
             CMMsg.MSG_NOISYMOVEMENT,
             null);
     if (msg.source().location().okMessage(msg.source(), msg2)) {
       msg.source().location().send(msg.source(), msg2);
       int damage = CMLib.dice().roll(1, 15, 0);
       if (msg.value() > 0) damage = damage / 2;
       msg.addTrailerMsg(
           CMClass.getMsg(
               msg.source(),
               msg.target(),
               CMMsg.MSG_OK_ACTION,
               L(
                   "@x1 dispels evil within <T-NAME> and @x2 <T-HIM-HER>>!",
                   name(),
                   CMLib.combat().standardHitWord(Weapon.TYPE_BURSTING, damage))));
       final CMMsg msg3 =
           CMClass.getMsg(
               msg.source(),
               msg.target(),
               null,
               CMMsg.MSG_OK_VISUAL,
               CMMsg.MSG_DAMAGE,
               CMMsg.NO_EFFECT,
               null);
       msg3.setValue(damage);
       msg.addTrailerMsg(msg3);
     }
   }
 }
コード例 #19
0
  public boolean tick(Tickable ticking, int tickID) {
    if (!super.tick(ticking, tickID)) return false;
    if (affected == null) return false;
    if (!(affected instanceof MOB)) return true;

    MOB mob = (MOB) affected;
    MOB diseaser = invoker;
    if (diseaser == null) diseaser = mob;
    if ((!mob.amDead()) && ((--diseaseTick) <= 0)) {
      diseaseTick = DISEASE_DELAY();
      mob.location().show(mob, null, CMMsg.MSG_NOISE, DISEASE_AFFECT());
      int damage = CMLib.dice().roll(2, diseaser.envStats().level() + 1, 1);
      if (CMLib.dice().rollPercentage() == 1) damage += CMLib.dice().roll(10, 10, 1);
      CMLib.combat()
          .postDamage(diseaser, mob, this, damage, CMMsg.MASK_ALWAYS | CMMsg.TYP_DISEASE, -1, null);
      catchIt(mob);
      return true;
    }
    return true;
  }
コード例 #20
0
  @Override
  public boolean tick(Tickable ticking, int tickID) {
    if (!(affected instanceof MOB)) return super.tick(ticking, tickID);

    if (!super.tick(ticking, tickID)) return false;
    if ((--plagueDown) <= 0) {
      final MOB mob = (MOB) affected;
      plagueDown = 10;
      if (invoker == null) invoker = mob;
      drawups += .1;
      if (drawups >= 3.1) {
        if ((mob.location() != null) && (CMLib.flags().isInTheGame(mob, false))) {
          mob.location().show(mob, null, CMMsg.MSG_OK_VISUAL, L("<S-YOU-POSS> feet rot off!"));
          final Ability A = CMClass.getAbility("Amputation");
          if (A != null) {
            int x = 100;
            while (((--x) > 0) && A.invoke(mob, CMParms.parse("foot"), mob, true, 0)) {
              /*do nothing */
            }
            mob.recoverCharStats();
            mob.recoverPhyStats();
            mob.recoverMaxState();
          }
          unInvoke();
        }
      } else {
        final MOB invoker = (invoker() != null) ? invoker() : mob;
        CMLib.combat()
            .postDamage(
                invoker,
                mob,
                this,
                1,
                CMMsg.TYP_DISEASE,
                -1,
                L(
                    "<T-NAME> feel(s) the fungus between <T-HIS-HER> toes eating <T-HIS-HER> feet away!"));
      }
    }
    return true;
  }
コード例 #21
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;
  }
コード例 #22
0
  public boolean okMessage(final Environmental myHost, final CMMsg msg) {
    if (!super.okMessage(myHost, msg)) return false;

    if (!(affected instanceof MOB)) return true;
    MOB mob = (MOB) affected;
    if ((msg.amITarget(mob)) && (msg.targetMinor() == CMMsg.TYP_DAMAGE)) {
      if ((msg.tool() == null) || (!msg.tool().ID().equals(ID()))) {
        int recovery = (int) Math.round(CMath.div((msg.value()), 2.0));
        msg.setValue(recovery);
        CMLib.combat()
            .postDamage(
                msg.source(),
                buddy,
                this,
                recovery,
                CMMsg.MASK_ALWAYS | CMMsg.TYP_JUSTICE,
                Weapon.TYPE_BURSTING,
                "<T-NAME> absorb(s) damage from the harm to " + msg.target().name() + ".");
      }
    }
    return true;
  }
コード例 #23
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
        && (target.phyStats().level()
            < ((mob.phyStats().level() + super.getXLEVELLevel(mob)) / 2))) {
      final CMMsg msg =
          CMClass.getMsg(
              mob,
              target,
              this,
              verbalCastCode(mob, target, auto) | CMMsg.MASK_MALICIOUS,
              L("^S<S-NAME> @x1 for <T-NAME> to die.^?", prayForWord(mob)));
      if (mob.location().okMessage(mob, msg)) {
        mob.location().send(mob, msg);
        CMLib.combat().postDeath(target, target, null);
        DeadBody body = null;
        for (Enumeration<Item> i = mob.location().items(); i.hasMoreElements(); ) {
          final Item I = i.nextElement();
          if ((I instanceof DeadBody) && (((DeadBody) I).getMobName().equals(target.Name())))
            body = (DeadBody) I;
        }
        if (body == null) mob.tell(L("The death did not appear to create a body!"));
        else beneficialAffect(mob, body, asLevel, 0);
      }
    } else
      return maliciousFizzle(
          mob,
          target,
          L("^S<S-NAME> @x1 <T-NAME> to die, but nothing happens.^?", prayForWord(mob)));
    // return whether it worked
    return success;
  }
コード例 #24
0
ファイル: Trap_Spark.java プロジェクト: kingdavid127/MUD
 @Override
 public void spring(MOB target) {
   if ((target != invoker()) && (target.location() != null)) {
     if ((!invoker().mayIFight(target))
         || (isLocalExempt(target))
         || (invoker().getGroupMembers(new HashSet<MOB>()).contains(target))
         || (target == invoker())
         || (doesSaveVsTraps(target)))
       target
           .location()
           .show(
               target,
               null,
               null,
               CMMsg.MASK_ALWAYS | CMMsg.MSG_NOISE,
               L("<S-NAME> avoid(s) setting off a sparking trap!"));
     else if (target
         .location()
         .show(
             target,
             target,
             this,
             CMMsg.MASK_ALWAYS | CMMsg.MSG_NOISE,
             L("<S-NAME> set(s) off an sparking trap!"))) {
       super.spring(target);
       CMLib.combat()
           .postDamage(
               invoker(),
               target,
               null,
               CMLib.dice().roll(trapLevel() + abilityCode(), 8, 1),
               CMMsg.MASK_ALWAYS | CMMsg.TYP_FIRE,
               Weapon.TYPE_BURNING,
               L("The sparks <DAMAGE> <T-NAME>!@x1", CMLib.protocol().msp("shock.wav", 30)));
       if ((canBeUninvoked()) && (affected instanceof Item)) disable();
     }
   }
 }
コード例 #25
0
ファイル: CoffeeUtensils.java プロジェクト: bbailey/ewok
 public void extinguish(MOB source, Environmental target, boolean mundane) {
   if (target instanceof Room) {
     Room R = (Room) target;
     for (int m = 0; m < R.numInhabitants(); m++) {
       MOB M = R.fetchInhabitant(m);
       if (M != null) extinguish(source, M, mundane);
     }
     for (int i = 0; i < R.numItems(); i++) {
       Item I = R.fetchItem(i);
       if (I != null) extinguish(source, I, mundane);
     }
     return;
   }
   for (int a = target.numEffects() - 1; a >= 0; a--) {
     Ability A = target.fetchEffect(a);
     if ((A != null)
         && ((!mundane)
             || ((A.classificationCode() & Ability.ALL_ACODES) == Ability.ACODE_PROPERTY))) {
       if ((CMath.bset(A.flags(), Ability.FLAG_HEATING) && (!mundane))
           || (CMath.bset(A.flags(), Ability.FLAG_FIREBASED))
           || ((A.ID().equalsIgnoreCase("Spell_SummonElemental")
               && A.text().toUpperCase().indexOf("FIRE") >= 0))) A.unInvoke();
     }
   }
   if ((target instanceof MOB) && (!mundane)) {
     MOB tmob = (MOB) target;
     if (tmob.charStats().getMyRace().ID().equals("FireElemental"))
       CMLib.combat().postDeath(source, (MOB) target, null);
     for (int i = 0; i < tmob.inventorySize(); i++) {
       Item I = tmob.fetchInventory(i);
       if (I != null) extinguish(tmob, I, mundane);
     }
   }
   if ((target instanceof Light) && (((Light) target).isLit())) {
     ((Light) target).tick(target, Tickable.TICKID_LIGHT_FLICKERS);
     ((Light) target).light(false);
   }
 }
コード例 #26
0
ファイル: Spell_AcidSpray.java プロジェクト: kingdavid127/MUD
 @Override
 public boolean tick(Tickable ticking, int tickID) {
   if ((tickID == Tickable.TICKID_MOB) && (affected instanceof MOB)) {
     final MOB vic = (MOB) affected;
     if ((!vic.amDead()) && (vic.location() != null)) {
       final MOB invoker = (invoker() != null) ? invoker() : vic;
       CMLib.combat()
           .postDamage(
               invoker,
               vic,
               this,
               CMLib.dice()
                   .roll(
                       1,
                       10 + super.getXLEVELLevel(invoker()) + (2 * super.getX1Level(invoker())),
                       0),
               CMMsg.MASK_ALWAYS | CMMsg.TYP_ACID,
               -1,
               L("<T-NAME> sizzle(s) from the acid!"));
     }
   }
   return super.tick(ticking, tickID);
 }
コード例 #27
0
  @Override
  public boolean okMessage(final Environmental myHost, final CMMsg msg) {
    if (!super.okMessage(myHost, msg)) return false;

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

    final MOB mob = (MOB) affected;
    if ((msg.amITarget(mob))
        && (msg.sourceMinor() == CMMsg.TYP_FIRE)
        && (msg.targetMinor() == CMMsg.TYP_DAMAGE)) {
      final int recovery = (int) Math.round(CMath.div((msg.value()), 2.0));
      mob.location()
          .show(
              mob,
              null,
              CMMsg.MSG_OK_VISUAL,
              L("The flame attack heals <S-NAME> @x1 points.", "" + recovery));
      CMLib.combat()
          .postHealing(mob, mob, this, recovery, CMMsg.MASK_ALWAYS | CMMsg.TYP_CAST_SPELL, null);
      return false;
    }
    return true;
  }
コード例 #28
0
ファイル: Trap_SpikePit.java プロジェクト: JEBailey/CoffeeMud
 public void finishSpringing(MOB target) {
   if ((!invoker().mayIFight(target)) || (target.phyStats().weight() < 5))
     target
         .location()
         .show(target, null, CMMsg.MSG_OK_ACTION, "<S-NAME> float(s) gently into the pit!");
   else {
     target.location().show(target, null, CMMsg.MSG_OK_ACTION, "<S-NAME> hit(s) the pit floor!");
     int damage = CMLib.dice().roll(trapLevel() + abilityCode(), 6, 1);
     if ((daggerDamages != null) && (daggerDamages.size() > 0)) {
       for (int i = 0; i < daggerDamages.size(); i++)
         damage += CMLib.dice().roll(1, ((Integer) daggerDamages.elementAt(i)).intValue(), 0);
     } else damage += CMLib.dice().roll(5, 4, 0);
     CMLib.combat()
         .postDamage(
             invoker(),
             target,
             this,
             damage,
             CMMsg.MASK_MALICIOUS | CMMsg.MASK_ALWAYS | CMMsg.TYP_JUSTICE,
             Weapon.TYPE_PIERCING,
             "Spikes on the pit floor <DAMAGE> <T-NAME>!");
   }
   CMLib.commands().postLook(target, true);
 }
コード例 #29
0
  public boolean invoke(MOB mob, Vector commands, Physical givenTarget, boolean auto, int asLevel) {
    MOB target = this.getTarget(mob, commands, givenTarget);
    if (target == null) return false;

    if ((target.baseCharStats().getMyRace() == null)
        || (!target.baseCharStats().getMyRace().racialCategory().equals("Undead"))) {
      mob.tell(auto ? "Only the undead can be turned." : "You can only turn the undead.");
      return false;
    }

    if (CMLib.flags().isEvil(mob)) {
      mob.tell("Only the riteous may turn the undead.");
      return false;
    }

    // the invoke method for spells receives as
    // parameters the invoker, and the REMAINING
    // command line parameters, divided into words,
    // and added as String objects to a vector.
    if (!super.invoke(mob, commands, givenTarget, auto, asLevel)) return false;

    boolean success =
        proficiencyCheck(
            mob,
            ((mob.phyStats().level() + (4 * getXLEVELLevel(mob))) - target.phyStats().level()) * 30,
            auto);

    if (success) {
      // it worked, so build a copy of this ability,
      // and add it to the affects list of the
      // affected MOB. Then tell everyone else
      // what happened.
      CMMsg msg =
          CMClass.getMsg(
              mob,
              target,
              this,
              CMMsg.MSG_CAST_ATTACK_SOMANTIC_SPELL | (auto ? CMMsg.MASK_ALWAYS : 0),
              auto ? "<T-NAME> turn(s) away." : "^S<S-NAME> turn(s) <T-NAMESELF>.^?");
      if (mob.location().okMessage(mob, msg)) {
        mob.location().send(mob, msg);
        if (msg.value() <= 0) {
          if ((mob.phyStats().level() - target.phyStats().level()) > 6) {
            mob.location()
                .show(
                    mob,
                    target,
                    CMMsg.MSG_OK_ACTION,
                    "<T-NAME> wither(s)" + (auto ? "." : " under <S-HIS-HER> holy power!"));
            CMLib.combat()
                .postDamage(
                    mob,
                    target,
                    this,
                    target.curState().getHitPoints(),
                    CMMsg.MASK_ALWAYS | CMMsg.TYP_CAST_SPELL,
                    -1,
                    null);
          } else {
            mob.location().show(target, null, CMMsg.MSG_OK_VISUAL, "<S-NAME> shake(s) in fear!");
            CMLib.commands().postFlee(target, "");
          }
          invoker = mob;
        }
      }
    } else
      return maliciousFizzle(mob, target, "<S-NAME> attempt(s) to turn <T-NAMESELF>, but fail(s).");

    // return whether it worked
    return success;
  }
コード例 #30
0
 @Override
 public boolean tick(Tickable ticking, int tickID) {
   if ((affected != null)
       && (affected instanceof Item)
       && (((Item) affected).owner() != null)
       && (((Item) affected).owner() instanceof Room)
       && (invoker() != null)
       && (invoker().location().isContent((Item) affected))) {
     if (invoker().isInCombat()) {
       final boolean isHit =
           (CMLib.combat()
               .rollToHit(
                   CMLib.combat().adjustedAttackBonus(invoker(), invoker().getVictim())
                       + ((Item) affected).phyStats().attackAdjustment(),
                   CMLib.combat().adjustedArmor(invoker().getVictim()),
                   0));
       if ((!isHit) || (!(affected instanceof Weapon)))
         invoker()
             .location()
             .show(
                 invoker(),
                 invoker().getVictim(),
                 affected,
                 CMMsg.MSG_OK_ACTION,
                 L("<O-NAME> attacks <T-NAME> and misses!"));
       else
         CMLib.combat()
             .postDamage(
                 invoker(),
                 invoker().getVictim(),
                 affected,
                 CMLib.dice().roll(1, affected.phyStats().damage(), 5),
                 CMMsg.MASK_ALWAYS | CMMsg.TYP_WEAPONATTACK,
                 ((Weapon) affected).weaponType(),
                 L("@x1 attacks and <DAMAGE> <T-NAME>!", affected.name()));
     } else if (CMLib.dice().rollPercentage() > 75)
       switch (CMLib.dice().roll(1, 5, 0)) {
         case 1:
           invoker()
               .location()
               .showHappens(CMMsg.MSG_OK_VISUAL, L("@x1 twiches a bit.", affected.name()));
           break;
         case 2:
           invoker()
               .location()
               .showHappens(
                   CMMsg.MSG_OK_VISUAL, L("@x1 is looking for trouble.", affected.name()));
           break;
         case 3:
           invoker()
               .location()
               .showHappens(CMMsg.MSG_OK_VISUAL, L("@x1 practices its moves.", affected.name()));
           break;
         case 4:
           invoker()
               .location()
               .showHappens(
                   CMMsg.MSG_OK_VISUAL, L("@x1 makes a few fake attacks.", affected.name()));
           break;
         case 5:
           invoker()
               .location()
               .showHappens(CMMsg.MSG_OK_VISUAL, L("@x1 dances around.", affected.name()));
           break;
       }
   } else unInvoke();
   return super.tick(ticking, tickID);
 }