[scenario]
	id=The_Vanguard
	#textdomain wesnoth-trow
	name= _ "The Vanguard"
	map_data="{campaigns/The_Rise_Of_Wesnoth/maps/The_Vanguard.map}"
	{TURNS 41 38 35}

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

	next_scenario=Return_of_the_Fleet
	bonus=yes

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

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

	[story]
		[part]
			background=story/the_great_continent.png
			show_title=yes
			{DOT 310 176}
			{DOT 310 191}
			{DOT 300 200}
			{DOT 290 207}
			{CROSS 274 212}
		[/part]
	[/story]

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

	[side]
		type=Orcish Warlord
		description=Tan-Erirt
		user_description= _ "Tan-Erirt"
		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 Pillager, Goblin Knight, Orcish Slayer, Orcish Warrior, 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 150 190 230}
		team_name=orcs
		[ai]
			#{NO_SCOUTS}
			recruitment_ignore_bad_movement=yes
			recruitment_pattern=scout,fighter,fighter,archer
			{ATTACK_DEPTH 5 5 6}
		[/ai]
		[ai]
			time_of_day=dusk,first_watch,second_watch
			aggression=0.75
			caution=0.0
			grouping=no
		[/ai]
		{INCOME 2 4 8}
	[/side]

	[side]
		type=Orcish Warlord
		description=Tan-Gagar
		user_description= _ "Tan-Gagar"
		side=3
		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, Orcish Warrior, 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 150 190 230}
		team_name=orcs
		[ai]
			#{NO_SCOUTS}
			recruitment_ignore_bad_movement=yes
			recruitment_pattern=scout,fighter,fighter,archer
			{ATTACK_DEPTH 5 5 6}
		[/ai]
		[ai]
			time_of_day=dusk,first_watch,second_watch
			aggression=0.75
			caution=0.0
			grouping=no
		[/ai]
		{INCOME 2 4 8}
	[/side]

	[side]
		type=Troll Warrior
		description=Thruf
		user_description= _ "Thruf"
		side=4
		canrecruit=1
#ifdef EASY
		recruit=Troll Whelp
#endif

#ifdef NORMAL
		recruit=Troll Whelp,Troll,Troll Rocklobber
#endif

#ifdef HARD
		recruit=Troll Whelp,Troll,Troll Warrior,Troll Rocklobber
#endif

		{GOLD 110 150 190}
		team_name=orcs
		[ai]
			{NO_SCOUTS}
			recruitment_ignore_bad_movement=yes
			recruitment_pattern=fighter
			grouping=no
			{ATTACK_DEPTH 5 5 6}
		[/ai]

		{INCOME 2 4 8}
	[/side]

	[event]
	name=prestart

		{STARTING_VILLAGES 2 8}
		{STARTING_VILLAGES 3 8}
		{STARTING_VILLAGES 4 8}

		{PLACE_IMAGE (scenery/fire1.png) 4 24}
		{PLACE_IMAGE (scenery/fire1.png) 8 25}
		{PLACE_IMAGE (scenery/fire1.png) 26 9}
		{PLACE_IMAGE (scenery/fire1.png) 25 17}

		{VARIABLE_OP xx1 random 10..18}
		{VARIABLE_OP yy1 random 2..6}

		{PLACE_IMAGE (items/chest-plain-closed.png) $xx1 $yy1}

		[recall]
			description=Lady Jessica
		[/recall]
		[recall]
			description=Commander Aethyr
		[/recall]

		#OK Get rid of the Ruby of Fire
		[store_unit]
			variable=haldric_store
			kill=yes
			[filter]
			description=Prince Haldric
			[/filter]
		[/store_unit]

		[unit]
			type=$haldric_store.type
			description=$haldric_store.description
			side=1
			x=$haldric_store.x
			y=$haldric_store.y
			canrecruit=1
			experience=$haldric_store.experience
			user_description=$haldric_store.user_description
			unrenamable=yes
		[/unit]

		{CLEAR_VARIABLE haldric_store}

		[objectives]
		side=1
			[objective]
				description= _ "Defeat all enemy leaders"
				condition=win
			[/objective]
			[objective]
				description= _ "Death of Prince Haldric"
				condition=lose
			[/objective]
			[objective]
				description= _ "Death of Commander Aethyr"
				condition=lose
			[/objective]
			[objective]
				description= _ "Turns run out"
				condition=lose
			[/objective]
		[/objectives]
	[/event]

	[event]
		name=start
		[message]
			speaker=narrator
			message= _ "Haldric and his companions race across the plains to confront the resurgent orcish threat. On the eve of battle, Lady Jessica catches up with Haldric on a fog-covered plain."
		[/message]
		[message]
			description=Lady Jessica
			message= _ "Haldric, the elves, we can't trust them!"
		[/message]

		[message]
			description=Prince Haldric
			message= _ "I could have told you that."
		[/message]
		[message]
			description=Lady Jessica
			message= _ "Haldric, it's bad. The elves are having second thoughts. They think we might be more trouble than we're worth. We have to defeat these orcs decisively."
		[/message]
		[message]
			description=Prince Haldric
			message= _ "That does not sound unreasonable."
		[/message]
		[message]
			description=Lady Jessica
			message= _ "More orcs will follow after these. That ruby guarantees it. If more orcs follow us here, the elves seem content to let us fight it out. Then they said they would 'deal with the survivors'."
		[/message]
		[message]
			description=Lady Jessica
			message= _ "Jevyan is here... His familiar, that bat. He won't let such a lucrative prize as the Ruby of Fire just slip away. Especially when he sees that he has the advantage."
		[/message]
		[message]
			description=Prince Haldric
			message= _ "I have a plan. Jessica, remember that troll-hole? Here, take the Ruby of Fire, hide it in the hole."
		[/message]
		[message]
			description=Lady Jessica
			message= _ "Haldric! What! Why?"
		[/message]
		[message]
			description=Prince Haldric
			message= _ "Just do it."
		[/message]
		[message]
			description=Prince Haldric
			message= _ "Commander Aethyr, did these orcs come on our ships? Did they capture the fleet we sent out?"
		[/message]
		[message]
			description=Commander Aethyr
			message= _ "No, sir! They must have seized all remaining boats on the Green Isle. Our fleet should be returning any day now."
		[/message]
		[message]
			description=Prince Haldric
			message= _ "We are a refugee people. We must push back their vanguard, and secure our beachhead. If they capture our ships all is lost. We will be crushed under a tide of orcs."
		[/message]

		[store_unit]
			variable=jessica_store
			kill=yes
			[filter]
			description=Lady Jessica
			[/filter]
		[/store_unit]

		[message]
			speaker=narrator
			message= _ "Lady Jessica soon departs. In the distance a voice booms:"
		[/message]

		[recall]
			description=Burin the Lost
		[/recall]
		[recall]
			description=Sir Ruddry
		[/recall]
		[recall]
			description=Sir Ladoc
		[/recall]
		[recall]
			description=Minister Edmond
		[/recall]

		[message]
			description=Tan-Gagar
			message= _ "Drop the gold where it is! We've paid our friends enough. There are humans about, I can smell 'em!"
		[/message]

	[/event]

	[event]
	name=time over
		[message]
			description=Prince Haldric
			message= _ "We have run out of time... We'll never beat the orcs to the beach."
		[/message]
	[/event]

	[event]
		name=moveto
		[filter]
			side=1
			x=$xx1
			y=$yy1
		[/filter]

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

		[message]
			speaker=unit
			message= _ "I've found the orcs' chest! It's filled with gold."
		[/message]

		[removeitem]
		[/removeitem]

		{PLACE_IMAGE (items/chest-plain-open.png) $xx1 $yy1}

#ifdef EASY
		{LOOT 125 1}
#endif

#ifdef NORMAL
		{LOOT 100 1}
#endif

#ifdef HARD
		{LOOT 75 1}
#endif

	[/event]

	[event]
	name=attack
		[filter_second]
			description=Tan-Erirt
		[/filter_second]

		{UNDEAD_INTEL (Soul Shooter) (Rabbin) ( _ "Rabbin") "unit_image" 2 1 28}

		[message]
			description=Rabbin
			message= _ "You will be felled by my hand, useless fleshbags!"
		[/message]

		{UNDEAD_UNIT (Chocobone) 2 1 29}
		{UNDEAD_UNIT (Chocobone) 2 1 27}
#ifdef HARD
		{UNDEAD_UNIT (Chocobone) 2 2 28}
#endif
	[/event]

	[event]
	name=attack
		[filter_second]
		#The Forest Orc
			description=Tan-Gagar
		[/filter_second]

		{UNDEAD_INTEL (Draug) (General Kafka) ( _ "General Kafka") "unit_image" 3 35 19}

		[message]
			description=General Kafka
			message= _ "Never trust the living to do the job of the undead. Prepare to meet the inevitable!"
		[/message]

		[message]
			description=Minister Edmond
			message= _ "The only job of the dead is to remain dead. Prepare to be reunited with the ground."
		[/message]

		{UNDEAD_UNIT (Chocobone) 3 35 18}
		{UNDEAD_UNIT (Chocobone) 3 35 20}
#ifdef HARD
		{UNDEAD_UNIT (Chocobone) 3 35 17}
		{UNDEAD_UNIT (Chocobone) 3 35 21}
#endif
	[/event]

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

		[filter_second]
			side=1
		[/filter_second]

		[message]
			description=Tan-Gagar
			message= _ "We must block the human advance!"
		[/message]

		[gold]
			side=3
			amount=80
		[/gold]
	[/event]

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

		[filter_second]
			side=1
		[/filter_second]

		[message]
			description=Tan-Erirt
			message= _ "Reserves! We can't let them get to their landing site."
		[/message]

		[gold]
			side=2
			amount=80
		[/gold]
	[/event]

	[event]
		name=victory

		[message]
			description=Prince Haldric
			message= _ "We've defeated their vanguard. We have to meet the fleet before Jevyan destroys them and captures the ships. I hope Jessica makes it back soon."
		[/message]

		{CLEAR_VARIABLE xx1}
		{CLEAR_VARIABLE yy1}
	[/event]

	[event]
		name=die
		[filter]
			description=Commander Aethyr
		[/filter]

		[message]
			description=Commander Aethyr
			message= _ "Oh, to join my family again! Do not mourn my passing."
		[/message]

		[endlevel]
			result=defeat
		[/endlevel]
	[/event]

	[event]
		name=attack
		[filter]
			description=Burin the Lost
		[/filter]

		[message]
			description=Burin the Lost
			message= _ "Ahh, it's great to be home! I'm not much for the politics, but it's great to be home!"
		[/message]
	[/event]
[/scenario]
