IF
	See(NearestEnemyOf(Myself))
	Global("RemoveMagic","LOCALS",0)
THEN
	RESPONSE #100
		ForceSpell(Myself,DRAGON_STONE_SKIN)
		ForceSpell(LastSeenBy(Myself),WIZARD_DISPEL_MAGIC)
		SetGlobal("StoneSkin","LOCALS",1)
		SetGlobal("RemoveMagic","LOCALS",1)
END

IF
	!Detect([PC])
	HPLT(Myself,50)
	CombatCounter(0)
THEN
	RESPONSE #100
		SetGlobal("RemoveMagic","LOCALS",0)
		SetGlobal("WingBuffet","LOCALS",0)
		SetGlobal("Haste","LOCALS",0)
		SetGlobal("DRAGONFEAR","LOCALS",0)
		ForceSpell(Myself,CLERIC_HEAL)
END

IF
	See(NearestEnemyOf(Myself))
	Global("DRAGONFEAR","LOCALS",0)
THEN
	RESPONSE #100
		ReallyForceSpell(NearestEnemyOf(Myself),DRAGON_FEAR)
		ReallyForceSpell(NearestEnemyOf(Myself),DRAGON_LOWER_FIRE)
		SetGlobal("DRAGONFEAR","LOCALS",1)
		SetGlobalTimer("YELLOWDRAGONBREATH","GLOBAL",1)
END

IF
	GlobalTimerExpired("YELLOWDRAGONBREATH","GLOBAL")
	See(NearestEnemyOf(Myself))
	Range(LastSeenBy(Myself),11)
	Global("WingBuffet","LOCALS",0)
	Global("NoBlowBack","LOCALS",0)
THEN
	RESPONSE #100
		ForceSpell(LastSeenBy(Myself),DRAGON_WING_BUFFET)
		Wait(1)
		SetGlobal("WingBuffet","LOCALS",1)
	RESPONSE #60
		Continue()
END

IF
	See(NearestEnemyOf(Myself))
	!Range(LastSeenBy(Myself),10)
	GlobalTimerExpired("YELLOWDRAGONBREATH","GLOBAL")
THEN
	RESPONSE #100
		SetGlobal("WingBuffet","LOCALS",0)
		ForceSpell(LastSeenBy(Myself),YELLOW_DRAGON_BREATH)
		SetGlobalTimer("YELLOWDRAGONBREATH","GLOBAL",12)
END

IF
	Global("WingBuffet","LOCALS",1)
	See(NearestEnemyOf(Myself))
	Range(LastSeenBy(Myself),11)
THEN
	RESPONSE #100
		SetGlobal("WingBuffet","LOCALS",0)
		SetGlobalTimer("YELLOWDRAGONBREATH","GLOBAL",18)
END

IF
	See(NearestEnemyOf(Myself))
	Global("Offense1","LOCALS",0)
THEN
	RESPONSE #100
		ForceSpell(LastSeenBy(Myself),WIZARD_GREATER_MALISON)
		SetGlobal("Offense1","LOCALS",1)
END

IF
	See(NearestEnemyOf(Myself))
	Global("Haste","LOCALS",0)
THEN
	RESPONSE #100
		ForceSpell(Myself,WIZARD_HASTE)
		SetGlobal("Haste","LOCALS",1)
END

IF
	See(NearestEnemyOf(Myself))
	Global("HoldPerson","LOCALS",0)
THEN
	RESPONSE #100
		ForceSpell(LastSeenBy(Myself),CLERIC_HOLD_PERSON)
		SetGlobal("HoldPerson","LOCALS",1)
END

IF
	Global("Silence","LOCALS",0)
	OR(2)
		See(NearestEnemyOfType([0.0.0.LONG_BOW]))
		See(NearestEnemyOfType([0.0.0.CLERIC_ALL]))
THEN
	RESPONSE #100
		ForceSpell(LastSeenBy(Myself),DRAGON_SILENCE)
		SetGlobal("Silence","LOCALS",1)
		AttackOneRound(LastSeenBy(Myself))
		AttackOneRound(LastSeenBy(Myself))
END

IF
	See(NearestEnemyOf(Myself))
	Delay(6)
	GlobalLT("CharmPerson","LOCALS",3)
THEN
	RESPONSE #100
		ForceSpell(NearestEnemyOf(Myself),WIZARD_CHARM_PERSON)
		IncrementGlobal("CharmPerson","LOCALS",1)
END

IF
	See(NearestEnemyOf(Myself))
THEN
	RESPONSE #100
		EquipMostDamagingMelee()
		AttackReevaluate(NearestEnemyOf(Myself),35)
	RESPONSE #10
		ForceSpell(LastSeenBy(Myself),WIZARD_MELF_ACID_ARROW)
END

IF
	Allegiance(Myself,ENEMY)
THEN
	RESPONSE #100
		MoveToObject(NearestEnemyOf(Myself))
END

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