PHP Code:
public function changeStatBase(object, stat, val) {
if (!(stat in {"health", "stamina"})) {
this.error(null, "Stat (#s) is not in the required stat list!", stat);
return;
}
object.(@ stat)[BASE] += val;
echo("STAT BASE: " @ object.(@ stat));
}
public function changeStatCurrent(object, stat, val) {
if (!(stat in {"health", "stamina"})) {
this.error(null, "Stat (#s) is not in the required stat list!", stat);
return;
}
object.(@ stat)[CURRENT] += val;
if (object.(@ stat)[CURRENT] > object.(@ stat)[TOTAL]) {
object.(@ stat)[CURRENT] = object.(@ stat)[TOTAL];
}
else if (object.(@ stat)[CURRENT] < object.(@ stat)[MIN]) {
object.(@ stat)[CURRENT] = object.(@ stat)[MIN];
}
echo("STAT CURRENT: " @ object.(@ stat));
}
Percent signs once again replaced with "#" signs.
These are my basic system functions for stat changing for example if someone were to do some damage this is where I go to reduce or increase health or another listed stat etc.