IF
    OR(2)
		!GlobalTimerNotExpired("CAST","LOCALS")
        CheckStatGT(Myself,0,WIZARD_IMPROVED_ALACRITY)
    HaveSpell(WIZARD_LARLOCHS_MINOR_DRAIN)
	See(NearestEnemyOf(Myself))
	OR(12)
		HasItemEquiped("clck26",LastSeenBy(Myself))
        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),0,MINORGLOBE)
        CheckStatGT(LastSeenBy(Myself),0,SHIELDGLOBE)
		CheckStat(LastSeenBy(Myself),7,WIZARD_SPELL_IMMUNITY)
        CheckStatGT(LastSeenBy(Myself),50,MAGICDAMAGERESISTANCE)
        CheckStatGT(LastSeenBy(Myself),50,RESISTMAGIC)
        StateCheck(LastSeenBy(Myself),STATE_IMPROVEDINVISIBILITY)
        CheckStatGT(LastSeenBy(Myself),0,SANCTUARY)
	See(SecondNearestEnemyOf(Myself))
	OR(12)
		HasItemEquiped("clck26",LastSeenBy(Myself))
        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),0,MINORGLOBE)
        CheckStatGT(LastSeenBy(Myself),0,SHIELDGLOBE)
		CheckStat(LastSeenBy(Myself),7,WIZARD_SPELL_IMMUNITY)
        CheckStatGT(LastSeenBy(Myself),50,MAGICDAMAGERESISTANCE)
        CheckStatGT(LastSeenBy(Myself),50,RESISTMAGIC)
        StateCheck(LastSeenBy(Myself),STATE_IMPROVEDINVISIBILITY)
        CheckStatGT(LastSeenBy(Myself),0,SANCTUARY)
	See(ThirdNearestEnemyOf(Myself))
	OR(12)
		HasItemEquiped("clck26",LastSeenBy(Myself))
        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),0,MINORGLOBE)
        CheckStatGT(LastSeenBy(Myself),0,SHIELDGLOBE)
		CheckStat(LastSeenBy(Myself),7,WIZARD_SPELL_IMMUNITY)
        CheckStatGT(LastSeenBy(Myself),50,MAGICDAMAGERESISTANCE)
        CheckStatGT(LastSeenBy(Myself),50,RESISTMAGIC)
        StateCheck(LastSeenBy(Myself),STATE_IMPROVEDINVISIBILITY)
        CheckStatGT(LastSeenBy(Myself),0,SANCTUARY)
	See(FourthNearestEnemyOf(Myself))
	OR(12)
		HasItemEquiped("clck26",LastSeenBy(Myself))
        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),0,MINORGLOBE)
        CheckStatGT(LastSeenBy(Myself),0,SHIELDGLOBE)
		CheckStat(LastSeenBy(Myself),7,WIZARD_SPELL_IMMUNITY)
        CheckStatGT(LastSeenBy(Myself),50,MAGICDAMAGERESISTANCE)
        CheckStatGT(LastSeenBy(Myself),50,RESISTMAGIC)
        StateCheck(LastSeenBy(Myself),STATE_IMPROVEDINVISIBILITY)
        CheckStatGT(LastSeenBy(Myself),0,SANCTUARY)
	See(FifthNearestEnemyOf(Myself))
	OR(12)
		HasItemEquiped("clck26",LastSeenBy(Myself))
        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),0,MINORGLOBE)
        CheckStatGT(LastSeenBy(Myself),0,SHIELDGLOBE)
		CheckStat(LastSeenBy(Myself),7,WIZARD_SPELL_IMMUNITY)
        CheckStatGT(LastSeenBy(Myself),50,MAGICDAMAGERESISTANCE)
        CheckStatGT(LastSeenBy(Myself),50,RESISTMAGIC)
        StateCheck(LastSeenBy(Myself),STATE_IMPROVEDINVISIBILITY)
        CheckStatGT(LastSeenBy(Myself),0,SANCTUARY)
	See(SixthNearestEnemyOf(Myself))
	OR(12)
		HasItemEquiped("clck26",LastSeenBy(Myself))
        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),0,MINORGLOBE)
        CheckStatGT(LastSeenBy(Myself),0,SHIELDGLOBE)
		CheckStat(LastSeenBy(Myself),7,WIZARD_SPELL_IMMUNITY)
        CheckStatGT(LastSeenBy(Myself),50,MAGICDAMAGERESISTANCE)
        CheckStatGT(LastSeenBy(Myself),50,RESISTMAGIC)
        StateCheck(LastSeenBy(Myself),STATE_IMPROVEDINVISIBILITY)
        CheckStatGT(LastSeenBy(Myself),0,SANCTUARY)
	See(SeventhNearestEnemyOf(Myself))
	OR(12)
		HasItemEquiped("clck26",LastSeenBy(Myself))
        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),0,MINORGLOBE)
        CheckStatGT(LastSeenBy(Myself),0,SHIELDGLOBE)
		CheckStat(LastSeenBy(Myself),7,WIZARD_SPELL_IMMUNITY)
        CheckStatGT(LastSeenBy(Myself),50,MAGICDAMAGERESISTANCE)
        CheckStatGT(LastSeenBy(Myself),50,RESISTMAGIC)
        StateCheck(LastSeenBy(Myself),STATE_IMPROVEDINVISIBILITY)
        CheckStatGT(LastSeenBy(Myself),0,SANCTUARY)
	See(EighthNearestEnemyOf(Myself))
	OR(12)
		HasItemEquiped("clck26",LastSeenBy(Myself))
        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),0,MINORGLOBE)
        CheckStatGT(LastSeenBy(Myself),0,SHIELDGLOBE)
		CheckStat(LastSeenBy(Myself),7,WIZARD_SPELL_IMMUNITY)
        CheckStatGT(LastSeenBy(Myself),50,MAGICDAMAGERESISTANCE)
        CheckStatGT(LastSeenBy(Myself),50,RESISTMAGIC)
        StateCheck(LastSeenBy(Myself),STATE_IMPROVEDINVISIBILITY)
        CheckStatGT(LastSeenBy(Myself),0,SANCTUARY)
	See(NinthNearestEnemyOf(Myself))
	OR(12)
		HasItemEquiped("clck26",LastSeenBy(Myself))
        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),0,MINORGLOBE)
        CheckStatGT(LastSeenBy(Myself),0,SHIELDGLOBE)
		CheckStat(LastSeenBy(Myself),7,WIZARD_SPELL_IMMUNITY)
        CheckStatGT(LastSeenBy(Myself),50,MAGICDAMAGERESISTANCE)
        CheckStatGT(LastSeenBy(Myself),50,RESISTMAGIC)
        StateCheck(LastSeenBy(Myself),STATE_IMPROVEDINVISIBILITY)
        CheckStatGT(LastSeenBy(Myself),0,SANCTUARY)
	See(TenthNearestEnemyOf(Myself))
	OR(12)
		HasItemEquiped("clck26",LastSeenBy(Myself))
        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),0,MINORGLOBE)
        CheckStatGT(LastSeenBy(Myself),0,SHIELDGLOBE)
		CheckStat(LastSeenBy(Myself),7,WIZARD_SPELL_IMMUNITY)
        CheckStatGT(LastSeenBy(Myself),50,MAGICDAMAGERESISTANCE)
        CheckStatGT(LastSeenBy(Myself),50,RESISTMAGIC)
        StateCheck(LastSeenBy(Myself),STATE_IMPROVEDINVISIBILITY)
        CheckStatGT(LastSeenBy(Myself),0,SANCTUARY)
	See(NearestEnemyOf(Myself))
	False()
THEN
	RESPONSE #100
		Continue()
END

IF
    OR(2)
		!GlobalTimerNotExpired("CAST","LOCALS")
        CheckStatGT(Myself,0,WIZARD_IMPROVED_ALACRITY)
    HaveSpell(WIZARD_LARLOCHS_MINOR_DRAIN)
	See(LastSeenBy(Myself))
	!HasItemEquiped("clck26",LastSeenBy(Myself))
    !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),0,MINORGLOBE)
    !CheckStatGT(LastSeenBy(Myself),0,SHIELDGLOBE)
	!CheckStat(LastSeenBy(Myself),7,WIZARD_SPELL_IMMUNITY)
    !CheckStatGT(LastSeenBy(Myself),50,MAGICDAMAGERESISTANCE)
    !CheckStatGT(LastSeenBy(Myself),50,RESISTMAGIC)
    !StateCheck(LastSeenBy(Myself),STATE_IMPROVEDINVISIBILITY)
    !CheckStatGT(LastSeenBy(Myself),0,SANCTUARY)
THEN
    RESPONSE #100
        SetGlobalTimer("CAST","LOCALS",6)
        Spell(LastSeenBy(Myself),WIZARD_LARLOCHS_MINOR_DRAIN)
END
