[scenario]
id=Orc_war
next_scenario=Return_to_Halal
#textdomain wesnoth-did

name=_ "Orc War"
map_data="{campaigns/Descent_Into_Darkness/maps/Orc_war.map}"
turns=30

victory_when_enemies_defeated=yes

{STORY_ORC_WAR}

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

[side]
	side=1
	controller=human
	type=Apprentice Mage
	description=Malin Keshar
	user_description=_ "Malin Keshar"
	unrenamable=yes
	canrecruit=1
	recruit=Walking Corpse,Vampire Bat,Ghost,Ghoul,Skeleton Archer,Skeleton,Dark Adept DiD
	fog=no
	shroud=no
	gold=200
[/side]

[side]
	side=2
	controller=ai
	team_name=orcs
	type=Orcish Warlord
	description=Borth
	user_description=_ "Borth"
	profile=portraits/James_Woo/orc-warlord2.png
	canrecruit=1
	recruit=Goblin Spearman,Orcish Archer,Orcish Crossbowman,Wolf Rider,Orcish Grunt,Goblin Knight,Orcish Warrior,Troll Whelp
	{GOLD 120 140 160}
	{INCOME 0 3 6}
	fog=no
	shroud=no
	[ai]
		villages_per_scout=8
		village_value=0.5
		[target]
			description=Malin Keshar
			value=1
		[/target]
		[target]
			description=Darken Volk
			value=1
		[/target]
	[/ai]
[/side]

[side]
	side=3
	controller=ai
	team_name=orcs
	type=Orcish Slurbow
	description=P'Gareth
	user_description=_ "P'Gareth"
	profile=portraits/James_Woo/orc-warlord2.png
	canrecruit=1
	recruit=Orcish Archer,Orcish Crossbowman,Goblin Pillager,Orcish Grunt,Orcish Assassin
	{GOLD 120 140 160}
	{INCOME 0 3 6}
	fog=no
	shroud=no
	[ai]
		scout_village_targetting=2
		village_value=0.5
		[target]
			description=Malin Keshar
			value=1
		[/target]
		[target]
			description=Darken Volk
			value=1
		[/target]
	[/ai]
[/side]

[side]
	side=4
	controller=ai
	team_name=orcs
	type=Orcish Warlord
	description=K'Vark
	user_description=_ "K'Vark"
	profile=portraits/James_Woo/orc-warlord2.png
	canrecruit=1
	recruit=Orcish Archer,Orcish Crossbowman,Troll Whelp,Wolf Rider,Orcish Grunt
	{GOLD 120 140 160}
	{INCOME 0 3 6}
	fog=no
	shroud=no
	[ai]
		villages_per_scout=6
		village_value=0.5
				[target]
			description=Malin Keshar
			value=1
		[/target]
		[target]
			description=Darken Volk
			value=1
		[/target]
	[/ai]
[/side]

[event]
	name=prestart
	[music]
		name=battle.ogg
	[/music]
	
	[objectives]
		side=1
		[objective]
			condition=win
			description=_ "Kill the orc leaders"
		[/objective]
		[objective]
			condition=lose
			description=_ "Death of Malin Keshar"
		[/objective]
		[objective]
			condition=lose
			description=_ "Death of Darken Volk"
		[/objective]
	[/objectives]
	
	[recall]
		description=Darken Volk
	[/recall]

	{VARIABLE orc_leaders_killed 0}
[/event]

[event]
	name=start
	{DIALOGUE_OW_START}
		
	# Set orc villages
	{STARTING_VILLAGES 2 10}
	{SET_VILLAGE 3 3 29}
	{SET_VILLAGE 3 7 33}
	{SET_VILLAGE 3 5 25}
	{SET_VILLAGE 3 17 28}
	{STARTING_VILLAGES 4 8}
	{SET_VILLAGE 4 22 30}
	{SET_VILLAGE 4 20 33}
[/event]

# In-scenario events


# Defeat Conditions
{MALIN_DEATH}
{VOLK_DEATH}
{TIME_OUT_LOSE}

# Victory Condition
[event]
	name=die
	first_time_only=no
	[filter]
		canrecruit=1
		[not]
			side=1
		[/not]
	[/filter]
	{VARIABLE_OP orc_leaders_killed add 1}
	[if]
		[variable]
			name=orc_leaders_killed
			numerical_equals=2
		[/variable]
		[then]
			{CLEAR_VARIABLE orc_leaders_killed}
			[endlevel]
				bonus=yes
				result=victory
			[/endlevel]
		[/then]
	[/if]
[/event]

[event]
	name=victory
	[if]
		[have_unit]
			side=2
			canrecruit=1
		[/have_unit]
		[then]
{MOVE_UNIT (side=2
canrecruit=1) 13 1}
		[/then]
		[else]
			[if]
				[have_unit]
					side=3
					canrecruit=1
				[/have_unit]
				[then]
{MOVE_UNIT (side=3
canrecruit=1) 1 31}
				[/then]
				[else]
					# must have side 4 leader left
{MOVE_UNIT (side=4
canrecruit=1) 40 34}
				[/else]
			[/if]
		[/else]
	[/if]
	
	# Store the 3rd orc leader for use in Return to Hal'al
	[store_unit]
		[filter]
			canrecruit=1
			[not]
				side=1
			[/not]
		[/filter]
		variable=orc_leader_store
		kill=yes
	[/store_unit]
	{DIALOGUE_OW_END}
	# Heal Darken Volk and store him for his return in A Small Favor
	[object]
		silent=yes
		[filter]
			description=Darken Volk
		[/filter]
		[effect]
			apply_to=hitpoints
			heal_full=yes
		[/effect]
	[/object]
	[store_unit]
		[filter]
			description=Darken Volk
		[/filter]
		variable=darken_volk_store
		kill=yes
	[/store_unit]
[/event]

[/scenario]
