I have a issue I am unsure the best way to go about solving. Developing a game I store all the "percentage boosts" a character could get either from skills, equipment, quest items or whatnot as decimals (lowest being 0.0001 all the way to 1.0+).
This might not be the proper way in relation to my question but, without radically changing a game that's already live (web game), it's the way I have to work with.
What I normally do is look at all your equipment, boons, skills and so on that affect this stat and add them all together:
loop equipmentBonus += slot->bonus // where equipBonus = 0.0 to start.
Do the same things for boons, skills and so on.
Now we have this number, lets say its 1.87 (187% to this stat) One might think:
Stat * Bonus // (10 * 1.87 = 18.7)
Seems straight forward. But what if that total bonus is a flat 1.0; now it's just 10. In my mind it should double it, so:
Stat * (1 + Bonus) // (10 * 2.87 = 28.7)
Ok so now if their bonus is above 1 we double it.
Bonus is now 3.6 (+1 = 4.6)
This is where I am having issues, because in my mind 3.6 (360%) (same base stat of 10) is now 36, where as 4.6 (1 + Bonus) = 46.
The only solution I could think of was to stop the addition of 1 once we reach higher then 2, but again that poses issues because 1 is now 2, 2 is now 3, 3 is now 3 ... (hundred percent).
Can some one help me understand the best way to apply these stat bonuses? Would it be as simple as:
Stat + (Stat * Bonus)// But what if the bonus is higher then 1?
I am not looking for code, but a better understanding oh how to handle percentages both above and below 100%, without fundamentally changing how they are stored (i.e., 0.0001 -> 1.0) in a way where they stack in an additive way (I believe is above) as opposed to multiplicative way)