[scenario]
	id=09_The_Valley_of_Death
	#textdomain wesnoth-httt
	name= _ "The Valley of Death - The Princess's Revenge"
	map_data="{campaigns/Heir_To_The_Throne/maps/Valley_of_Death}"
	{SCENARIO_MUSIC "wesnoth-5.ogg"}
	turns=12

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

	next_scenario=10_Gryphon_Mountain

	[event]
	name=prestart
		[objectives]
		side=1
			[objective]
				description= _ "Survive for two days"
				condition=win
			[/objective]
			[objective]
				description= _ "Eradicate the Liches (Bonus)"
				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_VALLEY_OF_DEATH}

	[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]

#define VOD_AI_PARMS
	[ai]
	grouping=no
	simple_targetting=yes
	recruitment_ignore_bad_combat=yes
	recruitment_ignore_bad_movement=yes
	aggression=1.0
	caution=-5.0
	{ATTACK_DEPTH 1 3 5}
	[/ai]
#enddef

	[side]
	type=Lich
	description=Galga
	user_description= _ "Galga"
	side=2
	canrecruit=1
	team_name=undead
	#flag=terrain/undead-flag-1.png,terrain/undead-flag-2.png,terrain/undead-flag-3.png,terrain/undead-flag-4.png

	{VOD_AI_PARMS}
	{GOLD 200 320 440}

#ifdef EASY
	recruit=Skeleton,Revenant,Blood Bat,Ghost,Bone Shooter
#endif
#ifdef NORMAL
	recruit=Skeleton,Revenant,Chocobone,Blood Bat,Wraith,Bone Shooter,Dark Adept
#endif
#ifdef HARD
	recruit=Skeleton,Revenant,Chocobone,Wraith,Bone Shooter,Dark Adept
#endif

		[ai]
#ifdef EASY
		recruitment_pattern=fighter,fighter,archer,scout
#endif
#ifdef NORMAL
		recruitment_pattern=fighter,fighter,archer,scout
#endif
#ifdef HARD
		recruitment_pattern=fighter,fighter,archer,scout
#endif
		[/ai]

		[ai]
		aggression=1.0
		village_value=0.0
		leader_value=50.0
		[/ai]
	[/side]

	[side]
	type=Lich
	description=Na-alga
	user_description= _ "Na-alga"
	side=3
	team_name=undead
	canrecruit=1
	recruit=Wraith,Walking Corpse
	#flag=terrain/undead-flag-1.png,terrain/undead-flag-2.png,terrain/undead-flag-3.png,terrain/undead-flag-4.png
	{VOD_AI_PARMS}
	{GOLD 200 400 600}
		[ai]
#ifdef EASY
		recruitment_pattern=fighter
#endif
#ifdef NORMAL
		recruitment_pattern=fighter
#endif
#ifdef HARD
		recruitment_pattern=fighter,fighter,fighter,scout
#endif
		[/ai]

		[ai]
		aggression=1.0
		village_value=0.0
		leader_value=50.0
		villages_per_scout=0.0
		[/ai]
	[/side]

	[side]
	type=Lich
	description=Selda-Mana
	user_description= _ "Selda-Mana"
	side=4
	canrecruit=1
	#flag=terrain/undead-flag-1.png,terrain/undead-flag-2.png,terrain/undead-flag-3.png,terrain/undead-flag-4.png
	{VOD_AI_PARMS}
	{GOLD 160 280 400}

#ifdef EASY
	recruit=Walking Corpse,Wraith,Bone Shooter,Revenant,Skeleton
#endif
#ifdef NORMAL
	recruit=Walking Corpse,Wraith,Bone Shooter,Revenant,Skeleton,Dark Adept
#endif
#ifdef HARD
	recruit=Wraith,Chocobone,Bone Shooter,Revenant,Skeleton,Dark Adept
#endif

		[ai]
#ifdef EASY
		recruitment_pattern=fighter,fighter,archer,scout
#endif
#ifdef NORMAL
		recruitment_pattern=fighter,fighter,archer,scout
#endif
#ifdef HARD
		recruitment_pattern=fighter,fighter,archer,scout,scout
#endif
		[/ai]

		[ai]
		aggression=1.0
		village_value=0.0
		leader_value=50.0
		[/ai]

	team_name=undead
	[/side]

	{OBJ_POTION_HOLY 5 23 object7_holywater}
	{OBJ_POTION_HOLY 31 43 object7_holywater2}

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

	[event]
	name=start
		[message]
		description=Kalenz
		message= _ "My lord! This road does not seem as safe as we had hoped. Look around us at the hills - there are undead about!"
		[/message]
		[message]
		description=Selda-Mana
		message= _ "Who are these who approach? Let us kill them all!"
		[/message]
		[message]
		description=Delfador
		message= _ "To arms, men! The undead hordes approach!"
		[/message]
		[message]
		description=Moremirmu
		user_description= _ "Moremirmu"
		message= _ "Let us never surrender to these foul beasts of the pit! We fight until victory, or until every one of us is slain!"
		[/message]
	[/event]

	[event]
	name=turn 3
		[message]
		description=Konrad
		message= _ "There are just so many! What shall we do?"
		[/message]
		[message]
		description=Kalenz
		message= _ "My people douse our weapons with holy water when fighting undead. It usually lasts until the end of the battle, and they shrink in utter fear of our blades... if that is possible for an undead minion."
		[/message]
		[message]
		description=Delfador
		message= _ "Let us hold them off as long as we can!"
		[/message]
	[/event]

	[event]
	name=turn 7
		[if]
			[variable]
			name=moremirmu
			numerical_equals=1
			[/variable]
			[then]
				[unit]
				description=Moremirmu
				user_description= _ "Moremirmu"
				type=Mage of Light
				side=1
				x=20
				y=48
				[modifications]
					{TRAIT_LOYAL}
				[/modifications]
				[/unit]

				{UNIT (White Mage) (Heldra) ( _ "Heldra") 1 20 48}
				{UNIT (White Mage) (Marcus) ( _ "Marcus") 1 20 48}
				{UNIT (White Mage) (Haldar) ( _ "Haldar") 1 20 48}

				[message]
				description=Moremirmu
				message= _ "I have come once again to aid you, friends!"
				[/message]
				[message]
				description=Delfador
				message= _ "White magi? Come to help us? But what are they doing here?"
				[/message]
				[message]
				description=Konrad
				message= _ "That is Moremirmu! He helped us fight the undead in the Isles of the Damned, let us hope he can help us once more!"
				[/message]
			[/then]
		[/if]
	[/event]

	[event]
	name=time over

		[message]
		description=Delfador
		message= _ "The sun rises in the east. Surely the undead do not have the power to continue their onslaught through another day!"
		[/message]
		[message]
		description=Kalenz
		message= _ "Indeed not! I feel we have survived this battle."
		[/message]
		[message]
		description=Konrad
		message= _ "Whew! That was a difficult battle, but they are retreating at last!"
		[/message]

		[endlevel]
		result=victory
		[/endlevel]
	[/event]

	[event]
	name=die
		[filter]
		description=Moremirmu
		[/filter]
		[set_variable]
		name=moremirmu
		value=3
		[/set_variable]
	[/event]

	[event]
	name=victory
		[message]
		description=Delfador
		message= _ "Yes! We have fought them off!"
		[/message]

		#if Moremirmu survived the battle, then this dialog
		#takes place
		[if]
			[variable]
			name=moremirmu
			numerical_equals=1
			[/variable]

			[then]
			[message]
			description=Konrad
			message= _ "Thank you for returning to help us, Moremirmu."
			[/message]
			[message]
			description=Moremirmu
			message= _ "It is both my duty and pleasure, my lord! We were dining with some royal guards of the princess, taking a rest from our pilgrimage, when they spoke of how you were tricked into traveling these dangerous lands. We could do nothing but help you!"
			[/message]
			[message]
			description=Konrad
			message= _ "So, she tricked us into coming this way! Where may we go now? Which way will be safe for us?"
			[/message]
			[message]
			description=Moremirmu
			message= _ "You must get out of the clutches of that vile Queen, my lord. If you take a course bearing north-east, on past the mountain of gryphons, you will be able to ford the great river at Abez. Make haste though, for you will not be able to ford the river in winter!"
			[/message]
			[message]
			description=Konrad
			message= _ "Thank you for your counsel, good friend! May our paths meet again in happier times!"
			[/message]
			[/then]

			[else]
			[if]
				#if Moremirmu died in this battle, the
				#player laments his death
				[variable]
				name=moremirmu
				numerical_equals=3
				[/variable]
				[then]
					[message]
					description=Konrad
					message= _ "It greatly saddens me that Moremirmu was slain on the field, after he helped us."
					[/message]
					[message]
					type=White Mage,Mage of Light
					message= _ "May he rest peacefully!"
					[/message]
					[message]
					description=Kalenz
					message= _ "He died fighting for you, Prince, just as any of us would be willing to die for you."
					[/message]
				[/then]
			[/if]
			[message]
			description=Konrad
			message= _ "This place makes me feel uneasy, even with the undead retreating. Where may we go now?"
			[/message]
			[message]
			description=Kalenz
			message= _ "The land of Wesnoth is not safe for us. The Queen's forces reach every corner. We must make haste to the north lands, across the great river. Let us go quickly!"
			[/message]
			[message]
			description=Delfador
			message= _ "Indeed! Let us go from here!"
			[/message]
			[/else]
		[/if]

		[if]
			[or]
			[variable]
			name=moremirmu
			numerical_equals=1
			[/variable]
			[/or]
			[or]
			[variable]
			name=moremirmu
			numerical_equals=3
			[/variable]
			[/or]

			[then]
				[kill]
				description=Moremirmu
				[/kill]
				[kill]
				description=Haldar
				[/kill]
				[kill]
				description=Marcus
				[/kill]
				[kill]
				description=Heldra
				[/kill]
			[/then]
		[/if]

		[endlevel]
		result=victory
		[/endlevel]
	[/event]

	{campaigns/Heir_To_The_Throne/utils/deaths.cfg}

[/scenario]
