I've been working on getting an effects system set up but I'm having some trouble figuring out how to implement some parts of it. I've made a sort of outline of the key parts of it, how I think some things should work, and what things I don't know how to do. If anyone could look over it and comment on whether these are good ideas or not, or how to do some of these things, I'd appreciate it. If anything in my rather abbreviated list doesn't make sense I can explain it better, if need be.
2 types of effects: active, reactive (not a code based differentiation)
active: DoTs and instants, stat changes. Not interested in other effects, just applies some kind of stat change
reactive: shields, effect modifiers.
Change effects when they update?
Somehow need to pass computed change from active effects to reactive ones for modification
How does sorting play into this? does effect type (additive, multiplicitive, exclusive) matter?
effects have a priority number manually assigned as well as a type (additive, multiplicitive, exclusive)
exclusive effects apply before additive/multiplicitive and prevent same-priority effects from applying (how?)
possibly sort, then group same-priority effects together, stop processing group after hitting exclusive effect
each tick, effect list is sorted
loop over list, call update on each effect
remove effects with remaining duration <= 0
when multiple instances of a single effect are active, need to apply the visual only once (how?)
visual probably can't be applied every update, needs to be applied once then removed, which means something has to hold a reference to the VFX object
what holds the reference? can't be held by the effect instance
how do you ensure that as one effect wears off, the visual stays active until all effects of that type have worn off
when are packets sent? after each stat change? after each effect is processed? after all effects are processed?
is there any per-update data involved besides stat changes?
for things like stun, root, etc, have a handful of hidden bool stats that determine state. Input system can check these to selectively disable
likely needs to use same system as visuals to ensure the state remains set so long as any effect is active that applies the state