Ideas for Stendhal/Magic: Difference between revisions

Jump to navigation Jump to search
Content deleted Content added
imported>Madmetzger
imported>Madmetzger
Line 55: Line 55:
Some spell like Freeze or Weaken Creature temporarily affect specific attributes of an entity. As it is reasonable not to change the attributes themselves, it is necessary to add attribute modifiers to an entity.
Some spell like Freeze or Weaken Creature temporarily affect specific attributes of an entity. As it is reasonable not to change the attributes themselves, it is necessary to add attribute modifiers to an entity.


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'''.
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''.


<gallery caption="Attribute modifiers variants">
<gallery caption="Attribute modifiers variants">