Repository navigation
Status Effects
The status effects system allows the implementation of temporary buffs or debuffs to an entity. This is achieved by attributing the entities with a component to store the relevant stat changes.
To interact with status effects you must first be operating with an entity with the StatusEffectControllerComponent, this should be all entities as some effects may grant another entity a status effect. Most interaction can be achieved directly through a method call on this class.
-
public void addStatusEffect(int, char)This method is the way to give an entity a status effect. It is a method of theStatusEffectControllerComponent.-
int stacks- This refers to the number of stacks of the status effect you want to add. -
char statusEffect- This is the character symbol reference for the status effect you want to add. A list of current character symbols can be found at the bottom of the file..
-
statusEffectControllerComponent.addStatusEffect(1, 'r') This will add 1 new stack of burning to the relevant entity.
statusEffectControllerComponent.addStatusEffect(4, 'v') This will add 4 new stacks of vulnerability to the relevant entity.
Generally you will not need to worry about removing status effects as they remove themselves once the duration has expired.
The status effect controller follows a class structure based on not interacting directly with any of the concrete implementations of status effects where possible to remove dependencies. Instead it interacts with the StatusEffectFactory class to create the status effect. This class then creates the status effect and returns it to the controller as a StatusEffect object.
- When you create the new status effect object make sure it implements the
StatusEffectinterface. - Add any other relevant interfaces for the status effect triggers. e.g. If your status effect does something when the entity is damaged, add the
Damageableinterface. - Once you have completed the status effect's methods, add it to the
StatusEffectFactorystatic class. - Add the
StatusEffectFactorystatic method to theaddStatusEffectmethod in theStatusEffectControllerComponent. Make sure to choose a unique character symbol for your status effect as the switch case wont work if you choose the same one. - Make sure your new status effect holds with the below class diagram
- 'b' - burning
- 'r' - regeneration
- 's' - slow
- 'S' - speed up
- 'v' - vulnerable
- 'f' - freeze