new Stats()
Stats component for RPG character statistics. Includes health, stamina, and stat modifiers.
- Source
Extends
Members
health
Health reads the authoritative Combatant after binding and writes through its validated health path.
- Source
isAlive
Check if alive.
- Source
maxHealth
Maximum health mirrors Combatant while explicitly bound; standalone Stats retains legacy ownership.
- Source
(readonly) properties
The entity that this component is attached to.
- Inherited From
- Source
Methods
applyEffect(name, duration, modifier)
Apply a status effect.
| Name | Type | Description |
|---|---|---|
name | string | |
duration | number | Duration in seconds. |
modifier | Object | { stat: multiplier } |
- Source
bindCombatant()
Bind this legacy stat component to the authoritative Combatant health state.
- Source
deserialize(props)
Populates the component properties from a data object. Override this method for custom property handling.
| Name | Type | Description |
|---|---|---|
props | object | The properties object (usually from JSON). |
- Inherited From
- Source
getModifiedStat(statName) → {number}
Get stat with modifiers applied.
| Name | Type | Description |
|---|---|---|
statName | string |
- Source
- Type:
- number
heal(amount)
Heal health.
| Name | Type | Description |
|---|---|---|
amount | number |
- Source
regenStamina(amount)
Regenerate stamina.
| Name | Type | Description |
|---|---|---|
amount | number |
- Source
takeDamage(amount) → {number}
Take damage (reduced by defense).
| Name | Type | Description |
|---|---|---|
amount | number | Raw damage amount. |
- Source
Actual damage taken.
- Type:
- number
unbindCombatant()
Stop mirroring a Combatant, retaining the last authoritative health value.
- Source
updateEffects(deltaTime)
Update status effects.
| Name | Type | Description |
|---|---|---|
deltaTime | number |
- Source
useStamina(amount) → {boolean}
Use stamina.
| Name | Type | Description |
|---|---|---|
amount | number |
- Source
True if had enough stamina.
- Type:
- boolean