Esempio n. 1
0
  public boolean invoke(MOB mob, Vector commands, Physical givenTarget, boolean auto, int asLevel) {
    Set<MOB> h = properTargets(mob, givenTarget, false);
    if (h == null) {
      mob.tell("There doesn't appear to be anyone here worth floating.");
      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, 0, auto);

    if (success) {
      if (mob.location()
          .show(
              mob,
              null,
              this,
              verbalCastCode(mob, null, auto),
              auto ? "" : "^S<S-NAME> wave(s) <S-HIS-HER> arms and speak(s) lightly.^?"))
        for (Iterator f = h.iterator(); f.hasNext(); ) {
          MOB target = (MOB) f.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), null);
          if (mob.location().okMessage(mob, msg)) {
            mob.location().send(mob, msg);
            Spell_FeatherFall fall = new Spell_FeatherFall();
            fall.setProficiency(proficiency());
            fall.beneficialAffect(mob, target, asLevel, 0);
          }
        }
    } else
      return beneficialWordsFizzle(
          mob,
          null,
          "<S-NAME> wave(s) <S-HIS-HER> arms and speak(s) lightly, but the spell fizzles.");

    // return whether it worked
    return success;
  }
Esempio n. 2
0
  public boolean invoke(MOB mob, Vector commands, Physical givenTarget, boolean auto, int asLevel) {
    if (mob.fetchEffect("Thief_Hide") != null) {
      mob.tell("You are already hiding.");
      return false;
    }

    if (mob.isInCombat()) {
      mob.tell("Not while in combat!");
      return false;
    }

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

    Set<MOB> H = mob.getGroupMembers(new HashSet<MOB>());
    if (!H.contains(mob)) H.add(mob);
    int numBesidesMe = 0;
    for (Iterator e = H.iterator(); e.hasNext(); ) {
      MOB M = (MOB) e.next();
      if ((M != mob) && (mob.location().isInhabitant(M))) numBesidesMe++;
    }
    if (numBesidesMe == 0) {
      mob.tell("You need a group to set up an ambush!");
      return false;
    }
    for (int i = 0; i < mob.location().numInhabitants(); i++) {
      MOB M = mob.location().fetchInhabitant(i);
      if ((M != null) && (M != mob) && (!H.contains(M)) && (CMLib.flags().canSee(M))) {
        mob.tell(M, null, null, "<S-NAME> is watching you too closely.");
        return false;
      }
    }
    boolean success = proficiencyCheck(mob, 0, auto);

    if (!success)
      beneficialVisualFizzle(mob, null, "<S-NAME> attempt(s) to set up an ambush, but fail(s).");
    else {
      CMMsg msg =
          CMClass.getMsg(
              mob,
              null,
              this,
              auto ? CMMsg.MSG_OK_ACTION : (CMMsg.MSG_DELICATE_HANDS_ACT | CMMsg.MASK_MOVE),
              "<S-NAME> set(s) up an ambush, directing everyone to hiding places.");
      if (mob.location().okMessage(mob, msg)) {
        mob.location().send(mob, msg);
        invoker = mob;
        Ability hide = CMClass.getAbility("Thief_Hide");
        for (Iterator e = H.iterator(); e.hasNext(); ) {
          MOB M = (MOB) e.next();
          hide.invoke(M, M, true, adjustedLevel(mob, asLevel));
        }
      } else success = false;
    }
    return success;
  }
Esempio n. 3
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 (!super.invoke(mob, commands, givenTarget, auto, asLevel)) return false;

    int levelDiff =
        target.phyStats().level() - (mob.phyStats().level() + (2 * getXLEVELLevel(mob)));
    if (levelDiff < 0) levelDiff = 0;
    boolean success = proficiencyCheck(mob, -(levelDiff * 25), auto);
    Item Bread = null;
    Item BreadContainer = null;
    for (int i = 0; i < target.numItems(); i++) {
      Item I = target.getItem(i);
      if ((I != null) && (I instanceof Food)) {
        if (I.container() != null) {
          Bread = I;
          BreadContainer = I.container();
        } else {
          Bread = I;
          BreadContainer = null;
          break;
        }
      }
    }
    if ((Bread != null) && (BreadContainer != null))
      CMLib.commands().postGet(target, BreadContainer, Bread, false);
    if (Bread == null) {
      ShopKeeper SK = CMLib.coffeeShops().getShopKeeper(target);
      if (SK != null) {
        for (Iterator<Environmental> i = SK.getShop().getStoreInventory(); i.hasNext(); ) {
          Environmental E2 = (Environmental) i.next();
          if ((E2 != null) && (E2 instanceof Food)) {
            Bread = (Item) E2.copyOf();
            target.addItem(Bread);
            break;
          }
        }
      }
    }
    if ((success) && (Bread != null)) {
      // 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),
              "^S<S-NAME> "
                  + prayWord(mob)
                  + " for <T-NAMESELF> to provide <S-HIS-HER> daily bread!^?");
      CMMsg msg2 =
          CMClass.getMsg(
              mob,
              target,
              this,
              CMMsg.MSK_CAST_MALICIOUS_VERBAL | CMMsg.TYP_MIND | (auto ? CMMsg.MASK_ALWAYS : 0),
              null);
      if ((mob.location().okMessage(mob, msg)) && (mob.location().okMessage(mob, msg2))) {
        mob.location().send(mob, msg);
        mob.location().send(mob, msg2);
        if ((msg.value() <= 0) && (msg2.value() <= 0)) {
          msg =
              CMClass.getMsg(
                  target,
                  mob,
                  Bread,
                  CMMsg.MSG_GIVE,
                  "<S-NAME> gladly donate(s) <O-NAME> to <T-NAMESELF>.");
          if (mob.location().okMessage(mob, msg)) mob.location().send(mob, msg);
        }
      }
    } else
      maliciousFizzle(
          mob,
          target,
          auto
              ? ""
              : "<S-NAME> "
                  + prayWord(mob)
                  + " for <T-NAMESELF> to provide <S-HIS-HER> daily bread, but nothing happens.");

    // return whether it worked
    return success;
  }
Esempio n. 4
0
  public boolean invoke(MOB mob, Vector commands, Physical givenTarget, boolean auto, int asLevel) {
    Set<MOB> h = properTargets(mob, givenTarget, auto);
    if ((h == null) || (h.size() == 0)) {
      mob.tell("There doesn't appear to be anyone here worth repelling.");
      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, 0, auto);

    if (success) {
      if (mob.location()
          .show(
              mob,
              null,
              this,
              somanticCastCode(mob, null, auto),
              auto ? "" : "^S<S-NAME> wave(s) <S-HIS-HER> arms and cast(s) a spell.^?"))
        for (Iterator f = h.iterator(); f.hasNext(); ) {
          MOB target = (MOB) f.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), null);
          if ((mob.location().okMessage(mob, msg)) && (target.fetchEffect(this.ID()) == null)) {
            mob.location().send(mob, msg);
            if (msg.value() <= 0) {
              amountRemaining = 130;
              if (target.location() == mob.location()) {
                success =
                    maliciousAffect(
                        mob,
                        target,
                        asLevel,
                        ((mob.phyStats().level() + (2 * getXLEVELLevel(mob))) * 10),
                        -1);
                int level = 2;
                if ((CMLib.ableMapper().qualifyingClassLevel(mob, this) > 0)
                    && ((adjustedLevel(mob, asLevel)
                            - CMLib.ableMapper().qualifyingClassLevel(mob, this))
                        > 10))
                  level +=
                      ((adjustedLevel(mob, asLevel)
                                  - CMLib.ableMapper().qualifyingClassLevel(mob, this))
                              - 10)
                          / 10;
                if (level < 2) level = 2;
                target
                    .location()
                    .show(target, null, CMMsg.MSG_OK_ACTION, "<S-NAME> become(s) repelled!");
                if ((target.getVictim() != null) && (target.rangeToTarget() > 0))
                  target.setAtRange(target.rangeToTarget());
                else if (target.location().maxRange() < level)
                  target.setAtRange(target.location().maxRange());
                else target.setAtRange(level);
                if (target.getVictim() != null)
                  target.getVictim().setAtRange(target.rangeToTarget());
                if (mob.getVictim() == null) mob.setVictim(null); // correct range
                if (target.getVictim() == null) target.setVictim(null); // correct range
              }
            }
          }
        }
    } else
      return maliciousFizzle(
          mob, null, "<S-NAME> wave(s) <S-HIS-HER> arms, but the spell fizzles.");

    // return whether it worked
    return success;
  }