StatusEffectManager

Manages timed and periodic status effects with stacking rules (replace, duration_stack, intensity_stack, independent).

Constructor

new StatusEffectManager(configopt)

Parameters:
NameTypeAttributesDescription
configObject<optional>
Properties
NameTypeAttributesDescription
targetObject<optional>

Target combatant or entity

Classes

StatusEffectManager

Methods

applyEffect(effectConfig) → {Object}

Apply or stack a status effect.

Parameters:
NameTypeDescription
effectConfigObject
Properties
NameTypeAttributesDefaultDescription
namestring

Unique effect identifier

durationnumber

Duration in seconds

stackModestring<optional>
"replace"

'replace'|'duration_stack'|'intensity_stack'|'independent'

maxStacksnumber<optional>
5

Max stacks allowed for intensity_stack

maxDurationnumber<optional>
60

Max duration for duration_stack

intensitynumber<optional>
1

Initial intensity/multiplier

modifiersObject<optional>
{}

Stat multipliers or deltas

tickIntervalnumber<optional>
0

Periodic interval in seconds (0 = no periodic tick)

onTickfunction<optional>

Callback on periodic tick: (effect, target) => void

categorystring<optional>
"neutral"

'buff'|'debuff'|'neutral'

tagsArray.<string><optional>
[]

Categorical tags (e.g. ['poison', 'curse'])

Returns:

The active effect record

Type: 
Object

cleanse(tagOrCategory) → {number}

Remove all effects matching a tag or category.

Parameters:
NameTypeDescription
tagOrCategorystring

E.g. 'poison', 'debuff', 'buff'

Returns:

Count of removed effects

Type: 
number

clearAll()

Clear all active status effects unconditionally.

getEffect(name) → {Object|null}

Get effect record by name.

Parameters:
NameTypeDescription
namestring
Returns:
Type: 
Object | null

getModifiedStat(stat, baseValueopt) → {number}

Calculate compound stat multiplier across all active status effects. For intensity_stack effects, multiplier applies per stack: 1 + (mod - 1) * stacks.

Parameters:
NameTypeAttributesDefaultDescription
statstring

Name of stat

baseValuenumber<optional>
1
Returns:
Type: 
number

hasEffect(name) → {boolean}

Check if a status effect is active by name.

Parameters:
NameTypeDescription
namestring
Returns:
Type: 
boolean

onStatusEvent(listener) → {function}

Listen for status events: applied, refreshed, ticked, expired, cleansed.

Parameters:
NameTypeDescription
listenerfunction
Returns:

Unsubscribe

Type: 
function

setPaused(paused)

Set paused state. When paused, effect durations and tick intervals do not advance.

Parameters:
NameTypeDescription
pausedboolean

update(deltaTime, optionsopt)

Advance elapsed time for active effects. When paused, timers do not decrement and no periodic ticks fire.

Parameters:
NameTypeAttributesDescription
deltaTimenumber
optionsObject<optional>
Properties
NameTypeAttributesDefaultDescription
pausedboolean<optional>
false