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

	{UNDERGROUND}

	next_scenario=17_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=Orcish Warlord
	side=3
	canrecruit=1
	recruit=Orcish Warrior,Wolf Rider,Troll,Troll Whelp,Goblin Pillager
	{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,Boneshooter
	{GOLD 240 300 360}
		[ai]
		{ATTACK_DEPTH 4 5 5}
		[/ai]
	team_name=evil
	[/side]

	{PLACE_IMAGE items/signpost.png 27 22}
	{PLACE_IMAGE misc/rocks.png 28 25}
	{PLACE_IMAGE misc/rocks.png 26 24}
	{PLACE_IMAGE misc/rocks.png 27 24}

	[event]
	name=start
		[recall]
		description=Delfador
		[/recall]
		[recall]
		description=Kalenz
		[/recall]
		[message]
		description=Delfador
		message= _ "These are some of 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="items/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=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=u
		[/terrain]

		{PLACE_IMAGE misc/rocks.png 28 26}

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

		{PLACE_IMAGE misc/rocks.png 26 25}

		#just in case that the player wait until the other end is open to catch him alone
		[unit]
#ifdef EASY
		type=Skeleton
#endif
#ifdef NORMAL
		type=Skeleton
#endif
#ifdef HARD
		type=Revenant
#endif
		side=4
		x=23
		y=29
		[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=23
		y=29
		[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 29}
#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

#define TREMOR
		[scroll]
			x=5
			y=0
		[/scroll]
		[delay]
			time=10
		[/delay]
		[scroll]
			x=-10
			y=0
		[/scroll]
		[delay]
			time=10
		[/delay]
		[scroll]
			x=0
			y=5
		[/scroll]
		[delay]
			time=10
		[/delay]
		[scroll]
			x=0
			y=-10
		[/scroll]
#enddef

		{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=u
		[/terrain]

		{PLACE_IMAGE misc/rocks.png 15 26}

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

		{PLACE_IMAGE misc/rocks.png 16 26}

		{UNDEAD_UNIT (Skeleton) 4 23 29}
	[/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 you. Life has been nothing but a struggle recently. We are the last outpost of 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 you seek. You surface dwellers are ambitious. Beyond my citadel the spawn of the darkness hold complete sway. You will not survive without assistance."
		[/message]
		[message]
		description=Konrad
		message= _ "How will we make it?"
		[/message]
		[message]
		description=Geldar
		message= _ "Northeast of my keep, young human, the tunnels converge towards the deepest reaches of the underground kingdom. The Scepter can only be there. Please accept the gift 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]
