DoesAttackSucceed

Immediately after rolling the HitDice and computing thac0 we search for Special Ability scripts for:
The attacker Combatant
The target Combatant
The item (weapon) used in the attack
The spell associated with the item.
We look for scripts named DoesAttackSucceed.
The results of each scripts is examined in this order:
If a script returns a result containing the character 'N' then the script processing is terminated and the attack fails.
If a script returns a result containing the character 'Y' then the script processing is terminated and the attack succeeds.
If no script returns a 'N' or 'Y' then the attack succeeds if HitDice > thac0.

Parameters

The script has access to two parameters:
Parameter 5 = the value determined by the HitDice
Parameter 6 = The computed thac0
These parameters may be fetched using the $GET_HOOK_PARAM(n) , where n is 5 or 6.

Context


Example of use


Let us provide "Stainless Armor" that prevents attacks from non-magical weapons.
We give all magical weapons a Special Ability named "Magical".
We give "Stainless Armor" a Special Ability named "Physically Impervious".
We write a script for "Physically Impervious" named OnReadyArmor and, when the "Stainless Armor" is readied, the script gives the wearer a Special Ability named "Physcially Impervious".
We attach a script named DoesAttackSucceed to the Special Ability "Physically Impervious". This script looks at the attack weapon and, if it does not have the Special Ability "Magical", then it returns "N", therby causing the attack to fail.
So here is what happens when a character wearing "Stainless Armor" is attacked with a "Club":
An attack is made with a Club.
We search the target combatant and find a Special Ability named "Physically Impervious".
We search the Special Ability for a script named "DoesAttackSucceed".
We run the script with 'Club' as the weapon parameter.
The script examines 'Club' for a Special Ability named "Magical". None is found so the script returns "N", causing the attack to fail.
To attempt to say it one more time in a slightly different way......The Special Ability named "Physically Impervious" has a script named "DoesAttackSucceed" which allows the attack to succeed only if the weapon being used is 'Magical'.