shoddybattle
Class PokemonSpecies

java.lang.Object
  extended by shoddybattle.PokemonSpecies
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
Pokemon

public class PokemonSpecies
extends java.lang.Object
implements java.io.Serializable

This class represents a species of pokemon.

See Also:
Serialized Form

Field Summary
static int GENDER_BOTH
           
static int GENDER_FEMALE
           
static int GENDER_MALE
          Gender constants.
static int GENDER_NONE
           
protected  int[] m_base
           
protected  int m_genders
           
protected  java.lang.String m_name
           
protected  int m_species
          Serialised data.
protected  PokemonType[] m_type
           
 
Constructor Summary
PokemonSpecies(PokemonSpecies i)
          Allows for construction from another PokemonSpecies.
PokemonSpecies(PokemonSpeciesData data, int i)
          Creates a new instance of PokemonSpecies
PokemonSpecies(PokemonSpeciesData data, java.lang.String str)
          Construct by name.
 
Method Summary
 boolean canLearn(PokemonSpeciesData data, java.lang.String move)
          Return whether this species can learn a particular move.
 boolean canUseAbility(PokemonSpeciesData data, java.lang.String ability)
          Return whether a pokemon can have a particular ability.
 int getBase(int i)
           
 int[] getBaseStats()
          Get this pokemon's base stats.
static PokemonSpeciesData getDefaultData()
          Return the default species data.
 java.util.TreeSet getLearnableMoves(PokemonSpeciesData data)
          Return a TreeSet of moves that the pokemon can learn.
 MoveSet getMoveSet(MoveSetData data)
          Get the MoveSet associated with this species.
 java.lang.String getName()
          Get the name of this species.
 java.util.SortedSet getPossibleAbilities(PokemonSpeciesData data)
          Return a TreeSet of possible abilities.
 int getPossibleGenders()
          Return the possible genders for this species.
 PokemonType[] getTypes()
           
static java.lang.Object readObject(PokemonSpeciesData data, java.io.ObjectInputStream in)
          Read a PokemonSpecies from a stream, backed by an arbitrary PokemonSpeciesData object.
static void setDefaultData(PokemonSpeciesData data)
          Set the default species data.
 void setName(java.lang.String name)
          Set the name of this species.
 void setPossibleGenders(int genders)
          Set the possible genders for this species.
 void setType(PokemonType[] type)
          Set the type of this pokemon.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_species

protected int m_species
Serialised data. Note that both the species ID and the species name are written. Only one of these is actually required in order to load the Pokemon, but both are written in case the server operator would rather load by name (ID is the default) - this allows for removing pokemon from the database without breaking existing teams, although it is somewhat slow.


m_name

protected java.lang.String m_name

GENDER_MALE

public static final int GENDER_MALE
Gender constants.

See Also:
Constant Field Values

GENDER_FEMALE

public static final int GENDER_FEMALE
See Also:
Constant Field Values

GENDER_BOTH

public static final int GENDER_BOTH
See Also:
Constant Field Values

GENDER_NONE

public static final int GENDER_NONE
See Also:
Constant Field Values

m_base

protected transient int[] m_base

m_type

protected transient PokemonType[] m_type

m_genders

protected transient int m_genders
Constructor Detail

PokemonSpecies

public PokemonSpecies(PokemonSpeciesData data,
                      int i)
               throws PokemonException
Creates a new instance of PokemonSpecies

Throws:
PokemonException

PokemonSpecies

public PokemonSpecies(PokemonSpecies i)
Allows for construction from another PokemonSpecies.


PokemonSpecies

public PokemonSpecies(PokemonSpeciesData data,
                      java.lang.String str)
               throws PokemonException
Construct by name.

Throws:
PokemonException
Method Detail

getPossibleGenders

public int getPossibleGenders()
Return the possible genders for this species.


setPossibleGenders

public void setPossibleGenders(int genders)
Set the possible genders for this species.


getDefaultData

public static PokemonSpeciesData getDefaultData()
Return the default species data.


setDefaultData

public static void setDefaultData(PokemonSpeciesData data)
Set the default species data.


canUseAbility

public boolean canUseAbility(PokemonSpeciesData data,
                             java.lang.String ability)
Return whether a pokemon can have a particular ability.


getPossibleAbilities

public java.util.SortedSet getPossibleAbilities(PokemonSpeciesData data)
Return a TreeSet of possible abilities.


readObject

public static java.lang.Object readObject(PokemonSpeciesData data,
                                          java.io.ObjectInputStream in)
                                   throws java.io.IOException,
                                          java.lang.ClassNotFoundException
Read a PokemonSpecies from a stream, backed by an arbitrary PokemonSpeciesData object.

Throws:
java.io.IOException
java.lang.ClassNotFoundException

getBaseStats

public int[] getBaseStats()
Get this pokemon's base stats.


getTypes

public PokemonType[] getTypes()

setType

public void setType(PokemonType[] type)
Set the type of this pokemon.


getBase

public int getBase(int i)
            throws StatException
Throws:
StatException

getName

public java.lang.String getName()
Get the name of this species.


setName

public void setName(java.lang.String name)
Set the name of this species.


getMoveSet

public MoveSet getMoveSet(MoveSetData data)
Get the MoveSet associated with this species.


getLearnableMoves

public java.util.TreeSet getLearnableMoves(PokemonSpeciesData data)
Return a TreeSet of moves that the pokemon can learn.


canLearn

public boolean canLearn(PokemonSpeciesData data,
                        java.lang.String move)
Return whether this species can learn a particular move.