IF
	Die()
	!AreaCheck("AR2402")
THEN
	RESPONSE #100
		SetInterrupt(FALSE)
		SetGlobal("DrowCityHostile","GLOBAL",1)
		EraseJournalEntry(15797) // Recover the Silver Dragon's Eggs.  I have finally encountered Adalon, a female silver dragon who is desperate to have her eggs returned.  She normally guards the path to the surface from drow incursion, but Irenicus and Bodhi have stolen her eggs and given them to the drow... and she can do nothing for fear of her eggs being destroyed.   She has turned me into the likeness of a drow, with the name 'Veldrin', and bade me to enter the nearby city of Ust Natha in search of her eggs.  Once her eggs are returned safely, she will show me to the surface and reward me with an item from her hoard.
		AddJournalEntry(62079,QUEST_DONE)
		ActionOverride(Player1,ApplySpell(Myself,UNDER_NORM))
		ActionOverride(Player2,ApplySpell(Myself,UNDER_NORM))
		ActionOverride(Player3,ApplySpell(Myself,UNDER_NORM))
		ActionOverride(Player4,ApplySpell(Myself,UNDER_NORM))
		ActionOverride(Player5,ApplySpell(Myself,UNDER_NORM))
		ActionOverride(Player6,ApplySpell(Myself,UNDER_NORM))
		DisplayStringHead(Myself,62029) // With your attack on the dragon, the drow illusion fades away.
		SetGlobal("PlayerLooksLikeDrow","GLOBAL",0)
		SetInterrupt(TRUE)
END

IF
	AttackedBy([PC],DEFAULT)
	Global("DrowCityHostile","GLOBAL",0)
THEN
	RESPONSE #100
		SetGlobal("DrowCityHostile","GLOBAL",1)
		Continue()
END

IF
	AttackedBy([PC],DEFAULT)
	!Allegiance(Myself,ENEMY)
THEN
	RESPONSE #100
		EraseJournalEntry(15797) // Recover the Silver Dragon's Eggs.  I have finally encountered Adalon, a female silver dragon who is desperate to have her eggs returned.  She normally guards the path to the surface from drow incursion, but Irenicus and Bodhi have stolen her eggs and given them to the drow... and she can do nothing for fear of her eggs being destroyed.   She has turned me into the likeness of a drow, with the name 'Veldrin', and bade me to enter the nearby city of Ust Natha in search of her eggs.  Once her eggs are returned safely, she will show me to the surface and reward me with an item from her hoard.
		AddJournalEntry(62079,QUEST_DONE)
		Enemy()
END

IF
	AttackedBy([PC],DEFAULT)
	Global("PlayerLooksLikeDrow","GLOBAL",1)
THEN
	RESPONSE #100
		ActionOverride(Player1,ApplySpell(Myself,UNDER_NORM))
		ActionOverride(Player2,ApplySpell(Myself,UNDER_NORM))
		ActionOverride(Player3,ApplySpell(Myself,UNDER_NORM))
		ActionOverride(Player4,ApplySpell(Myself,UNDER_NORM))
		ActionOverride(Player5,ApplySpell(Myself,UNDER_NORM))
		ActionOverride(Player6,ApplySpell(Myself,UNDER_NORM))
		DisplayStringHead(Myself,62029) // With your attack on the dragon, the drow illusion fades away.
		SetGlobal("PlayerLooksLikeDrow","GLOBAL",0)
		Continue()
END

IF
	AreaCheck("AR2402")
	!Detect([0.0.0.0.129])
	Detect([PC])
	!Allegiance(Myself,ENEMY)
THEN
	RESPONSE #100
		SetGlobal("udDrowPlot","GLOBAL",99)
		DialogInterrupt(TRUE)
		StartDialogueNoSet(LastSeenBy(Myself))
END

IF
	Allegiance(Myself,ENEMY)
	AreaCheck("AR2402")
THEN
	RESPONSE #100
		ForceSpell(Myself,WIZARD_STONE_SKIN)
		ForceSpell(Myself,DRYAD_TELEPORT)
END

IF
	See([0.0.0.0.129])
	!Allegiance(Myself,ENEMY)
	Global("rain","LOCALS",0)
THEN
	RESPONSE #100
		SetGlobal("rain","LOCALS",1)
END

IF
	!Allegiance(Myself,ENEMY)
	Detect("uddoor05")
	!Dead("uddoor05")
THEN
	RESPONSE #100
		ForceSpell(LastSeenBy(Myself),WIZARD_LOWER_RESISTANCE)
		ForceSpell(LastSeenBy(Myself),WIZARD_MAGIC_MISSILE)
		Kill("uddoor05")
END

IF
	Detect("uddoor06")
	!Allegiance(Myself,ENEMY)
	!Dead("uddoor06")
THEN
	RESPONSE #100
		ForceSpell(LastSeenBy(Myself),WIZARD_LOWER_RESISTANCE)
		ForceSpell(LastSeenBy(Myself),WIZARD_HOLD_PERSON)
		ForceSpell(LastSeenBy(Myself),WIZARD_MAGIC_MISSILE)
		Kill("uddoor06")
END

IF
	Detect([0.0.0.0.129])
	!Allegiance(Myself,ENEMY)
	!StateCheck(LastSeenBy(Myself),STATE_REALLY_DEAD)
THEN
	RESPONSE #60
		ForceSpell(LastSeenBy(Myself),WIZARD_LOWER_RESISTANCE)
		ForceSpell(LastSeenBy(Myself),WIZARD_FLAME_ARROW)
		ForceSpell(LastSeenBy(Myself),WIZARD_FLAME_ARROW)
		ForceSpell(LastSeenBy(Myself),WIZARD_FLAME_ARROW)
	RESPONSE #60
		ForceSpell(LastSeenBy(Myself),WIZARD_FINGER_OF_DEATH)
	RESPONSE #60
		AttackReevaluate(LastSeenBy(Myself),15)
END

IF
	See(NearestEnemyOf(Myself))
	Global("RemoveMagic","LOCALS",0)
THEN
	RESPONSE #100
		ForceSpell(Myself,DRAGON_STONE_SKIN)
		ForceSpell(LastSeenBy(Myself),WIZARD_DISPEL_MAGIC)
		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)
		SetGlobal("DRAGONFEAR","LOCALS",1)
		SetGlobalTimer("SILVERDRAGONBREATH","GLOBAL",1)
		SetGlobalTimer("SILVERDRAGONBREATH2","GLOBAL",1)
		ForceSpell(LastSeenBy(Myself),DRAGON_WING_BUFFET)
END

IF
	OR(2)
		GlobalTimerExpired("SILVERDRAGONBREATH2","GLOBAL")
		GlobalTimerExpired("SILVERDRAGONBREATH","GLOBAL")
	See(NearestEnemyOf(Myself))
	Range(LastSeenBy(Myself),11)
THEN
	RESPONSE #100
		ForceSpell(LastSeenBy(Myself),DRAGON_WING_BUFFET)
	RESPONSE #60
		Continue()
END

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

IF
	See(SixthNearestEnemyOf(Myself))
	!Range(LastSeenBy(Myself),10)
	GlobalTimerExpired("SILVERDRAGONBREATH","GLOBAL")
THEN
	RESPONSE #100
		SetGlobal("WingBuffet","LOCALS",0)
		ForceSpell(LastSeenBy(Myself),SILVER_DRAGON_BREATH_COLD)
		SetGlobalTimer("SILVERDRAGONBREATH","GLOBAL",18)
END

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

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

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

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

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

IF
	See(NearestEnemyOf(Myself))
	Global("StoneSkin","LOCALS",0)
THEN
	RESPONSE #100
		ForceSpell(Myself,DRAGON_STONE_SKIN)
		SetGlobal("StoneSkin","LOCALS",1)
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("Invisible","LOCALS",0)
THEN
	RESPONSE #100
		ForceSpell(Myself,WIZARD_INVISIBILITY)
		SetGlobal("Invisible","LOCALS",1)
		RunAwayFrom(LastSeenBy(Myself),36)
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)
END

IF
	HPLT(Myself,100)
	GlobalLT("MediumWounds","LOCALS",3)
THEN
	RESPONSE #100
		ForceSpell(Myself,CLERIC_CURE_MEDIUM_WOUNDS)
		IncrementGlobal("MediumWounds","LOCALS",1)
END

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

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

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