IF
    OR(2)
		!GlobalTimerNotExpired("CAST","LOCALS")
        CheckStatGT(Myself,0,WIZARD_IMPROVED_ALACRITY)
    NumCreatureGT([GOODCUTOFF.0.0.0.0.SUMMONED],1)
    OR(5)
        NumCreatureGT([GOODCUTOFF.0.0.0.0.SUMMONED],3)
        CheckStatGT(NearestEnemyOfType([GOODCUTOFF.0.0.0.0.SUMMONED]),50,RESISTMAGIC)
        CheckStatGT(SecondNearestEnemyOfType([GOODCUTOFF.0.0.0.0.SUMMONED]),50,RESISTMAGIC)
        CheckStatGT(ThirdNearestEnemyOfType([GOODCUTOFF.0.0.0.0.SUMMONED]),50,RESISTMAGIC)
		RandomNumGT(10,7)
    See([GOODCUTOFF.0.0.0.0.SUMMONED])
	HaveSpell(WIZARD_DEATH_SPELL)
THEN
	RESPONSE #100
		SetGlobalTimer("CAST","LOCALS",6)
		Spell(LastSeenBy(Myself),WIZARD_DEATH_SPELL)
END

IF
    OR(2)
		!GlobalTimerNotExpired("CAST","LOCALS")
        CheckStatGT(Myself,0,WIZARD_IMPROVED_ALACRITY)
	HaveSpell(WIZARD_DEATH_SPELL)
	OR(2)
		!See(NearestEnemyOf(Myself))
		LevelGT(NearestEnemyOf(Myself),8)
	OR(2)
		!See(SecondNearestEnemyOf(Myself))
		LevelGT(SecondNearestEnemyOf(Myself),8)
	OR(2)
		!See(ThirdNearestEnemyOf(Myself))
		LevelGT(ThirdNearestEnemyOf(Myself),8)
	OR(2)
		!See(FourthNearestEnemyOf(Myself))
		LevelGT(FourthNearestEnemyOf(Myself),8)
	OR(2)
		!See(FifthNearestEnemyOf(Myself))
		LevelGT(FifthNearestEnemyOf(Myself),8)
	OR(2)
		!See(SixthNearestEnemyOf(Myself))
		LevelGT(SixthNearestEnemyOf(Myself),8)
	See(NearestEnemyOf(Myself))
	False()
THEN
	RESPONSE #100
		Continue()
END

IF
    OR(2)
		!GlobalTimerNotExpired("CAST","LOCALS")
        CheckStatGT(Myself,0,WIZARD_IMPROVED_ALACRITY)
	See(LastSeenBy(Myself))
	OR(2)
		Gender(LastSeenBy(Myself),SUMMONNED)
		LevelLT(LastSeenBy(Myself),9)
	HaveSpell(WIZARD_DEATH_SPELL)
THEN
	RESPONSE #100
		SetGlobalTimer("CAST","LOCALS",6)
		Spell(LastSeenBy(Myself),WIZARD_DEATH_SPELL)
END

IF
    OR(2)
		!GlobalTimerNotExpired("CAST","LOCALS")
        CheckStatGT(Myself,0,WIZARD_IMPROVED_ALACRITY)
	See(NearestEnemyOf(Myself))
	Range(NearestEnemyOf(Myself),7)
	HaveSpell(WIZARD_IMPRISONMENT)
	RandomNumGT(6,2)
THEN
	RESPONSE #100
		SetGlobalTimer("CAST","LOCALS")
		Spell(NearestEnemyOf(Myself),WIZARD_IMPRISONMENT)
END

IF
    OR(2)
		!GlobalTimerNotExpired("CAST","LOCALS")
        CheckStatGT(Myself,0,WIZARD_IMPROVED_ALACRITY)
    HaveSpell(WIZARD_ABI_DALZIMS_HORRID_WILTING)
	RandomNumGT(3,1)
	OR(6)
		!See(NearestEnemyOf(Myself))
		HasBounceEffects(NearestEnemyOf(Myself))
		HasImmunityEffects(NearestEnemyOf(Myself))
        HasItemEquiped("CLCK26",NearestEnemyOf(Myself))
		CheckStatGT(NearestEnemyOf(Myself),25,RESISTMAGIC)
		RandomNumGT(10,3)
	OR(6)
		!See(SecondNearestEnemyOf(Myself))
		HasBounceEffects(SecondNearestEnemyOf(Myself))
		HasImmunityEffects(SecondNearestEnemyOf(Myself))
        HasItemEquiped("CLCK26",SecondNearestEnemyOf(Myself))
		CheckStatGT(SecondNearestEnemyOf(Myself),25,RESISTMAGIC)
		RandomNumGT(10,4)
	OR(6)
		!See(ThirdNearestEnemyOf(Myself))
		HasBounceEffects(ThirdNearestEnemyOf(Myself))
		HasImmunityEffects(ThirdNearestEnemyOf(Myself))
        HasItemEquiped("CLCK26",ThirdNearestEnemyOf(Myself))
		CheckStatGT(ThirdNearestEnemyOf(Myself),25,RESISTMAGIC)
		RandomNumGT(10,5)
	OR(6)
		!See(FourthNearestEnemyOf(Myself))
		HasBounceEffects(FourthNearestEnemyOf(Myself))
		HasImmunityEffects(FourthNearestEnemyOf(Myself))
        HasItemEquiped("CLCK26",FourthNearestEnemyOf(Myself))
		CheckStatGT(FourthNearestEnemyOf(Myself),25,RESISTMAGIC)
		RandomNumGT(10,6)
	OR(6)
		!See(FifthNearestEnemyOf(Myself))
		HasBounceEffects(FifthNearestEnemyOf(Myself))
		HasImmunityEffects(FifthNearestEnemyOf(Myself))
        HasItemEquiped("CLCK26",FifthNearestEnemyOf(Myself))
		CheckStatGT(FifthNearestEnemyOf(Myself),25,RESISTMAGIC)
		RandomNumGT(10,7)
	OR(6)
		!See(SixthNearestEnemyOf(Myself))
		HasBounceEffects(SixthNearestEnemyOf(Myself))
		HasImmunityEffects(SixthNearestEnemyOf(Myself))
        HasItemEquiped("CLCK26",SixthNearestEnemyOf(Myself))
		CheckStatGT(SixthNearestEnemyOf(Myself),25,RESISTMAGIC)
		RandomNumGT(10,8)
	OR(6)
		!See(SeventhNearestEnemyOf(Myself))
		HasBounceEffects(SeventhNearestEnemyOf(Myself))
		HasImmunityEffects(SeventhNearestEnemyOf(Myself))
        HasItemEquiped("CLCK26",SeventhNearestEnemyOf(Myself))
		CheckStatGT(SeventhNearestEnemyOf(Myself),25,RESISTMAGIC)
		RandomNumGT(10,9)
	OR(5)
		!See(EighthNearestEnemyOf(Myself))
		HasBounceEffects(EighthNearestEnemyOf(Myself))
		HasImmunityEffects(EighthNearestEnemyOf(Myself))
        HasItemEquiped("CLCK26",EighthNearestEnemyOf(Myself))
		CheckStatGT(EighthNearestEnemyOf(Myself),25,RESISTMAGIC)
	OR(5)
		!See(NinthNearestEnemyOf(Myself))
		HasBounceEffects(NinthNearestEnemyOf(Myself))
		HasImmunityEffects(NinthNearestEnemyOf(Myself))
        HasItemEquiped("CLCK26",NinthNearestEnemyOf(Myself))
		CheckStatGT(NinthNearestEnemyOf(Myself),25,RESISTMAGIC)
	OR(5)
		!See(TenthNearestEnemyOf(Myself))
		HasBounceEffects(TenthNearestEnemyOf(Myself))
		HasImmunityEffects(TenthNearestEnemyOf(Myself))
        HasItemEquiped("CLCK26",TenthNearestEnemyOf(Myself))
		CheckStatGT(TenthNearestEnemyOf(Myself),25,RESISTMAGIC)
	See(NearestEnemyOf(Myself))
	False()
THEN
	RESPONSE #100
		Continue()
END

IF
    OR(2)
		!GlobalTimerNotExpired("CAST","LOCALS")
        CheckStatGT(Myself,0,WIZARD_IMPROVED_ALACRITY)
	See(LastSeenBy(Myself))
	!HasBounceEffects(LastSeenBy(Myself))
	!HasImmunityEffects(LastSeenBy(Myself))
    !HasItemEquiped("CLCK26",LastSeenBy(Myself))
	!CheckStatGT(LastSeenBy(Myself),50,RESISTMAGIC)
    HaveSpell(WIZARD_ABI_DALZIMS_HORRID_WILTING)
	RandomNumGT(3,1)
THEN
	RESPONSE #100
		SetGlobalTimer("CAST","LOCALS",6)
		Spell(LastSeenBy(Myself),ABI_DALZIMS_HORRID_WILTING)
END

IF
    OR(2)
		!GlobalTimerNotExpired("CAST","LOCALS")
        CheckStatGT(Myself,0,WIZARD_IMPROVED_ALACRITY)
	Range(NearestEnemyOf(Myself),10)
	Range(SecondNearestEnemyOf(Myself),10)
    HaveSpell(WIZARD_ABI_DALZIMS_HORRID_WILTING)
	RandomNumGT(4,2)
THEN
	RESPONSE #100
		SetGlobalTimer("CAST","LOCALS",6)
		Spell(Myself,ABI_DALZIMS_HORRID_WILTING)
END

IF
    OR(2)
		!GlobalTimerNotExpired("CAST","LOCALS")
        CheckStatGT(Myself,0,WIZARD_IMPROVED_ALACRITY)
	HaveSpell(WIZARD_POWER_WORD_KILL)
	RandomNumGT(7,2)
	OR(2)
		!See(NearestEnemyOf(Myself))
		HPGT(NearestEnemyOf(Myself),60)
	OR(2)
		!See(SecondNearestEnemyOf(Myself))
		HPGT(SecondNearestEnemyOf(Myself),60)
	OR(2)
		!See(ThirdNearestEnemyOf(Myself))
		HPGT(ThirdNearestEnemyOf(Myself),60)
	OR(2)
		!See(FourthNearestEnemyOf(Myself))
		HPGT(FourthNearestEnemyOf(Myself),60)
	OR(2)
		!See(FifthNearestEnemyOf(Myself))
		HPGT(FifthNearestEnemyOf(Myself),60)
	OR(2)
		!See(SixthNearestEnemyOf(Myself))
		HPGT(SixthNearestEnemyOf(Myself),60)
	OR(2)
		!See(SeventhNearestEnemyOf(Myself))
		HPGT(SeventhNearestEnemyOf(Myself),60)
	OR(2)
		!See(EighthNearestEnemyOf(Myself))
		HPGT(EighthNearestEnemyOf(Myself),60)
	OR(2)
		!See(NinthNearestEnemyOf(Myself))
		HPGT(NinthNearestEnemyOf(Myself),60)
	OR(2)
		!See(TenthNearestEnemyOf(Myself))
		HPGT(TenthNearestEnemyOf(Myself),60)
	See(NearestEnemyOf(Myself))
	False()
THEN
	RESPONSE #100
		Continue()
END

IF
    OR(2)
		!GlobalTimerNotExpired("CAST","LOCALS")
        CheckStatGT(Myself,0,WIZARD_IMPROVED_ALACRITY)
	See(LastSeenBy(Myself))
	HPLT(LastSeenBy(Myself),61)
	HaveSpell(WIZARD_POWER_WORD_KILL)
	RandomNumGT(7,2)
THEN
	RESPONSE #100
		SetGlobalTimer("CAST","LOCALS",6)
		Spell(LastSeenBy(Myself),WIZARD_POWER_WORD_KILL)
END

IF
    OR(2)
		!GlobalTimerNotExpired("CAST","LOCALS")
        CheckStatGT(Myself,0,WIZARD_IMPROVED_ALACRITY)
	HaveSpell(WIZARD_POWER_WORD_STUN)
	RandomNumGT(6,1)
	OR(2)
		!See(NearestEnemyOf(Myself))
		HPGT(NearestEnemyOf(Myself),90)
	OR(2)
		!See(SecondNearestEnemyOf(Myself))
		HPGT(SecondNearestEnemyOf(Myself),90)
	OR(2)
		!See(ThirdNearestEnemyOf(Myself))
		HPGT(ThirdNearestEnemyOf(Myself),90)
	OR(2)
		!See(FourthNearestEnemyOf(Myself))
		HPGT(FourthNearestEnemyOf(Myself),90)
	OR(2)
		!See(FifthNearestEnemyOf(Myself))
		HPGT(FifthNearestEnemyOf(Myself),90)
	OR(2)
		!See(SixthNearestEnemyOf(Myself))
		HPGT(SixthNearestEnemyOf(Myself),90)
	OR(2)
		!See(SeventhNearestEnemyOf(Myself))
		HPGT(SeventhNearestEnemyOf(Myself),90)
	OR(2)
		!See(EighthNearestEnemyOf(Myself))
		HPGT(EighthNearestEnemyOf(Myself),90)
	OR(2)
		!See(NinthNearestEnemyOf(Myself))
		HPGT(NinthNearestEnemyOf(Myself),90)
	OR(2)
		!See(TenthNearestEnemyOf(Myself))
		HPGT(TenthNearestEnemyOf(Myself),90)
	See(NearestEnemyOf(Myself))
	False()
THEN
	RESPONSE #100
		Continue()
END

IF
    OR(2)
		!GlobalTimerNotExpired("CAST","LOCALS")
        CheckStatGT(Myself,0,WIZARD_IMPROVED_ALACRITY)
	See(LastSeenBy(Myself))
	HPLT(LastSeenBy(Myself),91)
	HaveSpell(WIZARD_POWER_WORD_STUN)
	RandomNumGT(6,1)
THEN
	RESPONSE #100
		SetGlobalTimer("CAST","LOCALS",6)
		Spell(LastSeenBy(Myself),WIZARD_POWER_WORD_STUN)
END

IF
    OR(2)
		!GlobalTimerNotExpired("CAST","LOCALS")
        CheckStatGT(Myself,0,WIZARD_IMPROVED_ALACRITY)
	HaveSpell(WIZARD_FINGER_OF_DEATH)
	OR(10)
		!See(NearestEnemyOf(Myself))
		CheckStatGT(LastSeenBy(Myself),0,WIZARD_SPELL_SHIELD)
		CheckStatGT(LastSeenBy(Myself),0,WIZARD_SPELL_DEFLECTION)
		CheckStatGT(LastSeenBy(Myself),0,WIZARD_SPELL_TURNING)
		CheckStatGT(LastSeenBy(Myself),0,WIZARD_SPELL_TRAP)
		CheckStatGT(LastSeenBy(Myself),0,CLERIC_SHIELD_OF_THE_ARCHONS)
		CheckStatGT(LastSeenBy(Myself),50,RESISTMAGIC)
		CheckStatLT(LastSeenBy(Myself),10,SAVEVSSPELL)
		CheckStatGT(LastSeenBy(Myself),0,SCRIPTINGSTATE2)
	    HasItemEquiped("CLCK26",LastSeenBy(Myself))
	OR(10)
		!See(SecondNearestEnemyOf(Myself))
		CheckStatGT(LastSeenBy(Myself),0,WIZARD_SPELL_SHIELD)
		CheckStatGT(LastSeenBy(Myself),0,WIZARD_SPELL_DEFLECTION)
		CheckStatGT(LastSeenBy(Myself),0,WIZARD_SPELL_TURNING)
		CheckStatGT(LastSeenBy(Myself),0,WIZARD_SPELL_TRAP)
		CheckStatGT(LastSeenBy(Myself),0,CLERIC_SHIELD_OF_THE_ARCHONS)
		CheckStatGT(LastSeenBy(Myself),50,RESISTMAGIC)
		CheckStatLT(LastSeenBy(Myself),10,SAVEVSSPELLS)
		CheckStatGT(LastSeenBy(Myself),0,SCRIPTINGSTATE2)
	    HasItemEquiped("CLCK26",LastSeenBy(Myself))
	OR(10)
		!See(ThirdNearestEnemyOf(Myself))
		CheckStatGT(LastSeenBy(Myself),0,WIZARD_SPELL_SHIELD)
		CheckStatGT(LastSeenBy(Myself),0,WIZARD_SPELL_DEFLECTION)
		CheckStatGT(LastSeenBy(Myself),0,WIZARD_SPELL_TURNING)
		CheckStatGT(LastSeenBy(Myself),0,WIZARD_SPELL_TRAP)
		CheckStatGT(LastSeenBy(Myself),0,CLERIC_SHIELD_OF_THE_ARCHONS)
		CheckStatGT(LastSeenBy(Myself),50,RESISTMAGIC)
		CheckStatLT(LastSeenBy(Myself),10,SAVEVSSPELLS)
		CheckStatGT(LastSeenBy(Myself),0,SCRIPTINGSTATE2)
	    HasItemEquiped("CLCK26",LastSeenBy(Myself))
	OR(10)
		!See(FourthNearestEnemyOf(Myself))
		CheckStatGT(LastSeenBy(Myself),0,WIZARD_SPELL_SHIELD)
		CheckStatGT(LastSeenBy(Myself),0,WIZARD_SPELL_DEFLECTION)
		CheckStatGT(LastSeenBy(Myself),0,WIZARD_SPELL_TURNING)
		CheckStatGT(LastSeenBy(Myself),0,WIZARD_SPELL_TRAP)
		CheckStatGT(LastSeenBy(Myself),0,CLERIC_SHIELD_OF_THE_ARCHONS)
		CheckStatGT(LastSeenBy(Myself),50,RESISTMAGIC)
		CheckStatLT(LastSeenBy(Myself),10,SAVEVSSPELLS)
		CheckStatGT(LastSeenBy(Myself),0,SCRIPTINGSTATE2)
	    HasItemEquiped("CLCK26",LastSeenBy(Myself))
	OR(10)
		!See(FifthNearestEnemyOf(Myself))
		CheckStatGT(LastSeenBy(Myself),0,WIZARD_SPELL_SHIELD)
		CheckStatGT(LastSeenBy(Myself),0,WIZARD_SPELL_DEFLECTION)
		CheckStatGT(LastSeenBy(Myself),0,WIZARD_SPELL_TURNING)
		CheckStatGT(LastSeenBy(Myself),0,WIZARD_SPELL_TRAP)
		CheckStatGT(LastSeenBy(Myself),0,CLERIC_SHIELD_OF_THE_ARCHONS)
		CheckStatGT(LastSeenBy(Myself),50,RESISTMAGIC)
		CheckStatLT(LastSeenBy(Myself),10,SAVEVSSPELLS)
		CheckStatGT(LastSeenBy(Myself),0,SCRIPTINGSTATE2)
	    HasItemEquiped("CLCK26",LastSeenBy(Myself))
	OR(10)
		!See(SixthNearestEnemyOf(Myself))
		CheckStatGT(LastSeenBy(Myself),0,WIZARD_SPELL_SHIELD)
		CheckStatGT(LastSeenBy(Myself),0,WIZARD_SPELL_DEFLECTION)
		CheckStatGT(LastSeenBy(Myself),0,WIZARD_SPELL_TURNING)
		CheckStatGT(LastSeenBy(Myself),0,WIZARD_SPELL_TRAP)
		CheckStatGT(LastSeenBy(Myself),0,CLERIC_SHIELD_OF_THE_ARCHONS)
		CheckStatGT(LastSeenBy(Myself),50,RESISTMAGIC)
		CheckStatLT(LastSeenBy(Myself),10,SAVEVSSPELLS)
		CheckStatGT(LastSeenBy(Myself),0,SCRIPTINGSTATE2)
	    HasItemEquiped("CLCK26",LastSeenBy(Myself))
	OR(10)
		!See(TenthNearestEnemyOf(Myself))
		CheckStatGT(LastSeenBy(Myself),0,WIZARD_SPELL_SHIELD)
		CheckStatGT(LastSeenBy(Myself),0,WIZARD_SPELL_DEFLECTION)
		CheckStatGT(LastSeenBy(Myself),0,WIZARD_SPELL_TURNING)
		CheckStatGT(LastSeenBy(Myself),0,WIZARD_SPELL_TRAP)
		CheckStatGT(LastSeenBy(Myself),0,CLERIC_SHIELD_OF_THE_ARCHONS)
		CheckStatGT(LastSeenBy(Myself),50,RESISTMAGIC)
		CheckStatLT(LastSeenBy(Myself),10,SAVEVSSPELLS)
		CheckStatGT(LastSeenBy(Myself),0,SCRIPTINGSTATE2)
	    HasItemEquiped("CLCK26",LastSeenBy(Myself))
	OR(9)
		!See(NearestEnemyOf(Myself))
		CheckStatGT(LastSeenBy(Myself),0,WIZARD_SPELL_SHIELD)
		CheckStatGT(LastSeenBy(Myself),0,WIZARD_SPELL_DEFLECTION)
		CheckStatGT(LastSeenBy(Myself),0,WIZARD_SPELL_TURNING)
		CheckStatGT(LastSeenBy(Myself),0,WIZARD_SPELL_TRAP)
		CheckStatGT(LastSeenBy(Myself),0,CLERIC_SHIELD_OF_THE_ARCHONS)
		CheckStatGT(LastSeenBy(Myself),50,RESISTMAGIC)
		CheckStatGT(LastSeenBy(Myself),0,SCRIPTINGSTATE2)
	    HasItemEquiped("CLCK26",LastSeenBy(Myself))
	OR(9)
		!See(SecondNearestEnemyOf(Myself))
		CheckStatGT(LastSeenBy(Myself),0,WIZARD_SPELL_SHIELD)
		CheckStatGT(LastSeenBy(Myself),0,WIZARD_SPELL_DEFLECTION)
		CheckStatGT(LastSeenBy(Myself),0,WIZARD_SPELL_TURNING)
		CheckStatGT(LastSeenBy(Myself),0,WIZARD_SPELL_TRAP)
		CheckStatGT(LastSeenBy(Myself),0,CLERIC_SHIELD_OF_THE_ARCHONS)
		CheckStatGT(LastSeenBy(Myself),50,RESISTMAGIC)
		CheckStatGT(LastSeenBy(Myself),0,SCRIPTINGSTATE2)
	    HasItemEquiped("CLCK26",LastSeenBy(Myself))
	OR(9)
		!See(ThirdNearestEnemyOf(Myself))
		CheckStatGT(LastSeenBy(Myself),0,WIZARD_SPELL_SHIELD)
		CheckStatGT(LastSeenBy(Myself),0,WIZARD_SPELL_DEFLECTION)
		CheckStatGT(LastSeenBy(Myself),0,WIZARD_SPELL_TURNING)
		CheckStatGT(LastSeenBy(Myself),0,WIZARD_SPELL_TRAP)
		CheckStatGT(LastSeenBy(Myself),0,CLERIC_SHIELD_OF_THE_ARCHONS)
		CheckStatGT(LastSeenBy(Myself),50,RESISTMAGIC)
		CheckStatGT(LastSeenBy(Myself),0,SCRIPTINGSTATE2)
	    HasItemEquiped("CLCK26",LastSeenBy(Myself))
	OR(9)
		!See(NearestEnemyOf(Myself))
		CheckStatGT(LastSeenBy(Myself),0,WIZARD_SPELL_SHIELD)
		CheckStatGT(LastSeenBy(Myself),0,WIZARD_SPELL_DEFLECTION)
		CheckStatGT(LastSeenBy(Myself),0,WIZARD_SPELL_TURNING)
		CheckStatGT(LastSeenBy(Myself),0,WIZARD_SPELL_TRAP)
		CheckStatGT(LastSeenBy(Myself),0,CLERIC_SHIELD_OF_THE_ARCHONS)
		CheckStatGT(LastSeenBy(Myself),99,RESISTMAGIC)
		CheckStatGT(LastSeenBy(Myself),0,SCRIPTINGSTATE2)
	    HasItemEquiped("CLCK26",LastSeenBy(Myself))
	OR(9)
		!See(SecondNearestEnemyOf(Myself))
		CheckStatGT(LastSeenBy(Myself),0,WIZARD_SPELL_SHIELD)
		CheckStatGT(LastSeenBy(Myself),0,WIZARD_SPELL_DEFLECTION)
		CheckStatGT(LastSeenBy(Myself),0,WIZARD_SPELL_TURNING)
		CheckStatGT(LastSeenBy(Myself),0,WIZARD_SPELL_TRAP)
		CheckStatGT(LastSeenBy(Myself),0,CLERIC_SHIELD_OF_THE_ARCHONS)
		CheckStatGT(LastSeenBy(Myself),99,RESISTMAGIC)
		CheckStatGT(LastSeenBy(Myself),0,SCRIPTINGSTATE2)
	    HasItemEquiped("CLCK26",LastSeenBy(Myself))
	!See(NearestEnemyOf(Myself))
THEN
	RESPONSE #100
		Continue()
END

IF
    OR(2)
		!GlobalTimerNotExpired("CAST","LOCALS")
    	CheckStatGT(Myself,0,WIZARD_IMPROVED_ALACRITY)
	See(LastSeenBy(Myself))
	!CheckStatGT(LastSeenBy(Myself),0,WIZARD_SPELL_SHIELD)
	!CheckStatGT(LastSeenBy(Myself),0,WIZARD_SPELL_DEFLECTION)
	!CheckStatGT(LastSeenBy(Myself),0,WIZARD_SPELL_TURNING)
	!CheckStatGT(LastSeenBy(Myself),0,WIZARD_SPELL_TRAP)
	!CheckStatGT(LastSeenBy(Myself),0,CLERIC_SHIELD_OF_THE_ARCHONS)
	!CheckStatGT(LastSeenBy(Myself),99,RESISTMAGIC)
	!CheckStatGT(LastSeenBy(Myself),0,SCRIPTINGSTATE2)
	!HasItemEquiped("CLCK26",LastSeenBy(Myself))
	HaveSpell(WIZARD_FINGER_OF_DEATH)
THEN
	RESPONSE #100
		SetGlobalTimer("CAST","LOCALS",6)
		Spell(LastSeenBy(Myself),WIZARD_FINGER_OF_DEATH)
END

IF
    OR(2)
		!GlobalTimerNotExpired("CAST","LOCALS")
        CheckStatGT(Myself,0,WIZARD_IMPROVED_ALACRITY)
	RandomNumGT(5,1)
	HaveSpell(WIZARD_FLESH_TO_STONE)
	OR(6)
		!See(NearestEnemyOf(Myself))
		StateCheck(NearestEnemyOf(Myself),STATE_STONE_DEATH)
		HasBounceEffects(NearestEnemyOf(Myself))
		HasImmunityEffects(NearestEnemyOf(Myself))
        HasItemEquiped("CLCK26",NearestEnemyOf(Myself))
		CheckStatGT(NearestEnemyOf(Myself),25,RESISTMAGIC)
	OR(6)
		!See(SecondNearestEnemyOf(Myself))
		StateCheck(SecondNearestEnemyOf(Myself),STATE_STONE_DEATH)
		HasBounceEffects(SecondNearestEnemyOf(Myself))
		HasImmunityEffects(SecondNearestEnemyOf(Myself))
        HasItemEquiped("CLCK26",SecondNearestEnemyOf(Myself))
		CheckStatGT(SecondNearestEnemyOf(Myself),25,RESISTMAGIC)
	OR(6)
		!See(ThirdNearestEnemyOf(Myself))
		StateCheck(ThirdNearestEnemyOf(Myself),STATE_STONE_DEATH)
		HasBounceEffects(ThirdNearestEnemyOf(Myself))
		HasImmunityEffects(ThirdNearestEnemyOf(Myself))
        HasItemEquiped("CLCK26",ThirdNearestEnemyOf(Myself))
		CheckStatGT(ThirdNearestEnemyOf(Myself),25,RESISTMAGIC)
	OR(6)
		!See(FourthNearestEnemyOf(Myself))
		StateCheck(FourthNearestEnemyOf(Myself),STATE_STONE_DEATH)
		HasBounceEffects(FourthNearestEnemyOf(Myself))
		HasImmunityEffects(FourthNearestEnemyOf(Myself))
        HasItemEquiped("CLCK26",FourthNearestEnemyOf(Myself))
		CheckStatGT(FourthNearestEnemyOf(Myself),25,RESISTMAGIC)
	OR(6)
		!See(FifthNearestEnemyOf(Myself))
		StateCheck(FifthNearestEnemyOf(Myself),STATE_STONE_DEATH)
		HasBounceEffects(FifthNearestEnemyOf(Myself))
		HasImmunityEffects(FifthNearestEnemyOf(Myself))
        HasItemEquiped("CLCK26",FifthNearestEnemyOf(Myself))
		CheckStatGT(FifthNearestEnemyOf(Myself),25,RESISTMAGIC)
	OR(6)
		!See(SixthNearestEnemyOf(Myself))
		StateCheck(SixthNearestEnemyOf(Myself),STATE_STONE_DEATH)
		HasBounceEffects(SixthNearestEnemyOf(Myself))
		HasImmunityEffects(SixthNearestEnemyOf(Myself))
        HasItemEquiped("CLCK26",SixthNearestEnemyOf(Myself))
		CheckStatGT(SixthNearestEnemyOf(Myself),25,RESISTMAGIC)
	See(NearestEnemyOf(Myself))
	False()
THEN
	RESPONSE #100
		Continue()
END

IF
    OR(2)
		!GlobalTimerNotExpired("CAST","LOCALS")
        CheckStatGT(Myself,0,WIZARD_IMPROVED_ALACRITY)
	See(LastSeenBy(Myself))
	!StateCheck(LastSeenBy(Myself),STATE_STONE_DEATH)
	!HasBounceEffects(LastSeenBy(Myself))
	!HasImmunityEffects(LastSeenBy(Myself))
    !HasItemEquiped("CLCK26",LastSeenBy(Myself))
	!CheckStatGT(LastSeenBy(Myself),25,RESISTMAGIC)
	HaveSpell(WIZARD_FLESH_TO_STONE)
	RandomNumGT(5,1)
THEN
	RESPONSE #100
		SetGlobalTimer("CAST","LOCALS",6)
		Spell(LastSeenBy(Myself),WIZARD_FLESH_TO_STONE)
END

IF
    OR(2)
		!GlobalTimerNotExpired("CAST","LOCALS")
        CheckStatGT(Myself,0,WIZARD_IMPROVED_ALACRITY)
	RandomNumGT(6,1)
	HaveSpell(WIZARD_DISINTEGRATE)
	OR(6)
		!See(NearestEnemyOf(Myself))
		HasBounceEffects(NearestEnemyOf(Myself))
        !CheckStat(NearestEnemyOf(Myself),0,SCRIPTINGSTATE2)
		HasImmunityEffects(NearestEnemyOf(Myself))
        HasItemEquiped("CLCK26",NearestEnemyOf(Myself))
		CheckStatGT(NearestEnemyOf(Myself),25,RESISTMAGIC)
	OR(6)
		!See(SecondNearestEnemyOf(Myself))
		HasBounceEffects(SecondNearestEnemyOf(Myself))
        !CheckStat(SecondNearestEnemyOf(Myself),0,SCRIPTINGSTATE2)
		HasImmunityEffects(SecondNearestEnemyOf(Myself))
        HasItemEquiped("CLCK26",SecondNearestEnemyOf(Myself))
		CheckStatGT(SecondNearestEnemyOf(Myself),25,RESISTMAGIC)
	OR(6)
		!See(ThirdNearestEnemyOf(Myself))
		HasBounceEffects(ThirdNearestEnemyOf(Myself))
        !CheckStat(ThirdNearestEnemyOf(Myself),0,SCRIPTINGSTATE2)
		HasImmunityEffects(ThirdNearestEnemyOf(Myself))
        HasItemEquiped("CLCK26",ThirdNearestEnemyOf(Myself))
		CheckStatGT(ThirdNearestEnemyOf(Myself),25,RESISTMAGIC)
	OR(6)
		!See(FourthNearestEnemyOf(Myself))
		HasBounceEffects(FourthNearestEnemyOf(Myself))
        !CheckStat(FourthNearestEnemyOf(Myself),0,SCRIPTINGSTATE2)
		HasImmunityEffects(FourthNearestEnemyOf(Myself))
        HasItemEquiped("CLCK26",FourthNearestEnemyOf(Myself))
		CheckStatGT(FourthNearestEnemyOf(Myself),25,RESISTMAGIC)
	OR(6)
		!See(FifthNearestEnemyOf(Myself))
		HasBounceEffects(FifthNearestEnemyOf(Myself))
        !CheckStat(FifthNearestEnemyOf(Myself),0,SCRIPTINGSTATE2)
		HasImmunityEffects(FifthNearestEnemyOf(Myself))
        HasItemEquiped("CLCK26",FifthNearestEnemyOf(Myself))
		CheckStatGT(FifthNearestEnemyOf(Myself),25,RESISTMAGIC)
	OR(6)
		!See(SixthNearestEnemyOf(Myself))
		HasBounceEffects(SixthNearestEnemyOf(Myself))
        !CheckStat(SixthNearestEnemyOf(Myself),0,SCRIPTINGSTATE2)
		HasImmunityEffects(SixthNearestEnemyOf(Myself))
        HasItemEquiped("CLCK26",SixthNearestEnemyOf(Myself))
		CheckStatGT(SixthNearestEnemyOf(Myself),25,RESISTMAGIC)
	See(NearestEnemyOf(Myself))
	False()
THEN
	RESPONSE #100
		Continue()
END

IF
    OR(2)
		!GlobalTimerNotExpired("CAST","LOCALS")
        CheckStatGT(Myself,0,WIZARD_IMPROVED_ALACRITY)
	See(LastSeenBy(Myself))
	!HasBounceEffects(LastSeenBy(Myself))
	CheckStat(LastSeenBy(Myself),0,SCRIPTINGSTATE2)
	!HasImmunityEffects(LastSeenBy(Myself))
    !HasItemEquiped("CLCK26",LastSeenBy(Myself))
	!CheckStatGT(LastSeenBy(Myself),25,RESISTMAGIC)
	HaveSpell(WIZARD_DISINTEGRATE)
	RandomNumGT(6,1)
THEN
	RESPONSE #100
		SetGlobalTimer("CAST","LOCALS",6)
		Spell(LastSeenBy(Myself),WIZARD_DISINTEGRATE)
END
