java.lang.Object
com.pixelmonmod.pixelmon.api.pokemon.stats.EVStore
All Implemented Interfaces:
IStatStore

public class EVStore extends Object implements IStatStore
Stores a Pokémon's EVs.
  • Field Details

  • Constructor Details

    • EVStore

      public EVStore()
      Initializes an EV store with 0 EVs.
    • EVStore

      public EVStore(int... evs)
      Initializes an EV store.
      Parameters:
      evs - The EVs to initializes the store to.
    • EVStore

      public EVStore(HashMap<BattleStatsType,Integer> evGain)
  • Method Details

    • reset

      public void reset()
      Description copied from interface: IStatStore
      Resets all the stats to 0
      Specified by:
      reset in interface IStatStore
    • withPokemon

      public EVStore withPokemon(Pokemon pokemon)
      Sets the pokemon related to these EVs
      Parameters:
      pokemon - The new pokemon
      Returns:
      This object
    • getStat

      public int getStat(BattleStatsType type)
      Gets the EVs for a stat.
      Specified by:
      getStat in interface IStatStore
      Parameters:
      type - The stat to get EVs for.
      Returns:
      The EV for the given stat.
    • setStat

      public void setStat(BattleStatsType type, int value)
      Sets the EVs for a stat. This does not check if the total evs has surpassed MAX_TOTAL_EVS
      Specified by:
      setStat in interface IStatStore
      Parameters:
      type - The stat to get EVs for.
      value - The value to set the EV to.
    • canSet

      public boolean canSet(BattleStatsType type, int value)
      Description copied from interface: IStatStore
      Checks if the stat can be set to the value
      Specified by:
      canSet in interface IStatStore
      Parameters:
      type - The type being set
      value - The value being set
      Returns:
      If the stat can be set to the value
    • markDirty

      public void markDirty()
      Marks the EnumUpdateType.EVs and EnumUpdateType.Stats as dirty on the owner pokemon
    • fillFromArray

      public void fillFromArray(int... evs)
      Updates the given variables based on the array provided
      Parameters:
      evs - The new ev values
    • gainEV

      @Deprecated(since="9.2.11", forRemoval=true) public void gainEV(EVYields evYields)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Adds EVs to the Pokémon.
      Parameters:
      evYields - The amount of EVs gained.
    • calculateEVYieldsWithinMaximumLimits

      public EVYields calculateEVYieldsWithinMaximumLimits(EVYields evYields)
      Takes the EVYields after all the extra EVs from Macho Brace, Power Items, and Pokérus have been added, and then subtracts any EVs in the EVYields that won't be able to be added due to either a stat reaching the maximum number of EVs for a stat (252) or the Pokémon reaching the maximum number of EVs a Pokémon can have (510).
      Parameters:
      evYields - The EVs that a Pokémon is expected to gain.
      Returns:
      A EVYields that excludes EVs that go over the maximum limit.
    • gainEVYields

      public EVYields gainEVYields(EVYields evYields)
      Adds EVs to the Pokémon.
      Parameters:
      evYields - The amount of EVs expected to be gained.
      Returns:
      An EVYields of the EVs that were actually gained, after staying within the maximum amount of EVs that could be had for each stat and in total.
    • getRemainingEVs

      public int getRemainingEVs()
      Returns the number of remaining EVs the Pokémon can gain.
      Returns:
      The number of remaining EVs the Pokémon can gain.
    • writeToNBT

      public void writeToNBT(net.minecraft.nbt.CompoundTag nbt)
      Writes the Pokémon's EVs to NBT.
      Parameters:
      nbt - The NBT tag to write to.
    • readFromNBT

      public void readFromNBT(net.minecraft.nbt.CompoundTag nbt)
      Reads the Pokémon's EVs from NBT.
      Parameters:
      nbt - The NBT tag to read from.
    • writeToByteBuffer

      public void writeToByteBuffer(io.netty.buffer.ByteBuf buf)
      Writes the Pokemon's EVs to a ByteBuffer
      Parameters:
      buf - The byte buffer
    • readFromByteBuffer

      public EVStore readFromByteBuffer(io.netty.buffer.ByteBuf buf)
      Reads the Pokemon's EVs from a ByteBuffer
      Parameters:
      buf - The byte buffer
      Returns:
      The ev store
    • getArray

      public int[] getArray()
      Gets an array of the EVs in the store.
      Returns:
      An array of the EVs in the store.
    • cloneEVs

      public EVStore cloneEVs()
      Makes a copy of the Pokémon's EVs.
      Returns:
      A copy of the Pokémon's EVs.
    • doubleValues

      public void doubleValues()
      Doubles all EV values.
    • berryEVs

      public boolean berryEVs(BattleStatsType stat)
      Reduces the Pokémon's EVs from a Berry.
      Parameters:
      stat - The stat to lower EVs in.
      Returns:
      Whether EVs were lowered successfully
    • vitaminEVs

      public boolean vitaminEVs(BattleStatsType stat)
      Adds EVs to a Pokémon from a vitamin.
      Parameters:
      stat - The stat to raise EVs in.
      Returns:
      Whether EVs were raised successfully.
    • wingEVs

      public boolean wingEVs(BattleStatsType stat)
      Adds EVs to a Pokémon from a wing.
      Parameters:
      stat - The stat to raise EVs in.
      Returns:
      Whether EVs were raised successfully.
    • addEVsOfType

      public boolean addEVsOfType(BattleStatsType stat, int evIncrease, int maxValue)
      Adds EVs to a Pokémon from a vitamin or wing.
      Parameters:
      stat - The stat to raise EVs in.
      evIncrease - The amount to increase by
      maxValue - The max value before it can't increase
      Returns:
      Whether EVs were raised successfully.
    • subtractEVsOfType

      public boolean subtractEVsOfType(BattleStatsType stat, int evDecrease, int minValue)
      Subtracts EVs from a Pokémon.
      Parameters:
      stat - The stat to lower EVs in.
      evDecrease - The positive amount to decrease by
      minValue - The min value before it can't decrease
      Returns:
      Whether EVs were lowered successfully.
    • randomizeMaxEVs

      public void randomizeMaxEVs()
      Allocates all EVs into random stats.
    • getPerilousSoupEVYield

      public EVYields getPerilousSoupEVYield()