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
  @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;
  }