Class BattleStats
java.lang.Object
com.pixelmonmod.pixelmon.api.pokemon.stats.BattleStats
A Pokémon's stats while in battle.
-
Field Summary
Modifier and TypeFieldDescriptionint
The Pokémon's accuracy modifier.int
The Pokémon's attack modifier.int
The Pokémon's attack stat.int
The Pokémon's defense modifier.int
The Pokémon's Defense stat.int
The Pokémon's evasion modifier.int
The Pokémon's Special attack modifier.int
The Pokémon's Special attack stat.int
The Pokémon's Special Defense modifier.int
The Pokémon's Special Defense stat.int
The Pokémon's speed modifier.int
The Pokémon's speed stat. -
Constructor Summary
ConstructorDescriptionBattleStats
(BattleStats original) Saves a copy of another set of battle stats.BattleStats
(PixelmonWrapper pixelmon) Creates and resets BattleStats. -
Method Summary
Modifier and TypeMethodDescriptionvoid
changeStat
(BattleStatsType stat, int value) Changes a stat to its value.void
Resets battle-specific stats.void
clearBattleStats
(boolean init) Resets battle-specific stats.copy()
void
copyStats
(BattleStats battleStats) Copies all modifiers and stages.boolean
decreaseStat
(int amount, BattleStatsType stat, PixelmonWrapper user, boolean isAttack) boolean
decreaseStat
(int amount, BattleStatsType stat, PixelmonWrapper user, boolean isAttack, boolean messages) Decreases the given stat the amount of stages.int
GetAccOrEva
(double stage) Gets the new value of the stat.int
Returns accuracy modifier.int
Returns accuracy stage.double
Returns attack modifier.int[]
Returns all base stats (not counting multipliers).int[]
Returns all stats.int
Returns defense modifier.int
Returns evasion modifier.int
Returns evasion stage.double
Returns change in stat based on abilities, items, and statuses.double
Returns Special attack modifier.int
Returns Special defense modifier.double
Returns speed modifier.int
getStage
(BattleStatsType stat) Returns the stage of a specified stat.getStageEnum
(int index) Returns the stat enum from the stage array index.int[]
Returns all stat stages.static int
GetStat
(double stage) Gets the new value of the stat.void
getStatFailureMessage
(BattleStatsType stat, boolean increase) Sends a battle message saying the stat cannot be increased/decreased any further.int
Returns the stat modifier from the stat enum.int
Returns the stat modifier from the stat enum.Returns a string corresponding with lang entries for the stats.int
Calculates the specified stat with its modifier.int
Computes the total number of increased stages.int
Computes the net number of stage modifiers.boolean
increaseStat
(int amount, BattleStatsType stat, PixelmonWrapper user, boolean isAttack) Increases the given stat the amount of stages.boolean
increaseStat
(int amount, BattleStatsType stat, PixelmonWrapper user, boolean isAttack, boolean sendMessage) Increases the given stat the amount of stages.boolean
boolean
True if any stats were raised this turn.boolean
Checks if any stats have been modified.boolean
modifyStat
(int[] amounts, BattleStatsType[] stats) Modifies several stats by different amounts.boolean
modifyStat
(int[] amounts, BattleStatsType[] stats, PixelmonWrapper user, boolean isAttack) boolean
modifyStat
(int[] amounts, BattleStatsType[] stats, PixelmonWrapper user, boolean isAttack, boolean messages) Modifies several stats by different amounts.boolean
modifyStat
(int amount, BattleStatsType stat) Modifies a specified stat.boolean
modifyStat
(int amount, BattleStatsType... stats) Modifies several stats by the same amount.boolean
modifyStat
(int amount, BattleStatsType[] stats, PixelmonWrapper user) Modifies several stats by the same amount.boolean
modifyStat
(int amount, BattleStatsType stat, PixelmonWrapper cause) Modifies a specified stat.boolean
modifyStat
(int amount, BattleStatsType stat, PixelmonWrapper user, boolean isAttack) Modifies a specified stat.boolean
modifyStat
(int amount, BattleStatsType stat, PixelmonWrapper user, boolean isAttack, boolean messages) void
boolean
raiseRandomStat
(int amount) Raises a random stat.void
void
resetStat
(int index) Resets a specific stat.void
resetStat
(BattleStatsType stat) Resets a specific stat.void
Reverses all stat boosts.void
Update the battle stats of a new Pokémon with their current form.void
setLoweredThisTurn
(boolean loweredThisTurn) void
setRaisedThisTurn
(boolean raisedThisTurn) void
setStage
(BattleStatsType stat, int value) Sets the stage of a stat.void
setStatsForTurn
(int[] stats) Sets stats during a battle turn.boolean
Determines whether a stat can be lowered.boolean
Determines whether the specified stat can be lowered.boolean
Determines whether a stat can be raised.boolean
Determines whether the specified stat can be raised.boolean
statsCanChange
(PixelmonWrapper pw, PixelmonWrapper cause, boolean increase, BattleStatsType... stats) void
swapStats
(BattleStats otherPokemon, BattleStatsType... stats) Swaps the stats of the Pokémon and another Pokémon.toString()
-
Field Details
-
accuracy
public int accuracyThe Pokémon's accuracy modifier. -
evasion
public int evasionThe Pokémon's evasion modifier. -
attackModifier
public int attackModifierThe Pokémon's attack modifier. -
defenseModifier
public int defenseModifierThe Pokémon's defense modifier. -
specialAttackModifier
public int specialAttackModifierThe Pokémon's Special attack modifier. -
specialDefenseModifier
public int specialDefenseModifierThe Pokémon's Special Defense modifier. -
speedModifier
public int speedModifierThe Pokémon's speed modifier. -
attackStat
public int attackStatThe Pokémon's attack stat. -
defenseStat
public int defenseStatThe Pokémon's Defense stat. -
specialAttackStat
public int specialAttackStatThe Pokémon's Special attack stat. -
specialDefenseStat
public int specialDefenseStatThe Pokémon's Special Defense stat. -
speedStat
public int speedStatThe Pokémon's speed stat.
-
-
Constructor Details
-
BattleStats
Creates and resets BattleStats.- Parameters:
pixelmon
- The Pokémon who the battle stats are attributed to.
-
BattleStats
Saves a copy of another set of battle stats.- Parameters:
original
- The battle stats to save.
-
-
Method Details
-
getAccuracy
public int getAccuracy()Returns accuracy modifier.- Returns:
- Accuracy modifier.
-
getEvasion
public int getEvasion()Returns evasion modifier.- Returns:
- Evasion modifier.
-
getAttackModifier
public double getAttackModifier()Returns attack modifier.- Returns:
- attack modifier.
-
getDefenseModifier
public int getDefenseModifier()Returns defense modifier.- Returns:
- defense modifier.
-
getSpecialAttackModifier
public double getSpecialAttackModifier()Returns Special attack modifier.- Returns:
- Special attack modifier.
-
getSpecialDefenseModifier
public int getSpecialDefenseModifier()Returns Special defense modifier.- Returns:
- Special defense modifier.
-
getSpeedModifier
public double getSpeedModifier()Returns speed modifier.- Returns:
- speed modifier.
-
getAccuracyStage
public int getAccuracyStage()Returns accuracy stage.- Returns:
- Accuracy stage.
-
getEvasionStage
public int getEvasionStage()Returns evasion stage.- Returns:
- Evasion stage.
-
getStages
public int[] getStages()Returns all stat stages.- Returns:
- An array containing all stat stages.
-
modifyStat
Modifies a specified stat.- Parameters:
amount
- How much to raise or lower stat by.stat
- The stat to modify.- Returns:
- Whether the modification was able to occur.
-
modifyStat
Modifies a specified stat.- Parameters:
amount
- How much to raise or lower stat by.stat
- The stat to modify.cause
- The Pokemon causing the change- Returns:
- Whether the modification was able to occur.
-
modifyStat
Modifies several stats by the same amount.- Parameters:
amount
- How much to raise or lower the specified stats by.stats
- The stats to modify.- Returns:
- Whether a modification was able to occur.
-
modifyStat
Modifies several stats by different amounts.- Parameters:
amounts
- The amounts to modify each corresponding stat by.stats
- The stats to modify.- Returns:
- Whether a modification was able to occur.
-
modifyStat
Modifies several stats by the same amount.- Parameters:
amount
- How much to raise or lower the specified stats by.stats
- The stats to modify.user
- The Pokémon that caused the stat modification.- Returns:
- Whether a modification was able to occur.
-
modifyStat
public boolean modifyStat(int amount, BattleStatsType stat, PixelmonWrapper user, boolean isAttack, boolean messages) -
modifyStat
Modifies a specified stat.- Parameters:
amount
- How much to raise or lower stat by.stat
- The stat to modify.user
- The Pokémon that caused the stat modification.isAttack
- Whether the modification was from an attack.- Returns:
- Whether the modification was able to occur.
-
modifyStat
public boolean modifyStat(int[] amounts, BattleStatsType[] stats, PixelmonWrapper user, boolean isAttack) -
modifyStat
public boolean modifyStat(int[] amounts, BattleStatsType[] stats, PixelmonWrapper user, boolean isAttack, boolean messages) Modifies several stats by different amounts.- Parameters:
amounts
- The amounts to modify each corresponding stat by.stats
- The stats to modify.user
- The Pokémon that caused the stat modifications.isAttack
- Whether the modifications were from an attack.- Returns:
- Whether a modification was able to occur.
-
notifyActivePokemonOfStatChange
public void notifyActivePokemonOfStatChange() -
GetAccOrEva
public int GetAccOrEva(double stage) Gets the new value of the stat. Specific to accuracy or evasion.- Parameters:
stage
- The current stage of the stat (bounds of -6 to 6).- Returns:
- The new value for the stat.
-
GetStat
public static int GetStat(double stage) Gets the new value of the stat.- Parameters:
stage
- The current stage of the stat (bounds of -6 to 6).- Returns:
- The new value for the stat.
-
increaseStat
public boolean increaseStat(int amount, BattleStatsType stat, PixelmonWrapper user, boolean isAttack) Increases the given stat the amount of stages.- Parameters:
amount
- How much to increase the stat by.stat
- The stat to increase.user
- The Pokémon that caused the stat increase.isAttack
- Whether the stat increase was caused by an attack.- Returns:
- Whether the change was successful.
-
increaseStat
public boolean increaseStat(int amount, BattleStatsType stat, PixelmonWrapper user, boolean isAttack, boolean sendMessage) Increases the given stat the amount of stages.- Parameters:
amount
- How much to increase the stat by.stat
- The stat to increase.user
- The Pokémon that caused the stat increase.isAttack
- Whether the stat increase was caused by an attack.sendMessage
- Whether to send the message to the battle.- Returns:
- Whether the change was successful.
-
decreaseStat
public boolean decreaseStat(int amount, BattleStatsType stat, PixelmonWrapper user, boolean isAttack) -
decreaseStat
public boolean decreaseStat(int amount, BattleStatsType stat, PixelmonWrapper user, boolean isAttack, boolean messages) Decreases the given stat the amount of stages.- Parameters:
amount
- How much to decrease the stat by.stat
- The stat to decrease.user
- The Pokémon that caused the stat decrease.isAttack
- Whether the stat decrease was caused by an attack.- Returns:
- Whether the change was successful.
-
changeStat
Changes a stat to its value.- Parameters:
stat
- The stat to change.value
- The new value to change the stat to.
-
getStatFromEnum
Returns the stat modifier from the stat enum.- Parameters:
stat
- The stat modifier to retrieve.- Returns:
- The requested stat modifier.
-
getStatModFromEnum
Returns the stat modifier from the stat enum.- Parameters:
stat
- The stat modifier to retrieve.- Returns:
- The requested stat modifier.
-
getStageEnum
Returns the stat enum from the stage array index.- Parameters:
index
- The stage array index.- Returns:
- The requested stat enum.
-
getStage
Returns the stage of a specified stat.- Parameters:
stat
- The stat to get the stage for.- Returns:
- The stage of the stat.
-
setStage
Sets the stage of a stat.- Parameters:
stat
- The stat to change the stage of.value
- The value to change the stage to.
-
swapStats
Swaps the stats of the Pokémon and another Pokémon.- Parameters:
otherPokemon
- The other Pokémon.stats
- The stats to swap.
-
reverseStats
public void reverseStats()Reverses all stat boosts. -
resetStat
public void resetStat(int index) Resets a specific stat.- Parameters:
index
- The index of the stat to reset.
-
resetStat
Resets a specific stat.- Parameters:
stat
- The stat to reset.
-
clearBattleStats
public void clearBattleStats()Resets battle-specific stats. -
clearBattleStats
public void clearBattleStats(boolean init) Resets battle-specific stats.- Parameters:
init
- Whether to ignore the check for simulate mode.
-
resetLoweredBattleStats
public void resetLoweredBattleStats() -
copyStats
Copies all modifiers and stages.- Parameters:
battleStats
- The source stats to copy from.
-
isStatModified
public boolean isStatModified()Checks if any stats have been modified.- Returns:
- Whether any stats have been modified.
-
getSumIncreases
public int getSumIncreases()Computes the total number of increased stages.- Returns:
- The total number of increased stages.
-
getSumStages
public int getSumStages()Computes the net number of stage modifiers.- Returns:
- The net number of stage modifiers.
-
statCanBeRaised
public boolean statCanBeRaised()Determines whether a stat can be raised.- Returns:
- Whether any stat can be raised.
-
statCanBeLowered
public boolean statCanBeLowered()Determines whether a stat can be lowered.- Returns:
- Whether any stat can be lowered.
-
statCanBeRaised
Determines whether the specified stat can be raised.- Parameters:
stat
- The stat to be raised.- Returns:
- Whether the stat can be raised
-
statCanBeLowered
Determines whether the specified stat can be lowered.- Parameters:
stat
- The stat to be lowered.- Returns:
- Whether the stat can be lowered
-
statsCanChange
public boolean statsCanChange(PixelmonWrapper pw, PixelmonWrapper cause, boolean increase, BattleStatsType... stats) -
getPossibleStatIncreases
-
raiseRandomStat
public boolean raiseRandomStat(int amount) Raises a random stat.- Parameters:
amount
- The amount to raise the random stat by.- Returns:
- Whether a stat could be raised.
-
getBattleStats
public int[] getBattleStats()Returns all stats.- Returns:
- Array containing all stats.
-
getBaseBattleStats
public int[] getBaseBattleStats()Returns all base stats (not counting multipliers).- Returns:
- Array containing all base stats.
-
getModifierForStat
Returns change in stat based on abilities, items, and statuses.- Parameters:
type
- Which stat to get the modifier for.- Returns:
- Array containing all base stats.
-
setStatsForTurn
public void setStatsForTurn(int[] stats) Sets stats during a battle turn.- Parameters:
stats
- What to set the stats to.
-
getStatStringLang
Returns a string corresponding with lang entries for the stats.- Parameters:
stat
- The stat to get the lang entry for.- Returns:
- The lang entry.
-
getStatFailureMessage
Sends a battle message saying the stat cannot be increased/decreased any further.- Parameters:
stat
- The stat that cannot be modified.increase
- Whether the stat was supposed to be increased.
-
getStatWithMod
Calculates the specified stat with its modifier.- Parameters:
stat
- The stat to calculate.- Returns:
- The modified stat.
-
setLoweredThisTurn
public void setLoweredThisTurn(boolean loweredThisTurn) -
isLoweredThisTurn
public boolean isLoweredThisTurn() -
isRaisedThisTurn
public boolean isRaisedThisTurn()True if any stats were raised this turn. -
setRaisedThisTurn
public void setRaisedThisTurn(boolean raisedThisTurn) -
setBattleStatsForCurrentForm
public void setBattleStatsForCurrentForm()Update the battle stats of a new Pokémon with their current form. This should be called everytime a Pokémon changes form in battle. -
copy
-
toString
-