mechanics.statuses
Class StatusEffect

java.lang.Object
  extended by mechanics.statuses.StatusEffect
All Implemented Interfaces:
java.lang.Cloneable
Direct Known Subclasses:
AwesomeEffect, BurnEffect, ChargeEffect, ConfuseEffect, FieldEffect, FlinchEffect, FreezeEffect, IntrinsicAbility, MoveList.AttractEffect, MoveList.CoEffect, MoveList.EndureEffect, MoveList.FixedAttackEffect, MoveList.LockOnEffect, MoveList.SubstituteEffect, MoveList.TrappingEffect, MultipleStatChangeEffect, ParalysisEffect, PercentEffect, PoisonEffect, SleepEffect, StatChangeEffect

public abstract class StatusEffect
extends java.lang.Object
implements java.lang.Cloneable

This class represents a change in status of a pokemon.


Field Summary
protected  int m_lock
           
static int SPECIAL_EFFECT_LOCK
          A pokemon can have only one of freeze, burn, sleep, paralysis, and poison, so we protect against this by giving this class of effects a designated lock called SPECIAL_EFFECT_LOCK.
static int STATE_ACTIVE
          States of a StatusEffect.
static int STATE_DEACTIVATED
           
static int STATE_REMOVABLE
           
static int WEATHER_EFFECT_LOCK
          There can be only be only weather effect in play.
 
Constructor Summary
StatusEffect()
           
 
Method Summary
 void activate()
          Activate this status effect, unless it is removable.
 boolean apply(Pokemon p)
          Applies the initial effects of the status to a pokemon but does not add the status to the list of statuses the pokemon has.
 boolean apply(Pokemon source, Pokemon p)
          The point of this method is to catch errors.
 void beginTick()
          Begin ticking this effect.
 boolean canSwitch()
          This method catches errors.
 boolean canSwitch(Pokemon p)
          Return whether this status effect allows switching.
 java.lang.Object clone()
          Clone this status effect.
 void deactivate()
          Deactivate this status effect, unless it is removable.
 boolean deactivates(Pokemon p)
          Determine whether this effect deactivates a pokemon.
 void disable()
          Disable this status effect (i.e.
 boolean equals(java.lang.Object eff)
          Determine whether two status effects are equal semantically.
 void executeTurn(Pokemon p, BattleTurn turn)
          This method is called when the pokemon to whom the status effect is applied is just about to execute his turn.
 java.lang.String getDescription()
          Get a description of this status effect.
 double getEffectiveness(PokemonType move, PokemonType pokemon, boolean enemy)
          Get transformed effectiveness based on this status effect.
protected  double getEnemyTransformedEffectiveness(PokemonType move, PokemonType pokemon)
           
protected  MoveListEntry getEnemyTransformedMove(Pokemon p, MoveListEntry move)
           
 Pokemon getInducer()
          Get the pokemon who induced this effect.
 int getLock()
          Get the lock of this effect.
 MoveListEntry getMove(Pokemon p, MoveListEntry move, boolean enemy)
          Transform a move based on this status effect.
 java.lang.String getName()
          Get the name of this status effect.
 int getTier()
          Remove the tier of the after-turn effect.
static int getTierCount()
          Return the total number of tiers.
protected  double getTransformedEffectiveness(PokemonType move, PokemonType pokemon)
           
protected  MoveListEntry getTransformedMove(Pokemon p, MoveListEntry move)
           
 boolean hitsThroughSubstitute()
          Return whether this status effect can apply statuses through a substitute.
 boolean immobilises(Pokemon poke)
          Return whether this effect immobilises the pokemon.
 void informDamaged(Pokemon source, Pokemon target, MoveListEntry move, int damage)
          React to damage.
 void informDuplicateEffect(Pokemon p)
          Inform that this effect was applied, unsuccessfully, a second time.
 boolean isActive()
          Is this status effect active?
 boolean isEffectivenessTransformer(boolean enemy)
          Does this status effect transform effectivenesses?
 boolean isExclusiveWith(StatusEffect eff)
          Return whether this effect can coexist with another effect.
 boolean isListener()
          Return whether this effect listens for damage.
 boolean isMoveTransformer(boolean enemy)
          Returns true if this status effect is capable of transforming moves.
 boolean isPassable()
          Can this status effect by baton passed? (Almost all can.)
 boolean isRemovable()
          Is this status effect waiting to be removed?
 boolean isSingleton()
          Determine whether this effect is a singleton -- i.e., whether only a single copy of it can be present on a pokemon.
 void setInducer(Pokemon p)
          Set the pokemon who induced this effect.
 void switchIn(Pokemon p)
          Called when a pokemon with this status effect switches in.
 boolean switchOut(Pokemon p)
          Called when a pokemon with this status effect switches out.
 boolean tick(Pokemon p)
          Called each turn that this status effect is applied to a pokemon.
 void unapply(Pokemon p)
          Unapply this status effect.
 boolean vetoesMove(Pokemon p, MoveListEntry entry)
          Returns whether this status effect vetoes the choice of a particular move.
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SPECIAL_EFFECT_LOCK

public static final int SPECIAL_EFFECT_LOCK
A pokemon can have only one of freeze, burn, sleep, paralysis, and poison, so we protect against this by giving this class of effects a designated lock called SPECIAL_EFFECT_LOCK.

See Also:
Constant Field Values

WEATHER_EFFECT_LOCK

public static final int WEATHER_EFFECT_LOCK
There can be only be only weather effect in play.

See Also:
Constant Field Values

STATE_ACTIVE

public static final int STATE_ACTIVE
States of a StatusEffect.

See Also:
Constant Field Values

STATE_DEACTIVATED

public static final int STATE_DEACTIVATED
See Also:
Constant Field Values

STATE_REMOVABLE

public static final int STATE_REMOVABLE
See Also:
Constant Field Values

m_lock

protected int m_lock
Constructor Detail

StatusEffect

public StatusEffect()
Method Detail

setInducer

public void setInducer(Pokemon p)
Set the pokemon who induced this effect.


getInducer

public Pokemon getInducer()
Get the pokemon who induced this effect.


getLock

public int getLock()
Get the lock of this effect.


getName

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


getTierCount

public static final int getTierCount()
Return the total number of tiers. There will be six tiers eventually. This could also differ based on the mechanics used.


isPassable

public boolean isPassable()
Can this status effect by baton passed? (Almost all can.)


isExclusiveWith

public boolean isExclusiveWith(StatusEffect eff)
Return whether this effect can coexist with another effect.

Parameters:
eff - the effect to test exclusiveness with

disable

public final void disable()
Disable this status effect (i.e. mark it as removable). This cannot be undone.


deactivate

public final void deactivate()
Deactivate this status effect, unless it is removable.


activate

public final void activate()
Activate this status effect, unless it is removable.


isActive

public final boolean isActive()
Is this status effect active?


isRemovable

public final boolean isRemovable()
Is this status effect waiting to be removed?


clone

public java.lang.Object clone()
Clone this status effect.

Overrides:
clone in class java.lang.Object

immobilises

public boolean immobilises(Pokemon poke)
Return whether this effect immobilises the pokemon.


getDescription

public java.lang.String getDescription()
Get a description of this status effect.


tick

public boolean tick(Pokemon p)
Called each turn that this status effect is applied to a pokemon. Returns whether the status was removed.


getTier

public int getTier()
Remove the tier of the after-turn effect.


switchIn

public void switchIn(Pokemon p)
Called when a pokemon with this status effect switches in.


switchOut

public boolean switchOut(Pokemon p)
Called when a pokemon with this status effect switches out. Returns true if the status effect should be removed.


unapply

public void unapply(Pokemon p)
Unapply this status effect.


apply

public final boolean apply(Pokemon source,
                           Pokemon p)
The point of this method is to catch errors.


apply

public boolean apply(Pokemon p)
Applies the initial effects of the status to a pokemon but does not add the status to the list of statuses the pokemon has.


hitsThroughSubstitute

public boolean hitsThroughSubstitute()
Return whether this status effect can apply statuses through a substitute.


isEffectivenessTransformer

public boolean isEffectivenessTransformer(boolean enemy)
Does this status effect transform effectivenesses?


executeTurn

public void executeTurn(Pokemon p,
                        BattleTurn turn)
This method is called when the pokemon to whom the status effect is applied is just about to execute his turn.


getEffectiveness

public final double getEffectiveness(PokemonType move,
                                     PokemonType pokemon,
                                     boolean enemy)
Get transformed effectiveness based on this status effect.

Parameters:
move - type of the move
pokemon - type of the pokemon
enemy - whether the Pokemon using the move is an enemy

getTransformedEffectiveness

protected double getTransformedEffectiveness(PokemonType move,
                                             PokemonType pokemon)

getEnemyTransformedEffectiveness

protected double getEnemyTransformedEffectiveness(PokemonType move,
                                                  PokemonType pokemon)

getMove

public final MoveListEntry getMove(Pokemon p,
                                   MoveListEntry move,
                                   boolean enemy)
Transform a move based on this status effect.

Parameters:
move - the move to transform; the method is free to modify it although it may also return a new MoveListEntry
enemy - whether the Pokemon p is an enemy
Returns:
the transformed move

getEnemyTransformedMove

protected MoveListEntry getEnemyTransformedMove(Pokemon p,
                                                MoveListEntry move)

getTransformedMove

protected MoveListEntry getTransformedMove(Pokemon p,
                                           MoveListEntry move)

isMoveTransformer

public boolean isMoveTransformer(boolean enemy)
Returns true if this status effect is capable of transforming moves.

Parameters:
enemy - whether this is an enemy move

isListener

public boolean isListener()
Return whether this effect listens for damage.


informDamaged

public void informDamaged(Pokemon source,
                          Pokemon target,
                          MoveListEntry move,
                          int damage)
React to damage.


deactivates

public boolean deactivates(Pokemon p)
Determine whether this effect deactivates a pokemon.


equals

public boolean equals(java.lang.Object eff)
Determine whether two status effects are equal semantically.

Overrides:
equals in class java.lang.Object

isSingleton

public boolean isSingleton()
Determine whether this effect is a singleton -- i.e., whether only a single copy of it can be present on a pokemon.


informDuplicateEffect

public void informDuplicateEffect(Pokemon p)
Inform that this effect was applied, unsuccessfully, a second time.


canSwitch

public boolean canSwitch(Pokemon p)
Return whether this status effect allows switching.


canSwitch

public boolean canSwitch()
This method catches errors.


vetoesMove

public boolean vetoesMove(Pokemon p,
                          MoveListEntry entry)
Returns whether this status effect vetoes the choice of a particular move.


beginTick

public void beginTick()
Begin ticking this effect.