[scenario]
	id=Temple_in_the_Deep
	#textdomain wesnoth-trow
	name= _ "Temple in the Deep"
	map_data="{campaigns/The_Rise_Of_Wesnoth/maps/Temple_in_the_Deep}"
	{TURNS 35 32 29}

	{UNDERGROUND}

	next_scenario=Return_to_Oldwood
	victory_when_enemies_defeated=no

	[music]
	name="frantic.ogg"
	[/music]

	{campaigns/The_Rise_Of_Wesnoth/utils/trow-deaths.cfg}

	[story]
		[part]
			background=story/the_green_isle.png
			show_title=yes
			{CROSS 296 367}
		[/part]
	[/story]


	[side]
		side=1
		type=Noble Commander
		description=Prince Haldric
		user_description= _ "Prince Haldric"
		unrenamable=yes
		canrecruit=1
		controller=human
		shroud=yes
		team_name=Haldric
		{INCOME 15 10 5}

	[/side]

	[side]
		side=2
		type=Lich
		description=Lich-Lord Lenvan
		user_description= _ "Lich-Lord Lenvan"
		profile="portraits/lich.png"
		canrecruit=1
		recruit=Revenant,Deathblade,Bone Shooter,Skeleton,Skeleton Archer
		{GOLD 200 320 440}
		{INCOME 8 12 16}
		team_name=undead
	[ai]
		aggression=1.0
		recruitment_pattern=fighter,archer
		{NO_SCOUTS}
		{ATTACK_DEPTH 4 5 5}
	[/ai]
	[/side]

	[event]
	name=prestart

#ifdef EASY
		{UNIT (Tentacle of the Deep) (Tentacle) ( _ "Tentacle") 2 3 16}
		{UNIT (Tentacle of the Deep) (Tentacle) ( _ "Tentacle") 2 22 16}
		{UNIT (Tentacle of the Deep) (Tentacle) ( _ "Tentacle") 2 10 16}
		{UNIT (Tentacle of the Deep) (Tentacle) ( _ "Tentacle") 2 16 16}
#endif
#ifdef NORMAL
		{UNIT (Tentacle of the Deep) (Tentacle) ( _ "Tentacle") 2 3 16}
		{UNIT (Tentacle of the Deep) (Tentacle) ( _ "Tentacle") 2 22 16}
		{UNIT (Tentacle of the Deep) (Tentacle) ( _ "Tentacle") 2 10 16}
		{UNIT (Tentacle of the Deep) (Tentacle) ( _ "Tentacle") 2 16 16}
		{UNIT (Tentacle of the Deep) (Tentacle) ( _ "Tentacle") 2 12 17}
		{UNIT (Tentacle of the Deep) (Tentacle) ( _ "Tentacle") 2 14 17}
#endif
#ifdef HARD
		{UNIT (Tentacle of the Deep) (Tentacle) ( _ "Tentacle") 2 3 16}
		{UNIT (Tentacle of the Deep) (Tentacle) ( _ "Tentacle") 2 22 16}
		{UNIT (Tentacle of the Deep) (Tentacle) ( _ "Tentacle") 2 10 16}
		{UNIT (Tentacle of the Deep) (Tentacle) ( _ "Tentacle") 2 16 16}
		{UNIT (Tentacle of the Deep) (Tentacle) ( _ "Tentacle") 2 12 17}
		{UNIT (Tentacle of the Deep) (Tentacle) ( _ "Tentacle") 2 14 17}
		{UNIT (Tentacle of the Deep) (Tentacle) ( _ "Tentacle") 2 10 15}
		{UNIT (Tentacle of the Deep) (Tentacle) ( _ "Tentacle") 2 16 15}
#endif
		{PLACE_IMAGE (terrain/cave-floor1.png) 6 18}
		{PLACE_IMAGE (terrain/cave-floor1.png) 20 18}
		{PLACE_IMAGE (terrain/cave-floor1.png) 10 2}
		{PLACE_IMAGE (terrain/cave-floor1.png) 16 2}
		{PLACE_IMAGE (items/monolith3.png) 6 18}
		{PLACE_IMAGE (items/monolith3.png) 20 18}
		{PLACE_IMAGE (items/chest.png) 13 2}
		{PLACE_IMAGE (items/dragonstatue.png) 10 2}
		{PLACE_IMAGE (items/dragonstatue.png) 16 2}

		{PLACE_IMAGE (misc/rocks.png) 16 24}
		{PLACE_IMAGE (misc/rocks.png) 4 18}
		{PLACE_IMAGE (misc/rocks.png) 12 12}
		{PLACE_IMAGE (misc/rocks.png) 6 6}
		{PLACE_IMAGE (misc/rocks.png) 17 3}

		{OBJ_POTION_HOLY 13 19 (holy_helper)}

		[recall]
			description=Burin the Lost
		[/recall]
		[recall]
			description=Minister Edmond
		[/recall]

		[objectives]
		side=1
			[objective]
				description= _ "Defeat the Lich-Lord and"
				condition=win
			[/objective]
			[objective]
				description= _ "Retrieve the Fire Ruby (with Prince Haldric)"
				condition=win
			[/objective]
			[objective]
				description= _ "Death of Prince Haldric"
				condition=lose
			[/objective]
			[objective]
				description= _ "Turns run out"
				condition=lose
			[/objective]
		[/objectives]

	[/event]

#	[event]
#		name=moveto
#		[filter]
#			side=1
#			x=13
#			y=19
#		[/filter]
#
#		[removeitem]
#		[/removeitem]
#	[/event]

	[event]
	name=start

		[message]
			speaker=narrator
			message= _ "With a feeling of grim curiosity Prince Haldric and his company descend into catacombs below the temple, buried deep in the bedrock, in the very roots of the world itself. In the distance Haldric hears a booming voice."
		[/message]
		[message]
			description=Lich-Lord Lenvan
			message= _ "Free! I'm free at last! I knew those puny magi couldn't seal me in here forever! Rise, my soldiers of Darkness, the world will be ours once more!"
		[/message]
		[message]
			description=Burin the Lost
			message= _ "Back underground... This feels much better! As for the current residents, ugh!"
		[/message]
		[message]
			description=Prince Haldric
			message= _ "Let's put these monsters to their final rest."
		[/message]
	[/event]

	[event]
	name=die
		[filter]
		description=Lich-Lord Lenvan
		[/filter]
		[message]
			speaker=unit
			message= _ "I am fallen after all this time."
		[/message]
		[set_variable]
			name=Lich_dead
			value=1
		[/set_variable]
		[message]
			description=Prince Haldric
			message= _ "The world won't miss him one bit."
		[/message]
		[if]
			[variable]
				name=Have_Ruby
				numerical_equals=1
			[/variable]
			[then]
				[endlevel]
					result=victory
					bonus=yes
				[/endlevel]
			[/then]
		[/if]
	[/event]

	[event]
	name=time over
		[message]
			description=Prince Haldric
			message= _ "What's that! No! The tree-folk are sealing us back in here. They must think that we've failed. We're trapped."
		[/message]
	[/event]

	[event]
		name=moveto
		[filter]
			side=1
			x=6
			y=18
		[/filter]
		[message]
			speaker=narrator
			message= _ "INSCRIPTION: Embrace the Monolith to be Cured by the Powers of Light."
		[/message]
	[/event]

	[event]
		name=moveto
		[filter]
			side=1
			x=20
			y=18
		[/filter]
		[message]
			speaker=narrator
			message= _ "INSCRIPTION: Embrace the Monolith to be Cured by the Powers of Light."
		[/message]
	[/event]

	[event]
		name=sighted
		[filter]
			type=Tentacle of the Deep
		[/filter]
		[filter_second]
			side=1
		[/filter_second]
		[message]
			speaker=second_unit
			message= _ "I don't like the look of that pool at all."
		[/message]
	[/event]

	[event]
		name=moveto
		[filter]
			side=1
			x=10,16
			y=2,2
		[/filter]
		[message]
			speaker=narrator
			message= _ "It looks scary, but it's good for you."
		[/message]
	[/event]

	[event]
		name=moveto
		first_time_only=no
		[filter]
			side=1
			x=13
			y=2
		[/filter]
		[if]
			[variable]
				name=Have_Ruby
				numerical_equals=1
			[/variable]
			[then]
				[message]
					speaker=narrator
					message= _ "You already have the Fire Ruby."
				[/message]
			[/then]
			[else]
				[if]
					[have_unit]
						description=Prince Haldric
						x=13
						y=2
					[/have_unit]

					[then]
						[set_variable]
							name=Have_Ruby
							value=1
						[/set_variable]

						[sound]
							name=open-chest.wav
						[/sound]

						[message]
							speaker=narrator
							message= _ "As you open the chest you see it, the Ruby of Fire. It is the size of an apple, and burns with an internal fire, which is refracted through its faces. You can feel the power flowing from it..."
						[/message]

						[message]
							description=Prince Haldric
							message= _ "It's funny that the Lich-Lord didn't have this on his person. Since I don't actually know what this thing does, I'll just put it in the bottom of my pack for right now."
						[/message]

						[if]
							[variable]
								name=Lich_dead
								numerical_equals=1
							[/variable]
							[then]
								[endlevel]
									result=victory
									bonus=yes
								[/endlevel]
							[/then]

						[/if]
					[/then]

					[else]

						[sound]
							name=ugg.wav
						[/sound]

						[message]
							speaker=narrator
							message= _ "Maybe you should move somebody else to the chest."
						[/message]
						[allow_undo]
						[/allow_undo]
					[/else]
				[/if]
			[/else]
		[/if]
	[/event]

	[event]
		name=victory
		[message]
			description=Prince Haldric
			message= _ "I'm glad that's over! We have the Ruby of Fire, and that Lich-Lord is now a pile of dust, let's get out of these catacombs!"
		[/message]
		{CLEAR_VARIABLE Lich_dead}
		{CLEAR_VARIABLE Have_Ruby}
	[/event]

	[event]
		name=die
		first_time_only=no

		{RISE_UP_RISE_UP $x1 $y1}
	[/event]

	[event]
		name=die
		[filter]
			side=1
		[/filter]
		[message]
			description=Prince Haldric
			message= _ "He's raising our dead!"
		[/message]
	[/event]

[/scenario]
