Esempio n. 1
0
  @Override
  public boolean invoke(MOB mob, Vector commands, Physical givenTarget, boolean auto, int asLevel) {
    final Room target = mob.location();
    if (target == null) return false;
    if (target.fetchEffect(ID()) != null) {
      mob.tell(L("The aura of harm is already here."));
      return false;
    }
    if (target.fetchEffect("Prayer_AuraHeal") != null) {
      target.fetchEffect("Prayer_AuraHeal").unInvoke();
      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> @x1 for all to feel pain.^?", prayWord(mob)));
      if (mob.location().okMessage(mob, msg)) {
        mob.location().send(mob, msg);
        mob.location()
            .show(mob, null, CMMsg.MSG_OK_VISUAL, L("A harmful aura descends over the area!"));
        maliciousAffect(mob, target, asLevel, 0, -1);
      }
    } else
      return maliciousFizzle(
          mob,
          target,
          L(
              "<S-NAME> @x1 for an aura of harm, but <S-HIS-HER> plea is not answered.",
              prayWord(mob)));

    // return whether it worked
    return success;
  }
Esempio n. 2
0
 @Override
 public int castingQuality(MOB mob, Physical target) {
   if (mob != null) {
     final Room R = mob.location();
     if ((R != null) && (!R.getArea().getClimateObj().canSeeTheMoon(R, null))) {
       if ((R.getArea().getTimeObj().getTODCode() != TimeClock.TimeOfDay.DUSK)
           && (R.getArea().getTimeObj().getTODCode() != TimeClock.TimeOfDay.NIGHT))
         return Ability.QUALITY_INDIFFERENT;
       if ((R.domainType() & Room.INDOORS) > 0) return Ability.QUALITY_INDIFFERENT;
       if (R.fetchEffect(ID()) != null) return Ability.QUALITY_INDIFFERENT;
       return super.castingQuality(mob, target, Ability.QUALITY_BENEFICIAL_SELF);
     }
   }
   return super.castingQuality(mob, target);
 }
Esempio n. 3
0
  @Override
  public boolean invoke(MOB mob, Vector commands, Physical givenTarget, boolean auto, int asLevel) {
    final Room target = mob.location();
    if (target == null) return false;
    if ((target.getArea().getTimeObj().getTODCode() != TimeClock.TimeOfDay.DUSK)
        && (target.getArea().getTimeObj().getTODCode() != TimeClock.TimeOfDay.NIGHT)) {
      mob.tell(L("You can only start this chant at night."));
      return false;
    }
    if ((target.domainType() & Room.INDOORS) > 0) {
      mob.tell(L("This chant only works outdoors."));
      return false;
    }

    if (target.fetchEffect(ID()) != null) {
      mob.tell(L("This place is already under the piercing moon."));
      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> chant(s) to the sky.^?"));
      if (mob.location().okMessage(mob, msg)) {
        mob.location().send(mob, msg);
        if (msg.value() <= 0) {
          if (!mob.location().getArea().getClimateObj().canSeeTheStars(mob.location()))
            mob.location()
                .showHappens(CMMsg.MSG_OK_VISUAL, L("The Moon pierces through the clouds!"));
          else mob.location().showHappens(CMMsg.MSG_OK_VISUAL, L("The Moon brightens!"));
          beneficialAffect(mob, target, asLevel, 0);
        }
      }
    } else
      return maliciousFizzle(mob, target, L("<S-NAME> chant(s) to the sky, but the magic fades."));
    // return whether it worked
    return success;
  }
Esempio n. 4
0
  public boolean invoke(
      MOB mob, Vector commands, Environmental givenTarget, boolean auto, int asLevel) {
    if ((commands.size() < 1) && (givenTarget == null)) {
      mob.tell("Wizard Lock what?.");
      return false;
    }
    String targetName = CMParms.combine(commands, 0);

    Environmental target = null;
    int dirCode = Directions.getGoodDirectionCode(targetName);
    if (dirCode >= 0) target = mob.location().getExitInDir(dirCode);
    if (target == null)
      target = getTarget(mob, mob.location(), givenTarget, commands, Wearable.FILTER_ANY);
    if (target == null) return false;

    if ((!(target instanceof Container)) && (!(target instanceof Exit))) {
      mob.tell("You can't lock that.");
      return false;
    }

    if (target instanceof Container) {
      Container container = (Container) target;
      if ((!container.hasALid()) || (!container.hasALock())) {
        mob.tell("You can't lock that!");
        return false;
      }
    } else if (target instanceof Exit) {
      Exit exit = (Exit) target;
      if (!exit.hasADoor()) {
        mob.tell("You can't lock that!");
        return false;
      }
    }

    if (target.fetchEffect(this.ID()) != null) {
      mob.tell(target.name() + " is already magically locked!");
      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 ? "" : "^S<S-NAME> point(s) <S-HIS-HER> finger at <T-NAMESELF>, incanting.^?");
      if (mob.location().okMessage(mob, msg)) {
        mob.location().send(mob, msg);
        if (target instanceof Exit) {
          Exit exit = (Exit) target;
          exit.setDoorsNLocks(
              exit.hasADoor(),
              false,
              exit.defaultsClosed(),
              exit.hasALock(),
              true,
              exit.defaultsLocked());
          Room R = mob.location();
          Room R2 = null;
          for (int d = Directions.NUM_DIRECTIONS() - 1; d >= 0; d--)
            if (R.getExitInDir(d) == target) {
              R2 = R.getRoomInDir(d);
              break;
            }
          if ((CMLib.law().doesOwnThisProperty(mob, R))
              || ((R2 != null) && (CMLib.law().doesOwnThisProperty(mob, R2)))) {
            target.addNonUninvokableEffect((Ability) copyOf());
            CMLib.database().DBUpdateExits(R);
          } else beneficialAffect(mob, target, asLevel, Integer.MAX_VALUE / 2);
          mob.location().show(mob, target, CMMsg.MSG_OK_VISUAL, "<T-NAME> look(s) shut tight!");
        } else if (target instanceof Container) {
          beneficialAffect(mob, target, asLevel, Integer.MAX_VALUE / 2);
          Container container = (Container) target;
          container.setLidsNLocks(container.hasALid(), false, container.hasALock(), true);
          mob.location().show(mob, target, CMMsg.MSG_OK_VISUAL, "<T-NAME> look(s) shut tight!");
        }
        Ability lock = target.fetchEffect(ID());
        if (lock != null) {
          lock.setMiscText(Integer.toString(mob.envStats().level()));
          if (target instanceof Exit) {
            Room R = mob.location();
            if (!CMLib.law().doesHavePriviledgesHere(mob, R))
              for (int a = 0; a < R.numEffects(); a++)
                if ((R.fetchEffect(a) instanceof LandTitle)
                    && (((LandTitle) R.fetchEffect(a)).landOwner().length() > 0))
                  lock.setMiscText(lock.text() + " MALICIOUS");
          }
        }
      }

    } else
      beneficialWordsFizzle(
          mob, target, "<S-NAME> point(s) at <T-NAMESELF>, incanting, but nothing happens.");

    // return whether it worked
    return success;
  }
Esempio n. 5
0
  @Override
  public boolean invoke(
      MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) {
    final Room trapThis = mob.location();

    Item resource =
        CMLib.materials().findMostOfMaterial(mob.location(), RawMaterial.MATERIAL_METAL);
    if (resource == null)
      resource = CMLib.materials().findMostOfMaterial(mob.location(), RawMaterial.MATERIAL_MITHRIL);
    int amount = 0;
    if (resource != null)
      amount = CMLib.materials().findNumberOfResource(mob.location(), resource.material());
    if (amount < 100) {
      mob.tell(L("You need 100 pounds of raw metal to build this trap."));
      return false;
    }
    if (mob.isInCombat()) {
      mob.tell(L("You are too busy to get that done right now."));
      return false;
    }

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

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

    if (resource != null)
      CMLib.materials().destroyResourcesValue(mob.location(), 100, resource.material(), -1, null);

    final CMMsg msg =
        CMClass.getMsg(
            mob,
            trapThis,
            this,
            auto ? CMMsg.MSG_OK_ACTION : CMMsg.MSG_THIEF_ACT,
            CMMsg.MASK_ALWAYS | CMMsg.MSG_DELICATE_HANDS_ACT,
            CMMsg.MSG_OK_ACTION,
            (auto
                ? L("@x1 begins to glow!", trapThis.name())
                : L("<S-NAME> attempt(s) to lay a trap here.")));
    if (mob.location().okMessage(mob, msg)) {
      mob.location().send(mob, msg);
      if (success) {
        mob.tell(L("You have set the trap."));
        setTrap(
            mob,
            trapThis,
            mob.charStats().getClassLevel(mob.charStats().getCurrentClass()),
            (CMLib.ableMapper().qualifyingClassLevel(mob, this)
                    - CMLib.ableMapper().lowestQualifyingLevel(ID()))
                + 1,
            false);
        final Thief_DeathTrap T = (Thief_DeathTrap) trapThis.fetchEffect(ID());
        if (T != null) T.setMiscText(mob.Name());
      } else {
        if (CMLib.dice().rollPercentage() > 50) {
          final Trap T =
              setTrap(
                  mob,
                  trapThis,
                  mob.charStats().getClassLevel(mob.charStats().getCurrentClass()),
                  (CMLib.ableMapper().qualifyingClassLevel(mob, this)
                          - CMLib.ableMapper().lowestQualifyingLevel(ID()))
                      + 1,
                  false);
          mob.location()
              .show(mob, null, CMMsg.MSG_OK_ACTION, L("<S-NAME> trigger(s) the trap on accident!"));
          T.spring(mob);
        } else {
          mob.tell(L("You fail in your attempt to set the death trap."));
        }
      }
    }
    return success;
  }
Esempio n. 6
0
  public boolean invoke(
      MOB mob, Vector commands, Environmental givenTarget, boolean auto, int asLevel) {
    if (!super.invoke(mob, commands, givenTarget, auto, asLevel)) return false;

    Room target = mob.location();
    if ((auto) && (givenTarget != null) && (givenTarget instanceof Room))
      target = (Room) givenTarget;
    Ability A = target.fetchEffect(ID());
    if (A != null) {
      mob.tell("This place is already a safehouse.");
      return false;
    }
    if ((!auto) && (CMLib.law().getLegalBehavior(target) == null)) {
      mob.tell("There is no law here!");
      return false;
    }
    if (!isGoodSafehouse(target)) {
      TrackingLibrary.TrackingFlags flags;
      flags =
          new TrackingLibrary.TrackingFlags()
              .add(TrackingLibrary.TrackingFlag.OPENONLY)
              .add(TrackingLibrary.TrackingFlag.AREAONLY)
              .add(TrackingLibrary.TrackingFlag.NOEMPTYGRIDS)
              .add(TrackingLibrary.TrackingFlag.NOAIR)
              .add(TrackingLibrary.TrackingFlag.NOWATER);
      Vector V = CMLib.tracking().getRadiantRooms(target, flags, 50 + (2 * getXLEVELLevel(mob)));
      Room R = null;
      int v = 0;
      for (; v < V.size(); v++) {
        R = (Room) V.elementAt(v);
        if ((isGoodSafehouse(R)) && (!isLawHere(R))) break;
      }
      mob.tell("A place like this can't be a safehouse.");
      if ((isGoodSafehouse(R)) && (!isLawHere(R))) {
        V =
            CMLib.tracking()
                .findBastardTheBestWay(
                    target, CMParms.makeVector(R), flags, 50 + (2 * getXLEVELLevel(mob)));
        StringBuffer trail = new StringBuffer("");
        int dir = CMLib.tracking().trackNextDirectionFromHere(V, target, true);
        while (target != R) {
          if ((dir < 0) || (dir >= Directions.NUM_DIRECTIONS()) || (target == null)) break;
          trail.append(Directions.getDirectionName(dir));
          if (target.getRoomInDir(dir) != R) trail.append(", ");
          target = target.getRoomInDir(dir);
          dir = CMLib.tracking().trackNextDirectionFromHere(V, target, true);
        }
        if (target == R)
          mob.tell("You happen to know of one nearby though.  Go: " + trail.toString());
      }
      return false;
    }

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

    CMMsg msg =
        CMClass.getMsg(
            mob,
            null,
            this,
            auto ? CMMsg.MASK_ALWAYS : CMMsg.MSG_DELICATE_HANDS_ACT,
            CMMsg.MSG_OK_VISUAL,
            CMMsg.MSG_OK_VISUAL,
            auto ? "" : "<S-NAME> hide(s) out from the law here.");
    if (!success)
      return beneficialVisualFizzle(
          mob,
          null,
          auto
              ? ""
              : "<S-NAME> attempt(s) hide out from the law here, but things are just too hot.");
    else if (mob.location().okMessage(mob, msg)) {
      mob.location().send(mob, msg);
      beneficialAffect(mob, target, asLevel, (CMProps.getIntVar(CMProps.SYSTEMI_TICKSPERMUDMONTH)));
    }
    return success;
  }