コード例 #1
0
ファイル: Spell_Shrink.java プロジェクト: JEBailey/CoffeeMud
 public void unInvoke() {
   // undo the affects of this spell
   MOB recheckMOB = null;
   if ((canBeUninvoked()) && (affected != null)) {
     if (affected instanceof MOB) {
       MOB mob = (MOB) affected;
       if ((mob.location() != null) && (!mob.amDead()))
         mob.location()
             .show(
                 mob, null, CMMsg.MSG_OK_VISUAL, "<S-NAME> return(s) to <S-HIS-HER> normal size.");
       recheckMOB = mob;
     } else if (affected instanceof Item) {
       Item item = (Item) affected;
       if (item.owner() != null) {
         if (item.owner() instanceof Room)
           ((Room) item.owner())
               .showHappens(CMMsg.MSG_OK_VISUAL, item.name() + " returns to its proper size.");
         else if (item.owner() instanceof MOB) {
           ((MOB) item.owner()).tell(item.name() + " returns to its proper size.");
           recheckMOB = (MOB) item.owner();
         }
       }
     }
   }
   super.unInvoke();
   if (recheckMOB != null) CMLib.utensils().confirmWearability(recheckMOB);
 }
コード例 #2
0
  @Override
  public boolean invoke(MOB mob, Vector commands, Physical givenTarget, boolean auto, int asLevel) {
    final Item I =
        getTarget(mob, mob.location(), givenTarget, commands, Wearable.FILTER_UNWORNONLY);
    if (I == null) return false;
    if (((I.material() & RawMaterial.MATERIAL_MASK) != RawMaterial.MATERIAL_VEGETATION)
        && ((I.material() & RawMaterial.MATERIAL_MASK) != RawMaterial.MATERIAL_WOODEN)) {
      mob.tell(L("Your plant knowledge can tell you nothing about @x1.", I.name(mob)));
      return false;
    }

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

    if (!success) mob.tell(L("Your plant senses fail you."));
    else {
      final CMMsg msg =
          CMClass.getMsg(mob, I, null, CMMsg.MSG_DELICATE_SMALL_HANDS_ACT | CMMsg.MASK_MAGIC, null);
      if (mob.location().okMessage(mob, msg)) {
        mob.location().send(mob, msg);
        final StringBuffer str = new StringBuffer("");
        str.append(
            L(
                "@x1 is a kind of @x2.  ",
                I.name(mob),
                RawMaterial.CODES.NAME(I.material()).toLowerCase()));
        if (isPlant(I)) str.append(L("It was summoned by @x1.", I.rawSecretIdentity()));
        else str.append(L("It is either processed by hand, or grown wild."));
        mob.tell(str.toString());
      }
    }
    return success;
  }
コード例 #3
0
  public boolean invoke(
      MOB mob, Vector commands, Environmental givenTarget, boolean auto, int asLevel) {
    if (!super.invoke(mob, commands, givenTarget, auto, asLevel)) return false;

    HashSet h = properTargets(mob, givenTarget, auto);
    if (h == null) return false;

    boolean success = proficiencyCheck(mob, 0, auto);
    boolean nothingDone = true;
    if (success) {
      for (Iterator e = h.iterator(); e.hasNext(); ) {
        MOB target = (MOB) e.next();
        // 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,
                verbalCastCode(mob, target, auto) | CMMsg.MASK_MALICIOUS,
                auto
                    ? ""
                    : "^S<S-NAME> "
                        + prayForWord(mob)
                        + " an unholy paralysis upon <T-NAMESELF>.^?");
        CMMsg msg2 =
            CMClass.getMsg(
                mob,
                target,
                this,
                CMMsg.MASK_MALICIOUS | CMMsg.TYP_PARALYZE | (auto ? CMMsg.MASK_ALWAYS : 0),
                null);
        if ((target != mob)
            && (mob.location().okMessage(mob, msg))
            && (mob.location().okMessage(mob, msg2))) {
          int levelDiff =
              target.envStats().level()
                  - (mob.envStats().level() + (2 * super.getXLEVELLevel(mob)));
          if (levelDiff < 0) levelDiff = 0;
          if (levelDiff > 6) levelDiff = 6;
          mob.location().send(mob, msg);
          mob.location().send(mob, msg2);
          if ((msg.value() <= 0) && (msg2.value() <= 0)) {
            success = maliciousAffect(mob, target, asLevel, 8 - levelDiff, -1);
            mob.location().show(target, null, CMMsg.MSG_OK_VISUAL, "<S-NAME> can't move!");
          }
          nothingDone = false;
        }
      }
    }

    if (nothingDone)
      return maliciousFizzle(
          mob, null, "<S-NAME> attempt(s) to paralyze everyone, but flub(s) it.");

    // return whether it worked
    return success;
  }
コード例 #4
0
ファイル: Gaian.java プロジェクト: bbailey/ewok
 public void affectCharState(MOB affected, CharState affectableState) {
   super.affectCharState(affected, affectableState);
   if (affected.location() != null) {
     Room room = affected.location();
     if (affected.charStats().getClassLevel(this) >= 5) {
       if (CMLib.flags().isInDark(room)) {
         affectableState.setMana(affectableState.getMana() - (affectableState.getMana() / 4));
         affectableState.setMovement(
             affectableState.getMovement() - (affectableState.getMovement() / 4));
       } else if ((room.domainType() & Room.INDOORS) == 0)
         switch (room.getArea().getClimateObj().weatherType(room)) {
           case Climate.WEATHER_BLIZZARD:
           case Climate.WEATHER_CLOUDY:
           case Climate.WEATHER_DUSTSTORM:
           case Climate.WEATHER_HAIL:
           case Climate.WEATHER_RAIN:
           case Climate.WEATHER_SLEET:
           case Climate.WEATHER_SNOW:
           case Climate.WEATHER_THUNDERSTORM:
             break;
           default:
             affectableState.setMana(affectableState.getMana() + (affectableState.getMana() / 4));
             affectableState.setMovement(
                 affectableState.getMovement() + (affectableState.getMovement() / 4));
             break;
         }
     }
   }
 }
コード例 #5
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,
              verbalCastCode(mob, target, auto),
              auto ? "" : L("^S<S-NAME> chant(s) to <T-NAMESELF>.^?"));
      if (mob.location().okMessage(mob, msg)) {
        mob.location().send(mob, msg);
        mob.location()
            .show(target, null, CMMsg.MSG_OK_VISUAL, L("<S-NAME> seem(s) strangely fertile!"));
        beneficialAffect(mob, target, asLevel, Ability.TICKS_ALMOST_FOREVER);
      }
    } else
      return beneficialWordsFizzle(
          mob, target, L("<S-NAME> chant(s) to <T-NAMESELF>, but the magic fades."));

    // return whether it worked
    return success;
  }
コード例 #6
0
ファイル: IMC2.java プロジェクト: renokun/CoffeeMud
  @Override
  public boolean execute(MOB mob, Vector commands, int metaFlags) throws java.io.IOException {
    if (!(CMLib.intermud().imc2online())) {
      mob.tell(L("IMC2 is unavailable."));
      return false;
    }
    commands.remove(0);
    if (commands.size() < 1) {
      IMC2Error(mob);
      return false;
    }
    final String str = (String) commands.get(0);
    if (!(CMLib.intermud().imc2online())) mob.tell(L("IMC2 is unavailable."));
    else if (str.equalsIgnoreCase("list")) CMLib.intermud().giveIMC2MudList(mob);
    else if (str.equalsIgnoreCase("locate"))
      CMLib.intermud().i3locate(mob, CMParms.combine(commands, 1));
    else if (str.equalsIgnoreCase("channels")
        && CMSecurity.isAllowed(mob, mob.location(), CMSecurity.SecFlag.IMC2))
      CMLib.intermud().giveIMC2ChannelsList(mob);
    else if (str.equalsIgnoreCase("info"))
      CMLib.intermud().imc2mudInfo(mob, CMParms.combine(commands, 1));
    else if (str.equalsIgnoreCase("restart")
        && CMSecurity.isAllowed(mob, mob.location(), CMSecurity.SecFlag.IMC2)) {
      try {
        mob.tell(CMLib.hosts().get(0).executeCommand("START IMC2"));
      } catch (final Exception e) {
        Log.errOut("IMC2Cmd", e);
      }
    } else IMC2Error(mob);

    return false;
  }
コード例 #7
0
  @Override
  public boolean okMessage(final Environmental myHost, final CMMsg msg) {
    if (!super.okMessage(myHost, msg)) return false;

    final MOB mob = msg.source();
    if (mob.location() == null) return true;

    if (msg.amITarget(this))
      switch (msg.targetMinor()) {
        case CMMsg.TYP_HOLD:
        case CMMsg.TYP_WEAR:
        case CMMsg.TYP_WIELD:
        case CMMsg.TYP_GET:
          if ((!msg.source().charStats().getCurrentClass().ID().equals("Paladin"))
              || (!CMLib.flags().isGood(msg.source()))) {
            unWear();
            mob.location()
                .show(
                    mob,
                    null,
                    CMMsg.MSG_OK_ACTION,
                    L("@x1 flashes and flies out of <S-HIS-HER> hands!", name()));
            if (msg.source().isMine(this))
              CMLib.commands().postDrop(msg.source(), this, true, false, false);
            return false;
          }
          break;
        default:
          break;
      }
    return true;
  }
コード例 #8
0
  @Override
  public boolean invoke(
      MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) {
    MOB target = mob;
    if ((auto) && (givenTarget != null) && (givenTarget instanceof MOB)) target = (MOB) givenTarget;
    if (target.fetchEffect(this.ID()) != null) {
      mob.tell(target, null, null, L("<S-NAME> <S-IS-ARE> already observing."));
      return false;
    }

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

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

    final CMMsg msg =
        CMClass.getMsg(
            mob,
            target,
            this,
            auto ? CMMsg.MSG_OK_ACTION : (CMMsg.MSG_DELICATE_HANDS_ACT | CMMsg.MASK_EYES),
            auto
                ? L("<T-NAME> become(s) observant.")
                : L(
                    "<S-NAME> open(s) <S-HIS-HER> eyes and observe(s) <S-HIS-HER> surroundings carefully."));
    if (!success)
      return beneficialVisualFizzle(
          mob, null, L("<S-NAME> look(s) around carefully, but become(s) distracted."));
    else if (mob.location().okMessage(mob, msg)) {
      mob.location().send(mob, msg);
      beneficialAffect(mob, target, asLevel, 0);
    }
    return success;
  }
コード例 #9
0
  public boolean invoke(MOB mob, Vector commands, Physical givenTarget, boolean auto, int asLevel) {
    MOB target = mob;
    if ((auto) && (givenTarget != null) && (givenTarget instanceof MOB)) target = (MOB) givenTarget;
    if (target.fetchEffect(this.ID()) != null) {
      mob.tell(target, null, null, "<S-NAME> <S-IS-ARE> detecting undead things.");
      return false;
    }
    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,
              verbalCastCode(mob, target, auto),
              auto
                  ? "<T-NAME> gain(s) dark cold senses!"
                  : "^S<S-NAME> incant(s) softly, and gain(s) dark cold senses!^?");
      if (mob.location().okMessage(mob, msg)) {
        mob.location().send(mob, msg);
        beneficialAffect(mob, target, asLevel, 0);
      }
    } else
      beneficialVisualFizzle(
          mob,
          null,
          "<S-NAME> incant(s) and open(s) <S-HIS-HER> cold eyes, but the spell fizzles.");

    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) {
      final CMMsg msg =
          CMClass.getMsg(
              mob,
              target,
              this,
              verbalCastCode(mob, target, auto),
              auto ? "" : L("^S<S-NAME> whistle(s) to <T-NAMESELF>.^?"));
      if (mob.location().okMessage(mob, msg)) {
        mob.location().send(mob, msg);
        mob.location()
            .show(target, null, CMMsg.MSG_OK_VISUAL, L("<S-NAME> attain(s) an aquatic aura!"));
        beneficialAffect(mob, target, asLevel, 0);
      }
    } else
      beneficialWordsFizzle(
          mob, target, L("<S-NAME> whistle(s) to <T-NAMESELF>, but nothing happens."));

    return success;
  }
コード例 #11
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;
  }
コード例 #12
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 false;
    final MOB mob = (MOB) affected;
    if (mob.location().numInhabitants() == 1) return true;
    final Vector choices = new Vector();
    for (final Enumeration<Ability> a = mob.effects(); a.hasMoreElements(); ) {
      final Ability A = a.nextElement();
      if ((A != null)
          && (A.canBeUninvoked())
          && (!A.ID().equals(ID()))
          && (A.abstractQuality() == Ability.QUALITY_MALICIOUS)
          && (((A.classificationCode() & Ability.ALL_ACODES) == Ability.ACODE_SPELL)
              || ((A.classificationCode() & Ability.ALL_ACODES) == Ability.ACODE_PRAYER))
          && (!A.isAutoInvoked())) choices.addElement(A);
    }
    if (choices.size() == 0) return true;
    final MOB target = mob.location().fetchRandomInhabitant();
    final Ability thisOne = (Ability) choices.elementAt(CMLib.dice().roll(1, choices.size(), -1));
    if ((target == null) || (thisOne == null) || (target.fetchEffect(ID()) != null)) return true;
    if (CMLib.dice().rollPercentage() > (target.charStats().getSave(CharStats.STAT_SAVE_DISEASE))) {
      ((Ability) this.copyOf()).invoke(target, target, true, 0);
      if (target.fetchEffect(ID()) != null)
        ((Ability) thisOne.copyOf()).invoke(target, target, true, 0);
    } else spreadImmunity(target);
    return true;
  }
コード例 #13
0
  public boolean invoke(
      MOB mob, Vector commands, Environmental givenTarget, boolean auto, int asLevel) {
    MOB target = getTarget(mob, commands, givenTarget);
    if (target == null) return false;

    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,
              verbalCastCode(mob, target, auto),
              auto
                  ? "<T-NAME> feel(s) magically protected."
                  : "^S<S-NAME> invoke(s) an absorbing barrier of protection around <T-NAMESELF>.^?");
      if (mob.location().okMessage(mob, msg)) {
        mob.location().send(mob, msg);
        beneficialAffect(mob, target, asLevel, 0);
      }
    } else
      beneficialWordsFizzle(
          mob, target, "<S-NAME> attempt(s) to invoke an absorbing barrier, but fail(s).");

    return success;
  }
コード例 #14
0
ファイル: WeakParalysis.java プロジェクト: JEBailey/CoffeeMud
  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 (!super.invoke(mob, commands, givenTarget, auto, asLevel)) return false;

    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.
      CMMsg msg =
          CMClass.getMsg(
              mob,
              target,
              this,
              CMMsg.MSK_MALICIOUS_MOVE | CMMsg.TYP_PARALYZE | (auto ? CMMsg.MASK_ALWAYS : 0),
              auto ? "" : "^S<S-NAME> paralyze(s) <T-NAMESELF>.^?");
      if (target.location().okMessage(target, msg)) {
        target.location().send(target, msg);
        if (msg.value() <= 0) {
          success = maliciousAffect(mob, target, asLevel, 5, -1);
          mob.location().show(target, null, CMMsg.MSG_OK_VISUAL, "<S-NAME> can't move!");
        }
      }
    } else
      return maliciousFizzle(
          mob, target, "<S-NAME> attempt(s) to paralyze <T-NAMESELF>, but fail(s)!");

    // return whether it worked
    return success;
  }
コード例 #15
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;
  }
コード例 #16
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;
  }
コード例 #17
0
  public boolean okMessage(Environmental myHost, CMMsg msg) {
    if (!super.okMessage(myHost, msg)) return false;

    if (msg.targetMinor() == CMMsg.TYP_ENTER) {
      if (msg.target() == this) {
        MOB mob = msg.source();
        if ((mob.location() != null) && (mob.location().roomID().length() > 0)) {
          int direction = -1;
          for (int d = Directions.NUM_DIRECTIONS() - 1; d >= 0; d--) {
            if (mob.location().getRoomInDir(d) == this) direction = d;
          }
          if (direction < 0) {
            mob.tell("Some great evil is preventing your movement that way.");
            return false;
          }
          msg.modify(
              msg.source(),
              getAltRoomFrom(mob.location(), direction),
              msg.tool(),
              msg.sourceCode(),
              msg.sourceMessage(),
              msg.targetCode(),
              msg.targetMessage(),
              msg.othersCode(),
              msg.othersMessage());
        }
      }
    }
    return true;
  }
コード例 #18
0
ファイル: Bomb_Pepper.java プロジェクト: renokun/CoffeeMud
 @Override
 public void spring(MOB target) {
   if (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) the water bomb!"));
     else if (target
         .location()
         .show(
             invoker(),
             target,
             this,
             CMMsg.MASK_ALWAYS | CMMsg.MSG_NOISE,
             L("@x1 explodes water all over <T-NAME>!", affected.name()))) {
       super.spring(target);
       final Ability A = CMClass.getAbility("Spell_Irritation");
       if (A != null) A.invoke(target, target, true, invoker().phyStats().level() + abilityCode());
     }
   }
 }
コード例 #19
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;

    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) at <T-NAMESELF>.^?"));
      if (mob.location().okMessage(mob, msg)) {
        mob.location().send(mob, msg);
        if (msg.value() <= 0) {
          mob.location().show(target, null, CMMsg.MSG_OK_VISUAL, L("<S-NAME> get(s) sick!"));
          success = maliciousAffect(mob, target, asLevel, 0, -1) != null;
        }
      }
    } else
      return maliciousFizzle(
          mob, target, L("<S-NAME> incant(s) at <T-NAMESELF>, but the spell fizzles."));

    // return whether it worked
    return success;
  }
コード例 #20
0
ファイル: Bomb_Smoke.java プロジェクト: JEBailey/CoffeeMud
 public void spring(MOB target) {
   if (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,
               "<S-NAME> avoid(s) the smoke bomb!");
     else if (target
         .location()
         .show(
             invoker(),
             target,
             this,
             CMMsg.MASK_ALWAYS | CMMsg.MSG_NOISE,
             affected.name() + " explodes smoke into <T-YOUPOSS> eyes!")) {
       super.spring(target);
       Ability A = CMClass.getAbility("Spell_Blindness");
       if (A != null) A.invoke(target, target, true, 0);
     }
   }
 }
コード例 #21
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) {

      final CMMsg msg =
          CMClass.getMsg(
              mob,
              target,
              this,
              verbalCastCode(mob, target, auto),
              auto
                  ? L("An anti-plant shell surrounds <T-NAME>!")
                  : L("^S<S-NAME> cast(s) the anti-plant shell around <T-NAMESELF>!^?"));
      if (mob.location().okMessage(mob, msg)) {
        mob.location().send(mob, msg);
        beneficialAffect(mob, target, asLevel, 0);
      }
    } else
      return beneficialWordsFizzle(
          mob, target, L("<S-NAME> cast(s) a shell at <T-NAMESELF>, but the magic fizzles."));

    // return whether it worked
    return success;
  }
コード例 #22
0
ファイル: Fighter_Shrug.java プロジェクト: renokun/CoffeeMud
  @Override
  public boolean invoke(MOB mob, Vector commands, Physical givenTarget, boolean auto, int asLevel) {
    if ((!auto) && (!mob.isInCombat())) {
      mob.tell(L("You must be in combat first!"));
      return false;
    }

    MOB target = mob;
    if ((auto) && (givenTarget != null) && (givenTarget instanceof MOB)) target = (MOB) givenTarget;

    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,
              CMMsg.MSG_QUIETMOVEMENT,
              auto
                  ? L("<T-NAME> is braced for an attack!")
                  : L("<S-NAME> brace(s) for an attack!"));
      if (mob.location().okMessage(mob, msg)) {
        mob.location().send(mob, msg);
        beneficialAffect(mob, target, asLevel, 0);
      }
    } else
      return beneficialVisualFizzle(
          mob, null, L("<S-NAME> attempt(s) to brace <S-HIM-HERSELF>, but get(s) distracted."));

    // return whether it worked
    return success;
  }
コード例 #23
0
ファイル: Trap_PoisonGas.java プロジェクト: kingdavid127/MUD
 @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();
     }
   }
 }
コード例 #24
0
 @Override
 public boolean tick(Tickable ticking, int tickID) {
   if (!super.tick(ticking, tickID)) return false;
   if ((tickID == Tickable.TICKID_MOB) && (invoker() != null) && (affected instanceof MOB)) {
     final MOB mob = (MOB) affected;
     final Set<MOB> invokerGroup = invoker().getGroupMembers(new HashSet<MOB>());
     if (mob != invoker()) {
       if (mob.location() != invoker().location()) unInvoke();
       else {
         if (invokerGroup.contains(mob)) unInvoke();
         else if (mob.isInCombat()) {
           int levels = invoker().charStats().getClassLevel("Templar");
           if (levels < 0) levels = invoker().phyStats().level();
           if (CMLib.dice().rollPercentage() >= levels) {
             final MOB newvictim = mob.location().fetchRandomInhabitant();
             if (newvictim != mob) mob.setVictim(newvictim);
           }
         }
       }
     } else if ((mob.location() != null) && (CMLib.flags().isEvil(invoker()))) {
       for (int m = 0; m < mob.location().numInhabitants(); m++) {
         final MOB M = mob.location().fetchInhabitant(m);
         if ((M != null)
             && (M != invoker())
             && (!invokerGroup.contains(M))
             && (!M.Name().equals(mob.getLiegeID())))
           beneficialAffect(invoker, M, 0, Ability.TICKS_FOREVER);
       }
     }
   }
   return true;
 }
コード例 #25
0
  @Override
  public boolean invoke(
      MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) {
    MOB target = null;
    Ability reAffect = null;
    if (mob.isInCombat()) {
      if (mob.rangeToTarget() > 0) {
        mob.tell(L("You are too far away to touch!"));
        return false;
      }
      final MOB victim = mob.getVictim();
      reAffect = victim.fetchEffect("Undead_WeakEnergyDrain");
      if (reAffect == null) reAffect = victim.fetchEffect("Undead_EnergyDrain");
      if (reAffect != null) target = victim;
    }
    if (target == null) target = this.getTarget(mob, commands, givenTarget);
    if (target == null) return false;

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

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

    String str = null;
    if (success) {
      str = auto ? "" : L("^S<S-NAME> extend(s) an energy draining hand to <T-NAMESELF>!^?");
      final CMMsg msg =
          CMClass.getMsg(
              mob,
              target,
              this,
              CMMsg.MSK_MALICIOUS_MOVE | CMMsg.TYP_UNDEAD | (auto ? CMMsg.MASK_ALWAYS : 0),
              str);
      if (mob.location().okMessage(mob, msg)) {
        mob.location().send(mob, msg);
        if (msg.value() <= 0) {
          mob.location().show(target, null, CMMsg.MSG_OK_VISUAL, L("<S-NAME> <S-IS-ARE> drained!"));
          if (reAffect != null) {
            if (reAffect instanceof Undead_EnergyDrain)
              ((Undead_EnergyDrain) reAffect).levelsDown++;
            ((StdAbility) reAffect)
                .setTickDownRemaining(
                    ((StdAbility) reAffect).getTickDownRemaining() + mob.phyStats().level());
            mob.recoverPhyStats();
            mob.recoverCharStats();
            mob.recoverMaxState();
          } else {
            direction = 1;
            if (target.charStats().getMyRace().racialCategory().equalsIgnoreCase("Undead"))
              direction = -1;
            success = maliciousAffect(mob, target, asLevel, 0, -1) != null;
          }
        }
      }
    } else
      return maliciousFizzle(
          mob, target, L("<S-NAME> attempt(s) to drain <T-NAMESELF>, but fail(s)."));

    return success;
  }
コード例 #26
0
ファイル: Down.java プロジェクト: bozimmerman/CoffeeMud
 @Override
 public boolean securityCheck(MOB mob) {
   return (mob == null)
       || (mob.isMonster())
       || (mob.location() == null)
       || ((!(mob.location() instanceof BoardableShip))
           && (!(mob.location().getArea() instanceof BoardableShip)));
 }
コード例 #27
0
  @Override
  public boolean invoke(
      MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) {
    if (commands.size() < 1) {
      mob.tell(
          L(
              "You must specify an item to fence, and possibly a ShopKeeper (unless it is implied)."));
      return false;
    }

    commands.add(0, "SELL"); // will be instantly deleted by parseshopkeeper
    final Environmental shopkeeper =
        CMLib.english().parseShopkeeper(mob, commands, L("Fence what to whom?"));
    if (shopkeeper == null) return false;
    if (commands.size() == 0) {
      mob.tell(L("Fence what?"));
      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,
              shopkeeper,
              this,
              CMMsg.MSG_SPEAK,
              auto ? "" : L("<S-NAME> fence(s) stolen loot to <T-NAMESELF>."));
      if (mob.location().okMessage(mob, msg)) {
        mob.location().send(mob, msg);
        invoker = mob;
        addBackMap.clear();
        mob.addEffect(this);
        mob.recoverCharStats();
        commands.add(0, CMStrings.capitalizeAndLower("SELL"));
        mob.doCommand(commands, MUDCmdProcessor.METAFLAG_FORCED);
        commands.add(shopkeeper.name());
        mob.delEffect(this);
        for (Item I : addBackMap.keySet()) {
          if (mob.isMine(I)) {
            I.addEffect(addBackMap.get(I));
          }
        }
        addBackMap.clear();
        mob.recoverCharStats();
      }
    } else
      beneficialWordsFizzle(
          mob,
          shopkeeper,
          L(
              "<S-NAME> attempt(s) to fence stolen loot to <T-NAMESELF>, but make(s) <T-HIM-HER> too nervous."));

    // return whether it worked
    return success;
  }
コード例 #28
0
  public boolean invoke(MOB mob, Vector commands, Physical givenTarget, boolean auto, int asLevel) {

    if (commands.size() < 1) {
      mob.tell("Grow plants where?");
      return false;
    }

    String areaName = CMParms.combine(commands, 0).trim().toUpperCase();
    Room anyRoom = null;
    Room newRoom = null;
    try {
      List<Room> rooms = CMLib.map().findRooms(CMLib.map().rooms(), mob, areaName, true, 10);
      for (Room R : rooms) {
        anyRoom = R;
        if (R.domainType() == Room.DOMAIN_INDOORS_CAVE) {
          newRoom = R;
          break;
        }
      }
    } catch (NoSuchElementException e) {
    }

    if (newRoom == null) {
      if (anyRoom == null)
        mob.tell("You don't know of a place called '" + CMParms.combine(commands, 0) + "'.");
      else if ((anyRoom.domainType() & Room.INDOORS) == 0)
        mob.tell("There IS such a place, but it is outdoors, where your fungus will not grow.");
      else if ((anyRoom.domainType() == Room.DOMAIN_INDOORS_UNDERWATER)
          || (anyRoom.domainType() == Room.DOMAIN_INDOORS_WATERSURFACE))
        mob.tell("There IS such a place, but it is on or in the water, so your magic would fail.");
      else mob.tell("There IS such a place, but it is not in a cave, so your magic would fail.");
      return false;
    }

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

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

    if (success) {
      CMMsg msg =
          CMClass.getMsg(
              mob,
              null,
              this,
              verbalCastCode(mob, null, auto),
              "^S<S-NAME> chant(s) about a far away place.^?");
      if (mob.location().okMessage(mob, msg)) {
        mob.location().send(mob, msg);
        Item newItem = Chant_SummonFungus.buildFungus(mob, newRoom);
        mob.tell("You feel a distant connection with " + newItem.name());
      }
    } else
      beneficialWordsFizzle(
          mob, null, "<S-NAME> chant(s) about a far away place, but the magic fades.");

    // return whether it worked
    return success;
  }
コード例 #29
0
  @Override
  public boolean invoke(MOB mob, Vector commands, Physical givenTarget, boolean auto, int asLevel) {
    Item target = null;
    if ((commands.size() == 0) && (!auto) && (givenTarget == null))
      target = Prayer_Sacrifice.getBody(mob.location());
    if (target == null)
      target = getTarget(mob, mob.location(), givenTarget, commands, Wearable.FILTER_UNWORNONLY);
    if (target == null) return false;

    if ((!(target instanceof DeadBody))
        || (target.rawSecretIdentity().toUpperCase().indexOf("FAKE") >= 0)) {
      mob.tell(L("You may only desecrate the dead."));
      return false;
    }
    if ((((DeadBody) target).isPlayerCorpse())
        && (!((DeadBody) target).getMobName().equals(mob.Name()))
        && (((DeadBody) target).hasContent())) {
      mob.tell(L("You are not allowed to desecrate a players corpse."));
      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> feel(s) desecrated!")
                  : L("^S<S-NAME> desecrate(s) <T-NAMESELF> before @x1.^?", hisHerDiety(mob)));
      if (mob.location().okMessage(mob, msg)) {
        mob.location().send(mob, msg);
        if (CMLib.flags().isEvil(mob)) {
          double exp = 5.0;
          final int levelLimit = CMProps.getIntVar(CMProps.Int.EXPRATE);
          final int levelDiff = (mob.phyStats().level()) - target.phyStats().level();
          if (levelDiff > levelLimit) exp = 0.0;
          if (exp > 0.0)
            CMLib.leveler()
                .postExperience(
                    mob, null, null, (int) Math.round(exp) + super.getXPCOSTLevel(mob), false);
        }
        target.destroy();
        mob.location().recoverRoomStats();
      }
    } else
      beneficialWordsFizzle(
          mob, target, L("<S-NAME> attempt(s) to desecrate <T-NAMESELF>, but fail(s)."));

    // return whether it worked
    return success;
  }
コード例 #30
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 (mob.fetchEffect(ID()) != null) {
      mob.tell("Your health is already linked with someones!");
      return false;
    }
    if (target.fetchEffect(ID()) != null) {
      mob.tell(target.name(mob) + "'s health is already linked with someones!");
      return false;
    }

    if (!mob.getGroupMembers(new HashSet<MOB>()).contains(target)) {
      mob.tell(target.name(mob) + " is not in your group.");
      return false;
    }

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

    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.
      CMMsg msg =
          CMClass.getMsg(
              mob,
              target,
              this,
              verbalCastCode(mob, target, auto),
              auto
                  ? ""
                  : "^S<S-NAME> "
                      + prayWord(mob)
                      + " that <S-HIS-HER> health be linked with <T-NAME>.^?");
      if (mob.location().okMessage(mob, msg)) {
        mob.location().send(mob, msg);
        mob.location()
            .show(mob, target, CMMsg.MSG_OK_VISUAL, "<S-NAME> and <T-NAME> are linked in health.");
        buddy = mob;
        beneficialAffect(mob, target, asLevel, 0);
        buddy = target;
        beneficialAffect(mob, mob, asLevel, 0);
      }
    } else
      return beneficialWordsFizzle(
          mob,
          target,
          "<S-NAME> "
              + prayWord(mob)
              + " for a link with <T-NAME>, but <S-HIS-HER> plea is not answered.");

    // return whether it worked
    return success;
  }