[scenario]
id=Saving_Halal
next_scenario=Peaceful_Valley
#textdomain wesnoth-did

name=_ "Saving Hal'al"
map_data="{campaigns/Descent_Into_Darkness/maps/Saving_halal.map}"
turns=15

victory_when_enemies_defeated=no

{STORY_SAVING_HALAL}

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

[side]
	side=1
	controller=human
	team_name=town guard
	type=Apprentice Mage
	description=Malin Keshar
	user_description=_ "Malin Keshar"
	profile=portraits/malin.png
	unrenamable=yes
	canrecruit=1
	recruit=Walking Corpse
	fog=no
	experience=0
	gold=70
[/side]

[side]
	side=2
	controller=ai
	team_name=orcs
	type=Orcish Warrior
	description=Kreg'a'shar Trr
	user_description=_ "Kreg'a'shar Trr"
	canrecruit=1
	recruit=Orcish Grunt,Orcish Archer,Wolf Rider,Orcish Crossbowman
	{GOLD 100 140 160}
	{INCOME 17 22 24}
	[ai]
		aggression=0.8
		leader_value=3
		grouping=offensive
		caution=0.1
		recruitment_pattern=fighter,archer,scout
	[/ai]
[/side]

[side]
	side=3
	controller=ai
	team_name=town guard
	type=Sergeant
	description=Drogan
	user_description=_ "Drogan"
	unrenamable=yes
	{GOLD 50 25 25}
	canrecruit=1
	recruit=Peasant,Woodsman,Spearman
	[ai]
		village_value=0
		[protect_unit]
			description=Malin Keshar
			value=4
		[/protect_unit]
		caution=0.5
		#don't block Malins keep
		[avoid]
			x=30
			y=12
		[/avoid]
	[/ai]
[/side]

[event]
	name=prestart

	[music]
		name=northerners.ogg
	[/music]
	[music]
		name=main_menu_new.ogg
		append=yes
		ms_before=1000
	[/music]

	[objectives]
		side=1
		[objective]
			condition=win
			description=_ "Defend the river fort for two nights"
		[/objective]
		[objective]
			condition=lose
			description=_ "Orcs break through the river fort defenses"
		[/objective]
		[objective]
			condition=lose
			description=_ "Death of Malin Keshar"
		[/objective]
		[objective]
			condition=lose
			description=_ "Death of Drogan"
		[/objective]
	[/objectives]

	# Place signpost to mark area defended
	{PLACE_IMAGE scenery/signpost.png 27 13}
	{PLACE_IMAGE scenery/signpost.png 23 20}

	# Drogan owns villages in the town
	{STARTING_VILLAGES 3 10}

	# Place starting units for Drogan and Malin
	{UNIT (Spearman) (River fort guard) ( _ "River fort guard") 1 30 11}
	{UNIT (Bowman) (River fort guard) ( _ "River fort guard") 1 31 12}
	{UNIT (Spearman) (River fort guard) ( _ "River fort guard") 1 31 13}

	{UNIT (Spearman) (Hal'al town guard) ( _ "Hal'al town guard") 3 5 17}
	{UNIT (Swordsman) (Hal'al town guard) ( _ "Hal'al town guard") 3 6 17}
	{UNIT (Spearman) (Hal'al town guard) ( _ "Hal'al town guard") 3 6 18}

[/event]

[event]
	name=start
	{DIALOGUE_SH_START}
[/event]

# In-scenario Events
[event]
	name=recruit
	first_time_only=yes
	[filter]
		type=Walking Corpse
	[/filter]
	{DIALOGUE_SH_CORPSE}
[/event]

[event]
	name=moveto
	[filter]
		side=1
		x,y=27,13
	[/filter]
	[message]
		speaker=narrator
		message=_ "Welcome to Hal'al"
	[/message]
[/event]

{EVENT_SH_EE}

# Defeat Conditions
[event]
	name=moveto
	[filter]
		side=2
		x=0-27
		y=13-20
	[/filter]
	[message]
		speaker=Drogan
		message=_ "The orcs have broken through our line.  Hal'al is open to attack!"
	[/message]
	[endlevel]
		result=defeat
	[/endlevel]
[/event]

{MALIN_DEATH}

[event]
	name=die
	[filter]
		speaker=Drogan
	[/filter]
	[message]
		speaker=unit
		message=_ "Who will be left to defend Hal'al?"
	[/message]
	[endlevel]
		result=defeat
	[/endlevel]
[/event]

# Victory Condition
[event]
	name=time over
	{DIALOGUE_SH_RETURN}
	[kill]
		side=2
		animate=no
		event_fire=no
	[/kill]
	{DIALOGUE_SH_END}
	[kill]
		side=1
		race=human
		[not]
			description=Malin Keshar
		[/not]
		animate=no
		fire_event=no
	[/kill]
	[endlevel]
		result=victory
	[/endlevel]
[/event]

[/scenario]
