Record Class EVYields

java.lang.Object
java.lang.Record
com.pixelmonmod.pixelmon.api.pokemon.species.evs.EVYields
Record Components:
hp - The BattleStatsType.HP yield.
attack - The BattleStatsType.ATTACK yield.
defense - The BattleStatsType.DEFENSE yield.
specialAttack - The BattleStatsType.SPECIAL_ATTACK yield.
specialDefense - The BattleStatsType.SPECIAL_DEFENSE yield.
speed - The BattleStatsType.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 EVsGainedEvent event and then using the methods provided in this class to set the new yields.
  • Constructor Summary

    Constructors
    Constructor
    Description
    EVYields(int[] yields)
    An ease of use constructor for creating a new EVYields object from an array of yields.
    EVYields(int hp, int attack, int defense, int specialAttack, int specialDefense, int speed)
    Creates an instance of a EVYields record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    addToAttack(int attack)
    Creates a new EVYields object with the given value added to the Attack yield
    addToDefense(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 yield
    addToSpecialAttack(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
    Returns the value of the attack record component.
    Creates a new EVYields object with the same values as this one.
    int
    Returns the value of the defense 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
    Gets the EV yield for the given stat.
    final int
    Returns a hash code value for this object.
    int
    hp()
    Returns the value of the hp record component.
    multiply(double multiplier)
    Creates a new EVYields object with all the values multiplied by the given multiplier.
    static EVYields
    Creates a new EVYields object with random values between 0 and 3.
    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 value
    setDefense(int defense)
    Creates a new EVYields object with the Defense set to the given value
    setHP(int hp)
    Creates a new EVYields object with the HP set to the given value
    setSpecialAttack(int specialAttack)
    Creates a new EVYields object with the Special Attack set to the given value
    setSpecialDefense(int specialDefense)
    Creates a new EVYields object with the Special Defense set to the given value
    setSpeed(int speed)
    Creates a new EVYields object with the Speed set to the given value
    setYield(BattleStatsType type, int amount)
    Creates a new EVYields object with the given value set to the given stat.
    int
    Returns the value of the specialAttack record component.
    int
    Returns the value of the specialDefense record component.
    int
    Returns the value of the speed record component.
    int[]
    Converts the EVYields object into an array of yields.
    final String
    Returns a string representation of this record class.
    static EVYields
    Creates a new EVYields object with all values set to 0.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • 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 following BattleStatsType expected ordering.
    • EVYields

      public EVYields(int hp, int attack, int defense, int specialAttack, int specialDefense, int speed)
      Creates an instance of a EVYields record class.
      Parameters:
      hp - the value for the hp record component
      attack - the value for the attack record component
      defense - the value for the defense record component
      specialAttack - the value for the specialAttack record component
      specialDefense - the value for the specialDefense record component
      speed - the value for the speed record component
  • Method Details

    • setHP

      public EVYields setHP(int hp)
      Creates a new EVYields object with the HP set to the given value
      Parameters:
      hp - The HP yield.
      Returns:
      The new EVYields instance
    • setAttack

      public EVYields setAttack(int attack)
      Creates a new EVYields object with the Attack set to the given value
      Parameters:
      attack - The Attack yield.
      Returns:
      The new EVYields instance
    • setDefense

      public EVYields setDefense(int defense)
      Creates a new EVYields object with the Defense set to the given value
      Parameters:
      defense - The Defense yield.
      Returns:
      The new EVYields instance
    • setSpecialAttack

      public EVYields setSpecialAttack(int specialAttack)
      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

      public EVYields setSpecialDefense(int specialDefense)
      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

      public EVYields setSpeed(int speed)
      Creates a new EVYields object with the Speed set to the given value
      Parameters:
      speed - The Speed yield.
      Returns:
      The new EVYields instance
    • addToHP

      public EVYields addToHP(int hp)
      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

      public EVYields addToAttack(int attack)
      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

      public EVYields addToDefense(int defense)
      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

      public EVYields addToSpecialAttack(int specialAttack)
      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

      public EVYields addToSpecialDefense(int specialDefense)
      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

      public EVYields addToSpeed(int speed)
      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

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

      public EVYields setYield(BattleStatsType type, int amount)
      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

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

      public EVYields multiply(double multiplier)
      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

      public EVYields 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 the BattleStatsType order.
      Returns:
      The array of yields.
    • copy

      public EVYields copy()
      Creates a new EVYields object with the same values as this one.
      Returns:
      The new EVYields instance
    • random

      public static EVYields random()
      Creates a new EVYields object with random values between 0 and 3.
      Returns:
      The new EVYields instance
    • zero

      public static EVYields zero()
      Creates a new EVYields object with all values set to 0.
      Returns:
      The new EVYields instance
    • toString

      public final String 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.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • 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.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • hp

      public int hp()
      Returns the value of the hp record component.
      Returns:
      the value of the hp record component
    • attack

      public int attack()
      Returns the value of the attack record component.
      Returns:
      the value of the attack record component
    • defense

      public int defense()
      Returns the value of the defense record component.
      Returns:
      the value of the defense record component
    • specialAttack

      public int specialAttack()
      Returns the value of the specialAttack record component.
      Returns:
      the value of the specialAttack record component
    • specialDefense

      public int specialDefense()
      Returns the value of the specialDefense record component.
      Returns:
      the value of the specialDefense record component
    • speed

      public int speed()
      Returns the value of the speed record component.
      Returns:
      the value of the speed record component