[scenario]
	id=Weldyn_Attack
	#textdomain wesnoth-ei
	name= _ "Weldyn under Attack"
	map_data="{campaigns/Eastern_Invasion/maps/Weldyn_under_Attack}"
	turns=18


	{DUSK}
	{DUSK}
	{DUSK}
	{FIRST_WATCH}
	{FIRST_WATCH}
	{FIRST_WATCH}
	{FIRST_WATCH}
	{FIRST_WATCH}
	{FIRST_WATCH}
	{SECOND_WATCH}
	{SECOND_WATCH}
	{SECOND_WATCH}
	{SECOND_WATCH}
	{SECOND_WATCH}
	{SECOND_WATCH}
	{DAWN}
	{DAWN}
	{DAWN}

	next_scenario=Duel

	{DEFAULT_MUSIC_PLAYLIST}

	{campaigns/Eastern_Invasion/utils/deaths.cfg}

	[side]
	type=Lieutenant
	description=Gweddry
	user_description= _ "Gweddry"
	side=1
	canrecruit=1
	controller=human
	team_name=good
	{GOLD 250 200 150}
	[/side]

	[side]
	type=General
	description=Halrad
	user_description= _ "Halrad"
	side=2
	canrecruit=1
	recruit=Heavy Infantryman,Swordsman,Mage
	controller=ai
	{GOLD 200 150 100}
	team_name=good
		[ai]
		{NO_SCOUTS}
		[/ai]
	[/side]
	[side]
	type=General
	description=Halric
	user_description= _ "Halric"
	side=3
	canrecruit=1
	recruit=Heavy Infantryman,Swordsman,Red Mage
	controller=ai
	{GOLD 250 200 150}
	team_name=good
		[ai]
		{NO_SCOUTS}
		[/ai]
	[/side]
	[side]
	type=General
	description=Halrod
	user_description= _ "Halrod"
	side=4
	canrecruit=1
	recruit=Shock Trooper,Swordsman,Mage
	controller=ai
	{GOLD 250 200 150}
	team_name=good
		[ai]
		{NO_SCOUTS}
		[/ai]
	[/side]

	[side]
	type=Lich
	description=Mal-Grekulak
	user_description= _ "Mal-Grekulak"
	side=5
	canrecruit=1
	recruit=Spectre,Revenant,Soul Shooter
	team_name=undead
	{GOLD 425 600 700}
		[ai]
		recruitment_pattern=scout,fighter,fighter,scout,fighter,archer,fighter
		{NO_SCOUTS}
		[/ai]
	[/side]

	[side]
	type=Lich
	description=Mal-Xakralan
	user_description= _ "Mal-Xakralan"
	side=6
	canrecruit=1
	recruit=Necrophage,Revenant,Soul Shooter,Blood Bat
	team_name=undead
	{GOLD 425 600 700}
		[ai]
		recruitment_pattern=scout,fighter,fighter,scout,fighter,archer,fighter
		{NO_SCOUTS}
		[/ai]
	[/side]

	[side]
	type=Lich
	description=Mal-Uknalu
	user_description= _ "Mal-Uknalu"
	side=7
	canrecruit=1
	recruit=Nightgaunt,Revenant,Soul Shooter
	team_name=undead
	{GOLD 425 600 700}
		[ai]
		recruitment_pattern=scout,fighter,fighter,scout,fighter,archer,fighter
		{NO_SCOUTS}
		[/ai]
	[/side]

#define TERRAIN_Y
#argh!!! terrain= should be a filter! (or is it? this might have all been pointless... :( )
x=10-13,23,24,25,26,27,28-31,32,39,40,39,38,34,33,32,31,30,29-28,10,11-12,12,13,13-14,15-16,4,5
y=6,6,5,6,5,6,5,4,8-11,11-16,17-18,18,25,26-28,28-29,30-31,31-33,34,27-29,30,31,32,33,34,11-16,17-20
#enddef

	{STARTING_VILLAGES 1 5}
	{STARTING_VILLAGES 2 5}
	{STARTING_VILLAGES 3 5}
	{STARTING_VILLAGES 4 5}

	[event]
	name=prestart
		[objectives]
		side=1
			[objective]
			description= _ "Survive until end of turns"
			condition=win
			[/objective]
			[objective]
			description= _ "Death of Gweddry"
			condition=lose
			[/objective]
			[objective]
			description= _ "Death of Dacyn"
			condition=lose
			[/objective]
			[objective]
			description= _ "Death of Owaec"
			condition=lose
			[/objective]
			[objective]
			description= _ "Death of Konrad II"
			condition=lose
			[/objective]
		[/objectives]
	[/event]

	#start event
	[event]
	name=start
		[recall]
		description=Dacyn
		[/recall]
		[recall]
		description=Owaec
		[/recall]
		[recall]
		description=Grug
		[/recall]
		[recall]
		description=Engineer
		[/recall]
		[unit]
		description=Konrad
		user_description= _ "Konrad II"
		profile=portraits/konrad_II.png
		type=General
		side=1
		x=21
		y=20
		[/unit]
		[message]
		description=Gweddry
		message= _ "We will fight soon, my lord. Look, night approaches; they will soon attack. I hope we can hold them off."
		[/message]
		[message]
		description=Konrad
		message= _ "Very well. But this... Mal-Ravanal, that you spoke of, is he here?"
		[/message]
		[message]
		description=Dacyn
		message= _ "I do not sense his magic, but he might be concealing his presence."
		[/message]
		[message]
		description=Owaec
		message= _ "In any case, the undead are attacking now. Let us hope we can last out the night."
		[/message]
	[/event]

	[event]
	name=moveto
		[filter]
		{TERRAIN_Y}
		side=5,6,7
		[/filter]
		[message]
		description=Gweddry
		message= _ "The undead are tearing down our defences!"
		[/message]
	[/event]

	[event]
	name=moveto
	first_time_only=no
		[filter]
		{TERRAIN_Y}
		side=5,6,7
		[/filter]
		[terrain]
		x,y=$x1,$y1
		letter=g
		[/terrain]
	[/event]

	[event]
	name=die
		[filter]
		description=Konrad
		[/filter]
		[message]
		description=Konrad
		message= _ "I have died, and with me gone the city shall fall."
		[/message]
		[endlevel]
		result=defeat
		[/endlevel]
	[/event]


	[event]
	name=time over
		[message]
		description=Dacyn
		message= _ "Look, the sun has risen, and the undead are retreating."
		[/message]
		[endlevel]
		[/endlevel]
	[/event]

	[event]
	name=victory
		[unit]
		type=Lich
		side=7
		description=Messenger of Doom
		user_description= _ "Messenger of Doom"
		x=20
		y=1
		[/unit]
		[message]
		description=Messenger of Doom
		message= _ "I come bearing a message from my leader."
		[/message]
		[message]
		description=Dacyn
		message= _ "Very well, you may read it. It might tell us something useful."
		[/message]
		[message]
		description=Messenger of Doom
		message= _ "He says: 'Well done; you have defeated some of my less powerful captains, and a small fraction of my horde. Were I to bring the whole might of my Dread Legions to bear I could crush you like an insect. But I seek a victory that will reveal the true extent of my personal power. Unlike the Great General Gweddry I do not seek to hide behind the armored skirts of my soldiers! You, O commander Gweddry, are a coward! The bards may sing that you defeated my captains, but in reality you did nothing but cower far behind the lines in safety while others braver than you fought and died in your name.'"
		[/message]
		[message]
		description=Gweddry
		message= _ "What is the point of this message? Does it consist of anything more than insults?"
		[/message]
		[message]
		description=Messenger of Doom
		message= _ "The point is that you did not defeat my Lord's minions, it was others doing the work for you! The mighty Gweddry himself would last but a few moments in actual combat. And my master seeks to prove this. He challenges you, Gweddry, to a contest, a battle."
		[/message]
		[message]
		description=Gweddry
		message= _ "What are his terms? I won't accept anything obviously weighted towards his victory!"
		[/message]
		[message]
		description=Messenger of Doom
		message= _ "That only proves you are a coward. Nevertheless, these are his terms: You pick your six best warriors and he will pick his six best. Then you will fight, to the death; until either you or he is destroyed!"
		[/message]
		[message]
		description=Owaec
		message= _ "Gweddry, I don't think you should accept. He is bound to bring more than six Undead to the battle; he will bring an army!"
		[/message]
		[message]
		description=Dacyn
		message= _ "Well, I think you should accept. There is a small chance that it will be a fair fight, and otherwise we will definitely have to face his whole undead army."
		[/message]
		[message]
		description=Messenger of Doom
		message= _ "I will simplify your choice. Accept, coward, or face the onslaught of my lord's hordes at dawn tomorrow!"
		[/message]
		[message]
		description=Gweddry
		message= _ "Hmm..."
			[option]
			message= _ "I will accept this challenge. By your own master's terms, that proves I am no coward."
				[command]
					[store_unit]
						[filter]
						description=Konrad
						[/filter]
					variable=konrad
					kill=yes
					[/store_unit]
					[endlevel]
					result=victory
					next_scenario=Duel
					[/endlevel]
				[/command]
			[/option]
			[option]
			message= _ "I will not accept a fight in which he will obviously cheat! I refuse!"
				[command]
					[store_unit]
						[filter]
						description=Konrad
						[/filter]
					variable=konrad
					kill=yes
					[/store_unit]
					[endlevel]
					result=victory
					next_scenario=Reject
					[/endlevel]
				[/command]
			[/option]
		[/message]
	[/event]
[/scenario]
