IF
        See(NearestEnemyOf(Myself))
	HasItem("SCRL7O",Myself)
        !CheckStat(Myself,4,WIZARD_PROTECTION_FROM_MAGIC_WEAPONS)
        !GlobalTimerNotExpired("PROTECTION_1","LOCALS")
        !GlobalTimerNotExpired("USE_DELAY","LOCALS")
THEN
	RESPONSE #100
                SetGlobalTimer("PROTECTION_1","LOCALS",6)
                SetGlobalTimer("USE_DELAY","LOCALS",6)
		UseItem("SCRL7O",Myself)
END

IF
        HPPercentLT(Myself,30)
        !GlobalTimerNotExpired("HEAL_1","LOCALS")
        GlobalLT("HEAL1_INCRE","LOCALS",5)
        !GlobalTimerNotExpired("USE_DELAY","LOCALS")
THEN
	RESPONSE #100
                IncrementGlobal("HEAL1_INCRE","LOCALS",1)
                SetGlobalTimer("HEAL_1","LOCALS",6)
                SetGlobalTimer("USE_DELAY","LOCALS",6)
                CreateItem("SCRLSD",1,0,0)
                UseItem("SCRLSD",Myself)
END

IF
        HPPercentLT(Myself,75)
        GlobalLT("HEAL2_INCRE","LOCALS",21)
        !GlobalTimerNotExpired("USE_DELAY","LOCALS")
THEN
	RESPONSE #100
                IncrementGlobal("HEAL2_INCRE","LOCALS",1)
                SetGlobalTimer("USE_DELAY","LOCALS",6)
		DisplayStringHead(Myself,46150)
                CreateItem("POTN55",1,0,0)
                UseItem("POTN55",Myself)
END

IF
        See(NearestEnemyOf(Myself))
        !StateCheck(Myself,STATE_IMPROVEDINVISIBILITY)
        !GlobalTimerNotExpired("PROTECTION_2","LOCALS")
        !GlobalTimerNotExpired("USE_DELAY","LOCALS")
THEN
	RESPONSE #100
                SetGlobalTimer("PROTECTION_2","LOCALS",6)
                SetGlobalTimer("USE_DELAY","LOCALS",6)
                CreateItem("SCRL1Y",1,0,0)
		UseItem("SCRL1Y",Myself)
END

IF
        See(NearestEnemyOf(Myself))
        !StateCheck(Myself,STATE_BLUR)
        !GlobalTimerNotExpired("PROTECTION_3","LOCALS")
        !GlobalTimerNotExpired("USE_DELAY","LOCALS")
THEN
	RESPONSE #100
                SetGlobalTimer("PROTECTION_3","LOCALS",6)
                SetGlobalTimer("USE_DELAY","LOCALS",6)
                CreateItem("SCRL85",1,0,0)
		UseItem("SCRL85",Myself)
END

IF
        See(NearestEnemyOf(Myself))
        CheckStatLT(Myself,23,STR)
        !GlobalTimerNotExpired("PROTECTION_4","LOCALS")
        !GlobalTimerNotExpired("USE_DELAY","LOCALS")
THEN
	RESPONSE #100
                SetGlobalTimer("PROTECTION_4","LOCALS",6)
                SetGlobalTimer("USE_DELAY","LOCALS",6)
		DisplayStringHead(Myself,46150)
                CreateItem("POTN07",1,0,0)
                UseItem("POTN07",Myself)
END

IF
        See(NearestEnemyOf(Myself))
        CheckStatGT(Myself,0, SAVEVSDEATH)
        !GlobalTimerNotExpired("PROTECTION_5","LOCALS")
        !GlobalTimerNotExpired("USE_DELAY","LOCALS")
THEN
	RESPONSE #100
                SetGlobalTimer("PROTECTION_5","LOCALS",6)
                SetGlobalTimer("USE_DELAY","LOCALS",6)
		DisplayStringHead(Myself,46150)
                CreateItem("POTN35",1,0,0)
                UseItem("POTN35",Myself)
END

IF
        See(NearestEnemyOf(Myself))
        CheckStatLT(Myself,50, RESISTMAGIC)
        !GlobalTimerNotExpired("PROTECTION_6","LOCALS")
        !GlobalTimerNotExpired("USE_DELAY","LOCALS")
THEN
	RESPONSE #100
                SetGlobalTimer("PROTECTION_6","LOCALS",6)
                SetGlobalTimer("USE_DELAY","LOCALS",6)
		DisplayStringHead(Myself,46150)
                CreateItem("POTN34",1,0,0)
                UseItem("POTN34",Myself)
END

IF
        See(NearestEnemyOf(Myself))
        CheckStatLT(Myself,21, DEX)
        !GlobalTimerNotExpired("PROTECTION_7","LOCALS")
        !GlobalTimerNotExpired("USE_DELAY","LOCALS")
THEN
	RESPONSE #100
                SetGlobalTimer("PROTECTION_7","LOCALS",6)
                SetGlobalTimer("USE_DELAY","LOCALS",6)
		DisplayStringHead(Myself,46150)
                CreateItem("POTN37",1,0,0)
                UseItem("POTN37",Myself)
END

IF
        See(NearestEnemyOf(Myself))
        !GlobalTimerNotExpired("FreeAction","LOCALS")
        !GlobalTimerNotExpired("USE_DELAY","LOCALS")
THEN
	RESPONSE #100
                SetGlobalTimer("FreeAction","LOCALS",60)
                SetGlobalTimer("USE_DELAY","LOCALS",6)
		DisplayStringHead(Myself,46150)
                CreateItem("POTN45",1,0,0)
                UseItem("POTN45",Myself)
END

IF
	See(NearestEnemyOf(Myself))
        !GlobalTimerNotExpired("ProtectionOfDeath","LOCALS")
THEN
	RESPONSE #100
                SetGlobalTimer("ProtectionOfDeath","LOCALS",30)
                ForceSpellRES("SPCL917",Myself)
END

IF
	See(NearestEnemyOf(Myself))
        !GlobalTimerNotExpired("GreaterEvasion","LOCALS")
THEN
	RESPONSE #100
                SetGlobalTimer("GreaterEvasion","LOCALS",30)
                ForceSpellRES("SPCL914",Myself)
END

IF
	See(NearestEnemyOf(Myself))
        !Range(LastSeenBy(Myself),2)
        !GlobalTimerNotExpired("USE_DELAY","LOCALS")
        !CheckStat(LastSeenBy(Myself),0,WIZARD_PROTECTION_FROM_MAGIC_WEAPONS)
        !InMyGroup(LastSeenBy(Myself))
THEN
	RESPONSE #100
                MoveToObject(LastSeenBy(Myself))
END

IF
	See(NearestEnemyOf(Myself))
        Range(LastSeenBy(Myself),2)
        !GlobalTimerNotExpired("USE_DELAY","LOCALS")
        !CheckStat(LastSeenBy(Myself),0,WIZARD_PROTECTION_FROM_MAGIC_WEAPONS)
        !InMyGroup(LastSeenBy(Myself))
THEN
	RESPONSE #100
                SetGlobalTimer("USE_DELAY","LOCALS",6)
                CreateItem("SCRL07",1,0,0)
                UseItem("SCRL07",LastSeenBy(Myself))
                ReallyForceSpellRES("SPCL900",Myself)
                AttackReevaluate(LastSeenBy(Myself),30)
END

IF
	See(NearestEnemyOf(Myself))
        CheckStat(LastSeenBy(Myself),0,WIZARD_PROTECTION_FROM_MAGIC_WEAPONS)
        !InMyGroup(LastSeenBy(Myself))
THEN
	RESPONSE #100
                ReallyForceSpellRES("SPCL900",Myself)
                AttackReevaluate(LastSeenBy(Myself),30)
END

IF
	Heard([ANYONE],ALERT)
        InMyGroup(LastHeardBy(Myself))
	Allegiance(Myself,NEUTRAL)
THEN
	RESPONSE #100
                Shout(ALERT)
                Enemy()
END

IF
        AttackedBy([GOODCUTOFF],DEFAULT)
	Allegiance(Myself,NEUTRAL)
THEN
	RESPONSE #100
                Shout(ALERT)
                Enemy()
END