Example #1
0
 @Override
 public void spring(MOB target) {
   if ((target != invoker()) && (target.location() != null)) {
     if ((doesSaveVsTraps(target))
         || (invoker().getGroupMembers(new HashSet<MOB>()).contains(target)))
       target
           .location()
           .show(
               target,
               null,
               null,
               CMMsg.MASK_ALWAYS | CMMsg.MSG_NOISE,
               L("<S-NAME> avoid(s) setting off a gas trap!"));
     else if (target
         .location()
         .show(
             target,
             target,
             this,
             CMMsg.MASK_ALWAYS | CMMsg.MSG_NOISE,
             L("<S-NAME> set(s) off a trap! The room fills with gas!"))) {
       super.spring(target);
       Ability A = CMClass.getAbility(text());
       if (A == null) A = CMClass.getAbility("Poison");
       for (int i = 0; i < target.location().numInhabitants(); i++) {
         final MOB M = target.location().fetchInhabitant(i);
         if ((M != null) && (M != invoker()) && (A != null))
           if (invoker().mayIFight(M)) A.invoke(invoker(), M, true, 0);
       }
       if ((canBeUninvoked()) && (affected instanceof Item)) disable();
     }
   }
 }
Example #2
0
 @Override
 public Trap setTrap(MOB mob, Physical P, int trapBonus, int qualifyingClassLevel, boolean perm) {
   if (P == null) return null;
   if (mob != null) {
     final Item I = findMostOfMaterial(mob.location(), RawMaterial.MATERIAL_METAL);
     if (I != null) super.destroyResources(mob.location(), I.material(), 10);
   }
   return super.setTrap(mob, P, trapBonus, qualifyingClassLevel, perm);
 }
Example #3
0
 @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();
     }
   }
 }