- Status effects all have a timer that is used to determine when the effect degrades in intensity
- In lua, we define a duration time for each status effect. The duration applies the same time to each intensity, so we currently have no way to make one intensity last longer than another
- In lua we define three functions for each affect: Apply, Update, and Finish
- Apply is called when the status effect first becomes active
- Update is called every once every game loop. Currently all update functions check to see if the status effect intensity changed and if not, it does nothing
- Finish is called when the status effect is cured or otherwise dissipates
I'm thinking of improving the battle effects system by mimicing the design of map events, where we have a single base class and multiple subclasses for different types of effects. More specifically, I'm thinking of doing the following:
- BattleEffect would be a base class (might be abstract, might not). It holds a _status_type member that determines whether or not this represents a status effect, and if so what status effect it is
- BattleStaticEffect would do what are current effects do now. It only makes a static change when the effect is applied or the intensity changes.
- BattlePeriodicEffect would have a second timer in addition to the duration timer. This timer would be shorter than the duration timer and when it completes, we make some change such as draining HP for a poison effect. The duration timer loops infinitely while the effect is active.
- BattleConditionalEffect would be an effect that activates only when certain conditions are checked and met. For example, when an ally is about to damage from an attacker.
- BattleCustomEffect would be implemented entirely in Lua, allowing us to do virtually anything we wanted there.
- In Lua, depending on the type of effect we would have to define specific functionality (for example, the duration of the periodic timer for the periodic effects). Additionally, we should have some member in Lua that declares what type of class effect this is
Does anyone have any thoughts or suggestions on how to best support effects? I want us to have a well-designed and elegant system that at the same time grants a lot of flexibility. We don't need to be able to support absolutely every kind of crazy effect we can dream up, but I want to eliminate most barriers from implementing new effects on a whim, which we will likely do for boss battles later in the game.