EffectLib

by Ter13
Handle generic temporary combat effects efficiently and cleanly
ID:2287833
 
Resolved
Overhaul has been completed in EffectLib's private build. Pending release at some point when it won't spam the forums too much, and there are a significant number of changes and fixes to effectlib.
Applies to:Effectlib 2.2
Status: Resolved (2.3)

This issue has been resolved.
There are situations where you need to know why an effect went inactive. Per usual, any variable implemented as a boolean is probably informationally worthless.

effect.active should be internally overhauled into effect.state. state will be in one of the following states:

EFFECT_INACTIVE   ( 0)
EFFECT_ACTIVE ( 1)
EFFECT_OVERRIDDEN (-1)
EFFECT_EXPIRED (-2)
EFFECT_CANCELED (-3)
EFFECT_REMOVED (-4)


This is to provide information to systems attempting to use temporary effects as a sort of state machine.

if(effect.state) can be checked as a boolean to check whether the effect was ever active at one time.

state<=0 means that the effect either was never added to the effects list of the target, or was removed from it at some point.

state==1 means that the state is currently active.

state==0 means that the effect was never added to the effects list of the target.

state<0 means that the effect is not running, and was at one time added to the effects list.

Each of these potential states has a particular use case and the state order arithmetic yields much more information external to the effect's code than would be otherwise acheived with a simple boolean.
Ter13 resolved issue with message:
Overhaul has been completed in EffectLib's private build. Pending release at some point when it won't spam the forums too much, and there are a significant number of changes and fixes to effectlib.