Compute Damage

Just prior to subtracting hitpoints from a combatant as a result of an attack, we set hookParameter[0] to the empty string. Then we search for scripts named “ComputeDamage” in the following places:

  1. The Weapon (if any)

  2. The Target's Monster Type (eg: orc)

  3. The Target Combatant.


Each script can examine hook parameter[0] and return a value that will replace hook parameter[0]. If, after all scripts have been called, hook parameter[0] is non-empty, then its value will be used as the damage.

Parameters

Hook parameter 5 contains the damage as computed by the engine.


Hook parameter 6 contains a “1” if the damage is considered 'non-lethal'.


Hook parameter 7 can be used to replace the normal “Rolls and hits for points” message. There are actually two messages: “Rolls and hits” and “Rolls and backstabs”. Hook parameter 7, if non-empty, will replace whichever of the two would otherwise be displayed.

Context


Attacker Character --- $AttackerContext

Target Character --- $TargetContext()

Weapon --- $ItemContext() ; If the combatant has no weapon then $ItemContext() will refer to an item with an empty name and no Special Abilities.