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

      public void gainEV(EVYields evYields)
      Adds EVs to the Pokémon.
      Parameters:
      evYields - The amount of EVs gained.
    • 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.
    • randomizeMaxEVs

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