[scenario]
#The Calgary Flames won game 1 when I started this, and they just won game 3, hence, Fire Wizards
	id=Sewer
	#textdomain wesnoth-trow
	name= _ "Sewer of Southbay"
	map_data="{campaigns/The_Rise_Of_Wesnoth/maps/Sewer.map}"
	{TURNS 39 36 33}

	{UNDERGROUND}

	next_scenario=Southbay_in_Winter
	victory_when_enemies_defeated=no

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

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

	[story]
		[part]
			background=story/the_green_isle.png
			show_title=yes
			{DOT 246 436}
			{DOT 236 431}
			{DOT 226 426}
			{CROSS 211 417}
		[/part]
	[/story]

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

	[side]
		type=Arch Mage
		description=Daellyn the Red
		user_description= _ "Daellyn the Red"
		profile="portraits/archmage.png"
		side=2
		canrecruit=1
		recruit=Red Mage,Giant Scorpion,Vampire Bat,Blood Bat
		{GOLD 160 220 280}
		{INCOME 4 8 12}
		team_name=wizards
		[ai]
			{NO_SCOUTS}
			recruitment_pattern=mixed fighter,fighter,scout,fighter
			aggression=0.75
			recruitment_ignore_bad_movement=yes
			recruitment_ignore_bad_combat=yes
			{ATTACK_DEPTH 4 5 5}
		[/ai]

	[/side]

	[side]
		type=Arch Mage
		description=Tinry the Red
		user_description= _"Tinry the Red"
		profile="portraits/archmage.png"
		side=3
		canrecruit=1
		recruit=Red Mage,Giant Scorpion,Vampire Bat,Blood Bat
		{GOLD 160 220 280}
		{INCOME 4 8 12}
		team_name=wizards
		[ai]
			{NO_SCOUTS}
			recruitment_pattern=mixed fighter,fighter,scout,fighter
			aggression=0.75
			recruitment_ignore_bad_movement=yes
			recruitment_ignore_bad_combat=yes
			{ATTACK_DEPTH 4 5 5}
		[/ai]
	[/side]

	[event]
	name=prestart

		{PLACE_IMAGE (scenery/signpost.png) 1 8}
		{PLACE_IMAGE (scenery/signpost.png) 12 9}
		#{PLACE_IMAGE (misc/foot-left-nw.png) 1 7}

		{PLACE_IMAGE (scenery/rubble.png) 17 15}
		{PLACE_IMAGE (scenery/rubble.png) 18 14}
		{PLACE_IMAGE (scenery/rubble.png) 19 14}

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

		{GUARD_UNIT (Giant Spider) (Spider) ( _ "Spider") 2 2 6}
		{GUARD_UNIT (Giant Scorpion) (Scorpion) ( _ "Scorpion") 3 3 5}
		{GUARD_UNIT (Giant Scorpion) (Scorpion) ( _ "Scorpion") 2 24 18}
		{GUARD_UNIT (Giant Scorpion) (Scorpion) ( _ "Scorpion") 3 20 15}
#ifdef NORMAL
		{GUARD_UNIT (Giant Scorpion) (Scorpion) ( _ "Scorpion") 2 12 7}
		{GUARD_UNIT (Giant Scorpion) (Scorpion) ( _ "Scorpion") 3 16 8}
		{GUARD_UNIT (Giant Scorpion) (Scorpion) ( _ "Scorpion") 2 29 20}
		{GUARD_UNIT (Giant Scorpion) (Scorpion) ( _ "Scorpion") 3 14 8}
		{GUARD_UNIT (Giant Scorpion) (Scorpion) ( _ "Scorpion") 2 2 5}
#endif

#ifdef HARD
		{GUARD_UNIT (Giant Scorpion) (Scorpion) ( _ "Scorpion") 2 12 7}
		{GUARD_UNIT (Giant Scorpion) (Scorpion) ( _ "Scorpion") 3 16 8}
		{GUARD_UNIT (Giant Scorpion) (Scorpion) ( _ "Scorpion") 2 29 20}
		{GUARD_UNIT (Giant Scorpion) (Scorpion) ( _ "Scorpion") 3 14 8}
		{GUARD_UNIT (Giant Scorpion) (Scorpion) ( _ "Scorpion") 2 2 5}
		{GUARD_UNIT (Giant Scorpion) (Scorpion) ( _ "Scorpion") 3 3 7}
#endif

		[objectives]
		side=1
			[objective]
				description= _ "Prince Haldric exits the sewer"
				condition=win
			[/objective]
			[objective]
				description= _ "Heroic: As above and defeat 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]
			speaker=narrator
			message= _ "In the last leg of their journey to Southbay, Haldric and his companions find themselves in the Sewers of Southbay."
		[/message]
		[message]
			description=Burin the Lost
			message= _ "Only a human could take such a lovely cave and fill it with refuse. Humans. Hey, is that a pair of boots?"
		[/message]
		[message]
			description=Prince Haldric
			message= _ "We should be cautious down here. This isn't an old maid's drain pipe, this is the sewer of Southbay. It is said that the city diverted an underground river for its own use, and let their own effluent run down the old river bed."
		[/message]
		[message]
			description=Prince Haldric
			message= _ "This is the far end of that river bed. Legend has it- -"
		[/message]
		[message]
			description=Tinry the Red
			message= _ "That a King banished a pair of twin Magi and their devoted followers down here after the Wesfolk war!"
		[/message]
		[message]
			description=Daellyn the Red
			message= _ "Can you feel it, brother? This one bears the Ruby of Fire. After all our time searching, it has come to us!"
		[/message]
		[message]
			description=Tinry the Red
			message= _ "The brothers Red will finally ascend to power. We must have it. Get them!"
		[/message]
	[/event]

	[event]
	name=time over
		[message]
			description=Prince Haldric
			message= _ "Nooo! The wizards are flooding the sewer. We're doomed!"
		[/message]
	[/event]

	[event]
	name=turn 3
		[message]
			description=Lady Jessica
			message= _ "Haldric, I feel a strong foreboding. Have you noticed that anything that happens to be strong in the ways of magic can sense that ruby? Elilmaldur-Rithrandil felt it, and so did Lich-Lord Caror, now these two."
		[/message]

		[message]
			description=Prince Haldric
			message= _ "We retrieved the Lich-Lord's book, and I can literally feel the power of the ruby, even with it in my pack. Let's work out what it does, before we decide what to do with it."
		[/message]
	[/event]

	[event]
		name=die
		[filter]
			description=Tinry the Red
		[/filter]

		[if]
			[variable]
			name=wiz_dead
			equals=yes
			[/variable]

			[then]

				[message]
					speaker=second_unit
					message= _ "Hmm. He seems to have had a map, and some gold!"
				[/message]

				{LOOT 50 1}

				[remove_shroud]
					side=1
					x=1-20,21-26,27-30,27-34,25-35,17-25, 9-16, 2- 9, 2- 3, 4- 6,6- 9,
					y=5- 8, 6- 8, 8-10,11-17,19-22,15-17,15-16,13-18,19-20,11-12,9-10,
				[/remove_shroud]

			[/then]

			[else]
				[set_variable]
				name=wiz_dead
				value=yes
				[/set_variable]

				[message]
					description=Daellyn the Red
							message= _ "Brother!"
				[/message]

				[gold]
					side=2
					amount=120
				[/gold]

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

	[event]
		name=die
		[filter]
			description=Daellyn the Red
		[/filter]

		[if]
			[variable]
			name=wiz_dead
			equals=yes
			[/variable]

			[then]
				[message]
					speaker=second_unit
					message= _ "Hmm. He seems to have had a map."
				[/message]

				[remove_shroud]
					side=1
					x=1-20,21-26,27-30,27-34,25-35,17-25, 9-16, 2- 9, 2- 3, 4- 6,6- 9,
					y=5- 8, 6- 8, 8-10,11-17,19-22,15-17,15-16,13-18,19-20,11-12,9-10,
				#	x=1-35
				#	y=1-25
				[/remove_shroud]
			[/then]

			[else]
				[set_variable]
				name=wiz_dead
				value=yes
				[/set_variable]

				[message]
					description=Tinry the Red
							message= _ "Brother!"
				[/message]

				[gold]
					side=3
					amount=120
				[/gold]

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

	[event]
		name=moveto
		[filter]
			x=17-22
			y=13-17
			side=1
		[/filter]

		[message]
			speaker=unit
			message= _ "Argh, the stream bed is blocked! Only a pint of goo is getting through. We'll have to go around."
		[/message]
	[/event]

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

		[redraw]
		[/redraw]

		[message]
			speaker=narrator
			message= _ "To Southbay"
		[/message]

		[allow_undo]
		[/allow_undo]
	[/event]

	[event]
		name=moveto
		first_time_only=no
		[filter]
			side=1
			x=1,1
			y=7,8
		[/filter]
		[if]
			[have_unit]
				description=Prince Haldric
				x=1,1
				y=7,8
			[/have_unit]
			[then]
				[if]

					[variable]
						name=wiz_dead
						equals=yes
					[/variable]

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

					[else]
						[endlevel]
							bonus=no
							result=victory
						[/endlevel]
					[/else]
				[/if]
			[/then]
			[else]
				[message]
					speaker=narrator
					message= _ "It's not very Heroic if Prince Haldric isn't the one to lead his band from the Sewers of Southbay."
				[/message]
				[allow_undo]
				[/allow_undo]
			[/else]
		[/if]
	[/event]

	[event]
		name=moveto
		[filter]
			side=1
			x=12
			y=9
		[/filter]
		[message]
			speaker=narrator
			message= _ "Danger Ahead!"
		[/message]

		[message]
			speaker=unit
			message= _ "Ahead, so far it's been danger everywhere."
		[/message]

		[allow_undo]
		[/allow_undo]
	[/event]

	[event]
		name=victory
		[message]
			description=Prince Haldric
			message= _ "Finally on to Southbay!"
		[/message]

		{CLEAR_VARIABLE wiz_dead}

	[/event]

[/scenario]
