[scenario]
id=Escape_Tunnel
#textdomain wesnoth-ei
name= _ "The Escape Tunnel"
map_data="{campaigns/Eastern_Invasion/maps/The_Escape_Tunnel}"
{TURNS 26 24 22}

	{UNDERGROUND}

next_scenario=Unexpected_Appearance

	{DEFAULT_MUSIC_PLAYLIST}

	{campaigns/Eastern_Invasion/utils/deaths.cfg}

	[side]
	type=Lieutenant
	description=Gweddry
	user_description= _ "Gweddry"
	side=1
	canrecruit=1
	controller=human
	shroud=yes
	team_name=good
#ifdef EASY
	gold=200
#endif
	[/side]

	[side]
	type=Troll
	description=Kabak
	user_description= _ "Kabak"
	side=2
	canrecruit=1
	controller=ai
	recruit=Troll Whelp
	{GOLD 60 70 90}
	[/side]

	[side]
	type=Dwarvish Steelclad
	description=Knutan
	user_description= _ "Knutan"
	side=3
	canrecruit=1
	controller=ai
	recruit=Dwarvish Fighter,Dwarvish Thunderer
	{GOLD 70 60 50}
	team_name=good
		[ai]
		grouping=no
			[target]
			side=2
			value=100
			[/target]
			[target]
			side=3
			value=1
			[/target]
		[/ai]
	[/side]

	[side]
	type=Dark Sorcerer
	description=Mal-Bakral
	user_description= _ "Mal-Bakral"
	side=4
	canrecruit=1
	controller=ai
	recruit=Vampire Bat,Ghost
	{GOLD 150 200 250}
		[ai]
		{NO_SCOUTS}
		[/ai]
	[/side]

	[event]
	name=prestart
		[objectives]
		side=1
			[objective]
			description= _ "Reach the end of the tunnel"
			condition=win
			[/objective]
			[objective]
			description= _ "Death of Gweddry"
			condition=lose
			[/objective]
			[objective]
			description= _ "Death of Dacyn"
			condition=lose
			[/objective]
		[/objectives]
	[/event]

	#beginning talking
	[event]
	name=start
		[recall]
		description=Dacyn
		[/recall]
		[message]
		description=Gweddry
		message= _ "Where are we? I can't see where we are going."
		[/message]
		[message]
		description=Dacyn
		message= _ "I do not know. There are trolls in here, which may try to fight us. Now hurry, we have to move quickly with those Lichs still behind us."
		[/message]
		[message]
		description=Gweddry
		message= _ "Wait, before we go anywhere - who were those undead?"
		[/message]
		[message]
		description=Dacyn
		message= _ "It doesn't matter. They are much too powerful for us; our only hope is to get away, far away. Perhaps we should go north, and meet with Owaec."
		[/message]
		[unit]
		type=Troll Whelp
		x,y=32,10
		side=2
		[/unit]
	[/event]

	#the signpost
	[item]
	x=29
	y=10
	image=items/signpost.png
	[/item]

	[event]
	name=moveto
		[filter]
		x=29
		y=10
		side=1
		[/filter]
		[message]
		speaker=unit
		message= _ "TROL TREZZUR HOLE: KEEP OWT"
		[/message]
		[allow_undo]
		[/allow_undo]
	[/event]

	#find the dwarves
	[event]
	name=sighted
		[filter]
		side=3
		[/filter]
		[message]
		speaker=unit
		message= _ "Who goes there?"
		[/message]
		[message]
		description=Gweddry
		message= _ "We are travelers loyal to the king of Wesnoth. Will you help us escape these trolls?"
		[/message]
		[message]
		speaker=unit
		message= _ "Yes, we will help you, for we have no love for the trolls. Anyone attacked by them deserves some help, I think."
		[/message]
		[if]
			[variable]
			name=undead
			equals=yes
			[/variable]
			[then]
				[message]
				description=Dacyn
				message= _ "Thank you. Now, I advise you to join us. Undead have followed us into these caves, and they will kill you if you stay behind."
				[/message]
			[/then]
			[else]
				[message]
				description=Dacyn
				message= _ "Thank you. Now, I advise you to join us. Undead are in these lands, and they will find these caves."
				[/message]
			[/else]
		[/if]
		[message]
		speaker=unit
		message= _ "My clan has lived in these caves for centuries. We will not leave now because of some roving undead."
		[/message]
		[message]
		description=Dacyn
		message= _ "Very well. The best of luck in your battle."
		[/message]
	[/event]

	#eternal holy water!
	[item]
	x=12
	y=2
	image=items/ankh-necklace.png
	[/item]

	[event]
	name=moveto
		[filter]
		side=1
		x=12
		y=2
		[/filter]
		[object]
		id=holyamulet
		name= _ "Holy Amulet"
		image=items/ankh-necklace.png
		duration=forever
		description= _ "Wearing this amulet will cause every blow you deal to be holy!"
		cannot_use_message= _ "I am not suited to using this item! Let another take it."
			[then]
				[removeitem]
				x=12
				y=2
				[/removeitem]
			[/then]
			[effect]
			apply_to=attack
			range=melee
			set_type=holy
			[/effect]
			[effect]
			apply_to=attack
			range=ranged
			set_type=holy
			[/effect]
		[/object]
	[/event]

	#treasure chest
	[item]
	x=35
	y=8
	image=items/chest.png
	[/item]

	[event]
	name=moveto
		[filter]
		x=35
		y=8
		side=1
		[/filter]
		[sound]
		name=gold.ogg
		[/sound]
		[message]
		speaker=unit
		message= _ "There is a great fortune in this chest of treasure! I can count two hundred pieces of gold."
		[/message]
		[gold]
		side=1
		amount=200
		[/gold]
		[removeitem]
		[/removeitem]
	[/event]


	#Mal-Bakral arrives
	[event]
	name=turn 6
		[set_variable]
		name=undead
		value=yes
		[/set_variable]
		[terrain]
		x=2,3,4,2
		y=4,4,4,5
		letter='
		[/terrain]
		[unit]
		type=Revenant
		side=4
		x=2
		y=5
		[/unit]
		[unit]
		type=Revenant
		side=4
		x=4
		y=5
		[/unit]
		[unit]
		type=Revenant
		side=4
		x=2
		y=4
		ai_special=guardian
		[/unit]
		[unit]
		type=Revenant
		side=4
		x=4
		y=4
		ai_special=guardian
		[/unit]

#ifdef HARD
		[unit]
		type=Bone Shooter
		side=4
		x=3
		y=5
		[/unit]
		[unit]
		type=Bone Shooter
		side=4
		x=3
		y=4
		ai_special=guardian
		[/unit]

#endif
		[remove_shroud]
		x,y=3,3
		[/remove_shroud]
		[teleport]
			[filter]
			description=Mal-Bakral
			[/filter]
		x,y=3,3
		[/teleport]
		[message]
		description=Mal-Bakral
		message= _ "We have found you, live one! Prepare to die!"
		[/message]
		[message]
		description=Dacyn
		message= _ "They follow us... we must get out of this tunnel. It looks like it is leading east. That is unfortunate, for it will bring us further from Weldyn. But it is our only option."
		[/message]
	[/event]

	[event]
	name=moveto
		[filter]
		x=39
		y=6
		description=Gweddry
		[/filter]
		[message]
		description=Gweddry
		message= _ "We have reached the end of the tunnel. I see daylight above us!"
		[/message]
		[clear_variable]
		name=undead
		[/clear_variable]
		[endlevel]
		result=victory
		bonus=yes
		[/endlevel]
	[/event]
[/scenario]
