|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectshoddybattle.BattleField
public abstract class BattleField
Nested Class Summary | |
---|---|
protected static class |
BattleField.PokemonWrapper
A wrapper for a pokemon and a turn. |
Field Summary | |
---|---|
protected int[] |
m_active
|
protected int |
m_participants
The number of people who can actually participate. |
protected Pokemon[][] |
m_pokemon
|
Constructor Summary | |
---|---|
protected |
BattleField(BattleMechanics mech)
|
|
BattleField(BattleMechanics mech,
Pokemon[][] pokemon)
Creates a new instance of BattleField |
Method Summary | |
---|---|
void |
addClause(Clause clause)
Add a clause to this battle field. |
boolean |
allowsStatus(StatusEffect eff,
Pokemon source,
Pokemon target)
Check whether the clauses present on this battle field permit the application of the given status effect to the given pokemon. |
boolean |
applyEffect(FieldEffect eff)
Apply a new FieldEffect to this BattleField. |
protected void |
attachField()
Attach this field to all of its pokemon. |
void |
checkBattleEnd(int i)
Check if one party has won the battle and inform victory if so. |
void |
dispose()
Dispose of this object by breaking all links to other objects, making it easy to the garbage collector to find and free them. |
void |
executeTurn(BattleTurn[] move)
Execute a turn. |
Pokemon[] |
getActivePokemon()
Get the active pokemon. |
int |
getAliveCount(int idx)
Return the number of party members in a given party who are alive. |
FieldEffect |
getEffectByType(java.lang.Class type)
Returns the first instance of an effect of a certain class that is applied to the BattleField. |
double |
getEffectiveness(PokemonType move,
PokemonType pokemon,
boolean enemy)
Get the effectiveness of a move against a given pokemon on this field. |
java.util.ArrayList |
getEffectsByType(java.lang.Class type)
Returns a list of the effects of a certain class that are applied to this BattleField. |
BattleMechanics |
getMechanics()
Get the mechanics used on this battle field. |
Pokemon |
getOpponent(Pokemon p)
Get the opponent of the Pokemon passed in. |
Pokemon[] |
getParty(int idx)
Get a party. |
int |
getPokemonTrainer(Pokemon p)
Get the index of a trainer from one of his pokemon. |
java.util.Random |
getRandom()
Return the instance of Random used on this BattleField. |
static MoveListEntry |
getStruggle()
|
abstract java.lang.String |
getTrainerName(int idx)
Get the name of a trainer by number. |
abstract void |
informPokemonFainted(int trainer,
int idx)
Inform that a pokemon fainted. |
abstract void |
informPokemonHealthChanged(Pokemon poke,
int change)
Inform that a pokemon's health was changed. |
abstract void |
informStatusApplied(Pokemon poke,
StatusEffect eff)
Inform that a status was applied to a pokemon. |
abstract void |
informStatusRemoved(Pokemon poke,
StatusEffect eff)
Inform that a status effect was removed from a pokemon. |
abstract void |
informSwitchInPokemon(int trainer,
Pokemon poke)
Inform that a pokemon was switched in. |
abstract void |
informUseMove(Pokemon poke,
java.lang.String name)
Inform that a pokemon used a move. |
abstract void |
informVictory(int winner)
Inform that a player has won. |
boolean |
isNarrationEnabled()
Return whether narration is enabled. |
abstract void |
queueMove(int trainer,
BattleTurn move)
Queue a move. |
abstract void |
refreshActivePokemon()
Refresh all active pokemon. |
void |
removeEffect(FieldEffect eff)
Remove a FieldEffect from this field. |
void |
replaceFaintedPokemon(int party,
int pokemon,
boolean search)
Replace a fainted pokemon. |
abstract void |
requestAndWaitForSwitch(int party)
Wait for a player to switch pokemon. |
protected abstract void |
requestMoves()
Request moves for the next turn. |
protected abstract void |
requestPokemonReplacement(int i)
Obtain a replacement pokemon for the team identified by the parameter. |
void |
setNarrationEnabled(boolean enabled)
Set whether to narrate the battle. |
protected void |
setPokemon(Pokemon[][] pokemon)
|
abstract void |
showMessage(java.lang.String message)
Narrate the battle. |
void |
switchInPokemon(int trainer,
int idx)
Switch in a pokemon and apply FieldEffects to it. |
void |
synchroniseFieldEffects()
Synchronise FieldEffects. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final int m_participants
protected Pokemon[][] m_pokemon
protected int[] m_active
Constructor Detail |
---|
public BattleField(BattleMechanics mech, Pokemon[][] pokemon)
protected BattleField(BattleMechanics mech)
Method Detail |
---|
public static MoveListEntry getStruggle()
public void addClause(Clause clause)
clause
- the clause to addpublic boolean isNarrationEnabled()
public void setNarrationEnabled(boolean enabled)
public double getEffectiveness(PokemonType move, PokemonType pokemon, boolean enemy)
public boolean allowsStatus(StatusEffect eff, Pokemon source, Pokemon target)
public void dispose()
public BattleMechanics getMechanics()
public java.util.Random getRandom()
protected void setPokemon(Pokemon[][] pokemon)
public Pokemon[] getParty(int idx) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
protected void attachField()
public Pokemon[] getActivePokemon()
public boolean applyEffect(FieldEffect eff)
public void synchroniseFieldEffects()
public void removeEffect(FieldEffect eff)
public FieldEffect getEffectByType(java.lang.Class type)
public java.util.ArrayList getEffectsByType(java.lang.Class type)
protected abstract void requestPokemonReplacement(int i)
public abstract void showMessage(java.lang.String message)
public abstract void refreshActivePokemon()
public int getPokemonTrainer(Pokemon p)
p
- a Pokemon who with 100% certainty belongs to one of the clientspublic abstract java.lang.String getTrainerName(int idx)
protected abstract void requestMoves()
public abstract void informPokemonHealthChanged(Pokemon poke, int change)
public abstract void informStatusApplied(Pokemon poke, StatusEffect eff)
public abstract void informStatusRemoved(Pokemon poke, StatusEffect eff)
public abstract void informSwitchInPokemon(int trainer, Pokemon poke)
public abstract void informPokemonFainted(int trainer, int idx)
public abstract void informUseMove(Pokemon poke, java.lang.String name)
poke
- the pokemon who used the movename
- the name of the move that was usedpublic void switchInPokemon(int trainer, int idx)
public abstract void informVictory(int winner)
public abstract void queueMove(int trainer, BattleTurn move) throws MoveQueueException
MoveQueueException
public abstract void requestAndWaitForSwitch(int party)
public Pokemon getOpponent(Pokemon p)
public void replaceFaintedPokemon(int party, int pokemon, boolean search)
public int getAliveCount(int idx)
public void checkBattleEnd(int i)
public void executeTurn(BattleTurn[] move)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |