[scenario]
	id=Fallen_Lich_Point
	#textdomain wesnoth-trow
	name= _ "Fallen Lich Point"
	map_data="{campaigns/The_Rise_Of_Wesnoth/maps/Fallen_Lich_Point.map}"
	{TURNS 39 36 33}

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

	next_scenario=Sewer
	victory_when_enemies_defeated=no

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

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

	[story]
		[part]
			background=story/the_green_isle.png
			show_title=yes
			{DOT 376 341}
			{DOT 386 346}
			{DOT 396 351}
			{DOT 411 356}
			{DOT 428 359}
			{DOT 446 361}
			{DOT 461 366}
			{DOT 476 371}
			{DOT 471 386}
			{DOT 466 396}
			{DOT 453 406}
			{DOT 441 416}
			{DOT 426 426}
			{DOT 406 431}
			{DOT 391 431}
			{DOT 371 431}
			{DOT 356 431}
			{DOT 341 431}
			{DOT 326 426}
			{DOT 311 426}
			{DOT 296 426}
			{DOT 281 431}
			{DOT 271 436}
			{DOT 256 436}
			{CROSS 236 437}
		[/part]
	[/story]


	[side]
		type=Noble Commander
		description=Prince Haldric
		user_description= _ "Prince Haldric"
		unrenamable=yes
		side=1
		canrecruit=1
		controller=human
		team_name=Haldric
	[/side]

	[side]
		type=Orcish Warlord
		description=Ut'Tan-Grilg
		user_description= _ "Ut'Tan-Grilg"
		side=2
		canrecruit=1
#ifdef EASY
		recruit=Orcish Archer, Orcish Assassin, Orcish Grunt, Wolf Rider, Orcish Crossbowman, Goblin Pillager, Goblin Knight, Goblin Spearman
#endif

#ifdef NORMAL
		recruit=Orcish Archer, Orcish Assassin, Orcish Grunt, Wolf Rider, Orcish Crossbowman, Goblin Knight, Orcish Slayer, Goblin Spearman
#endif

#ifdef HARD
		recruit=Orcish Archer, Orcish Assassin, Orcish Grunt, Wolf Rider, Orcish Crossbowman, Orcish Warrior, Goblin Knight, Goblin Pillager, Orcish Slayer, Goblin Spearman, Goblin Impaler
#endif
		{GOLD 210 250 290}
		team_name=orcs
		[ai]
			{NO_SCOUTS}
			recruitment_pattern=scout,fighter,fighter,archer
			{ATTACK_DEPTH 4 5 5}
		[/ai]
		[ai]
			time_of_day=first_watch,second_watch
			aggression=0.75
			caution=0.0
			grouping=no
		[/ai]
	[/side]

	[side]
		type=Orcish Warlord
		description=Tan-Pulk
		user_description= _ "Tan-Pulk"
		side=3
		canrecruit=1
#ifdef EASY
		recruit=Orcish Archer, Orcish Assassin, Orcish Grunt, Wolf Rider, Orcish Crossbowman, Goblin Pillager, Goblin Spearman
#endif

#ifdef NORMAL
		recruit=Orcish Archer, Orcish Assassin, Orcish Grunt, Wolf Rider, Orcish Crossbowman, Orcish Warrior, Goblin Pillager, Goblin Spearman
#endif

#ifdef HARD
		recruit=Orcish Archer, Orcish Assassin, Orcish Grunt, Wolf Rider, Orcish Crossbowman, Orcish Warrior, Goblin Knight, Goblin Pillager, Orcish Slayer, Goblin Spearman, Goblin Impaler
#endif

		{GOLD 210 250 290}
		team_name=orcs
		[ai]
			{NO_SCOUTS}
			recruitment_pattern=scout,fighter,fighter,archer
			{ATTACK_DEPTH 4 5 5}
		[/ai]
		[ai]
			time_of_day=first_watch,second_watch
			aggression=0.75
			caution=0.0
			grouping=no
		[/ai]
	[/side]

#define TURNED_TO_STONE
	[status]
		stone=on
	[/status]
#enddef

	[side]
		side=4
		type=Lich
		description=Lich-Lord Caror
		user_description= _ "Lich-Lord Caror"
		profile="brown-lich.png"
		canrecruit=1
		recruit=Skeleton, Skeleton Archer, Ghost, Ghoul, Walking Corpse
		{GOLD 120 150 190}
		team_name=undead
		[ai]
			aggression=1.0
			recruitment_ignore_bad_movement=yes
			recruitment_pattern=scout,fighter,fighter,archer
			{ATTACK_DEPTH 4 5 5}
		[/ai]
		{TURNED_TO_STONE}
		{NO_SCOUTS}
	[/side]

	[event]
	name=prestart

		{STARTING_VILLAGES 2 8}
		{STARTING_VILLAGES 3 6}

		{PLACE_IMAGE (scenery/signpost.png) 25 1}
		{PLACE_IMAGE (scenery/signpost.png) 14 8}
		{PLACE_IMAGE (scenery/monolith4.png) 14 30}
		{PLACE_IMAGE (scenery/mine-abandoned.png) 15 9}

#define STONE_SHOOTER X Y
		[unit]
			side=4
			type=Bone Shooter
			x={X}
			y={Y}
			{TURNED_TO_STONE}
			[modifications]
				{TRAIT_UNDEAD}
			[/modifications]
		[/unit]
#enddef

#define STONE_WARRIOR X Y
		[unit]
			side=4
			type=Revenant
			x={X}
			y={Y}
			{TURNED_TO_STONE}
			[modifications]
				{TRAIT_UNDEAD}
			[/modifications]
		[/unit]
#enddef
		{STONE_SHOOTER 12 35}
		{STONE_SHOOTER 13 37}
		{STONE_SHOOTER 11 37}
		{STONE_WARRIOR 13 36}
		{STONE_WARRIOR 12 37}
		{STONE_WARRIOR 11 36}

		[set_variable]
			name=lich_free
			value=0
		[/set_variable]
		[set_variable]
			name=have_book
			value=0
		[/set_variable]

		[hide_unit]
			x=33
			y=24
		[/hide_unit]

		[objectives]
		side=1
			[objective]
				description= _ "Kill the Lich to get his book and"
				condition=win
			[/objective]
			[objective]
				description= _ "Haldric enters Southbay's sewer"
				condition=win
			[/objective]
			[objective]
				description= _ "Heroic: As above and kill all enemy leaders"
				condition=win
			[/objective]
			[objective]
				description= _ "Death of Prince Haldric"
				condition=lose
			[/objective]
			[objective]
				description= _ "Death of Lady Jessica"
				condition=lose
			[/objective]
			[objective]
				description= _ "Turns run out"
				condition=lose
			[/objective]
		[/objectives]
	[/event]

	[event]
	name=start
		[message]
			description=Tan-Pulk
			message= _ "Da big bosses said we'd be in da city by winter. Bosses wrong, human-worms still there, and I'm a tinkin- -"
		[/message]
		[message]
			description=Ut'Tan-Grilg
			message= _ "Wait! I see a ship! Humans is coming! Smash 'em good!"
		[/message]

		[move_unit_fake]
			type=Transport Galleon
			x=35,34,33,33,34,34
			y=30,29,29,28,27,26
		[/move_unit_fake]

		{PLACE_IMAGE (units/transport/pirate-galleon.png) 34 26}

		[unhide_unit]
			x=33
			y=24
		[/unhide_unit]

		[message]
			speaker=narrator
			message= _ "Prince Haldric has arrived at Fallen Lich Point, to retrieve the Lich-Lord Caror's Book of Fire and Darkness, and flee into the Sewers of Southbay."
		[/message]

		[recall]
			description=Lady Jessica
		[/recall]
		[recall]
			description=Burin the Lost
		[/recall]
		[recall]
			description=Sir Ruddry
		[/recall]

		[recall]
			description=Sir Ladoc
		[/recall]

		[recall]
			description=Minister Edmond
		[/recall]

		[message]
			description=Prince Haldric
			message= _ "Okay. Let's unstone that lich and take his book, then get into the sewers. Umm, what language would that book be in?"
		[/message]
		[message]
			description=Lady Jessica
			message= _ "Some pep talk. The book will probably be in the Old Wesfolk tongue."
		[/message]
		[message]
			description=Prince Haldric
			message= _ "Ohh."
		[/message]
		[message]
			description=Lady Jessica
			message= _ "Just get the book, I think I should be able to translate it."
		[/message]
		[message]
			description=Prince Haldric
			message= _ "Then, into Southbay's sewer."
		[/message]
		[message]
			description=Lady Jessica
			message= _ "Right."
		[/message]
	[/event]

	[event]
		name=moveto
		first_time_only=yes

		[filter]
			side=1
			x=13-18
			y=29-34
		[/filter]

		[if]
			[have_unit]
				description=Prince Haldric
				x=13-18
				y=29-34
			[/have_unit]

			[then]
				[message]
					description=Prince Haldric
					message= _ "There's an odd monolith standing near here. Maybe it has something to do with the Lich-Lord...I should investigate more closely."
				[/message]
			[/then]

			[else]
				[message]
					speaker=unit
					message= _ "There's an odd monolith standing near here."
				[/message]

				[message]
					description=Lady Jessica
					message= _ "Haldric, this looks like a job for you, probably something to do with the Lich. Maybe you should get yourself over here."
				[/message]
			[/else]
		[/if]

		[allow_undo][/allow_undo]
	[/event]

	[event]
		name=moveto
		first_time_only=no
		[filter]
			side=1
			x=14
			y=30
		[/filter]
		[message]
			speaker=narrator
			message= _ "INSCRIPTION: This monolith was erected by me, <CHIPPED AWAY>, first Mage of the good people of the Green Isle. By its power the Lich-Lord is bound in stone. To end the spell a noble of the line of Kings should utter the following..."
		[/message]

		[if]

		[variable]
			name=lich_free
			numerical_equals=0
		[/variable]

		[then]

			[if]
				[have_unit]
					description=Prince Haldric
					x=14
					y=30
				[/have_unit]

				[then]
					[message]
						description=Prince Haldric
						message= _ "Hmm... after some thought..."

						[option]
							message= _ "I think I'll say that magic phrase."

							[command]
							[set_variable]
								name=lich_free
								value=1
							[/set_variable]
							[unstone]
							[/unstone]
							[message]
								description=Prince Haldric
								message= _ "The Lich is free! Let's bash him and grab that book. That sounds like a job for you, Lady Jessica!"
							[/message]
							[message]
								description=Lady Jessica
								message= _ "Hmph! You're just happy because that monolith proves your paternity!"
							[/message]
							[message]
								description=Lich-Lord Caror
								message= _ "Free, I'm free, and I feel the Ruby of Fire! It will be mine."
							[/message]
							[message]
								description=Minister Edmond
								message= _ "No you won't, you soldier of darkness!"
							[/message]
							[/command]
						[/option]

						[option]
						message= _ "I think I'll wait a while before uttering any magic phrases."

						[command]
							[message]
								description=Prince Haldric
								message= _ "We have more pressing matters to deal with before we free that Lich."
							[/message]

							[message]
								description=Lady Jessica
								message= _ "Afraid you'll find out you're not of the line of Kings?"
							[/message]
						[/command]
						[/option]
					[/message]
				[/then]

				[else]
					[message]
						speaker=narrator
						message= _ "This sounds like a job for Prince Haldric, hopefully."
					[/message]

					[allow_undo]
					[/allow_undo]
				[/else]
			[/if]
		[/then]

		[else]
			[message]
				speaker=narrator
				message= _ "The Lich-Lord is already free."
			[/message]
			[allow_undo]
			[/allow_undo]
		[/else]

		[/if]
	[/event]

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

		[redraw]
		[/redraw]

		[message]
			speaker=narrator
			message= _ "NW - Southbay."
		[/message]
		[message]
			speaker=unit
			message= _ "More Like NW - Every orc on the Isle. Hmph!"
		[/message]
		[allow_undo]
		[/allow_undo]
	[/event]

	[event]
		name=moveto
		first_time_only=no
		[filter]
			side=1
			x=15
			y=9
		[/filter]

		[if]
			[have_unit]
				description=Prince Haldric
				x=15
				y=9
			[/have_unit]

			[then]

				[if]

				[variable]
					name=have_book
					numerical_equals=1
				[/variable]
				[then]
					[message]
						description=Prince Haldric
						message= _ "We have the book, let's get out of here!"
					[/message]

					[message]
						description=Lady Jessica
						message= _ "Sounds good to me."
					[/message]

					[if]

						[variable]
							name=Killed_an_Orc
							numerical_equals=1
						[/variable]

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

						[else]
							[endlevel]
								bonus=no
								result=victory
							[/endlevel]
						[/else]
					[/if]

				[/then]

				[else]
					[message]
						description=Prince Haldric
						message= _ "I feel like I'm forgetting something. Ohh, the book!"
					[/message]
				[/else]
				[/if]
			[/then]

			[else]
				[message]
					speaker=narrator
					message= _ "Prince Haldric must be the first into the sewers of Southbay."
				[/message]

				[allow_undo]
				[/allow_undo]

			[/else]
		[/if]
	[/event]

	[event]
		name=moveto

		[filter]
			x=15-27
			y=16-25
		[/filter]
		[move_unit_fake]
			type=Yeti
			x=13,13,13,12,11,10,9,9,9,10,11,11,11,12,12
			y=1,2,3,3,4,4,5,6,7,7,8,9,10,10,11
		[/move_unit_fake]

		{UNIT (Yeti) (Rarlg) ( _ "Rarlg") 4 12 11}

		[message]
			description=Rarlg
			message= _ "Rarlg - argh, a raul-rarlg!"
		[/message]
		[message]
			description=Prince Haldric
			message= _ "Oh my!"
		[/message]
		[message]
			description=Ut'Tan-Grilg
			message= _ "Oh my!"
		[/message]
		[message]
			description=Tan-Pulk
			message= _ "Oh my!"
		[/message]
		[message]
			description=Lady Jessica
			message= _ "And he brought a friend."
		[/message]

		[scroll_to_unit]
			description=Rarlg
		[/scroll_to_unit]

		{UNIT (Yeti) (Raul-Rarlg) ( _ "Raul-Rarlg") 4 15 11}
	[/event]

	[event]
		name=die
		[filter]
			description=Lich-Lord Caror
		[/filter]

		[message]
			description=Lich-Lord Caror
			message= _ "So close. So close."
		[/message]

		[message]
			speaker=second_unit
			message= _ "I found the book in what was left of his robes! Let's get out of here!"
		[/message]

		[set_variable]
			name=have_book
			value=1
		[/set_variable]
	[/event]


	[event]
		name=die
		[filter]
			description=Tan-Pulk
		[/filter]

		[filter_second]
			side=1
		[/filter_second]

		[set_variable]
			name=Killed_an_Orc
			value=1
		[/set_variable]
	[/event]

	[event]
		name=die
		[filter]
			description=Ut'Tan-Grilg
		[/filter]

		[filter_second]
			side=1
		[/filter_second]

		[set_variable]
			name=Killed_an_Orc
			value=1
		[/set_variable]
	[/event]

	[event]
		name=victory

		{CLEAR_VARIABLE have_book}
		{CLEAR_VARIABLE lich_free}
		{CLEAR_VARIABLE Killed_an_Orc}
	[/event]

	[event]
		name=time over
		[message]
			description=Prince Haldric
			message= _ "I can hear their reinforcements coming! We're trapped! All is lost!"
		[/message]
	[/event]

	[event]
		name=moveto
		[filter]
			side=1
			x=14
			y=8
		[/filter]

		[redraw]
		[/redraw]

		[message]
			speaker=narrator
			message= _ "Sewer - Danger Keep Out!"
		[/message]

		[allow_undo]
		[/allow_undo]
	[/event]

[/scenario]
