I have been working on an RPG for a few days now and have been going over my buff/debuff system.
It works, I would like for it to be easier to manage and more flexible and was hoping you guys could give me some insight.
I have to explain the way the game works first and then I think it will make sense.
What is a debuff/buff? This is any modification to a characters stats. This means that items bonuses, and talent tree points spent in static buffs as well as a rats poison attacks are all in the debuff/buff list for processing.
Having the ability to create a buff that takes a characters crit chance and turns it against them in the form of a reduction to their dodge. And having a buff that reduces your health pool in half but increases your regen to triple is an example of how flexible I want my system.
There is a plethora of characters with very different stats and features and so a flexible debuff/buff system that can be applied to them is of vital importance.
Example characters (generic Names atm)
Warrior:
Rage user, no Mana, can ignore incomming debuffs.
Mage:
Mana user, no rage, Resists the damage on Magic Debuffs.
8 Bit Guy:
No health pool instead lives counter, 5 hits dead, kills a mob = 1up
Gravity Guy:
Uses his mass Attribute to deal damage when physics colliding with mobs
As you can see the stats each character has are not universal in a lot of cases
So how am I currently dealing with it.
Well I have alot of Interfaces such as IRageUser and IManaUser.
IManaUser means they have 4 methods for calling their current/base/max, Mana/ManaRegen
An IStrengthUser would have 2 methods for calling currStr and baseStr.
As of now all characters are able to be Debuffed/Buffed because they all Inherit IDebuffable (Meaning they have a public method ApplyDebuff(BasicBuff buff)
So If a mob has an effect that reduces your maximum mana temporarily, it first will check if the player is
IDebuffable and IManaUser
If true it will call the ApplyDebuff( ManaClamp); in this case.
The characterClass Then Takes the incomming ManaClamp Puts it in the appropriate Debuff/Buff list
and at each update the list checks for buffs that have a timer, counts them down then it checks each buff and sees which interfaces the buffs implement.
if(buffList is IAgiBuff)
{
_currAgi = ((IAgiBuff)buffList*).modifyCurrAgi(_currAgi,baseAgi);
_}*
I am not sure if this is an appropriate way to go about this and was wondering how other people would go about it.