java.lang.Object
com.csse3200.game.components.stats.Stat

public class Stat extends Object
A simple class to hold values for stats to be tracked through the game.
  • Constructor Details

    • Stat

      public Stat()
      Create no arg function for serialisation
    • Stat

      public Stat(String statName, String description, int current, Integer statMax, Boolean hasMax, Stat.StatType type)
      Constructor for a stat
  • Method Details

    • getStatName

      public String getStatName()
      Getter for the statName
      Returns:
      string statName
    • getStatDescription

      public String getStatDescription()
      Getter for the description
      Returns:
      string description
    • getCurrent

      public int getCurrent()
      Getter for the current stat value
      Returns:
      int current
    • getStatMax

      public Integer getStatMax()
      Getter for this.max
      Returns:
      the value of max, or -1 if hasMax == false
    • hasMax

      public boolean hasMax()
      Returns whether the stat has a Max value
      Returns:
      boolean hasMax
    • update

      public void update(String operation, int value)
      Event handling method that is called when an event is triggered
      Parameters:
      operation - the operation to be used to change the stat
      value - the amount to change by
    • getType

      public Stat.StatType getType()
      Get the type of stat
      Returns:
      the stat type
    • toString

      public String toString()
      Convert stats json to a human-readable string
      Overrides:
      toString in class Object
      Returns:
      human-readable stats string