fix: clamp stats between 0 and max value
This commit is contained in:
parent
b80b96a3a0
commit
7cd99495ba
@ -33,11 +33,11 @@ public class Stat {
|
||||
}
|
||||
|
||||
public void increaseValue(int value) {
|
||||
this.value += value;
|
||||
this.value = Math.min(this.max, this.value + value);
|
||||
}
|
||||
|
||||
public void decreaseValue(int value) {
|
||||
this.value -= value;
|
||||
this.value = Math.max(0, this.value - value);
|
||||
}
|
||||
|
||||
public int getMax() {
|
||||
|
Loading…
Reference in New Issue
Block a user