コード例 #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
ファイル: WeakParalysis.java プロジェクト: JEBailey/CoffeeMud
  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);
  }
コード例 #4
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;
  }
コード例 #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
ファイル: Falling.java プロジェクト: bozimmerman/CoffeeMud
 @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
ファイル: WeakParalysis.java プロジェクト: JEBailey/CoffeeMud
  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.");
  }
コード例 #10
0
 @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
ファイル: Falling.java プロジェクト: bozimmerman/CoffeeMud
 @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);
     }
   }
 }
コード例 #13
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
ファイル: Falling.java プロジェクト: bozimmerman/CoffeeMud
 @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();
     }
   }
 }
コード例 #15
0
 @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
ファイル: Falling.java プロジェクト: bozimmerman/CoffeeMud
 @Override
 public void setAffectedOne(Physical P) {
   if (P instanceof Room) room = (Room) P;
   else super.setAffectedOne(P);
 }
コード例 #20
0
ファイル: Falling.java プロジェクト: bozimmerman/CoffeeMud
 @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
ファイル: Chant.java プロジェクト: kingdavid127/MUD
 @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;
 }