One method would keep two separate stats for the player - base stats and equipment stats. Then you can just replace the equipment stat if you get new equipment. Any calculations done would simply add them together. This gives you more fine control over what stats are additive and multiplicative as well. However, this can be harder to implement if you have a lot of equipment categories modifying the same stats. You only have to do it once to set up the system though, and it should be flexible.
An alternative is to subtract out the stats when you unequip as you mentioned, but to me that method raises immediate concerns about possible number bugs/mistakes that can be cumulative. Also if you have any stat modifiers more complex than straight addition and subtraction you will need to work backwards for those too.
Hey there! Thanks for the reply! ^_^
So basically we have 10 equipment slots. Each equipment slot needs a variable of what is equipped, example -
Strength = X
Dexterity = X
Health = X
Mana = X
And so on....... And then when u equip, u will add to these variables the items stats and add them to the Heros stats.
When u unequip, u subtrack the variable stats from the Hero stats, and replace the variable stats with the new item u equipped and add them to the Hero.
Since we have alot of slots and items and stats, this will mean 10-15 variables for each slot. Is this really the easiest way to do it?