mechanics
Class AdvanceMechanics

java.lang.Object
  extended by mechanics.BattleMechanics
      extended by mechanics.AdvanceMechanics
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
JewelMechanics

public class AdvanceMechanics
extends BattleMechanics

This class represents the mechanics in the advanced generation of pokemon.

See Also:
Serialized Form

Constructor Summary
AdvanceMechanics(int bytes)
          Creates a new instance of AdvanceMechanics
 
Method Summary
 boolean attemptHit(PokemonMove move, Pokemon user, Pokemon target)
          Return whether the move hit.
 int calculateDamage(PokemonMove move, Pokemon attacker, Pokemon defender, boolean silent)
          Calculate the damage done by a move.
 int calculateStat(Pokemon p, int i)
          Calculate the initial value of a stat from a pokemon's base stats and hidden stats.
 boolean isCriticalHit(PokemonMove move, Pokemon user, Pokemon target)
           
 boolean isMoveSpecial(PokemonMove move)
          Return whether a given move deals special damage.
 void validateHiddenStats(Pokemon p)
          There are several conditions to validate.
 
Methods inherited from class mechanics.BattleMechanics
calculateDamage, getRandom, getRandomBytes, getRandomSource
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AdvanceMechanics

public AdvanceMechanics(int bytes)
Creates a new instance of AdvanceMechanics

Method Detail

calculateStat

public int calculateStat(Pokemon p,
                         int i)
                  throws StatException
Description copied from class: BattleMechanics
Calculate the initial value of a stat from a pokemon's base stats and hidden stats.

Specified by:
calculateStat in class BattleMechanics
Parameters:
p - the pokemon whose stats to calculate
i - the stat to calculate (use the constants Pokemon.S_HP, etc.)
Throws:
StatException

attemptHit

public boolean attemptHit(PokemonMove move,
                          Pokemon user,
                          Pokemon target)
Return whether the move hit.

Specified by:
attemptHit in class BattleMechanics

isCriticalHit

public boolean isCriticalHit(PokemonMove move,
                             Pokemon user,
                             Pokemon target)

isMoveSpecial

public boolean isMoveSpecial(PokemonMove move)
Return whether a given move deals special damage.

Specified by:
isMoveSpecial in class BattleMechanics

calculateDamage

public int calculateDamage(PokemonMove move,
                           Pokemon attacker,
                           Pokemon defender,
                           boolean silent)
Description copied from class: BattleMechanics
Calculate the damage done by a move. Does not actually inflict damage to pokemon. Optionally do not display any messages.

Specified by:
calculateDamage in class BattleMechanics

validateHiddenStats

public void validateHiddenStats(Pokemon p)
                         throws ValidationException
There are several conditions to validate. The total number of effort points must be less than or equal to 510. There can be no more than 255 effort points per stat. There can be no more than 31 individual points per stat. The pokemon's level must be in the interval [1, 100].

Specified by:
validateHiddenStats in class BattleMechanics
Throws:
ValidationException