Class engine.generator.interface.ActorStats
Handles actors stats
Methods
engine.generator.interface.ActorStats:defineStat (name, short_name, default_value, min, max, desc)
Defines stats Static!
engine.generator.interface.ActorStats:init (t)
Initialises stats with default values if needed
engine.generator.interface.ActorStats:incStat (stat, val)
Increases a stat
engine.generator.interface.ActorStats:incIncStat (stat, val)
Increases a stat additional value
engine.generator.interface.ActorStats:getStat (stat, scale, raw, no_inc)
Gets a stat value Not that the engine also auto-defines stat specific methods on the form: self:getShortname().
engine.generator.interface.ActorStats:isStatMax (stat)
Is the stat maxed ?
engine.generator.interface.ActorStats:onStatChange (stat, v)
Notifies a change of stat value
Methods
- engine.generator.interface.ActorStats:defineStat (name, short_name, default_value, min, max, desc)
-
Defines stats
Static!
Parameters:
- name
- short_name
- default_value
- min
- max
- desc
- engine.generator.interface.ActorStats:init (t)
-
Initialises stats with default values if needed
Parameters:
- t
- engine.generator.interface.ActorStats:incStat (stat, val)
-
Increases a stat
Parameters:
- stat the stat id to change
- val the increment to add/subtract
- engine.generator.interface.ActorStats:incIncStat (stat, val)
-
Increases a stat additional value
Parameters:
- stat the stat id to change
- val the increment to add/subtract
- engine.generator.interface.ActorStats:getStat (stat, scale, raw, no_inc)
-
Gets a stat value
Not that the engine also auto-defines stat specific methods on the form: self:getShortname().
If you stat short name is STR then it becomes getStr()
Parameters:
- stat the stat id
- scale a scaling factor, nil means max stat value
- raw false if the scaled result must be rounded down
- no_inc if true it wont include stats gained by self.inc_stats
- engine.generator.interface.ActorStats:isStatMax (stat)
-
Is the stat maxed ?
Parameters:
- stat
- engine.generator.interface.ActorStats:onStatChange (stat, v)
-
Notifies a change of stat value
Parameters:
- stat
- v