IF
	HPPercentLT(Myself,25)
	See(NearestEnemyOf(Myself))
THEN
	RESPONSE #100
		Help()
		RunAwayFrom(NearestEnemyOf(Myself),90)
END

IF
	!HaveAnySpells()
	HPPercentLT(Myself,50)
	See(NearestEnemyOf(Myself))
THEN
	RESPONSE #100
		Help()
		RunAwayFrom(NearestEnemyOf(Myself),90)
END

IF
	HPPercentLT(Myself,90)
	HPPercentGT(Myself,50)
	See(NearestEnemyOf(Myself))
THEN
	RESPONSE #100
		Help()
		Continue()
END

IF
	See([ENEMY])
	HaveAnySpells()
	HPPercentGT(Myself,25)
	!Range(NearestEnemyOf(Myself),30)
THEN
	RESPONSE #100
		MoveToObject(NearestEnemyOf(Myself))
END

IF
	!See([ENEMY])
	See([ANYONE])
	!Range(Player1,25)
THEN
	RESPONSE #100
		SetInterrupt(FALSE)
		MoveToObject(Player1)
		SetInterrupt(TRUE)
END

IF
	!HaveAnySpells()
	OutOfAmmo()
	HPPercentGT(Myself,90)
	See(NearestEnemyOf(Myself))
THEN
	RESPONSE #100
		EquipMostDamagingMelee()
		Attack(LastAttackerOf(Myself))
END

IF
	!HaveAnySpells()
	OutOfAmmo()
	HPPercentLT(Myself,75)
	See(NearestEnemyOf(Myself))
	Range(NearestEnemyOf(Myself),4)
THEN
	RESPONSE #100
		RunAwayFrom(LastAttackerOf(Myself),90)
END

IF
	!HaveAnySpells()
	!OutOfAmmo()
	See(NearestEnemyOf(Myself))
	!Range(NearestEnemyOf(Myself),4)
THEN
	RESPONSE #100
		EquipRanged()
		AttackReevaluate(NearestEnemyOf(Myself),30)
END

IF
	!HaveAnySpells()
	!OutOfAmmo()
	See(NearestEnemyOf(Myself))
	Range(NearestEnemyOf(Myself),4)
THEN
	RESPONSE #100
		RunAwayFrom(LastAttackerOf(Myself),45)
END

IF
	AttackedBy([ANYONE],MELEE)
THEN
	RESPONSE #100
		Spell(Myself,WIZARD_SPIRIT_ARMOR)
END

IF
	AttackedBy([ANYONE],RANGED)
THEN
	RESPONSE #100
		ForceSpell(Myself,WIZARD_PROTECTION_FROM_NORMAL_MISSILES)
END

IF
	Class(LastAttackerOf(Myself),MAGE)
THEN
	RESPONSE #100
		ForceSpell(Myself,DRADEEL_MINOR_GLOBE)
END

IF
	Class(LastAttackerOf(Myself),CLERIC_MAGE)
THEN
	RESPONSE #100
		ForceSpell(LastAttackerOf(Myself),TANARI_SILENCE)
END

IF
	Class(LastAttackerOf(Myself),FIGHTER_MAGE)
THEN
	RESPONSE #100
		ForceSpell(Myself,DRADEEL_MINOR_GLOBE)
END

IF
	Class(LastAttackerOf(Myself),FIGHTER_MAGE_CLERIC)
THEN
	RESPONSE #100
		ForceSpell(Myself,DRADEEL_MINOR_GLOBE)
END

IF
	Class(LastAttackerOf(Myself),FIGHTER_MAGE_THIEF)
THEN
	RESPONSE #100
		ForceSpell(Myself,DRADEEL_MINOR_GLOBE)
END

IF
	Class(LastAttackerOf(Myself),MAGE_THIEF)
THEN
	RESPONSE #100
		ForceSpell(Myself,DRADEEL_MINOR_GLOBE)
END

IF
	General(LastAttackerOf(Myself),UNDEAD)
THEN
	RESPONSE #100
		ForceSpell(LastAttackerOf(Myself),RED_FIREBALL)
END

IF
	General(LastAttackerOf(Myself),HUMANOID)
THEN
	RESPONSE #25
		ForceSpell(LastAttackerOf(Myself),SPIDER_SUMMON)
END

IF
	General(LastAttackerOf(Myself),HUMANOID)
THEN
	RESPONSE #25
		ForceSpell(LastAttackerOf(Myself),TANARI_DEATH_GAZE)
END

IF
	General(LastAttackerOf(Myself),HUMANOID)
THEN
	RESPONSE #50
		ForceSpell(LastAttackerOf(Myself),TANARI_VAMPIRIC_TOUCH)
END

IF
	See([ENEMY])
	Range(NearestEnemyOf(Myself),5)
	!General(LastAttackerOf(Myself),UNDEAD)
THEN
	RESPONSE #50
		ForceSpell(NearestEnemyOf(Myself),TANARI_VAMPIRIC_TOUCH)
END

IF
	See([ENEMY])
	Range(NearestEnemyOf(Myself),5)
	!General(LastAttackerOf(Myself),UNDEAD)
THEN
	RESPONSE #25
		ForceSpell(NearestEnemyOf(Myself),WIZARD_GHOUL_TOUCH)
END

IF
	See([ENEMY])
	Range(NearestEnemyOf(Myself),5)
	!General(LastAttackerOf(Myself),UNDEAD)
THEN
	RESPONSE #25
		ForceSpell(NearestEnemyOf(Myself),WIZARD_CHILL_TOUCH)
END

IF
	See([ENEMY])
	Range(NearestEnemyOf(Myself),10)
	NumCreatureGT([ENEMY],2)
	!General(LastAttackerOf(Myself),UNDEAD)
THEN
	RESPONSE #100
		ForceSpell(NearestEnemyOf(Myself),SUCCUBUS_ENERGY_DRAIN)
END

IF
	See([ENEMY])
	Range(NearestEnemyOf(Myself),10)
	NumCreatureGT([ENEMY],4)
THEN
	RESPONSE #100
		ForceSpell(NearestEnemyOf(Myself),WIZARD_GLOBE_OF_DARKNESS)
END

IF
	See([ENEMY])
	Range(NearestEnemyOf(Myself),10)
	!General(LastAttackerOf(Myself),UNDEAD)
THEN
	RESPONSE #50
		ForceSpell(NearestEnemyOf(Myself),WIZARD_HORROR)
END

IF
	See([ENEMY])
	Range(NearestEnemyOf(Myself),10)
	!General(LastAttackerOf(Myself),UNDEAD)
THEN
	RESPONSE #50
		ForceSpell(NearestEnemyOf(Myself),WIZARD_LARLOCH_MINOR_DRAIN)
END

IF
	See([ENEMY])
	Range(NearestEnemyOf(Myself),15)
THEN
	RESPONSE #100
		ForceSpell(NearestEnemyOf(Myself),DRADEEL_BLUE_FIREBALL)
END

IF
	See([ENEMY])
	Range(NearestEnemyOf(Myself),15)
	!General(LastAttackerOf(Myself),UNDEAD)
THEN
	RESPONSE #75
		ForceSpell(NearestEnemyOf(Myself),WIZARD_SKULL_TRAP)
END

IF
	See([ENEMY])
	Range(NearestEnemyOf(Myself),15)
	!General(LastAttackerOf(Myself),UNDEAD)
THEN
	RESPONSE #25
		ForceSpell(NearestEnemyOf(Myself),PAIN)
END


