new Effect()
Listens to Events:
Properties:
Name | Type | Description | |||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
config |
object | Effect configuration (name/desc/duration/etc.) Properties
|
|||||||||||||||||||||||||||
description |
string | ||||||||||||||||||||||||||||
duration |
number | Total duration of effect in milliseconds |
|||||||||||||||||||||||||||
elapsed |
number | Get elapsed time in milliseconds |
|||||||||||||||||||||||||||
id |
string | filename minus .js |
|||||||||||||||||||||||||||
modifiers |
EffectModifiers | Attribute modifier functions |
|||||||||||||||||||||||||||
name |
string | ||||||||||||||||||||||||||||
remaining |
number | Number of seconds remaining |
|||||||||||||||||||||||||||
startedAt |
number | Date.now() time this effect became active |
|||||||||||||||||||||||||||
state |
object | Configuration of this type of effect (magnitude, element, stat, etc.) |
|||||||||||||||||||||||||||
target |
Character | Character this effect is... effecting |
Extends
- EventEmitter
Members
-
description :string
-
-
duration :number
-
-
elapsed :number
-
Elapsed time in milliseconds since event was activated
-
name :string
-
-
remaining :number
-
Remaining time in seconds
Methods
-
activate()
-
Set this effect active
Fires:
-
deactivate()
-
Set this effect active
Fires:
-
hydrate(state, data)
-
Reinitialize from persisted data
Parameters:
Name Type Description state
GameState data
Object -
isCurrent() → {boolean}
-
Whether this effect has lapsed
Returns:
boolean -
modifyAttribute(attrName, currentValue) → {number}
-
Parameters:
Name Type Description attrName
string currentValue
number Returns:
number -attribute modified by effect
-
modifyIncomingDamage(damage, currentAmount) → {Damage}
-
Parameters:
Name Type Description damage
Damage currentAmount
number Returns:
Damage -
modifyOutgoingDamage(damage, currentAmount) → {Damage}
-
Parameters:
Name Type Description damage
Damage currentAmount
number Returns:
Damage -
pause()
-
Stop this effect from having any effect temporarily
-
remove()
-
Remove this effect from its target
Fires:
-
resume()
-
Resume a paused effect
-
serialize() → {Object}
-
Gather data to persist
Returns:
Object