Record Class EVYields
java.lang.Object
java.lang.Record
com.pixelmonmod.pixelmon.api.pokemon.species.evs.EVYields
- Record Components:
hp
- TheBattleStatsType.HP
yield.attack
- TheBattleStatsType.ATTACK
yield.defense
- TheBattleStatsType.DEFENSE
yield.specialAttack
- TheBattleStatsType.SPECIAL_ATTACK
yield.specialDefense
- TheBattleStatsType.SPECIAL_DEFENSE
yield.speed
- TheBattleStatsType.SPEED
yield.
public record EVYields(int hp, int attack, int defense, int specialAttack, int specialDefense, int speed)
extends Record
Immutable class containing the EV Yields of a Pokemon's form.
If you wish to modify the yields you should look at using the
If you wish to modify the yields you should look at using the
EVsGainedEvent
event and then using the methods provided in this class to set the new yields.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionaddToAttack
(int attack) Creates a new EVYields object with the given value added to the Attack yieldaddToDefense
(int defense) Creates a new EVYields object with the given value added to the Defense yield.addToHP
(int hp) Creates a new EVYields object with the given value added to the HP yieldaddToSpecialAttack
(int specialAttack) Creates a new EVYields object with the given value added to the Special Attack yield.addToSpecialDefense
(int specialDefense) Creates a new EVYields object with the given value added to the Special Defense yield.addToSpeed
(int speed) Creates a new EVYields object with the given value added to the Speed yield.addToYield
(BattleStatsType stat, int amount) Creates a new EVYields object with the given value added to the given stat.int
attack()
Returns the value of theattack
record component.copy()
Creates a new EVYields object with the same values as this one.int
defense()
Returns the value of thedefense
record component.Creates a new EVYields object with all the values multiplied by 2.final boolean
Indicates whether some other object is "equal to" this one.int
getYield
(BattleStatsType stat) Gets the EV yield for the given stat.final int
hashCode()
Returns a hash code value for this object.int
hp()
Returns the value of thehp
record component.multiply
(double multiplier) Creates a new EVYields object with all the values multiplied by the given multiplier.static EVYields
random()
Creates a new EVYields object with random values between 0 and 3.set
(BiFunction<BattleStatsType, Integer, Integer> handler) Creates a new EVYields object applying the given handler function to each yield before setting it.setAttack
(int attack) Creates a new EVYields object with the Attack set to the given valuesetDefense
(int defense) Creates a new EVYields object with the Defense set to the given valuesetHP
(int hp) Creates a new EVYields object with the HP set to the given valuesetSpecialAttack
(int specialAttack) Creates a new EVYields object with the Special Attack set to the given valuesetSpecialDefense
(int specialDefense) Creates a new EVYields object with the Special Defense set to the given valuesetSpeed
(int speed) Creates a new EVYields object with the Speed set to the given valuesetYield
(BattleStatsType type, int amount) Creates a new EVYields object with the given value set to the given stat.int
Returns the value of thespecialAttack
record component.int
Returns the value of thespecialDefense
record component.int
speed()
Returns the value of thespeed
record component.int[]
toArray()
Converts the EVYields object into an array of yields.final String
toString()
Returns a string representation of this record class.static EVYields
zero()
Creates a new EVYields object with all values set to 0.
-
Constructor Details
-
EVYields
public EVYields(int[] yields) An ease of use constructor for creating a new EVYields object from an array of yields.- Parameters:
yields
- The array of yields to use followingBattleStatsType
expected ordering.
-
EVYields
public EVYields(int hp, int attack, int defense, int specialAttack, int specialDefense, int speed) Creates an instance of aEVYields
record class.- Parameters:
hp
- the value for thehp
record componentattack
- the value for theattack
record componentdefense
- the value for thedefense
record componentspecialAttack
- the value for thespecialAttack
record componentspecialDefense
- the value for thespecialDefense
record componentspeed
- the value for thespeed
record component
-
-
Method Details
-
setHP
Creates a new EVYields object with the HP set to the given value- Parameters:
hp
- The HP yield.- Returns:
- The new EVYields instance
-
setAttack
Creates a new EVYields object with the Attack set to the given value- Parameters:
attack
- The Attack yield.- Returns:
- The new EVYields instance
-
setDefense
Creates a new EVYields object with the Defense set to the given value- Parameters:
defense
- The Defense yield.- Returns:
- The new EVYields instance
-
setSpecialAttack
Creates a new EVYields object with the Special Attack set to the given value- Parameters:
specialAttack
- The Special Attack yield.- Returns:
- The new EVYields instance
-
setSpecialDefense
Creates a new EVYields object with the Special Defense set to the given value- Parameters:
specialDefense
- The Special Defense yield.- Returns:
- The new EVYields instance
-
setSpeed
Creates a new EVYields object with the Speed set to the given value- Parameters:
speed
- The Speed yield.- Returns:
- The new EVYields instance
-
addToHP
Creates a new EVYields object with the given value added to the HP yield- Parameters:
hp
- The amount to add to the HP yield.- Returns:
- The new EVYields instance
-
addToAttack
Creates a new EVYields object with the given value added to the Attack yield- Parameters:
attack
- The amount to add to the Attack yield.- Returns:
- The new EVYields instance
-
addToDefense
Creates a new EVYields object with the given value added to the Defense yield.- Parameters:
defense
- The amount to add to the Defense yield.- Returns:
- The new EVYields instance
-
addToSpecialAttack
Creates a new EVYields object with the given value added to the Special Attack yield.- Parameters:
specialAttack
- The amount to add to the Special Attack yield.- Returns:
- The new EVYields instance
-
addToSpecialDefense
Creates a new EVYields object with the given value added to the Special Defense yield.- Parameters:
specialDefense
- The amount to add to the Special Defense yield.- Returns:
- The new EVYields instance
-
addToSpeed
Creates a new EVYields object with the given value added to the Speed yield.- Parameters:
speed
- The amount to add to the Speed yield.- Returns:
- The new EVYields instance
-
set
Creates a new EVYields object applying the given handler function to each yield before setting it.- Parameters:
handler
- The handler function to modify the yields.- Returns:
- The new EVYields instance
-
getYield
Gets the EV yield for the given stat.- Parameters:
stat
- The stat to get the yield for.- Returns:
- The yield for the given stat.
-
setYield
Creates a new EVYields object with the given value set to the given stat.- Parameters:
type
- The stat to set the yield for.amount
- The amount to set the yield to.- Returns:
- The new EVYields instance
-
addToYield
Creates a new EVYields object with the given value added to the given stat.- Parameters:
stat
- The stat to add the yield to.amount
- The amount to add to the yield.- Returns:
- The new EVYields instance
-
multiply
Creates a new EVYields object with all the values multiplied by the given multiplier.- Parameters:
multiplier
- The multiplier to multiply the yields by.- Returns:
- The new EVYields instance
-
doubleYields
Creates a new EVYields object with all the values multiplied by 2.- Returns:
- The new EVYields instance
-
toArray
public int[] toArray()Converts the EVYields object into an array of yields.
The order follows theBattleStatsType
order.- Returns:
- The array of yields.
-
copy
Creates a new EVYields object with the same values as this one.- Returns:
- The new EVYields instance
-
random
Creates a new EVYields object with random values between 0 and 3.- Returns:
- The new EVYields instance
-
zero
Creates a new EVYields object with all values set to 0.- Returns:
- The new EVYields instance
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with '=='. -
hp
public int hp()Returns the value of thehp
record component.- Returns:
- the value of the
hp
record component
-
attack
public int attack()Returns the value of theattack
record component.- Returns:
- the value of the
attack
record component
-
defense
public int defense()Returns the value of thedefense
record component.- Returns:
- the value of the
defense
record component
-
specialAttack
public int specialAttack()Returns the value of thespecialAttack
record component.- Returns:
- the value of the
specialAttack
record component
-
specialDefense
public int specialDefense()Returns the value of thespecialDefense
record component.- Returns:
- the value of the
specialDefense
record component
-
speed
public int speed()Returns the value of thespeed
record component.- Returns:
- the value of the
speed
record component
-