Constructor
new LevelProgression(configopt)
Parameters:
| Name | Type | Attributes | Description | ||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
config | Object | <optional> | Properties
|
Classes
Methods
(static) fromJSON(data) → {LevelProgression}
Restore from serialized state.
Parameters:
| Name | Type | Description |
|---|---|---|
data | Object |
Returns:
- Type:
- LevelProgression
applyToTarget(target)
Apply calculated stats to a Combatant or Stats component.
Parameters:
| Name | Type | Description |
|---|---|---|
target | Object |
experienceToNextLevel(levelopt) → {number}
Calculate experience needed to advance from given level to next.
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
level | number | <optional> | this.level |
Returns:
- Type:
- number
getCalculatedStats() → {Object}
Get computed total stats for the current level.
Returns:
- Type:
- Object
grantExperience(amount) → {Array}
Grant experience, potentially climbing multiple levels in one call.
Parameters:
| Name | Type | Description |
|---|---|---|
amount | number |
Returns:
Array of level numbers reached
- Type:
- Array
onProgression(listener) → {function}
Add a listener for progression events (level-up, exp-gained).
Parameters:
| Name | Type | Description |
|---|---|---|
listener | function |
Returns:
Unsubscribe function
- Type:
- function
toJSON() → {Object}
Create snapshot for serialization.
Returns:
- Type:
- Object