The code below means that the Mage will not cast Melf's Acid Arrow on a target if the target is under the influences of (Minor) Globe of Invulnerability, or has more than 75% Acid Resistance, or has more than 50% Magic Resistance, or has Mirror Image active, or has (Minor) Spell Turning active. I am still trying to figure out how to handle Mages with Spell Immunity and Spell Deflection.
code:
IF
ActionListEmpty()
See(NearestEnemyOf(Myself))
CheckStat(NearestEnemyOf(Myself),0,MINORGLOBE)
CheckStat(NearestEnemyOf(Myself),0,SHIELDGLOBE)
!CheckStatGT(NearestEnemyOf(Myself),75,RESISTACID)
!CheckStatGT(NearestEnemyOf(Myself),50,RESISTMAGIC )
!StateCheck(NearestEnemyOf(Myself),STATE_MIRRORIMA GE)
!HasBounceEffects(LastSeenBy(Myself))
HaveSpell(WIZARD_MELF_ACID_ARROW)
THEN
RESPONSE #100
Spell(NearestEnemyOf(Myself),WIZARD_MELF_ACID_ARRO W)
END
[/QUOTE]The IWD Mage AI script I have now is still a bit buggy in the defensive area, but most of the offensive scripts are working perfectly.