@Override
 public void affectCharState(MOB affected, CharState affectableState) {
   super.affectCharState(affected, affectableState);
   if (affected == null) return;
   affectableState.setMovement(
       (int)
           Math.round(
               CMath.div(
                   affectableState.getMovement(), drawups + (0.1 * super.getX1Level(invoker())))));
 }
Example #2
0
 @Override
 public void affectCharState(MOB affected, CharState affectableState) {
   super.affectCharState(affected, affectableState);
   if (affected.location() != null)
     for (int i = 0; i < affected.location().numItems(); i++) {
       final Item I = affected.location().getItem(i);
       if ((I != null) && (I.ID().equals("DruidicMonument")))
         affectableState.setMana(affectableState.getMana() + (affectableState.getMana() / 2));
     }
 }
Example #3
0
  @Override
  public boolean tick(Tickable ticking, int tickID) {
    if (!(affected instanceof MOB)) return super.tick(ticking, tickID);

    final MOB mob = (MOB) affected;

    if (tickID != Tickable.TICKID_MOB) return true;
    if (!proficiencyCheck(null, 0, false)) return true;

    if ((!mob.isInCombat()) && (CMLib.flags().isSleeping(mob))) {
      roundsHibernating++;
      final double man =
          ((mob.charStats().getStat(CharStats.STAT_INTELLIGENCE)
              + mob.charStats().getStat(CharStats.STAT_WISDOM)));
      mob.curState()
          .adjMana(
              (int)
                  Math.round(
                      (man * .1)
                          + ((mob.phyStats().level() + (2.0 * super.getXLEVELLevel(invoker())))
                              / 2.0)),
              mob.maxState());
      mob.curState().setHunger(oldState.getHunger());
      mob.curState().setThirst(oldState.getThirst());
      final double move = mob.charStats().getStat(CharStats.STAT_STRENGTH);
      mob.curState()
          .adjMovement(
              (int)
                  Math.round(
                      (move * .1)
                          + ((mob.phyStats().level() + (2.0 * super.getXLEVELLevel(invoker())))
                              / 2.0)),
              mob.maxState());
      if (!CMLib.flags().isGolem(mob)) {
        final double hp = mob.charStats().getStat(CharStats.STAT_CONSTITUTION);
        if (!CMLib.combat()
            .postHealing(
                mob,
                mob,
                this,
                CMMsg.MASK_ALWAYS | CMMsg.TYP_CAST_SPELL,
                (int)
                    Math.round(
                        (hp * .1)
                            + ((mob.phyStats().level() + (2.0 * super.getXLEVELLevel(invoker())))
                                / 2.0)),
                null)) unInvoke();
      }
    } else {
      unInvoke();
      return false;
    }
    return super.tick(ticking, tickID);
  }
 @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)));
 }
Example #5
0
 public void affectCharState(MOB mob, CharState state) {
   super.affectCharState(mob, state);
   if (mob.baseCharStats().getCurrentClass().ID().equals(ID())) {
     Ability A = null;
     for (int a = 0; a < mob.numLearnedAbilities(); a++) {
       A = mob.fetchAbility(a);
       if ((A != null)
           && ((A.classificationCode() & Ability.ALL_ACODES) == Ability.ACODE_SPELL)
           && (!CMLib.ableMapper().getDefaultGain(ID(), false, A.ID()))) {
         int[] cost = A.usageCost(mob, true);
         int manaCost = cost[Ability.USAGEINDEX_MANA];
         if (manaCost > 0) {
           if (state.getMana() < manaCost) {
             mob.delAbility(A);
             a--;
           } else state.setMana(state.getMana() - manaCost);
         }
       }
     }
     if (mob.curState().getMana() > state.getMana()) mob.curState().setMana(state.getMana());
   }
 }
Example #6
0
 @Override
 public void affectCharState(MOB affectedMOB, CharState affectableState) {
   affectableState.setHitPoints(affectableState.getHitPoints() * 4);
   affectableState.setHunger((Integer.MAX_VALUE / 2) + 10);
   affectedMOB.curState().setHunger(affectableState.getHunger());
   affectableState.setThirst((Integer.MAX_VALUE / 2) + 10);
   affectedMOB.curState().setThirst(affectableState.getThirst());
 }
Example #7
0
 @Override
 public void affectCharState(MOB affected, CharState affectableStats) {
   if ((whom != null) && (song != null)) {
     final Hashtable<Integer, Integer> H = getSongBenefits(song);
     for (final Enumeration<Integer> e = H.keys(); e.hasMoreElements(); ) {
       final Integer I = e.nextElement();
       final String[] chk = stuff[I.intValue()];
       if ((chk != null) && (chk[1].startsWith("s"))) {
         int ticks = H.get(I).intValue();
         if (ticks > 50) ticks = 50;
         if (ticks <= 0) ticks = 1;
         switch (chk[2].charAt(0)) {
           case 'h':
             affectableStats.setHunger(
                 affectableStats.getHunger() + ticks + getXLEVELLevel(invoker()));
             break;
           case 't':
             affectableStats.setThirst(
                 affectableStats.getThirst() + ticks + getXLEVELLevel(invoker()));
             break;
           case 'v':
             affectableStats.setMovement(
                 affectableStats.getMovement() + ticks + getXLEVELLevel(invoker()));
             break;
           case 'm':
             affectableStats.setMana(
                 affectableStats.getMana() + ticks + getXLEVELLevel(invoker()));
             break;
           case 'i':
             affectableStats.setHitPoints(
                 affectableStats.getHitPoints() + ticks + getXLEVELLevel(invoker()));
             break;
         }
       }
     }
   }
 }
Example #8
0
 @Override
 public void affectCharState(MOB affected, CharState affectableStats) {
   super.affectCharState(affected, affectableStats);
   if (invoker == null) return;
   affectableStats.setHitPoints(affectableStats.getHitPoints() + hpUp);
 }