Class CaptureValues

java.lang.Object
com.pixelmonmod.pixelmon.api.pokemon.catching.CaptureValues

public class CaptureValues extends Object
Variable encapsulation for CaptureMethod convenience. Allows variables to be passed through to different steps of the CaptureMethod, and also contains the end result of the capture attempt such as how many shakes occurred and whether the capture was critical.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
     
    static final String
     
    static final String
     
    static final String
     
    static final String
     
    static final String
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    CaptureValues(int catchRate, double ballBonus)
    Constructs a new CaptureValues with initial values set for the modified catch rate and ball bonus.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Adds a shake that will occur for the capture attempt this object is associated with.
    boolean
    Gets whether the capture attempt this object is associated with is allowed to be a critical capture or not.
    void
    Prevents the capture attempt this object is associated with from being a critical capture.
    void
    Allows the capture attempt this object is associated with to be a critical capture.
    double
    Gets the ball bonus of the capture attempt this object is associated with.
    int
    Gets the modified catch rate of the capture attempt this object is associated with.
    int
    Gets the number of shakes that will occur for the capture attempt this object is associated with.
    double
    Gets a variable for a specified key, or create a new variable with value 0 if not present.
    boolean
    Gets whether the capture attempt this object is associated with will succeed or not.
    boolean
    Gets whether the capture attempt this object is associated with is a critical capture or not.
    void
    setBallBonus(double ballBonus)
    Updates the ball bonus of the capture attempt this object is associated with, bound to 0 or greater.
    void
    setCanCritical(boolean canCritical)
    Sets whether the capture attempt this object is associated with can be a critical capture or not.
    void
    setCatchRate(int catchRate)
    Updates the modified catch rate of the capture attempt this object is associated with, bound between 1 and 255 inclusive.
    void
    Sets the capture attempt this object is associated with to succeed.
    void
    setCaught(boolean caught)
    Sets whether the capture attempt this object is associated with will succeed or not.
    void
    setCaught(int shakes)
    Sets the capture attempt this object is associated with to succeed, with a specified number of shakes.
    void
    Sets the capture attempt this object is associated with to be a critical capture.
    void
    setCritical(boolean critical)
    Sets whether the capture attempt this object is associated with is a critical capture or not.
    void
    setShakes(int shakes)
    Sets the number of shakes that will occur for the capture attempt this object is associated with.
    void
    setVariable(String key, double value)
    Sets a variable for a specified key.
    boolean
    trySetCaught(int targetShakes)
    Attempts to set the capture attempt this object is associated with to succeed, if the number of shakes equals or is greater than the specified target number.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • CaptureValues

      public CaptureValues(int catchRate, double ballBonus)
      Constructs a new CaptureValues with initial values set for the modified catch rate and ball bonus.
      Parameters:
      catchRate - The modified catch rate of this capture attempt.
      ballBonus - The ball bonus of this capture attempt.
  • Method Details

    • getCatchRate

      public int getCatchRate()
      Gets the modified catch rate of the capture attempt this object is associated with.
      Returns:
      The modified catch rate.
    • setCatchRate

      public void setCatchRate(int catchRate)
      Updates the modified catch rate of the capture attempt this object is associated with, bound between 1 and 255 inclusive.
    • getBallBonus

      public double getBallBonus()
      Gets the ball bonus of the capture attempt this object is associated with.
      Returns:
      The ball bonus.
    • setBallBonus

      public void setBallBonus(double ballBonus)
      Updates the ball bonus of the capture attempt this object is associated with, bound to 0 or greater.
    • disableCritical

      public void disableCritical()
      Prevents the capture attempt this object is associated with from being a critical capture.
    • enableCritical

      public void enableCritical()
      Allows the capture attempt this object is associated with to be a critical capture.
    • setCanCritical

      public void setCanCritical(boolean canCritical)
      Sets whether the capture attempt this object is associated with can be a critical capture or not.
      Parameters:
      canCritical - Whether the capture attempt can be a critical capture or not.
    • canCritical

      public boolean canCritical()
      Gets whether the capture attempt this object is associated with is allowed to be a critical capture or not.
      Returns:
      Whether the capture attempt can be a critical capture or not.
    • isCritical

      public boolean isCritical()
      Gets whether the capture attempt this object is associated with is a critical capture or not.
      Returns:
      Whether the capture attempt is a critical capture or not.
    • setCritical

      public void setCritical(boolean critical)
      Sets whether the capture attempt this object is associated with is a critical capture or not.
      Parameters:
      critical - Whether the capture attempt is a critical capture or not.
    • setCritical

      public void setCritical()
      Sets the capture attempt this object is associated with to be a critical capture.
    • getShakes

      public int getShakes()
      Gets the number of shakes that will occur for the capture attempt this object is associated with.
      Returns:
      The number of shakes.
    • setShakes

      public void setShakes(int shakes)
      Sets the number of shakes that will occur for the capture attempt this object is associated with.
      Parameters:
      shakes - The number of shakes.
    • addShake

      public void addShake()
      Adds a shake that will occur for the capture attempt this object is associated with.
    • isCaught

      public boolean isCaught()
      Gets whether the capture attempt this object is associated with will succeed or not.
      Returns:
      Whether the capture attempt will succeed.
    • setCaught

      public void setCaught(boolean caught)
      Sets whether the capture attempt this object is associated with will succeed or not.
      Parameters:
      caught - Whether the capture attempt will succeed.
    • setCaught

      public void setCaught()
      Sets the capture attempt this object is associated with to succeed.
    • setCaught

      public void setCaught(int shakes)
      Sets the capture attempt this object is associated with to succeed, with a specified number of shakes.
      Parameters:
      shakes - The number of shakes.
    • trySetCaught

      public boolean trySetCaught(int targetShakes)
      Attempts to set the capture attempt this object is associated with to succeed, if the number of shakes equals or is greater than the specified target number.
      Parameters:
      targetShakes - The number of shakes to equal or beat.
    • getVariable

      public double getVariable(String key)
      Gets a variable for a specified key, or create a new variable with value 0 if not present. The static Strings in this class are for use here.
      Parameters:
      key - The variable key.
      Returns:
      The variable value.
    • setVariable

      public void setVariable(String key, double value)
      Sets a variable for a specified key. The static Strings in this class are for use here.
      Parameters:
      key - The variable key.
      value - The new value for this variable.