damage extensions

From Wiki

Jump to: navigation, search


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 exchanged. Each time so-called hit points are rewarded until one side can bear no more 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*(Strength/50)*S.+

+Prior to 1.2.1.12 the formula had been P*(1+Strength/50)*S in keeping with being a strict bonus. Ever since it is geometric, so that no "strength" equates to no "damage." This change is first and foremost to let NPCs and PCs draw from the same pool of "magical" effects, since NPCs may be less efficacious.

Since 1.2.1.12 most "damage" sources can have the two "stats" traditionally related to Strength and Magic. In these cases, the #do_fix_damage_calculus formula uses the value 50, that is the default of #player_character_weight, only so that there is a standard scale. In order to replicate this or do otherwise pc is amended to include a character_identifier.

do_not_harm_defenseless_characters

Introduced around 1.1.2.2, this extension in the affirmative protects passive non-player characters from the attacks of aggressive non-player characters aimed at a player character. It does not protect the character from player character borne attacks. Values are limited to binary statements.[#]

hit_handicap_quantifier

Introduced around 1.1.2.2, this extension quantifies the final "hit point" damage. It accepts one input parameter: the aggregated sum of #hit_outcome_quantifier per each exchange. The default behavior is to round 0 up to 1 not changing anything otherwise, or not(_[0],1).

The pc variable refers to the defender. Values are limited to positive real numbers.[#]

Note: that if the output is 0 the stun animation is not triggered. In other words a 0 output exchange appears to miss its mark.

hit_offset_quantifier...

Since 1.2.1.12 hit_offset_quantifier defers to #hit_point_quantifier so it can be omitted where equivalent.

Introduced around 1.1.2.2, this extension quantifies the second input parameter of #hit_outcome_quantifier. It has three input parameters of its own: the damage rating of a character's defenses, a modifier associated with evasive maneuvers, and the affinity index of the damage rating; this number is 0 for the first rating, 1 for the second, and so on. Up to 7.

The default behavior depends on #do_fix_damage_calculus. Refer to the opening remarks of #Damage for details.

The default behavior of #hit_offset_quantifier2 is to defer to hit_offset_quantifier. Its function is dependent upon #hit_point_mode. However by default it is used for secondary ratings. By default these are ratings 4 through 8; traditionally associated with "magical" elemental forces: fire, water, and so on.

The pc variable refers to the defender. Values are limited to positive real numbers.[#]

hit_outcome_quantifier

Introduced around 1.1.2.2, this extension quantifies the damage done by a single damage rating. It accepts three input parameters. The first comes from #hit_point_quantifier. The second comes from #hit_offset_quantifier. And the third is the affinity index of the damage rating. Refer to hit_point_quantifier for details.

The default behavior depends on #do_fix_damage_calculus. Refer to the opening remarks of #Damage for details.

The outputs are clamped to the range of [0,65535] and converted to integers before being summed together per each damage rating. This sum is then inputted into #hit_handicap_quantifier in order to arrive at the ultimate "hit point" damage to the defending character. Values are limited to positive real numbers.[#]

hit_penalty_quantifier

This extension did not make it into 1.1.2.2. It is to govern damage born of residual factors; poisons for example.

hit_point_mode

Introduced around 1.1.2.2, this extension augments the behavior of #hit_point_quantifier and #hit_offset_quantifier. The default is 0. The default behavior is unspecified. Historically the default behavior is identical to 1. The behavior of 1 is to use #hit_point_quantifier2 and #hit_offset_quantifier2 for ratings 4 through 8. Classical Sword of Moonlight aligns these with "magical" elemental forces.

The behavior of 2+ is to use hit_point_quantifier2 and hit_offset_quantifier2 for indirect exchanges. Values are limited to numerical codes.[#]

+Prior to 1.2.1.12 the built-in formulas had not implemented mode 2.

hit_point_model

This extension did not make it into 1.1.2.2. It is to be used to select from a menu of alternative damage models. The simplest kind of model is +1, which says to shift the the dividing line between primary and secondary, aka. physical and magical, damage ratings up by 1 so that the fourth rating is changed from secondary to primary (in this example.)

hit_point_quantifier...

Introduced around 1.1.2.2, this extension quantifies the first input parameter of #hit_outcome_quantifier. It has three input parameters of its own: the damage rating of a weapon or more broadly speaking an "attack", a modifier used by #hit_offset_quantifier, and damage rating index; this number is 0 for the first rating, 1 for the second, and so on. Up to 7.

The default behavior depends on #do_fix_damage_calculus. Refer to the opening remarks of #Damage for details.

The default behavior of #hit_point_quantifier2 is to defer to hit_point_quantifier. Its function is dependent upon #hit_point_mode. However by default it is used for secondary ratings. By default these are ratings 4 through 8; traditionally associated with "magical" elemental forces: fire, water, and so on.

The pc variable refers to the attacker. Values are limited to positive real numbers.[#]