Class BattleStats

java.lang.Object
com.pixelmonmod.pixelmon.api.pokemon.stats.BattleStats

public class BattleStats extends Object
A Pokémon's stats while in battle.
  • Field Details

    • accuracy

      public int accuracy
      The Pokémon's accuracy modifier.
    • evasion

      public int evasion
      The Pokémon's evasion modifier.
    • attackModifier

      public int attackModifier
      The Pokémon's attack modifier.
    • defenseModifier

      public int defenseModifier
      The Pokémon's defense modifier.
    • specialAttackModifier

      public int specialAttackModifier
      The Pokémon's Special attack modifier.
    • specialDefenseModifier

      public int specialDefenseModifier
      The Pokémon's Special Defense modifier.
    • speedModifier

      public int speedModifier
      The Pokémon's speed modifier.
    • attackStat

      public int attackStat
      The Pokémon's attack stat.
    • defenseStat

      public int defenseStat
      The Pokémon's Defense stat.
    • specialAttackStat

      public int specialAttackStat
      The Pokémon's Special attack stat.
    • specialDefenseStat

      public int specialDefenseStat
      The Pokémon's Special Defense stat.
    • speedStat

      public int speedStat
      The Pokémon's speed stat.
  • Constructor Details

    • BattleStats

      public BattleStats(PixelmonWrapper pixelmon)
      Creates and resets BattleStats.
      Parameters:
      pixelmon - The Pokémon who the battle stats are attributed to.
    • BattleStats

      public BattleStats(BattleStats original)
      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

      public boolean modifyStat(int amount, BattleStatsType stat)
      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

      public boolean modifyStat(int amount, BattleStatsType... stats)
      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

      public boolean modifyStat(int[] amounts, BattleStatsType[] stats)
      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

      public boolean modifyStat(int amount, BattleStatsType[] stats, PixelmonWrapper user)
      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

      public boolean modifyStat(int amount, BattleStatsType stat, PixelmonWrapper user, boolean isAttack)
      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()
    • increaseCritStage

      public boolean increaseCritStage(int value, boolean isFocusEnergy)
      Attempts to increase critical hit ratio.
      Parameters:
      value - How much to increase critical hit ratio by.
      isFocusEnergy - Whether this is Focus Energy.
      Returns:
      Whether the increase was able to occur.
    • decreaseCritStage

      public boolean decreaseCritStage(int value)
      Attempts to increase critical hit ratio.
      Parameters:
      value - How much to increase critical hit ratio by.
      Returns:
      Whether the increase was able to occur.
    • getCritStage

      public int getCritStage()
      Returns critical hit ratio.
      Returns:
      Critical hit ratio.
    • 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

      public void changeStat(BattleStatsType stat, int value)
      Changes a stat to its value.
      Parameters:
      stat - The stat to change.
      value - The new value to change the stat to.
    • getStatFromEnum

      public int getStatFromEnum(BattleStatsType stat)
      Returns the stat modifier from the stat enum.
      Parameters:
      stat - The stat modifier to retrieve.
      Returns:
      The requested stat modifier.
    • getStatModFromEnum

      public int getStatModFromEnum(BattleStatsType stat)
      Returns the stat modifier from the stat enum.
      Parameters:
      stat - The stat modifier to retrieve.
      Returns:
      The requested stat modifier.
    • getStageEnum

      public BattleStatsType getStageEnum(int index)
      Returns the stat enum from the stage array index.
      Parameters:
      index - The stage array index.
      Returns:
      The requested stat enum.
    • getStage

      public int getStage(BattleStatsType stat)
      Returns the stage of a specified stat.
      Parameters:
      stat - The stat to get the stage for.
      Returns:
      The stage of the stat.
    • setStage

      public void setStage(BattleStatsType stat, int value)
      Sets the stage of a stat.
      Parameters:
      stat - The stat to change the stage of.
      value - The value to change the stage to.
    • swapStats

      public void swapStats(BattleStats otherPokemon, BattleStatsType... stats)
      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

      public void resetStat(BattleStatsType stat)
      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.
    • clearBattleStatsNoCrit

      public void clearBattleStatsNoCrit()
      Resets battle stats besides critical hit ratio.
    • resetLoweredBattleStats

      public void resetLoweredBattleStats()
    • copyStats

      public void copyStats(BattleStats battleStats)
      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

      public boolean statCanBeRaised(BattleStatsType stat)
      Determines whether the specified stat can be raised.
      Parameters:
      stat - The stat to be raised.
      Returns:
      Whether the stat can be raised
    • statCanBeLowered

      public boolean statCanBeLowered(BattleStatsType stat)
      Determines whether the specified stat can be lowered.
      Parameters:
      stat - The stat to be lowered.
      Returns:
      Whether the stat can be lowered
    • getPossibleStatIncreases

      public ArrayList<Integer> 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

      public double getModifierForStat(BattleStatsType type)
      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

      public String getStatStringLang(BattleStatsType stat)
      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

      public void getStatFailureMessage(BattleStatsType stat, boolean increase)
      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

      public int getStatWithMod(BattleStatsType stat)
      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

      public BattleStats copy()
    • toString

      public String toString()
      Overrides:
      toString in class Object