示例#1
0
 @Override
 public void unInvoke() {
   if (affected == null) return;
   for (final Object[] A : affects) unAffectAffected(A);
   affects.clear();
   super.unInvoke();
 }
示例#2
0
 @Override
 public void affectCharStats(MOB affected, CharStats affectableStats) {
   super.affectCharStats(affected, affectableStats);
   if (affected == null) return;
   affectableStats.setStat(CharStats.STAT_STRENGTH, 3);
   affectableStats.setStat(CharStats.STAT_CONSTITUTION, 3);
 }
示例#3
0
  public void affectPhyStats(Physical affected, PhyStats affectableStats) {
    super.affectPhyStats(affected, affectableStats);
    if (affected == null) return;
    if (!(affected instanceof MOB)) return;

    affectableStats.setSensesMask(affectableStats.sensesMask() | PhyStats.CAN_NOT_MOVE);
  }
  @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;
  }
示例#5
0
  @Override
  public void unInvoke() {
    if (!(affected instanceof MOB)) return;
    final MOB mob = (MOB) affected;

    super.unInvoke();
    if (canBeUninvoked()) mob.tell(L("The chill is lifted."));
  }
示例#6
0
 @Override
 public void affectCharState(MOB affected, CharState affectableStats) {
   super.affectCharState(affected, affectableStats);
   if (affected == null) return;
   for (final Object[] A : affects)
     if (A[0] instanceof StatsAffecting)
       ((StatsAffecting) A[0]).affectCharState(affected, affectableStats);
 }
示例#7
0
 @Override
 public void affectPhyStats(Physical affected, PhyStats affectableStats) {
   super.affectPhyStats(affected, affectableStats);
   if (affected == null) return;
   for (final Object[] A : affects)
     if (A[0] instanceof StatsAffecting)
       ((StatsAffecting) A[0]).affectPhyStats(affected, affectableStats);
 }
示例#8
0
 @Override
 public void setStat(String code, String val) {
   if (code == null) return;
   if (code.equalsIgnoreCase("DAMAGE")) this.damageToTake = CMath.s_int(val);
   else if (code.equalsIgnoreCase("REVERSED")) this.setProficiency(CMath.s_bool(val) ? 100 : 0);
   else if (code.equalsIgnoreCase("NORMAL")) this.setProficiency(CMath.s_bool(val) ? 0 : 100);
   else super.setStat(code, val);
 }
示例#9
0
  public void unInvoke() {
    // undo the affects of this spell
    if (!(affected instanceof MOB)) return;
    MOB mob = (MOB) affected;

    super.unInvoke();

    if (canBeUninvoked()) mob.tell("The paralysis eases out of your muscles.");
  }
 @Override
 public void affectCharStats(MOB affected, CharStats affectableStats) {
   super.affectCharStats(affected, affectableStats);
   if (affected == null) return;
   int newLevel =
       affected.basePhyStats().level()
           - (direction * (levelsDown - affectableStats.combinedSubLevels()));
   if (newLevel < 0) newLevel = 0;
   affectableStats.setClassLevel(affectableStats.getCurrentClass(), newLevel);
 }
示例#11
0
 @Override
 public boolean tick(Tickable ticking, int tickID) {
   if (destroyIfNecessary()) return false;
   if (!super.tick(ticking, tickID)) return false;
   super.makeLongLasting();
   for (final Object[] A : affects)
     if (!((Tickable) A[0]).tick(ticking, tickID)) unAffectAffected(A);
     else if ((--((int[]) A[1])[0]) <= 0) unAffectAffected(A);
   return true;
 }
示例#12
0
 @Override
 public void setMiscText(String newMiscText) {
   super.setMiscText(newMiscText);
   if ((newMiscText != null) && (newMiscText.length() > 0)) {
     for (final String parm : CMParms.parse(newMiscText.toUpperCase())) {
       if (parm.equals("REVERSED")) this.setProficiency(100);
       else if (parm.equals("NORMAL")) this.setProficiency(0);
     }
   }
 }
 @Override
 public void affectCharState(MOB affected, CharState affectableState) {
   super.affectCharState(affected, affectableState);
   if (affected == null) return;
   final int hplevel = affectableState.getHitPoints() / affected.basePhyStats().level();
   affectableState.setHitPoints(
       affectableState.getHitPoints() - (hplevel * (levelsDown * direction)));
   final int manalevel = affectableState.getMana() / affected.basePhyStats().level();
   affectableState.setMana(affectableState.getMana() - (manalevel * (levelsDown * direction)));
   final int movelevel = affectableState.getMovement() / affected.basePhyStats().level();
   affectableState.setMovement(
       affectableState.getMovement() - (movelevel * (levelsDown * direction)));
 }
示例#14
0
 @Override
 public void executeMsg(final Environmental myHost, final CMMsg msg) {
   super.executeMsg(myHost, msg);
   if ((affected != null) && (affected instanceof MOB) && (msg.amISource((MOB) affected))) {
     if (msg.sourceMinor() == CMMsg.TYP_RECALL) {
       damageToTake = 0;
       unInvoke();
     } else if ((msg.tool() instanceof Ability)
         && (CMath.bset(((Ability) msg.tool()).flags(), Ability.FLAG_TRANSPORTING))) {
       damageToTake = 0;
       unInvoke();
     }
   }
 }
 @Override
 public void affectPhyStats(Physical affected, PhyStats affectableStats) {
   super.affectPhyStats(affected, affectableStats);
   if (affected == null) return;
   if (levelsDown < 0) return;
   final int attacklevel = affectableStats.attackAdjustment() / affectableStats.level();
   affectableStats.setLevel(affectableStats.level() - (levelsDown * direction));
   if (affectableStats.level() <= 0) {
     levelsDown = -1;
     CMLib.combat().postDeath(invoker(), (MOB) affected, null);
   }
   affectableStats.setAttackAdjustment(
       affectableStats.attackAdjustment() - (attacklevel * (levelsDown * direction)));
 }
示例#16
0
  @Override
  public void setMiscText(String txt) {
    super.setMiscText("");
    if (txt.startsWith("-")) {
      txt = txt.substring(1).toLowerCase().trim();
      for (final Object[] A : affects)
        if (((CMObject) A[0]).ID().toLowerCase().equals(txt)) {
          unAffectAffected(A);
          return;
        }
      for (final Object[] A : affects)
        if ((A[0] instanceof Ability)
            && (((Environmental) A[0]).name().toLowerCase().startsWith(txt))) {
          unAffectAffected(A);
          return;
        }
      for (final Object[] A : affects)
        if ((A[0] instanceof Behavior)
            && (((Behavior) A[0]).name().toLowerCase().startsWith(txt))) {
          unAffectAffected(A);
          return;
        }
    } else if (txt.trim().length() > 0) {
      if (txt.startsWith("+")) txt = txt.substring(1);
      else for (final Object[] A : affects) unAffectAffected(A);

      int x = txt.indexOf(' ');
      if (x < 0) return;
      final String abilityStr = txt.substring(0, x).trim();
      String numTicksStr = txt.substring(x + 1).trim();
      String parms = "";
      x = numTicksStr.indexOf(' ');
      if (x > 0) {
        parms = numTicksStr.substring(x + 1).trim();
        numTicksStr = numTicksStr.substring(0, x);
      }
      CMObject A = CMClass.getAbility(abilityStr);
      if (A == null) A = CMClass.getBehavior(abilityStr);
      if (A == null) A = CMClass.findAbility(abilityStr);
      if (A == null) A = CMClass.findBehavior(abilityStr);
      if (A != null) {
        affects.addElement(new Object[] {A, new int[] {CMath.s_int(numTicksStr)}});
        if (A instanceof Ability) ((Ability) A).setMiscText(parms);
        if ((A instanceof Behavior) && (affected instanceof PhysicalAgent))
          ((Behavior) A).setParms(parms);
        finishInit(A);
      }
    }
  }
示例#17
0
 public boolean tick(Tickable ticking, int tickID) {
   super.tick(ticking, tickID);
   if (tickID != Tickable.TICKID_MOB) return true;
   if (reactToM == null) {
     // dont combine this if with the above
     if ((affected instanceof MOB) && (reactToName != null))
       reactToM = ((MOB) affected).location().fetchInhabitant(reactToName);
     if (reactToM == null) return shutdownPresence((MOB) affected);
   } else if (this.affected instanceof MOB) {
     MOB affected = (MOB) this.affected;
     if ((affected.location() != reactToM.location())
         || (affected.amDead())
         || (reactToM.amDead())
         || (affected.amDestroyed())
         || (reactToM.amDestroyed())
         || (!CMLib.flags().isInTheGame(affected, true))
         || (!CMLib.flags().isInTheGame(reactToM, true))) return shutdownPresence(affected);
     initializeAllManaged(affected);
     for (CMObject O : managed) if (O instanceof Tickable) ((Tickable) O).tick(ticking, tickID);
   }
   return true;
 }
示例#18
0
 public void executeMsg(Environmental affecting, CMMsg msg) {
   for (CMObject O : managed)
     if (O instanceof MsgListener) ((MsgListener) O).executeMsg(affecting, msg);
   super.executeMsg(affecting, msg);
 }
示例#19
0
 @Override
 public void setAffectedOne(Physical P) {
   if (P instanceof Room) room = (Room) P;
   else super.setAffectedOne(P);
 }
示例#20
0
 @Override
 public void affectPhyStats(Physical affected, PhyStats affectableStats) {
   super.affectPhyStats(affected, affectableStats);
   if ((affectableStats.disposition() & PhyStats.IS_FLYING) == 0)
     affectableStats.setDisposition(affectableStats.disposition() | PhyStats.IS_FALLING);
 }
示例#21
0
 @Override
 public void setMiscText(String newText) {
   if (newText.equalsIgnoreCase("render mundane")) renderedMundane = true;
   else super.setMiscText(newText);
 }
示例#22
0
 @Override
 public void setAffectedOne(Physical P) {
   super.setAffectedOne(P);
   if ((affects != null) && (!initialized))
     for (final Object[] set : affects) finishInit((CMObject) set[0]);
 }
示例#23
0
 public PresenceReaction() {
   super();
   super.makeLongLasting();
   super.savable = false;
   super.canBeUninvoked = false;
 }