Class Stat
java.lang.Object
com.csse3200.game.components.stats.Stat
A simple class to hold values for stats to be tracked through the game.
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
Getter for the current stat valueGetter for the descriptionGetter for this.maxGetter for the statNamegetType()
Get the type of statboolean
hasMax()
Returns whether the stat has a Max valuetoString()
Convert stats json to a human-readable stringvoid
Event handling method that is called when an event is triggered
-
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
Getter for the statName- Returns:
- string statName
-
getStatDescription
Getter for the description- Returns:
- string description
-
getCurrent
public int getCurrent()Getter for the current stat value- Returns:
- int current
-
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
Event handling method that is called when an event is triggered- Parameters:
operation
- the operation to be used to change the statvalue
- the amount to change by
-
getType
Get the type of stat- Returns:
- the stat type
-
toString
Convert stats json to a human-readable string
-