[scenario]
id=Captured
#textdomain wesnoth-ei
name= _ "Captured"
map_data="{campaigns/Eastern_Invasion/maps/Captured.map}"

	{TURNS 50 40 30}

	{UNDERGROUND}

next_scenario=Evacuation

{DEFAULT_MUSIC_PLAYLIST}

	{campaigns/Eastern_Invasion/utils/deaths.cfg}

victory_when_enemies_defeated=no

	[story]
		[part]
		story= _ "After reaching what they believed was safety, Gweddry and his men had been captured by northern orcs."
#		background=story/
		[/part]
		[part]
		story= _ "Informed they were being taken to the orcish king, Dra-Nak, they attempted to escape before that happened..."
		show_title=yes
#		background=story/
		[/part]
	[/story]

	#########################
	#names for all the rooms#
	#########################
	[label]
	x,y=23,25
	text=_"Prison"
	[/label]
	[label]
	x,y=33,28
	text=_"Torture Chamber"
	[/label]
	[label]
	x,y=12,18
	text=_"Throne Room"
	[/label]
	[label]
	x,y=28,32
	text=_"The City"
	[/label]
	[label]
	x,y=19,33
	text=_"The City"
	[/label]
	[label]
	x,y=15,32
	text=_"Exit"
	[/label]

	#######
	#sides#
	#######
	[side]
	type=General
	description=Gweddry
	user_description= _ "Gweddry"
	side=1
	canrecruit=0
	controller=human
	team_name=good
	fog=yes
	shroud=yes
	[/side]

	[side]
	type=Orcish Warlord
	description=King Dra-Nak
	user_description= _ "King Dra-Nak"
	side=2
	canrecruit=1
	controller=ai
	recruit=
	{GOLD 40 50 60}
		[ai]
		passive_leader=yes
		grouping=no
		recruitment_ignore_bad_combat=yes
		aggressive=0.4
			[avoid]
			x=1-7,7-14,14-21
			y=1-24,21-24,16-24
			[/avoid]
		[/ai]
	team_name=bad
	[/side]

	[side]
	side=3
	no_leader=yes
		[ai]
		aggression=1.0	# An insanely aggressive guardian :-)
		[/ai]
	team_name=bad
	[/side]

	#####################
	#lots of definitions#
	#####################

#define GUARD X Y T
[unit]
type={T}
side=2
x={X}
y={Y}
ai_special=guardian
[/unit]
#enddef

#define ATTACKER X Y T
[unit]
type={T}
side=2
x={X}
y={Y}
[/unit]
#enddef

#define SIDE3 X Y T
[unit]
type={T}
side=3
x={X}
y={Y}
ai_special=guardian
[/unit]
#enddef

#define PRISON X Y
[recall]
x,y={X},{Y}
[/recall]
[store_unit]
	[filter]
	x,y={X},{Y}
	[/filter]
variable=temp
[/store_unit]
[set_variable]
name=temp.hitpoints
multiply=0.75
[/set_variable]
[unstore_unit]
variable=temp
[/unstore_unit]
[clear_variable]
name=temp
[/clear_variable]
#enddef

#define ROLE T R X Y
[role]
type={T}
side=1
role={R}
[/role]
[recall]
role={R}
x,y={X},{Y}
[/recall]
#enddef

	######################
	#/lots of definitions#
	######################

	[event]
	name=prestart
		[objectives]
		side=1
			[objective]
			description= _ "Escape through the south-west tunnel"
			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]
		[/objectives]
	##############################
	#starting units (like guards)#
	##############################
	#the first guards
	#you cannot go out this way!
		{GUARD 34 17 (Troll Warrior)}
		{GUARD 34 19 (Troll Warrior)}
		{GUARD 31 18 (Troll Warrior)}
		{GUARD 31 20 (Troll Warrior)}
		{GUARD 27 17 (Troll Warrior)}
		{GUARD 27 19 (Troll Warrior)}

	#kings chamber guards
		{GUARD 9 16 (Orcish Warrior)}
		{GUARD 12 14 (Orcish Warrior)}
		{GUARD 15 16 (Orcish Warrior)}
		{GUARD 15 19 (Orcish Warrior)}
		{GUARD 25 11 (Orcish Warrior)}
		{GUARD 12 20 (Orcish Warrior)}
		{GUARD 9 19 (Orcish Warrior)}

	#torture chamber guards
		{GUARD 33 28 (Orcish Slayer)}
		{GUARD 30 26 (Orcish Slayer)}
		{GUARD 27 27 (Orcish Assassin)}
		{GUARD 28 29 (Orcish Assassin)}

	#these are bats that inhabit the side tunnels
		{SIDE3 14 9 (Blood Bat)}
		{SIDE3 19 10 (Vampire Bat)}
		{SIDE3 22 9 (Vampire Bat)}
		{SIDE3 24 7 (Vampire Bat)}
		{SIDE3 33 10 (Vampire Bat)}
	[/event]


	#############################
	#THE START EVENT BEGINS HERE#
	#############################
	[event]
	name=start
	################
	#getting people#
	################
	#getting Dacyn and Owaec
		[recall]
		description=Dacyn
		x,y=28,11
		[/recall]
		[recall]
		description=Owaec
		x,y=28,10
		[/recall]
	#getting the sidekicks
		{ROLE (Red Mage,Longbowman,Master Bowman,Arch Mage,Silver Mage,Great Mage) SIDE1 27 10}
		{ROLE (Swordsman,Pikeman,Royal Guard,Halbardier) SIDE2 29 10}

	##################
	#huge intro scene#
	##################

	#some talking
		[message]
		description=Gweddry
		message= _ "I think Dacyn and Owaec have escaped already. Now I have to, also... these guards are not being very alert, I may be able to get past them..."
		[/message]
		#move-unit-fake 1
		[teleport]
			[filter]
			description=Gweddry
			[/filter]
		x,y=29,17
		[/teleport]
		[hide_unit]
		x,y=29,17
		[/hide_unit]
		[move_unit_fake]
		type=General
		x=35,29
		y=19,17
		[/move_unit_fake]
		[unhide_unit]
		x,y=29,17
		[/unhide_unit]
		[scroll_to_unit]
		description=Gweddry
		[/scroll_to_unit]
		[message]
		description=Gweddry
		message= _ "Aha! There is a small crack in the cave wall here."
		[/message]
		#move-unit-fake 2
		[teleport]
			[filter]
			description=Gweddry
			[/filter]
		x,y=29,12
		[/teleport]
		[hide_unit]
		x,y=29,12
		[/hide_unit]
		[move_unit_fake]
		type=General
		x=29,29
		y=17,12
		[/move_unit_fake]
		[unhide_unit]
		x,y=29,12
		[/unhide_unit]
		#dialogue
		[message]
		description=Dacyn
		message= _ "So, Gweddry, you escaped too? Good. I think they have the rest of our troops captive, along with the peasants following us. We should be able to rescue them."
		[/message]
		[message]
		description=Gweddry
		message= _ "Where are they? These caves are impossible to navigate!"
		[/message]
		[message]
		description=Dacyn
		message= _ "Somewhere south of us. We are in a hidden passage in the north. Oh, and some others escaped too, along with Owaec."
		[/message]
		[message]
		description=King Dra-Nak
		message= _ "Well, where are the prisoners?"
		[/message]
		[message]
		x,y=15,16
		message= _ "Right here, boss."
		[/message]
		[message]
		description=King Dra-Nak
		message= _ "Well, where's their leader? I don't see him."
		[/message]
		[message]
		x,y=15,16
		message= _ "Uh... (whispers).. I dunno. He escaped, I think."
		[/message]
		[message]
		description=King Dra-Nak
		message= _ "You fool! Well, find him. Bring him to me! Wait, no, just kill him on sight."
		[/message]

		#######################
		#event inside an event#
		#######################
		[event]
		name=sighted
			[filter]
			type=Orcish Grunt,Orcish Warrior
			[/filter]
			[message]
			speaker=unit
			message= _ "Look, the escaped prisoners have returned!"
			[/message]
			[message]
			description=King Dra-Nak
			message= _ "Kill them."
			[/message]
		#these are prisoners even though the macro is called PRISON
		#first comes the annoying hack so the recalled units do not simply vanish
			[store_unit]
				[filter]
				description=Gweddry
				[/filter]
			variable=gweddry
			[/store_unit]
			[terrain]
			x,y=$gweddry.x,$gweddry.y
			letter=Kud
			[/terrain]
		#first group of prisoners- in the small cell
			{PRISON 37 27}
			{PRISON 38 27}
			{PRISON 39 28}
			{PRISON 39 29}
			{PRISON 39 30}
			{PRISON 38 30}
			{PRISON 37 31}
			{PRISON 36 31}
			{PRISON 35 31}
			{PRISON 34 30}
			{PRISON 38 29}
			{PRISON 37 30}
			{PRISON 36 30}
			[terrain]
			x,y=$gweddry.x,$gweddry.y
			letter=Uu
			[/terrain]
			[clear_variable]
			name=gweddry
			[/clear_variable]
		#a prisoner says something
			[message]
			speaker=narrator
			message= _ "The guards are distracted! Now is the time to escape!"
			[/message]
			[message]
			x,y=33,28
			message= _ "Huh? Who's there, who said that?"
			[/message]
			{ATTACKER 24 24 (Orcish Warrior)}
			{ATTACKER 24 25 (Orcish Warrior)}
			{ATTACKER 24 25 (Troll Warrior)}
			{ATTACKER 28 31 (Orcish Warrior)}
			{ATTACKER 29 32 (Orcish Warrior)}
			{ATTACKER 28 32 (Troll Warrior)}
		[/event]
		########################
		#/event inside an event#
		########################

	[/event]
	###########################
	#THE START EVENT ENDS HERE#
	###########################

	#eternal holy water!
	[item]
	x=22
	y=38
	image=items/ankh-necklace.png
	[/item]

	[event]
	name=moveto
		[filter]
		side=1
		x=22
		y=38
		[/filter]
		[object]
		id=holyamulet
		name= _ "Holy Amulet"
		image=items/ankh-necklace.png
		duration=forever
		description= _ "Wearing this amulet will cause every blow you deal to be holy!"
		cannot_use_message= _ "I am not suited to using this item! Let another take it."
			[then]
				[removeitem]
				x=22
				y=38
				[/removeitem]
			[/then]
			[effect]
			apply_to=attack
			range=melee
			set_type=arcane
			[/effect]
			[effect]
			apply_to=attack
			range=ranged
			set_type=arcane
			[/effect]
		[/object]
	[/event]

	#they start recruiting to chase you at turn 20
	[event]
	name=turn 20
		[recruit]
		side=2
		recruit=Orcish Warrior,Orcish Crossbowman,Troll
		[/recruit]
	[/event]

	#if you try to leave the way you came, it yells at you
	[event]
	name=moveto
		[filter]
		description=Gweddry
		x=23-31
		y=15-21
		[/filter]
		[message]
		description=Gweddry
		message= _ "I see the exit to the tunnel! Onward!"
		[/message]
		[message]
		description=Dacyn
		message= _ "Wait! We cannot go out that way. There are too many orcs. We must exit through the south-west gates."
		[/message]
		[message]
		description=Gweddry
		message= _ "Very well. We must go the other way."
		[/message]
	[/event]

	#victory
	#when you exit the caves, you win
	[event]
	name=moveto
		[filter]
		x=1-11
		y=32-40
		description=Gweddry
		[/filter]
		[message]
		description=Gweddry
		message= _ "Good! We have escaped these accursed caves!"
		[/message]
		[endlevel]
		result=victory
		[/endlevel]
	[/event]
[/scenario]
