[scenario]
	id=15_The_Lost_General
	#textdomain wesnoth-httt
	name= _ "The Lost General"
	map_data="{campaigns/Heir_To_The_Throne/maps/15_The_Lost_General.map}"
	{SCENARIO_MUSIC "underground.ogg"}
	{TURNS 64 60 54}

	{UNDERGROUND}

	next_scenario=16_Hasty_Alliance

	{BIGMAP_THE_LOST_GENERAL}

	[event]
	name=prestart
		[objectives]
		side=1
			[objective]
				description= _ "Defeat all enemy leaders"
				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]

	[side]
	type=Commander
	description=Konrad
	user_description= _ "Konrad"
	unrenamable=yes
	side=1
	canrecruit=1
	controller=human
	recruit=Dwarvish Fighter,Dwarvish Thunderer
	shroud=yes
	team_name=good
	{GOLD 350 250 100}
	[/side]

	[side]
	description=Geldar
	user_description= _ "Geldar"
	type=Dwarvish Lord
	side=2
	canrecruit=1
	recruit=Dwarvish Fighter
	gold=150
	team_name=good
	[/side]

	[side]
	description=Brugg
	user_description= _ "Brugg"
	type=Troll Warrior
	side=3
	canrecruit=1
	recruit=Orcish Warrior,Wolf Rider,Troll,Troll Whelp,Troll Rocklobber,Goblin Pillager,Orcish Assassin,Orcish Crossbowman
	{GOLD 290 350 410}
		[ai]
		{ATTACK_DEPTH 4 5 5}
		[/ai]
	team_name=evil
	[/side]

	[side]
	description=Lionel
	user_description= _ "Lionel"
	type=Death Knight
	side=4
	canrecruit=1
	recruit=Skeleton,Ghost,Revenant,Skeleton Archer,Bone Shooter
	{GOLD 240 300 360}
		[ai]
		{ATTACK_DEPTH 4 5 5}
		[/ai]
	team_name=evil
	[/side]

	{PLACE_IMAGE scenery/signpost.png 27 22}
	{PLACE_IMAGE scenery/rubble.png 28 25}
	{PLACE_IMAGE scenery/rubble.png 26 24}
	{PLACE_IMAGE scenery/rubble.png 27 24}

	[event]
	name=start
		[recall]
		description=Delfador
		[/recall]
		[recall]
		description=Kalenz
		[/recall]
		[message]
		description=Delfador
		message= _ "We are now in the main dwarvish caverns."
		[/message]
		[message]
		description=Delfador
		message= _ "Underground roads once led to the different parts of the complex, but now everything lies in ruins."
		[/message]
	[/event]

	[event]
	name=moveto
		[filter]
		x=27
		y=22
		side=1
		[/filter]
		[message]
		speaker=narrator
		image="scenery/signpost.png"
		message= _ "The sign says 'Guest quarters'."
		[/message]
	[/event]

	[event]
	name=moveto
		[filter]
		x=17
		y=24
		side=1
		[/filter]

		{UNIT (Dwarvish Fighter) (Burlin) ( _ "Burlin") 2 17 24}

		[message]
		description=Burlin
		message= _ "My uncle's family drowned after the orcs flooded that cavern..."
		[/message]
	[/event]

	[event]
	name=moveto
		[filter]
		x=13
		y=22
		side=1
		race=merman
		[/filter]
		[message]
		speaker=narrator
		image="wesnoth-icon.png"
		message= _ "A hidden whirlpool sucks you down into a subterranean current!"
		[/message]
		{PLACE_IMAGE units/trolls/whelp-die-6.png 2 22}
		{PLACE_IMAGE units/trolls/whelp-die-5.png 4 21}
		{UNIT (Dwarvish Ulfserker) (Ulfdain) ( _ "Ulfdain") 2 2 21}
		[teleport]
			[filter]
			x,y=$x1,$y1
			[/filter]
			x,y=6,23
		[/teleport]
		[scroll_to]
		x,y=6,23
		[/scroll_to]
		[remove_shroud]
		x=2-4
		y=21-24
		[/remove_shroud]
		[message]
		description=Ulfdain
		message= _ "What's this, more trolls? Aye, come to papa, little whelps."
		[/message]
		[message]
		x,y=6,23
		message= _ "Hello? Who is here?"
		[/message]
		[message]
		description=Ulfdain
		message= _ "What in the world are you? Some sort o' monster's appendage set tae lure me down to be yer watery meal, eh?"
		[/message]
		[message]
		x,y=6,23
		message= _ "I am a merman, dweller of the vast oceans! Do not ask me what I am doing in a cave. My lord can be somewhat eccentric. We are fighting at the side of your fellow cave-dwellers to drive back the orcs."
		[/message]
		[message]
		description=Ulfdain
		message= _ "(sniffs) A mer-mahn. Never heard of it. I doubt yer as tasty as my friends here."
		[/message]
		[message]
		x,y=6,23
		message= _ "Why are you down here? Are those... troll carcasses?"
		[/message]
		[message]
		description=Ulfdain
		message= _ "I was brawlin' with these wee pups here defending my outpost. We got a little carried away, fell in the water, and were sucked down inta this grotto."
		[/message]
		[message]
		x,y=6,23
		message= _ "How long have you been here?"
		[/message]
		[message]
		description=Ulfdain
		message= _ "Och, several days at least. The troll meat is starting to stink, and I'm a little ravenous, if ye catch my drift. Canna swim past that current, and not for lack o' tryin'."
		[/message]
		[message]
		x,y=6,23
		message= _ "I will rescue you. Hold onto my shoulders, sir dwarf."
		[/message]
		[message]
		description=Ulfdain
		message= _ "Thanks. No need to wait around here. Let's go."
		[/message]
		[kill]
		x,y=2,21
		[/kill]
	[/event]

	[event]
	name=moveto
		[filter]
		x=7
		y=23
		side=1
		race=merman
		[/filter]
		[message]
		speaker=narrator
		image="wesnoth-icon.png"
		message= _ "Better prepared this time to fight the current, you eventually manage to emerge from the whirlpool."
		[/message]
		[teleport]
			[filter]
			x,y=$x1,$y1
			[/filter]
			x,y=13,22
		[/teleport]
		[unit]
		side=1
		type=Dwarvish Ulfserker
		x,y=14,22
		user_description=Ulfdain
		description= _ "Ulfdain"
		unrenamable=yes
		random_traits=yes
		upkeep=1
		[/unit]		
		[place_shroud]
		x= 2-7 , 7-8
		y=21-24,22-24
		[/place_shroud]
		[message]
		description=Ulfdain
		message= _ "Well, mer-mahn, we made it. I will fight for yer lord. He sounds like a brave fellow."
		[/message]
	[/event]

	[event]
	name=moveto
		[filter]
		x=22-25
		y=1-23
		side=1
		[/filter]
		[message]
		speaker=unit
		message= _ "These passages seem to have been used recently."
		[/message]
	[/event]

	[event]
	name=moveto
		[filter]
		x=11-19
		y=10-16
		side=1
		[/filter]
		[remove_shroud]
		x=14-16,12-18,10-19,12-18
		y=10,   11,   12-14,15
		[/remove_shroud]
		[redraw]
		[/redraw]

		#
		# For some reason, the scroll_to tag isn't working.
		# If anyone can fix it, please do.
		#

		[scroll_to]
		x,y=15,13
		[/scroll_to]
		[delay]
		time=1500
		[/delay]
		[message]
		speaker=narrator
		image=misc/schedule-underground-illum.png
		message= _ "You emerge into a vast natural cathedral, the walls arching higher than you can see in the darkness. Stretching across the gallery is a great chasm, around which the cave floor appears to have been completely worn smooth. This was once the center of a bustling dwarvish empire, the remnants of which have since been driven into the upper caves of Knalga by the forces of darkness."
		[/message]
	[/event]

	[event]
	name=moveto
		[filter]
		x=20-30
		y=18-30
		side=1
		[/filter]
		[message]
		speaker=unit
		message= _ "There is a big cave-in south of here."
		[/message]
	[/event]
	[event]
	name=moveto
		[filter]
		x=20-30
		y=24-25
		side=1
		[/filter]
		[message]
		speaker=narrator
		message= _ "RUMBLE! RUMBLE! RUMBLE!"
		[/message]
		[message]
		speaker=unit
		message= _ "The rocks are moving!"
		[/message]
		[terrain]
		x=28
		y=26
		letter=Uu
		[/terrain]

		{PLACE_IMAGE scenery/rubble.png 28 26}

		[terrain]
		x=26
		y=25
		letter=Uu
		[/terrain]

		{PLACE_IMAGE scenery/rubble.png 26 25}

		#just in case that the player waits until the other end is
		# open to catch him alone
		[unit]
#ifdef HARD
		type=Revenant
#else
		type=Skeleton
#endif
		side=4
		x=24
		y=28
		[modifications]
			{TRAIT_UNDEAD}
			{TRAIT_LOYAL}
		[/modifications]
		[/unit]
		[unit]
#ifdef EASY
		type=Walking Corpse
#endif
#ifdef NORMAL
		type=Skeleton
#endif
#ifdef HARD
		type=Revenant
#endif
		side=4
		x=24
		y=28
		[modifications]
			{TRAIT_UNDEAD}
			{TRAIT_LOYAL}
		[/modifications]
		[/unit]
	[/event]

	[event]
	name=sighted
		[filter]
		side=2
		[/filter]
		[message]
		speaker=second_unit
		message= _ "Who goes there? Friend or foe?"
		[/message]
		[message]
		speaker=unit
		message= _ "We are desperately trying to rid these tunnels of the foul orcs! Please help us in our quest."
		[/message]
	[/event]

	[event]
	name=sighted
		[filter]
		side=3
		[/filter]
		[message]
		speaker=second_unit
		message= _ "Ah, a foul orc! Let us rid these tunnels of its kind!"
		[/message]
	[/event]

	[event]
	name=sighted
		[filter]
		side=4
		[/filter]
		[message]
		speaker=second_unit
		message= _ "I did not know that the undead were in these pits!"
		[/message]
	[/event]

	[event]
	name=sighted
		[filter]
		description=Lionel
		[/filter]
		[message]
		speaker=second_unit
		message= _ "Who is this foul enemy that we fight?"
		[/message]
		[message]
		description=Lionel
		message= _ "I am Lionel. I am the Lost General. I will avenge myself upon you all!"
		[/message]
		[message]
		description=Konrad
		message= _ "Avenge? What have we done to you that you must avenge?"
		[/message]
		[message]
		description=Delfador
		message= _ "Lionel? A General? I remember that name..."
		[/message]
		[message]
		description=Lionel
		message= _ "Remember me, do you? Aye. I was the king's finest general, sent down to these pits to retrieve the Scepter. But the orcs trapped me and my men in this cavern, to starve to death. The dwarves were no help, leaving me to die. Now I will get revenge on you all!"
		[/message]

#define MORE_UNITS
		{UNDEAD_UNIT (Revenant) 4 23 28}
#enddef

		{MORE_UNITS}
		{MORE_UNITS}
		{MORE_UNITS}
	[/event]

	[event]
	name=die
		[filter]
		description=Lionel
		[/filter]
		[message]
		description=Lionel
		message= _ "Argh! I am vanquished! But at least by worthy foes, instead of those disgusting orcs."
		[/message]
		[message]
		description=Delfador
		message= _ "Rest in peace, Lionel. The poor, lost general."
		[/message]
		[message]
		description=Lionel
		message= _ "I am destroyed, but my mission must be completed. Though you are foes, you are at least worthy ones, so I will tell you that the Scepter is east from here, the way you have come from, deep in the caverns. I made the mistake of not asking for directions when I became lost. May you have better fortune in your quest than I did!"
		[/message]
	[/event]

	[event]
	name=turn 20

		{TREMOR}
		{TREMOR}
		{TREMOR}
		{TREMOR}
		[message]
		speaker=narrator
		image="wesnoth-icon.png"
		message= _ "The earth shakes."
		[/message]
# just to open another exit to the undeads
		[terrain]
		x=15
		y=26
		letter=Uu
		[/terrain]

		{PLACE_IMAGE scenery/rubble.png 15 26}

		[terrain]
		x=16
		y=26
		letter=Uu
		[/terrain]

		{PLACE_IMAGE scenery/rubble.png 16 26}

		{UNDEAD_UNIT (Skeleton) 4 23 28}
	[/event]

	[event]
	name=victory

		#

		# We don't know if Geldar will be alive at this point,
                # but if he is, then he gives you guardsmen. The message 
		# tags outside the if statement will form a coherent 
		# conversation either way, and leaving them out avoids
		# some duplication.

		#
		[message]
		description=Geldar
		message= _ "Tall ones, I thank ye. Life has been nothing but a struggle recently. We are the last outpost o' civilization in these caves."
		[/message]
		[message]
		description=Delfador
		message= _ "These caves are vast. If we are to find the Scepter of Fire we must hurry. We are not alone, and now that our foes have smelled our blood it will be worse."
		[/message]
		[message]
		description=Geldar
		message= _ "The Scepter? Ah, the Scepter ye seek. You surface dwellers are ambitious. Beyond my citadel the spawn of the darkness hold complete sway. You'll no' survive without assistance."
		[/message]
		[message]
		description=Konrad
		message= _ "How will we make it?"
		[/message]
		[message]
		description=Geldar
		message= _ "Northeast o' my keep, young human, the tunnels converge towards the deepest reaches of the underground kingdom. The Scepter can only be there. Please accept the service of my guardsmen. These elite warriors will protect you."
		[/message]

		[if]
		[have_unit]
		description=Geldar
		[/have_unit]
		[then]
			[message]
			description=Delfador
			message= _ "Your boon is most welcome, sir dwarf. Keeping the Scepter out of the hands of evil beasts is a common goal for us, and we will prevail with your help."
			[/message]
			[message]
			speaker=narrator
			image="wesnoth-icon.png"
			message= _ "You may now recruit the legendary dwarvish guardsmen!"
			[/message]
			[allow_recruit]
			type=Dwarvish Guardsman
			[/allow_recruit]
		[/then]
		[else]
			[message]
			description=Delfador
			message= _ "I do not know, Konrad, but I can sense our path only leads us downward. We will continue to the northeast, to the deepest depths of these caverns."
			[/message]
		[/else]
		[/if]
	[/event]

	{campaigns/Heir_To_The_Throne/utils/deaths.cfg}
[/scenario]
