[scenario]
id=01_The_Elves_Besieged
#textdomain wesnoth-httt
name= _ "The Elves Besieged"
map_data="{campaigns/Heir_To_The_Throne/maps/01_The_Elves_Besieged.map}"
{SCENARIO_MUSIC "battle.ogg"}
{TURNS 16 14 12}

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

next_scenario=02_Blackwater_Port
victory_when_enemies_defeated=no

[event]
name=prestart
	[objectives]
	side=1
		[objective]
			description= _ "Move Konrad to the signpost in the northwest"
			condition=win
		[/objective]
		[objective]
			description= _ "Death of Konrad"
			condition=lose
		[/objective]
		[objective]
			description= _ "Death of Delfador"
			condition=lose
		[/objective]
		[objective]
			description= _ "Turns run out"
			condition=lose
		[/objective]
	[/objectives]
[/event]

{campaigns/Heir_To_The_Throne/utils/intro.cfg}
{BIGMAP_ELVES_BESIEGED}

{STARTING_VILLAGES 5 10}
{STARTING_VILLAGES 6 10}
{STARTING_VILLAGES 1 10}

[side]
type=Fighter
description=Konrad
user_description= _"Konrad"
unrenamable=yes
side=1
canrecruit=1
controller=human
recruit=Elvish Scout,Elvish Fighter,Elvish Archer,Elvish Shaman
gold=100
team_name=elves
	[unit]
	description=Delfador
	user_description= _ "Delfador"
	unrenamable=yes
	type=Elder Mage
	side=1
	x=19
	y=23
	{IS_HERO}
	[modifications]
		{TRAIT_LOYAL}
		{TRAIT_INTELLIGENT}
	[/modifications]
	[/unit]
	[ai]
		[target]
			description=Delfador
			value=3.0
		[/target]
		[protect_unit]
			description=Delfador
			radius=6
			value=20.0
		[/protect_unit]
		[protect_unit]
			description=Konrad
			radius=10
			value=20.0
		[/protect_unit]
		[target]
			description=Kalenz
			value=3.0
		[/target]
		[protect_unit]
			description=Kalenz
			radius=4
			value=20.0
		[/protect_unit]

		[avoid]
		x=20-31
		y=1-12
		[/avoid]

		[leader_goal]
		x,y=1,1
		[/leader_goal]
	[/ai]
[/side]

#ifdef HARD
#define HIGH_PRIORITY_TARGETS
	[target]
	description=Delfador
	value=100
	[/target]
	[target]
	description=Konrad
	value=100
	[/target]
#enddef
#endif

#macro which tells the AI not to start thinking about
#whether it's a bad idea to send trolls into the forest
#against elves, and just do it
#define EBESIEGED_RECRUITMENT
[ai]
recruitment_ignore_bad_movement=yes
recruitment_ignore_bad_combat=yes
simple_targetting=yes
[/ai]
#enddef

[side]
type=Orcish Warlord
description=Urug-Telfar
user_description= _ "Urug-Telfar"
side=2
canrecruit=1
recruit=Orcish Warrior,Goblin Knight,Goblin Pillager,Orcish Crossbowman,Orcish Assassin,Troll
gold=400
	[ai]
	recruitment_pattern=scout,fighter,archer
	{ATTACK_DEPTH 1 3 5}
#ifdef HARD
	{HIGH_PRIORITY_TARGETS}
#endif
	[/ai]
{EBESIEGED_RECRUITMENT}
team_name=orcs
[/side]

[side]
type=Orcish Warlord
description=Knafa-Tan
user_description= _ "Knafa-Tan"
side=3
canrecruit=1
recruit=Orcish Warrior,Wolf Rider,Orcish Crossbowman,Orcish Assassin,Troll
{EBESIEGED_RECRUITMENT}
team_name=orcs
{GOLD 200 300 500}
	[ai]
	{ATTACK_DEPTH 1 3 5}
#ifdef HARD
	{HIGH_PRIORITY_TARGETS}
#endif
	[/ai]
[/side]

[side]
type=Orcish Warlord
description=Maga-Knafa
user_description= _ "Maga-Knafa"
side=4
canrecruit=1
recruit=Orcish Warrior,Wolf Rider,Orcish Crossbowman,Troll Warrior,Orcish Slayer
{EBESIEGED_RECRUITMENT}
team_name=orcs
{GOLD 200 300 500}
	[ai]
	{ATTACK_DEPTH 1 3 5}
#ifdef HARD
	{HIGH_PRIORITY_TARGETS}
#endif
	[/ai]

[/side]

#allies of Konrad
[side]
type=Elvish Captain
description=Galdrad
user_description= _ "Galdrad"
side=5
canrecruit=1
recruit=Elvish Fighter,Elvish Archer,Elvish Ranger
	[ai]
	recruitment_pattern=fighter,archer,mixed fighter
	[/ai]
gold=200
team_name=elves
[/side]

[side]
type=Elvish Druid
description=Chantal
user_description= _ "Chantal"
side=6
canrecruit=1
recruit=Elvish Shaman,Elvish Archer,Elvish Fighter
	[ai]
	recruitment_pattern=archer,archer,fighter,fighter,healer
	[/ai]
gold=200
team_name=elves
[/side]

{PLACE_IMAGE scenery/signpost.png 1 1}

[event]
name=start
	[message]
	speaker=narrator
	image="wesnoth-icon.png"
	message= _ "Sixteen years into her rule, Asheviere turned her attention to the Wood Elves living in the great forest southwest of Wesnoth, whom she despised. Orcish mercenaries were hired and dispatched to bring about their ruin."
	[/message]
	[message]
	description=Konrad
	message= _ "Master Delfador! Look, there are orcs coming from all directions! What shall we do?"
	[/message]
	[message]
	description=Delfador
	message= _ "There are too many to fight, far too many. We must escape!"
	[/message]
	[message]
	description=Konrad
	message= _ "But to where? This is the only home we have! What about the elves?"
	[/message]
	[message]
	description=Galdrad
	message= _ "We will fight them, but you must escape, Konrad. It is imperative that you escape!"
	[/message]
	[message]
	description=Delfador
	message= _ "We will go north. Perhaps we can reach the Isle of Anduin. If we can make it there, surely we will be safe. Konrad, we must recruit some elves to help us, and then you must make it to the sign post in the north-west. I will protect you!"
	[/message]
	[message]
	description=Konrad
	message= _ "Very well, let us hurry!"
	[/message]
	[message]
	description=Urug-Telfar
	image=portraits/James_Woo/orc-warlord4.png
	message= _ "Attack the elves, my grunts, and take their villages. Let us claim this land for the Queen!"
	[/message]

#on hard level, the enemies will specifically target Delfador and Konrad
#ifdef HARD
	[message]
	description=Knafa-Tan
	image=portraits/James_Woo/orc-warlord.png
	message= _ "Remember, it is rumored that the filthy mage and one that he protects are in these parts. They are the ones we want!"
	[/message]
#else
	[message]
	description=Knafa-Tan
	image=portraits/James_Woo/orc-warlord.png
	message= _ "Ha ha! We will rip the filthy elves to pieces!"
	[/message]
#endif
	[message]
	description=Galdrad
	message= _ "Let them come. We will fight them with all we have!"
	[/message]
	[message]
	description=Chantal
	message= _ "Be careful, Konrad! Guard him well, Delfador!"
	[/message]
	[message]
	description=Delfador
	message= _ "And so it has begun!"
	[/message]
[/event]

[event]
name=moveto
	[filter]
	x=1
	y=1
	description=Konrad
	[/filter]
	[message]
	speaker=unit
	message= _ "OK, we have made it this far! But where do we go next?"
	[/message]
	[message]
	description=Delfador
	message= _ "We must travel north, and try to make it to the Isle of Anduin. Hopefully we will find refuge there."
	[/message]
	[message]
	speaker=unit
	message= _ "Of course you are right, Delfador. But what will become of the elves here?"
	[/message]
	[message]
	description=Delfador
	message= _ "The elves will fight. They may even prevail. But I fear things do not bode well for them. Let us not speak of it now. Onward!"
	[/message]
	[message]
	description=Chantal
	message= _ "Good luck, Konrad! Don't worry about us, we will fight as best we can!"
	[/message]
	[endlevel]
	result=victory
	bonus=yes
	[/endlevel]
[/event]

[event]
name=die
	[filter]
	description=Konrad
	[/filter]
	[message]
	speaker=unit
	message= _ "I... I don't think I can make it anymore."
	[/message]
	[message]
	description=Delfador
	message= _ "Prince... you must keep fighting! Nooooooo!"
	[/message]
	[message]
	speaker=unit
	message= _ "It is over. I am doomed..."
	[/message]
	[endlevel]
	result=defeat
	[/endlevel]
[/event]

[event]
name=die
	[filter]
	description=Delfador
	[/filter]
	[message]
	speaker=unit
	message= _ "I have... have failed in my duty to protect the prince! I am defeated."
	[/message]
	[message]
	description=Konrad
	message= _ "Don't die, Delfador! Please, you have to stay alive!"
	[/message]
	[message]
	speaker=unit
	message= _ "Ugh"
	[/message]
	[endlevel]
	result=defeat
	[/endlevel]
[/event]

[event]
name=time over
	[message]
	description=Delfador
	message= _ "Oh, no! We have run out of time, they have arrived with reinforcements..."
	[/message]
[/event]

[event]
name=die
	[filter]
	type=Orcish Warlord
	[/filter]
	{VARIABLE_OP warlord_count add 1}
[/event]

[event]
name=die
	[filter_second]
	description=Konrad
	[/filter_second]
	[message]
	speaker=second_unit
	message= _ "Die, Villain, die!"
	[/message]
[/event]

[event]
name=die
	[filter_second]
	description=Delfador
	[/filter_second]
	[message]
	speaker=second_unit
	message= _ "Only the foolish oppose me!"
	[/message]
[/event]

[event]
name=attack
	[filter_second]
	description=Galdrad
	[/filter_second]
	[message]
	description=Galdrad
	message= _ "I am Galdrad. You will have to fight me to get any further!"
	[/message]
[/event]

[event]
name=attack
	[filter_second]
	description=Delfador
	[/filter_second]
	[message]
	description=Delfador
	message= _ "Only a fool would dare to attack me!"
	[/message]
[/event]

[event]
name=attack
	[filter]
	description=Delfador
	[/filter]
	[message]
	description=Delfador
	message= _ "I am Delfador the Great. Prepare to die!"
	[/message]
[/event]

[event]
name=attack
	[filter]
	description=Konrad
	[/filter]
	[message]
	description=Konrad
	image=portraits/konrad-angry.png
	message= _ "Let me through, you rogue!"
	[/message]
[/event]

#when a Goblin Knight moves onto one of the villages
#that Delfador and Konrad start near
[event]
name=moveto
	[filter]
	side=2
	x=20,17
	y=25,23
	[/filter]
	[message]
	description=Konrad
	message= _ "Oh no! They are destroying our home!"
	[/message]
	[message]
	description=Delfador
	message= _ "There can be no looking back. We must go quickly!"
	[/message]
[/event]

[/scenario]
