ResistSpell(object, object)

Performs a spell resistance check between the caster and the target.

int ResistSpell(
    object oCaster,
    object oTarget
);

Parameters

oCaster

Caster of the spell.

oTarget

Target of the spell.


Description

* Return value if oCaster or oTarget is an invalid object: FALSE
* Return value if spell cast is not a player spell: - 1
* Return value if spell resisted: 1
* Return value if spell resisted via magic immunity: 2
* Return value if spell resisted via spell absorption: 3

Bioware uses MyResistSpell() for spells that use this, to apply appropriate effects for the return value. It is a good idea to use this wrapper function instead of this directly. The Bioware function only returns 1 or 0.



Remarks

This should only ever be used in a spell script! It may not work correctly elsewhere, as Mantals and Globes use the spells level, if it is a PC spell (defined in spells.2da), to stop this or decrease the amount of mantal power, and the caster level of oCaster of course!

It checks spell resistance, Globes, and Spell Immunity.

IE, the effects EffectSpellImmunity, EffectSpellResistanceIncrease, EffectSpellLevelAbsorption (Or approprate item properties). See seperate descriptions for exact effects.

Never use it for non-player spells, it mearly always returns -1 (as it would for a non-spell-script!)


Known Bugs

If the target has a spell absorption effect, this function does not return 3 and does not affect the spell absorption if the spell was a clerical domain spell. Reported by He Who Watches. Clerical domain spells have several problems with internal functions like this.


Version

1.22

See Also

functions: ActionCastFakeSpellAtObject | ActionCastSpellAtObject | MyResistSpell
categories: Spells Functions


 author: Jody Fletcher, editor: Jasperre
 Send comments on this topic.