[scenario]
	id=Mal-Ravanals_Capital
	#textdomain wesnoth-ei
	name= _ "Mal-Ravanal's Capital"
	map_data="{campaigns/Eastern_Invasion/maps/Mal-Ravanals_Capital}"
	turns=36

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

	next_scenario=Northern_Outpost

	{DEFAULT_MUSIC_PLAYLIST}

	{campaigns/Eastern_Invasion/utils/deaths.cfg}

	[side]
	race=Humans
	type=Lieutenant
	description=Gweddry
	user_description= _ "Gweddry"
	side=1
	canrecruit=1
	controller=human
	[/side]

	[side]
	race=undead
	type=Dark Sorcerer
	description=Mal-Marak
	user_description= _ "Mal-Marak"
	side=2
	canrecruit=1
	recruit=Walking Corpse,Skeleton,Skeleton Archer
	{GOLD 100 150 200}
	team_name=undead
	[/side]

	[side]
	race=undead
	type=Dark Sorcerer
	description=Mal-Galkar
	user_description= _ "Mal-Galkar"
	recruit=Vampire Bat,Skeleton,Skeleton Archer
	side=3
	canrecruit=1
	{GOLD 100 150 200}
	team_name=undead
	[/side]

	[side]
	race=undead
	type=Death Knight
	description=Ravanal-Guard
	user_description= _ "Rava-Krodaz"
	recruit=Revenant,Bone Shooter
	side=4
	canrecruit=1
	{GOLD 300 400 600}
	team_name=undead
		[ai]
		aggression=-0.2
		[/ai]
	[/side]

	[side]
	race=undead
	type=Lich
	description=Mal-Ravanal
	user_description= _ "Mal-Ravanal"
	recruit=Dark Adept,Bone Shooter,Revenant,Wraith,Shadow
	side=5
	canrecruit=1
	profile=portraits/mal-ravanal.png
	{GOLD 500 600 700}
	team_name=undead
		[ai]
		leader=passive
		[/ai]
	[/side]

	[event]
	name=prestart
		[objectives]
		side=1
			[objective]
			description= _ "Escape from the capital by killing one of the two dark sorcerers"
			condition=win
			[/objective]
			[objective]
			description= _ "Death of Gweddry"
			condition=lose
			[/objective]
			[objective]
			description= _ "Death of Dacyn"
			condition=lose
			[/objective]
		[/objectives]
	[/event]

	[event]
	name=start
		[recall]
		description=Dacyn
		[/recall]
		[message]
		description=Gweddry
		message= _ "We have come all the way to Mal-Ravanal's Capital!"
		[/message]

		[message]
		description=Dacyn
		message= _ "Yes, but look! The undead forces are closing in behind us. As I said before, we cannot kill Mal-Ravanal. It was foolish to come this far, we must turn back!"
		[/message]

		[message]
		description=Gweddry
		message= _ "Perhaps. To retreat, we must kill one of these dark sorcerers that follow us. But, perhaps we can kill this Mal-Ravanal still. I might wish to try."
		[/message]

		[message]
		description=Mal-Ravanal
		profile=portraits/mal-ravanal.png
		message= _ "These humans have dared to come this far into my land. Crush them!"
		[/message]
		#there are 6 prisoner knights you can rescue
		[set_variable]
		name=prisoners_left
		value=6
		[/set_variable]
	[/event]

	[event]
	name=die
		[filter]
		side=4
		[/filter]
		[unit]
		type=Paladin
		side=1
		description=Terraent
		user_description= _ "Terraent"
		x=25
		y=17
		[/unit]
		[message]
		description=Terraent
		message= _ "Thank you for destroying that skeleton warrior! Every time you kill one of the Revenants, one of us knights is let free!"
		[/message]
		[message]
		description=Gweddry
		message= _ "Why? Are you the undead's prisoners?"
		[/message]
		[message]
		description=Terraent
		message= _ "Yes. My allies and I were questing when we were ambushed by undead. The guard is playing a sick game- whenever one of their warriors dies, one of us is let free, but whenever you lose a fighter, they kill one of us."
		[/message]
		[message]
		description=Dacyn
		message= _ "This sounds dangerous. We will try to free as many of you as possible before we escape from here."
		[/message]
		[message]
		description=Terraent
		message= _ "There are five of us still locked up in the jail. All of us will join you if you can get us free."
		[/message]
		[event]
		name=die
		first_time_only=no
			[filter]
			side=4
			[/filter]
			[if]
			[variable]
			name=prisoners_left
			greater_than=0
			[/variable]
			[then]
				[unit]
				type=Knight
				side=1
				x=25
				y=17
				[/unit]
				[set_variable]
				name=prisoners_left
				add=-1
				[/set_variable]
			[/then]
			[/if]
		[/event]
		[event]
		name=die
		first_time_only=no
			[filter]
			side=1
			[/filter]
			[if]
				[variable]
				name=prisoners_left
				greater_than=0
				[/variable]
				[then]
					[set_variable]
					name=prisoners_left
					add=-1
					[/set_variable]
				[/then]
			[/if]
		[/event]
	[/event]

	#impossible to kill Mal-Ravanal
	[event]
	name=attack
	first_time_only=no
		[filter_second]
		description=Mal-Ravanal
		[/filter_second]
		[message]
		description=Mal-Ravanal
		profile=portraits/mal-ravanal.png
		message= _ "You dare to attack ME?!? Go back to your master!"
		[/message]
		[message]
		description=Gweddry
		message= _ "This is not good; we are unable to attack Mal-Ravanal at all, for his magic is too strong! We must turn back, it was foolish to press the attack."
		[/message]
		[teleport]
			[filter]
			x,y=$x1,$y1
			side=1
			[/filter]
		x=19
		y=13
		[/teleport]
	[/event]

	#when you kill one of the necros you win
	[event]
	name=die
		[filter]
		description=Mal-Marak
		[/filter]
		[endlevel]
		result=victory
		bonus=yes
		[/endlevel]
	[/event]

	[event]
	name=die
		[filter]
		description=Mal-Galkar
		[/filter]
		[endlevel]
		result=victory
		bonus=yes
		[/endlevel]
	[/event]
[/scenario]
