damage extensions
From Wiki
(Created page with "{{Notice|small=left|text='''Transcluded by Sword of Moonlight Extension Library / list of extensions.'''}} <onlyinclude> This section is available since 1.1.2.2. ...") |
|||
Line 4: | Line 4: | ||
This section is available since [[SomEx|1.1.2.2]]. | This section is available since [[SomEx|1.1.2.2]]. | ||
+ | |||
+ | Extensions in this section govern "damage". Which boils down to a kind of sport, often a virtual blood sport in violent video games. You basically have a tit-for-tat until one side falls or loses. | ||
+ | |||
+ | In a classical game of Sword of Moonlight the player wields weapons with different damage ratings, and monsters have built in "attacks" that are analogous to these weapons which may be mitigated by various pieces of armor worn by the player. Monsters have built in defenses. Blows are traded. Each time so-called hit points are rewarded until one side runs out of points and loses the game. | ||
+ | |||
+ | Where P is hit-points, and Q is the hit-point offset, or defense. The classical formula for calculating damage is equal to max(0,P-Q)+inf(P*P/(Q*2),0) and the new formula per [[#do_fix_damage_calculus]] is P-max(0,Q-P*P/(Q*2)). In both cases the result is clamped to the range [0,infinity]. The inf is a bug in the classical formula based on undefined behavior. The value of infinity arises when Q is 0. Becoming 0 when converted to an integer representation. | ||
+ | |||
+ | In the example above, in the case of the player, P and Q are subject to bonuses that are a function of the player's "stats" or characteristics such as Strength that accumulate over the course of a game as the player repeatedly performs certain actions. The classical bonus formula is Strength/5. However if P is 0 the bonus is 0. For Q the bonus is not zeroed out. The new bonus formula per do_fix_damage_calculus is P or Q*(Strength/[[#player_character_weight]]). | ||
+ | |||
+ | Finally do_fix_damage_calculus also factors in the scale of the player and monster. For monsters this scale is set when placing the monster onto its game map. For players the extension [[#player_character_scale]] is consulted. So when computing P where S is the scale, and weight is 50, P becomes P*(1+Strength/50)*S. | ||
====*do_not_harm_defenseless_characters==== | ====*do_not_harm_defenseless_characters==== |
Revision as of 06:03, 31 July 2013
! |
Transcluded by Sword of Moonlight Extension Library / list of extensions. |
This section is available since 1.1.2.2.
Extensions in this section govern "damage". Which boils down to a kind of sport, often a virtual blood sport in violent video games. You basically have a tit-for-tat until one side falls or loses.
In a classical game of Sword of Moonlight the player wields weapons with different damage ratings, and monsters have built in "attacks" that are analogous to these weapons which may be mitigated by various pieces of armor worn by the player. Monsters have built in defenses. Blows are traded. Each time so-called hit points are rewarded until one side runs out of points and loses the game.
Where P is hit-points, and Q is the hit-point offset, or defense. The classical formula for calculating damage is equal to max(0,P-Q)+inf(P*P/(Q*2),0) and the new formula per #do_fix_damage_calculus is P-max(0,Q-P*P/(Q*2)). In both cases the result is clamped to the range [0,infinity]. The inf is a bug in the classical formula based on undefined behavior. The value of infinity arises when Q is 0. Becoming 0 when converted to an integer representation.
In the example above, in the case of the player, P and Q are subject to bonuses that are a function of the player's "stats" or characteristics such as Strength that accumulate over the course of a game as the player repeatedly performs certain actions. The classical bonus formula is Strength/5. However if P is 0 the bonus is 0. For Q the bonus is not zeroed out. The new bonus formula per do_fix_damage_calculus is P or Q*(Strength/#player_character_weight).
Finally do_fix_damage_calculus also factors in the scale of the player and monster. For monsters this scale is set when placing the monster onto its game map. For players the extension #player_character_scale is consulted. So when computing P where S is the scale, and weight is 50, P becomes P*(1+Strength/50)*S.