Ideas for Stendhal/Effects
Players, creatures and other entities can be temporarily under the influence of certain effects. For example a player will constantly heal at a certain rate, because he is already eating. Or a creature could be slowed down, because a player has casted a kind of freeze spell to it.
To fully support effects client and server side, we first need to consider, which properties are needed at which side and for which purpose. We also need to think about how an effect is applied when an effect of the same kind is already there, i.e. a player eats more than one meat.
Effect | Client Side | Server Side |
---|---|---|
heal over time | name, type, world effect | amount, frequency, how often?, inactive |
damage over time | name, type, world effect | amount, frequency, how often?, source, inactive |
buff / debuff | name, type, value affected, world effect | inactive |
cooldown | name, type, affected, world effect | ... |
outfit | name, type, world effect | ... |
TODO: class diagram
TODO: sequence diagram
Description
The following information on status ailments and enhancements commonly found in traditional RPGs. Here can be found descriptions and some ways to possibly implement a versatile status effect system into Stendhal.
Status can temporarily affect a character's ability to do certain functions or alter stats such as HP, mana, defense, attack, etc. Status is usually inflicted through item usage, spells or physical attacks. Occasionally characters receive a status through game progression, such as speaking with an NPC or an event is triggered. Effects are generally nullified by the use of items or magic spells. Some effects, such as "sleep", are often alternatively cured by the character receiving a physical attack. Resistances to negative statuses can be acquired through special actions, such as spells or using items, or by equipping imbued items.
Distinction from Elemental
Status is distinct from elemental enhancements, though elemental resistance itself could be considered a status. For example, an entity could have a status effect called "warm" that protects against ice attacks. The major distinction is that status infliction is not intended to have a direct effect on the strength of the attack itself, but rather to cause a condition to enhance or impede the target's abilities.
Elemental attacks and resistances
Elemental attacks are used to compound the strength of a physical or magic attacks against enemies with a weak resistance to said element. If the target has a strong resistance to the element then the strength of the attack is reduced to below the normal range. If the target has a weakness to a particular elemental attack, then it does greater damage than a normal attack.
Status Ailments
A status ailment is a negative effect on the character. Effects can reduce/impede the characters ability to do an action or cause a temporary reduction in stats.
List of common ailments used in RPG games
Common Names | Common Functions | Suggested for Stendhal |
---|---|---|
blind, dark, darkness | player's attack accuracy is reduced | same |
burn, burning | • character gradually, or each turn, loses HP • lowered physical attack |
same |
confuse, confusion, confused, muddle | character is uncontrollable and acts randomly | Implemented: walking is limited to using directional arrows inverted (as poison is currently) |
death, instant death, KO | character is instantly KO'd | not recommended |
dizzy | physical attack evasion is reduced | same |
doom, condemned | character is KO'd after a predetermined period of time if ailment isn't removed | not recommended |
fear | attack and defense are weakened | same |
freeze, freezing, frozen | character can not move to a new position | same |
oil | character is more susceptible to fire-based attacks | same |
paralysis, paralized | usually disables a certain ability temporarily | cannot physically attack for a time or until cured |
poison | character loses HP over time | Implemented |
shock | character cannot act | Implemented: while walking character stops after specified number of steps (player must resume walking) |
silence, mute | character is unable to cast magic spells | same |
sleep | character is unable to act for a predetermined amount of time or until awoken | same |
slow, heavy | character's attack is delayed | same or slowed walking |
stone, petrified | character is unable to act until status removed | not recommended |
tiny, shrink, toad, frog, imp | • significantly decreases attack and defense • character's sprite transformed to correspond with affliction • commands become limited sometimes reduced to only physical attacks |
not recommended |
weaken | temporarily reduces character's max HP | same |
zombie | • healing items have the opposite effect • causes immunity to poison in some games • character is uncontrollable |
implemented: slowed walking |
Some of the status ailments mentioned above are "not recommended" because they are too risky for single character games. However, the risk could be reduced if there was a system to revive KO'd characters. Included in the system the player should have the option to wait to be revived/cured or teleport to the respawn point, thus sacrificing a greater amount of XP.
Status Enhancements
Status enhancements give the character a certain "buffer" and can increase specific abilities or stats.
List of common enhancement statuses in RPG games
Effect Name | Common Function | Suggested for Stendhal |
---|---|---|
autoraise | character is instantly revived, one time, on KO | same |
eat, eating | restore HP over time | Implemented |
focus, concentrate | increases power or accuracy of next physical or magical attack | same |
haste | decreases wait time between attacks | same or quickened walking |
protect | increases defense | same |
reflect | reflects magic back onto the caster | same |
regen, regenerate | restore HP over time | same |
shell | increases magic defense | same |
special | usually a state that allows the player to take special actions not normally available | none |
Mixed Effects
Mixed status effects generally give the character some kind of enhancement but at the loss of another function.
List of effects
Effect Name | Common Function | Suggested for Stendhal |
---|---|---|
berserk | physical attack strength is greatly increased but control over character is lost | not recommended |
focus, concentrate | Same as above but player loses a turn or turn is slowed | none |
Possible Implementation
Needed Changes To Entities
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. 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.
The second option has been implemented. It has been removed later due to compatibility reasons.
Player Resistance & Status
- Player has a keyed slot (status_resistance(s)) where status can be added/removed.
- "key" is status name and "value" is the resistance value (0-100 or 0.0-1.0).
- Creature has keyed status slot (status_attack) for attacks.
- "key" is status name and "value" is probability of status being applied to player.
- Player's resistance value is applied to creature's status probability during attack.
- Player has a second keyed slot (status) that carries the current statuses of the player.
- "key" is status name and "value" is duration of status.
- Each turn the key is checked and resulting action applied.
- Statuses induced by actions, such as spells, items, etc., should be saved to the database so they are not lost at logout.
Creature Resistance & Status
- The same can be applied reversed. Players can have "attack" slots and creatures "resistance".
- Allows players to inflict status effects on creatures.
Display Indicators
These are some ideas for status indicators: