What is a good way to handle buffs? I don't really like how I handle them now and was planning on reworking them. However before I do I'd like to know of a good way to handle it all.
Currently all buffs have 2 variables, one for the buff multi and another for the current buff multi the player is using.
Then the players stat is calculated with one formula per stat, updating whenever relevant.
So when the player uses the buff, the current buff multi is made equal to the buff multiplier. When its off the current buff multi is 0.
Stat = BaseStat + (BaseStat * Buff1) + (BaseStat * Buff2) ....
*Note that its the way I want to handle how buffs interact with the stat, don't want buffs to be multiplicative.
Any better way to handle buffs?
ID:1862252
May 31 2015, 12:21 am (Edited on May 31 2015, 12:32 am)
(See the best response by Kaiochao.)
|
|
Stat = BaseStat * (1 + Buff1 + Buff2 + ... + BuffN)
You can calculate the sum Buff1 + Buff2 + ... + BuffN with a loop through each included buff:
Of course, this is just a slightly different way to do exactly what you're already doing.