Class EVStore
java.lang.Object
com.pixelmonmod.pixelmon.api.pokemon.stats.EVStore
- All Implemented Interfaces:
IStatStore
Stores a Pokémon's EVs.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int[]
static final int
static final int
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
addEVsOfType
(BattleStatsType stat, int evIncrease, int maxValue) Adds EVs to a Pokémon from a vitamin or wing.boolean
berryEVs
(BattleStatsType stat) Reduces the Pokémon's EVs from a Berry.boolean
canSet
(BattleStatsType type, int value) Checks if the stat can be set to the valuecloneEVs()
Makes a copy of the Pokémon's EVs.void
Doubles all EV values.void
fillFromArray
(int... evs) Updates the given variables based on the array providedvoid
Adds EVs to the Pokémon.int[]
getArray()
Gets an array of the EVs in the store.int
Returns the number of remaining EVs the Pokémon can gain.int
getStat
(BattleStatsType type) Gets the EVs for a stat.void
Marks theEnumUpdateType.EVs
andEnumUpdateType.Stats
as dirty on the owner pokemonvoid
Allocates all EVs into random stats.readFromByteBuffer
(io.netty.buffer.ByteBuf buf) Reads the Pokemon's EVs from a ByteBuffervoid
readFromNBT
(net.minecraft.nbt.CompoundTag nbt) Reads the Pokémon's EVs from NBT.void
reset()
Resets all the stats to 0void
setStat
(BattleStatsType type, int value) Sets the EVs for a stat.boolean
vitaminEVs
(BattleStatsType stat) Adds EVs to a Pokémon from a vitamin.boolean
wingEVs
(BattleStatsType stat) Adds EVs to a Pokémon from a wing.withPokemon
(Pokemon pokemon) Sets the pokemon related to these EVsvoid
writeToByteBuffer
(io.netty.buffer.ByteBuf buf) Writes the Pokemon's EVs to a ByteBuffervoid
writeToNBT
(net.minecraft.nbt.CompoundTag nbt) Writes the Pokémon's EVs to NBT.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.pixelmonmod.pixelmon.api.pokemon.stats.IStatStore
addStat, getTotal, takeStat
-
Field Details
-
EMPTY
public static final int[] EMPTY -
MAX_EVS
public static final int MAX_EVS- See Also:
-
MAX_TOTAL_EVS
public static final int MAX_TOTAL_EVS- See Also:
-
-
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
-
-
Method Details
-
reset
public void reset()Description copied from interface:IStatStore
Resets all the stats to 0- Specified by:
reset
in interfaceIStatStore
-
withPokemon
Sets the pokemon related to these EVs- Parameters:
pokemon
- The new pokemon- Returns:
- This object
-
getStat
Gets the EVs for a stat.- Specified by:
getStat
in interfaceIStatStore
- Parameters:
type
- The stat to get EVs for.- Returns:
- The EV for the given stat.
-
setStat
Sets the EVs for a stat. This does not check if the total evs has surpassedMAX_TOTAL_EVS
- Specified by:
setStat
in interfaceIStatStore
- Parameters:
type
- The stat to get EVs for.value
- The value to set the EV to.
-
canSet
Description copied from interface:IStatStore
Checks if the stat can be set to the value- Specified by:
canSet
in interfaceIStatStore
- Parameters:
type
- The type being setvalue
- The value being set- Returns:
- If the stat can be set to the value
-
markDirty
public void markDirty()Marks theEnumUpdateType.EVs
andEnumUpdateType.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
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
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
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
Reduces the Pokémon's EVs from a Berry.- Parameters:
stat
- The stat to lower EVs in.- Returns:
- Whether EVs were lowered successfully
-
vitaminEVs
Adds EVs to a Pokémon from a vitamin.- Parameters:
stat
- The stat to raise EVs in.- Returns:
- Whether EVs were raised successfully.
-
wingEVs
Adds EVs to a Pokémon from a wing.- Parameters:
stat
- The stat to raise EVs in.- Returns:
- Whether EVs were raised successfully.
-
addEVsOfType
Adds EVs to a Pokémon from a vitamin or wing.- Parameters:
stat
- The stat to raise EVs in.evIncrease
- The amount to increase bymaxValue
- The max value before it can't increase- Returns:
- Whether EVs were raised successfully.
-
randomizeMaxEVs
public void randomizeMaxEVs()Allocates all EVs into random stats.
-