Given the normal entity-component-system architecture, lets say we a component that give the entity Strength. Now on the game flow I want to give +4 strength do to the wielded weapon. What would be the best way to do this, considering that.
BaseValue => 10; Weapon => +4; Weaken Spell -2 (Temporary); CurrentFinalValue => 12
I could have many modifiers, positive or negative; I would like to know for a given entity attribute "Strength", what are the modifiers sum; I could add or remove modifiers and they should not remove from the base "Strength";
I could add as a component (StrengthModifierComponent) and apply the change to the StrengthComponent, then to be able to calculate the CurrentFinalValue, I would have to discover every component that affects "Strength" somehow and sum it with BaseValue. This might be easier if I have complete control of the system, but if I am building the system for general purpose this would have to be dynamic and there for complicated, making it possibly "slow".
I cannot put in the entity since the entity is usually just an identifier (int,Guid,SomeUniqueName).
I could make a ModifiableComponent which accept a list of Modifiers and would allow an easier interaction when making all the calculus. But wouldn't this break the ES architecture?
Thanks you.