DoesSpellAttackSucceed
Just prior to applying a spell to a target we search for Special Ability scripts belonging to:
- The Spell being cast
- The Target's Race
- The Target's Monster Type
- The Target Character
This is a rather limited list, you may object. But it was sufficient to solve the problem of supplying a 'Magic Resistance' capability. If you need us to search in additional places, let us know where and why. We can very likely accommodate you.
We look for scripts named “DoesSpellAttackSucceed”.
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 spell attack succeeds.
Parameters
Parameter [5] = the text to be displayed as a result of attempting to apply the spell effects.
This parameters may be set using the $SET_HOOK_PARAM(n, string) , where n is 5.
Unless empty, this text will be displayed when the spell is applied even if the script returns a 'N'
to negate the spell. So you could say, for example, “The spell fails because it is Monday”.
Context
Character - the attacker - $AttackerContext
Character - the target - $TargetContext
Class - the attacker - $ClassContext
Spell - $SpellContext