Package org.pokenet.server.battle

Examples of org.pokenet.server.battle.BattleField


     public void removeSpikes(Pokemon p) {
       int team = p.getParty();
       m_layers[team] = 0;
     }
     public void switchIn(Pokemon p) {
       BattleField field = p.getField();
       if ((PokemonMove.getEffectiveness(PokemonType.T_GROUND, null, p) == 0.0) || p.hasAbility("Levitate")
           || (getLayers(p) <= 0)) {
         return;
       }
       int layers = getLayers(p);
       int maximum = p.getStat(Pokemon.S_HP);
       double factor = new double[] { 0.125, 0.1875, 0.25 }[layers - 1];
       int damage = (int)(((double)maximum) * factor);
       if (damage < 1) damage = 1;
       field.showMessage(p.getName() + " was hurt by Spikes!");
       p.changeHealth(-damage, true);
     }
View Full Code Here


     }
     public String getName() {
       return "Toxic spikes";
     }
     public void switchIn(Pokemon p) {
       BattleField field = p.getField();
       if ((PokemonMove.getEffectiveness(PokemonType.T_GROUND, null, p) == 0.0)
           || p.isType(PokemonType.T_STEEL)
           || p.hasAbility("Levitate")
           || (getLayers(p) <= 0)) {
         return;
       }
       if (p.isType(PokemonType.T_POISON)) {
         field.showMessage(p.getName() + " absorbed the Toxic Spikes!");
         removeSpikes(p);
         return;
       }
       int layers = getLayers(p);
       if (layers == 1) {
         if (p.addStatus(null, new PoisonEffect()) != null) {
           field.showMessage(p.getName() + " was poisoned by the Toxic Spikes!");
         }
       } else if (layers == 2) {
         if (p.addStatus(null, new ToxicEffect()) != null) {
           field.showMessage(p.getName() + " was badly poisoned by the Toxic Spikes!");
         }
       }
     }
View Full Code Here

                factor = user.getEffectiveness(type, def, false);
                if (factor == expected) {
                    factor = defender.getEffectiveness(type, def, true);
                }
            } else {
                BattleField field = defender.getField();
                factor = field.getEffectiveness(type, def, false);
                if (factor == expected) {
                    factor = field.getEffectiveness(type, def, true);
                }
            }
            multiplier *= factor;
        }
        return multiplier;
View Full Code Here

    public boolean attemptHit(BattleMechanics mech, Pokemon user, Pokemon target) {
        return true;
    }
   
    public int use(BattleMechanics mech, Pokemon user, Pokemon target) {
        BattleField field = user.getField();
        for (int i = 0; i < m_effects.length; ++i) {
            int length = user.hasItem(m_item) ? 8 : 5;
            WeatherEffect eff = null;
            try {
                Constructor<?> ctor = m_effects[i].getConstructor(new Class[] { int.class });
                eff = (WeatherEffect)ctor.newInstance(new Object[] { new Integer(length) });
            } catch (Exception e) {
                throw new InternalError();
            }
            field.applyEffect(eff);
        }
        return 0;
    }
View Full Code Here

         StatusEffect[] effects = smove.getEffects();
         for (int i = 0; i < effects.length; ++i) {
           if (effects[i] instanceof ChargeEffect) return entry;
         }
       }
       BattleField field = p.getField();
       if ((field.getMechanics() instanceof JewelMechanics)
           && (field.getEffectByType(RainEffect.class) != null)
           && name.equals("Thunder")) {
         return MoveList.getDefaultData().getMove("Thunder");
       }
       if (move.isAttack() || name.equals("Roar") || name.equals("Whirlwind")) {
         PokemonMove replace =
View Full Code Here

      }
      int damage = mech.calculateDamage(this, user, target, protect);
      if (ineffective) {
        user.removeStatus(CalculationEffect.class);
      }
      BattleField field = user.getField();
      if (!ineffective && !protect
          && super.attemptHit(mech, user, target)) {
        target.changeHealth(-damage);
        return damage;
      } else if (protect) {
        StatusEffect eff = target.getEffect(ProtectEffect.class);
        field.showMessage(target.getName() + eff.getDescription());
      }
      field.showMessage(user.getName() + " kept going and crashed!");
      int recoil = (int)((double)damage / 2.0);
      int max = target.getStat(Pokemon.S_HP) / 2;
      if (recoil > max) {
        recoil = max;
      }
View Full Code Here

       return true;
     }

     public int use(BattleMechanics mech, Pokemon user, final Pokemon target) {
       final String name = m_name;
       BattleField field = user.getField();
       if (!field.applyEffect(new TypeCutStatus(m_cut, user) {
         public String getName() {
           return name;
         }
       })) {
         field.showMessage("But it failed!");
       }
       return 0;
     }
View Full Code Here

    public boolean isSingleton() {
      return true;
    }
    public void activateParty(Pokemon p) {
      int party = p.getParty();
      BattleField field = p.getField();

      if (m_active[party]) {
        informDuplicateEffect(p);
        return;
      }
      m_active[party] = true;
      m_turns[party] = 5;
      if (m_startMessage != null) {
        field.showMessage(
            field.getActivePokemon()[party].getName() + m_startMessage);
      }
    }
View Full Code Here

TOP

Related Classes of org.pokenet.server.battle.BattleField

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.