[scenario]
	id=The_Dwarven_Doors
	#textdomain wesnoth-httt
	name= _ "The Dwarven Doors"
	map_data="{maps/Heir_To_The_Throne/Dwarven_Doors}"
	{TURNS 21 18 15}

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

	next_scenario=Plunging_into_the_Darkness

	music="wesnoth-4.ogg"

	{BIGMAP_DWARVEN_DOORS}

	[event]
	name=prestart
		[objectives]
		side=1
			[objective]
				description= _ "Move Konrad to entrance of the Dwarven Kingdom"
				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]

	{PLACE_IMAGE terrain/dwarven-doors.png 14 3}
	{PLACE_IMAGE terrain/mine.png 25 2}
	
	[side]
	type=Commander
	description=Konrad
	user_description= _ "Konrad"
	side=1
	unrenamable=yes
	canrecruit=1
	controller=human
	[/side]

	[side]
	type=Orcish Warlord
	description=Knafa-Telfar
	user_description= _ "Knafa-Telfar"
	side=2
	canrecruit=1
	recruit=Troll Whelp,Orcish Grunt,Orcish Crossbowman
	{GOLD 200 240 280}
	{INCOME 4 8 12}
		[ai]
		{ATTACK_DEPTH 4 5 5}
		aggression=1.0
		grouping=no
		caution=-5.0
		[/ai]
	team_name=orcs
	[/side]

	[side]
	type=Orcish Warlord
	description=Urug-Tan
	user_description= _ "Urug-Tan"
	side=3
	canrecruit=1
	recruit=Troll Whelp,Orcish Grunt,Orcish Crossbowman
	{GOLD 150 190 230}
	{INCOME 2 4 8}

		[ai]
		{ATTACK_DEPTH 4 5 5}
		aggression=1.0
		grouping=no
		caution=-5.0
		[/ai]
	team_name=orcs
	[/side]

	[side]
	type=Orcish Warlord
	description=Shuuga-Mool
	user_description= _ "Shuuga-Mool"
	side=4
	canrecruit=1
	recruit=Orcish Grunt,Wolf Rider,Orcish Archer,Troll
	{GOLD 60 100 140}
	{INCOME 2 4 8}
	team_name=orcs
		[ai]
		{ATTACK_DEPTH 4 5 5}
		aggression=1.0
		grouping=no
		caution=-5.0
		[/ai]
	[/side]

	{STARTING_VILLAGES 2 20}
	{STARTING_VILLAGES 3 20}
	{STARTING_VILLAGES 4 20}


	[event]
	name=moveto
	first_time_only=yes
		[filter]
		side=1
		x=14
		y=3
		[/filter]
		[message]
			description=unit
			message= _ "The doors are closed and barred from the inside!"
		[/message]
		[message]
			description=Konrad
			message= _ "We can't get in! What should we do now?"
		[/message]
		[message]
			description=Kalenz
			message= _ "It is said that the orcs used an old mine tunnel to surprise the dwarves. It must be that one in the north-east."
		[/message]
		[message]
			description=Konrad
			message= _ "Then we must make it to that tunnel!"
		[/message]
	[/event]

	[event]
		name=moveto
		[filter]
			description=Konrad
			x=25
			y=2
		[/filter]

		[message]
			description=Konrad
			message= _ "This old mine seems to be connected to the main tunnels."
		[/message]
		[message]
			description=Kalenz
			message= _ "I am hesitant to enter. It will be so difficult in the darkness!"
		[/message]
		[message]
			description=Delfador
			message= _ "There is no time for idle chatter or delay of any kind. Onward!"
		[/message]

		[set_variable]
		name=killed_enemies
		value=false
		[/set_variable]

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

	[event]
	name=enemies defeated
		[message]
		description=Kalenz
		message= _ "We have defeated the foul Orcs guarding this land, but we must continue without rest. More will surely come!"
		[/message]
		[message]
		description=Delfador
		message= _ "Indeed we must not delay. I remember now, the mines in the North-East are the best way to enter!"
		[/message]
		[message]
		speaker=narrator
		message= _ "But Konrad's party was not alone in entering the mines..."
		[/message]
	[/event]

	[event]
	name=victory
		{UNIT (Princess) (Li'sar) ( _ "Li'sar") 2 8 44}

#define LISAR_GUARD_DOORS
		{UNIT (Royal Guard) (Royal Guard) ( _ "Royal Guard") 2 8 44}
#enddef

		{LISAR_GUARD_DOORS}
		{LISAR_GUARD_DOORS}
		{LISAR_GUARD_DOORS}
		{LISAR_GUARD_DOORS}
		{LISAR_GUARD_DOORS}
		{LISAR_GUARD_DOORS}

		[message]
		description=Li'sar
		message= _ "Whew! We make our way through the dangerous fog of the mountains, and now there is all this chaos before us! Come on, men! We must make it to the mines, which lie ahead of us!"
		[/message]

	[/event]


	[event]
	name=turn 2
		[message]
		description=Konrad
		message= _ "The defense of the dwarves must have been strong. Look at those ruined towers!"
		[/message]
		[message]
		description=Delfador
		message= _ "The battle outside was fierce, and lasted a full half-year. But the battles inside the tunnels were worse."
		[/message]
	[/event]

	[event]
		name=moveto
		[filter]
			side=1
			x=10-15
			y=10-15
		[/filter]

		{UNIT (Cuttle Fish) (Cuttle Fish) ( _ "Cuttle Fish") 4 13 13}

		[message]
			description=Cuttle Fish
			message= _ "Ruarrrrr!!!"
		[/message]
		[message]
			speaker=unit
			message= _ "A monster was hiding in that lake!"
		[/message]
		[role]
		type=Thief,Rogue,Mage,Elvish Shaman,Elvish Druid,Elvish Archer,Elvish Fighter,Elvish Captain,Elvish Marshal,Horseman,Elvish Lord
		role=whiner
		[/role]
		[message]
			description=whiner
			message= _ "The legend was true! There are always tentacled creatures hiding in the lakes near the Dwarven Kingdoms."
		[/message]
	[/event]

	[event]
	name=start
		[recall]
		description=Delfador
		[/recall]
		[recall]
		description=Kalenz
		[/recall]
		[message]
		description=Delfador
		message= _ "At last, this is the entrance to the Dwarven Kingdoms."
		[/message]
		[message]
		description=Konrad
		message= _ "All can I see are ruins and poor villages."
		[/message]
		[message]
		description=Kalenz
		message= _ "The poor villagers that once lived here and traded with the dwarves are now held in slavery by the orcs."
		[/message]
		[message]
		description=Konrad
		message= _ "Slaves to the evil orcs? We must liberate them!"
		[/message]
		[message]
		description=Delfador
		message= _ "That would not be a wise choice, for our mission is to retrieve the Scepter of Fire. If we tarry in this place, hordes of orcs will surround us."
		[/message]
		[message]
		description=Kalenz
		message= _ "Konrad, heed the words of Delfador. We shall return to wrest the grip of the orcs from these lands."
		[/message]
		[message]
		description=Konrad
		message= _ "This does not please me, but I will listen to your advice."
		[/message]
#define TALK_ABOUT_UNCLE
				[set_variable]
				name=unclesmuggler
				value=1
				[/set_variable]
#enddef

				[role]
				type=Footpad,Thug,Poacher,Outlaw,Trapper,Bandit
            			role=Advisor
            			[/role]
	                	[recall]
            			role=Advisor
            			[/recall]
            			[message]
            			role=Advisor
            			message= _ "My uncle used to smuggle... err... I mean... trade food for the Dwarves. He could get grain carts in under the very noses of those ugly orcs."
            			[/message]
            			[message]
            			role=Advisor
            			message= _ "He must be hiding in one of those villages."
            			[/message]
		[if]
			[have_unit]
			type=Footpad
			[/have_unit]
			[then]
			{TALK_ABOUT_UNCLE}
			[/then]
			[else]
			    [have_unit]
			    type=Outlaw
			    [/have_unit]
			    [then]
			    {TALK_ABOUT_UNCLE}
			    [/then]
			    [else]
				[have_unit]
				type=Thug
				[/have_unit]
				[then]
				{TALK_ABOUT_UNCLE}
				[/then]
				[else]
				    [have_unit]
				    type=Poacher
				    [/have_unit]
				    [then]
				    {TALK_ABOUT_UNCLE}
				    [/then]
				    [else]
					[have_unit]
					type=Bandit
					[/have_unit]
					[then]
					{TALK_ABOUT_UNCLE}
					[/then]
					[else]
					    [have_unit]
					    type=Poacher
					    [/have_unit]
					    [then]
					    {TALK_ABOUT_UNCLE}
					    [/then]
					[/else]
				    [/else]
				[/else]
			    [/else]
			[/else]
		[/if]
	[/event]
	[event]
		name=moveto
		[filter]
			side=1
			x=18
			y=24
		[/filter]
		[if]
			[variable]
			name=unclesmuggler
			numerical_equals=1
			[/variable]
		[then]

			{UNIT (Bandit) (Uncle Somf) ( _ "Uncle Somf") 1 18 24}

			[message]
				description=Uncle Somf
				message= _ "Haw! My niece's friends are mine friends too"
			[/message]
#			[message]
#				description=Uncle Somf
#				message= _ "The best way to reach the old doors is to use one of the service tunnels, they have old railcarts and you could travel fast across them."
#			[/message]
			[set_variable]
				name=unclesmuggler
				value=2
			[/set_variable]
		[/then]
		[/if]
	[/event]

	{scenarios/Heir_To_The_Throne/utils/deaths.cfg}

[/scenario]
