[scenario]
	id=10_Gryphon_Mountain
	#textdomain wesnoth-httt
	name= _ "Gryphon Mountain"
	map_data="{campaigns/Heir_To_The_Throne/maps/Gryphon_Mountain}"
	{SCENARIO_MUSIC "gameplay01.ogg"}
	{TURNS 27 24 21}

	{DAWN}
	{MORNING}
	{AFTERNOON}
	{DUSK}
	{FIRST_WATCH}
	{SECOND_WATCH}

	next_scenario=11_The_Ford_of_Abez

	[event]
	name=prestart
		[objectives]
		side=1
			[objective]
				description= _ "Defeat the mother gryphon and the enemy commander"
				condition=win
			[/objective]
			[objective]
				description= _ "Death of Konrad"
				condition=lose
			[/objective]
			[objective]
				description= _ "Death of Delfador"
				condition=lose
			[/objective]
			[objective]
				description= _ "Death of Kalenz"
				condition=lose
			[/objective]
		[/objectives]
	[/event]

	{BIGMAP_GRYPHON_MOUNTAIN}

	{PLACE_IMAGE misc/nest-empty.png 10 14}

	{PLACE_IMAGE misc/nest-empty.png 16 16}

	{PLACE_IMAGE misc/nest-empty.png 12 18}

	{PLACE_IMAGE misc/nest-full.png 13 16}


	[side]
	type=Commander
	description=Konrad
	user_description= _ "Konrad"
	unrenamable=yes
	side=1
	canrecruit=1
	controller=human
#ifdef HARD
	gold=100
#else
	gold=300
#endif
	[/side]

	[side]
	type=General
	description=Robert
	user_description= _ "Robert"
	side=2
	canrecruit=1
	recruit=Cavalryman,Swordsman,Mage,Ogre,Duelist,Longbowman
		[ai]
		{ATTACK_DEPTH 1 3 5}
		recruitment_pattern=scout,fighter,fighter,fighter,archer,mixed fighter
		[/ai]
	{GOLD 160 270 350}
	[/side]

	[side]
	type=Gryphon
	description=Mother Gryphon
	user_description= _ "Mother Gryphon"
	side=3
	canrecruit=1
	recruit=Gryphon
	gold=0
		[ai]
		{ATTACK_DEPTH 1 3 5}
		passive_leader=yes
		[/ai]
	[/side]

	[event]
	name=prestart
		[recall]
		description=Delfador
		[/recall]
		[recall]
		description=Kalenz
		[/recall]

		{UNIT (Sleeping Gryphon) (Graak) ( _ "Graak") 3 12 18}
		{UNIT (Sleeping Gryphon) (Grook) ( _ "Grook") 3 16 16}
		{UNIT (Sleeping Gryphon) (Gruak) ( _ "Gruak") 3 10 14}

		# Eliminate the gryphon's starting keep
		[terrain]
		x,y=13,16
		letter=m
		[/terrain]

	[/event]

	[event]
	name=start
		[message]
		description=Konrad
		message= _ "What is this place? That is one big mountain!"
		[/message]
		[message]
		description=Delfador
		message= _ "That is the fabled Gryphon Mountain."
		[/message]
		[message]
		description=Konrad
		message= _ "Gryphon Mountain! Maybe we could steal some eggs from the gryphons and train the young to be flying mounts. Would that work, Delfador?"
		[/message]
		[message]
		description=Delfador
		message= _ "We can try to do that, but we must be careful. To disturb the gryphons could prove dangerous... and yet such mounts could help us greatly later. Whatever we do, we must pass by this place."
		[/message]
		[message]
		description=Konrad
		message= _ "Well, let's start climbing the mountain!"
		[/message]
	[/event]

	#if the player kills the mother gryphon
	#and gets her eggs
	[event]
	name=die
		[filter]
		description=Mother Gryphon
		[/filter]
		[filter_second]
		side=1
		[/filter_second]
		[message]
		speaker=second_unit
		message= _ "Here are the mother Gryphon's eggs!"
		[/message]
		[message]
		description=Konrad
		message= _ "Excellent! We should be able to breed Gryphons for our own uses now!"
		[/message]
		[set_variable]
		name=get_gryphons
		value=1
		[/set_variable]
	[/event]

	#if the enemy gets to the gryphon eggs first
	[event]
	name=die
		[filter]
		description=Mother Gryphon
		[/filter]
		[filter_second]
		side=2
		[/filter_second]
		[message]
		speaker=second_unit
		message= _ "Ha ha! We have killed this foul beast of the air, and can deny the rebels its eggs!"
		[/message]
	[/event]

	[event]
	name=turn 2
		[message]
		description=Delfador
		message= _ "It appears that we are not the only ones interested in this mountain. Once again the Queen opposes us!"
		[/message]
		[message]
		description=Konrad
		message= _ "Quickly, men! Onward!"
		[/message]
	[/event]

	[event]
	name=victory
		[message]
		description=Konrad
		message= _ "We have defeated them! Now what do we do?"
		[/message]
		[message]
		description=Delfador
		message= _ "We must continue north. It is too late to return to the safety of Elensefar or Anduin before winter falls. We must therefore cross the great river and continue toward the land of the dwarves. Hurry, let us go!"
		[/message]
		[if]
			[variable]
			name=get_gryphons
			numerical_equals=1
			[/variable]
			[then]
				[message]
				description=Konrad
				message= _ "With these gryphon eggs we should be able to breed gryphons that will serve us. When they are large enough to carry mounts, we can hire gryphon riders!"
				[/message]
			[/then]
			[else]
				[message]
				description=Konrad
				message= _ "It is a shame we could not get those gryphon eggs - they would surely have given us an advantage sometime. Still, we must continue."
				[/message]
			[/else]
		[/if]
		[message]
		description=Delfador
		message= _ "Let us continue onward!"
		[/message]
	[/event]

	#
	# If the sleeping gryphon is attacked, it wakes up
	#

	[event]
	name=attack
	[filter_second]
		description=Graak
	[/filter_second]
	[kill]
		description=Graak
	[/kill]
	{UNIT (Gryphon) (Rampant Graak) ( _ "Rampant Graak") 3 12 18}
	[/event]

	[event]
	name=attack
	[filter_second]
		description=Grook
	[/filter_second]
	[kill]
		description=Grook
	[/kill]
	{UNIT (Gryphon) (Rampant Grook) ( _ "Rampant Grook") 3 16 16}
	[/event]

	[event]
	name=attack
	[filter_second]
		description=Gruak
	[/filter_second]
	[kill]
	description=Gruak
	[/kill]
	{UNIT (Gryphon) (Rampant Gruak) ( _ "Rampant Gruak") 3 10 14}
	[/event]

	#
	# If the sleeping gryphon attacks you, it wakes up
	#

	[event]
	name=attack
	[filter]
		description=Graak
	[/filter]
	[kill]
		description=Graak
	[/kill]
	{UNIT (Gryphon) (Rampant Graak) ( _ "Rampant Graak") 3 12 18}
	[/event]

	[event]
	name=attack
	[filter]
		description=Grook
	[/filter]
	[kill]
		description=Grook
	[/kill]
	{UNIT (Gryphon) (Rampant Grook) ( _ "Rampant Grook") 3 16 16}
	[/event]

	[event]
	name=attack
	[filter]
		description=Gruak
	[/filter]
	[kill]
	description=Gruak
	[/kill]
	{UNIT (Gryphon) (Rampant Gruak) ( _ "Rampant Gruak") 3 10 14}
	[/event]

	#
	# Neutralize the movement goal for sleeping gryphons every turn
	#
	[event]
	name=side turn
	first_time_only=no
		[store_unit]
		variable=sleepy_gryphon_store
			[filter]
			type=Sleeping Gryphon
			[/filter]
		[/store_unit]
		{FOREACH sleepy_gryphon_store i}
		{VARIABLE_OP x_temp format $sleepy_gryphon_store[$i].x}
		{VARIABLE_OP y_temp format $sleepy_gryphon_store[$i].y}
		{VARIABLE sleepy_gryphon_store[$i].goto_x x_temp}
		{VARIABLE sleepy_gryphon_store[$i].goto_y y_temp}
		[unstore_unit]
		variable=sleepy_gryphon_store[$i]
		[/unstore_unit]
		{NEXT i}
		{CLEAR_VARIABLE sleepy_gryphon_store}
		{CLEAR_VARIABLE x_temp}
		{CLEAR_VARIABLE y_temp}
	[/event]

	{campaigns/Heir_To_The_Throne/utils/deaths.cfg}

[/scenario]
