Compute Damage
Just prior to subtracting hitpoints from a combatant as a result of an attack, we search for scripts named “ComputeDamage” in the following places:
The Ammunition (if any) (Perhaps an arrow)
The Primary weapon (if any) (Perhaps a club or bow)
The Target's Monster Type (eg: orc)
The Target Combatant.
Each script can examine hook parameter[0] and return a value that will replace hook parameter[0]. After all scripts have been called, hook parameter[5] will be used as the damage.
Parameters
Hook parameter 2 contains the result of the damage dice roll.
Hook parameter 3 contains the 'Attack Bonus' of the Weapon used to initiate the attack. In the case of arrows and such, this will probably be a bow or some such weapon that launched the missile. It will be zero if no weapon was used in the attack.
Hook parameter 4 contains the 'Attack Bonus' of any missile (ammunition) that was used in the attack. It will be zero if no such ammunition was used.
Hook parameter 5 contains the damage as computed by the engine. This will be the sum of hook parameters 2, 3, and 4.
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()