So I am making an ATLA open world rpg. I have decided to add status effects (inspired by arcane odessy). My problem is how can I set them, and have them stack. I also want to know how can different elements clear a status. For example:
If a firebender hits you, you get the “Burning” status. That does DOT. If an airbender then hits you WHILE you have the status, it will clear it and the attack will do 10% less damage. Each status has nerfs and buffs for different elements.
Some stun you, whilst others do damage over time, and some only give buffs / debuffs to other elements.
This type of system could be done in literally a million different ways, and its best to make your own system rather than have someone else write one for you.
Start by creating a table to handle the different status effects. Then when a new effect is applied, run through the table of current active effects and see if any counteract/enhance the current effect. Then do the damage/buff from the new effect and add it to the table. When status effects run out, remove them from the table.
I don’t mean code, I mean exactly what EpicJab just did for you, he gave you the base idea which is often limiting to that of which you could of came up with yourself.
Hey wait a minute, Riko said they wanted help. I am in no way telling Riko that they have to do it my way. I’m just giving them an idea of how to, which is what they were asking for. I’m not limiting them.
I would have a module that would list all the effects as well as the buffs + debuffs, and their type (stun, dot, etc)
I would then reference that module when I am attacking, checking in a table. If they have an effect then I will either cancel it or alter it