Ideas for Stendhal/Magic: Difference between revisions
Jump to navigation
Jump to search
Content deleted Content added
imported>Madmetzger |
imported>Madmetzger |
||
| Line 56: | Line 56: | ||
A first approach would store the modifier factors in a class and the entity classes compute an attribute's value by summing up all modifiers and applying it to the actual attribute's value. To reflect the temporal nature of a modifier it is capable of determining its validity based on a timestamp within the method ''isValid''. This approach has the obvious disadvantage, that within ''GuidedEntity'' the modifiers for not existing attributes are available. |
A first approach would store the modifier factors in a class and the entity classes compute an attribute's value by summing up all modifiers and applying it to the actual attribute's value. To reflect the temporal nature of a modifier it is capable of determining its validity based on a timestamp within the method ''isValid''. This approach has the obvious disadvantage, that within ''GuidedEntity'' the modifiers for not existing attributes are available. |
||
The second approach uses an additional layer of indirection to hide the modifiers for not existing attributes. On each level of the entity inheritance hierarchy is a specific modifier defined that is called to calculate the modified value. |
|||
The TurnNotifier is used to clean up expired modifiers. As a modifier is able to distinguish between being valid and not, it is not necessary, that this clean up helper runs every second or even more frequently. |
|||
<gallery caption="Attribute modifiers variants"> |
<gallery caption="Attribute modifiers variants"> |
||