[scenario]
	id=6a_Tidings_Good_And_Ill
	#textdomain wesnoth-tsg

	name= _ "Tidings, Good and Ill"
	next_scenario=7a_Into_The_Depths
	[music]
		name=battle.ogg
		ms_before=500
	[/music]
	[music]
		name=loyalists.ogg
		ms_before=500
		append=yes
	[/music]

	map_data="{campaigns/The_South_Guard/maps/6a_Tidings_Good_And_Ill.map}"

	{campaigns/The_South_Guard/utils/sg_deaths.cfg}
	{campaigns/The_South_Guard/utils/sg_help.cfg}

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

	turns=18
	victory_when_enemies_defeated=no


# Sir Gerrick's Men

[side]
	side=1
	type=Elvish Ranger
	description=Ithelden
	user_description= _ "Ithelden"
	unrenamable=yes

	team_name=South_Guard
	controller=human
	{CUSTOM_SG_FLAG}


	gold=0
	income=0

	shroud=yes
	fog=yes

	canrecruit=1
[/side]

# Miscellaneous Enemy Combatants

[side]
	side=2

	team_name=Various_Baddies
	no_leader=yes

	controller=ai



	{SG_GUARD (Saurian Skirmisher) (S'ssth) (_"S'ssth") 2 8 21}
	{SG_GUARD (Saurian Skirmisher) (S'ssth) (_"S'ssth") 2 17 16}
	{SG_GUARD (Saurian Skirmisher) (S'ssth) (_"S'ssth") 2 8 16}

	{SG_GUARD (Giant Scorpion) (Scorpion) (_"Scorpion") 2 14 16}
	{SG_GUARD (Ogre) (Wild Ogre) (_"Wild Ogre") 2 4 10}

	{SG_GUARD (Naga Fighter) (Naga) (_"Naga") 2 13 9}
	{SG_GUARD (Naga Fighter) (Naga) (_"Naga") 2 14 9}


	#ifdef EASY
		{SG_GUARD (Dark Adept) (Abdur) (_"Abdur") 2 8 1}
		{SG_GUARD (Naga Fighter) (Naga Queen) (_"Naga Queen") 2 12 8}
	#endif

	#ifdef MEDIUM
		{SG_GUARD (Saurian Skirmisher) (S'ssth) (_"S'ssth") 2 9 14}
		{SG_GUARD (Dark Adept) (Abdur) (_"Abdur") 2 8 1}
		{SG_GUARD (Naga Warrior) (Naga Queen) (_"Naga Queen") 2 12 8}
		{SG_GUARD (Naga Fighter) (Naga) (_"Naga") 2 13 7}
	#endif

	#ifdef HARD
		{SG_GUARD (Saurian Ambusher) (S'ssth) (_"S'ssth") 2 9 14}
		{SG_GUARD (Dark Adept) (Abdur) (_"Abdur") 2 8 1}
		{SG_GUARD (Dark Adept) (Kallen) (_"Kallen") 2 7 1}
		{SG_GUARD (Naga Myrmidon) (Naga Queen) (_"Naga Queen") 2 12 8}
		{SG_GUARD (Naga Warrior) (Naga) (_"Naga") 2 13 7}
	#endif

[/side]

#prestart

[event]
	name=prestart
	# Add the target location for Sir Gerrick to move to.

	{PLACE_IMAGE (items/gohere.png) 9 1}

	# Switch the leader from Ithelden to Sir Gerrick
	# Thanks to "shade" for help with this!

	[store_unit]
		variable=leader_store
		[filter]
			description=Ithelden
		[/filter]
		kill=yes
	[/store_unit]
	{VARIABLE leader_store.canrecruit 0}
	[unstore_unit]
		variable=leader_store
	[/unstore_unit]

	{VARIABLE Sir_Gerrick_Store.x 17}
	{VARIABLE Sir_Gerrick_Store.y 24}
	{VARIABLE Sir_Gerrick_Store.canrecruit 1}
	[unstore_unit]
		variable=Sir_Gerrick_Store
	[/unstore_unit]
	{CLEAR_VARIABLE Sir_Gerrick_Store}

	# Recall up to four elvish fighters and three elvish shamans
	# This is an ugly hack, and I need to figure out how to do it right,
	# but for the life of me, I can't get setting their x and y positions
	# to the results of a [store_starting_location] to work.

	{FOREACH elvish_fighters X}
		[if]
			[variable]
				name=X
				less_than=4
			[/variable]
			[then]
				{VARIABLE elvish_fighters[$X].x 16}
				{VARIABLE elvish_fighters[$X].y 24}
				{VARIABLE elvish_fighters[$X].moves 5}

				[unstore_unit]
					variable=elvish_fighters[$X]
					find_vacant=yes
				[/unstore_unit]
			[/then]
		[/if]
	{NEXT X}
	{CLEAR_VARIABLE elvish_fighers}

	{FOREACH elvish_healers X}
		[if]
			[variable]
				name=X
				less_than=4
			[/variable]
			[then]
				{VARIABLE elvish_healers[$X].x 16}
				{VARIABLE elvish_healers[$X].y 24}
				{VARIABLE elvish_healers[$X].moves 5}
				[unstore_unit]
					variable=elvish_healers[$X]
					find_vacant=yes
				[/unstore_unit]
			[/then]
		[/if]
	{NEXT X}
	{CLEAR_VARIABLE elvish_healers}

[/event]

#start

[event]
	name=start

	[message]
		speaker=Ithelden
		message= _ "Sir Gerrick, you must make it back to Kerlath and warn your people of the danger from the south. We will lead you through the forest and clear any foes from your path."
	[/message]
	[message]
		speaker=Sir Gerrick
		message= _ "With the bandits and undead vanquished behind us, what foes can there be ahead? Let us hope this is a speedy journey, for the spectre of winter looms."
	[/message]
	[remove_shroud]
		side=1
		x=8-10
		y=0-2
	[/remove_shroud]

	[objectives]
		side=1
			[objective]
				description= _ "Move Sir Gerrick to the north end of the woods"
				condition=win
			[/objective]
			[objective]
				description= _ "Death of Sir Gerrick"
				condition=lose
			[/objective]
			[objective]
				description= _ "Death of Ithelden"
				condition=lose
			[/objective]
			[objective]
				description= _ "Time runs out"
				condition=lose
			[/objective]
	[/objectives]
[/event]

# The nagas are sighted, and move to defend their home. They are enraged if you allied with the mermen in "Born to the Banner"

[event]
	name=sighted
	[filter]
		description=Naga Queen
	[/filter]

	[if]
		[variable]
			name=has_mermen
			equals="Yes"
		[/variable]
		[then]
			[message]
				speaker=Naga Queen
				message= _ "Hss... Here are the humans who have made a pact with the cursed mermen! Hss..."
			[/message]
			[message]
				speaker=Ithelden
				message= _ "We have stumbled into a den of nagas!"
			[/message]
			[message]
				speaker=Naga Queen
				message= _ "Hss... We will kill them all, my brood. Hss..."
			[/message]
			[message]
				speaker=Sir Gerrick
				message= _ "We must clear this road for Deoran and Ethiliel! We must destroy the naga lair!"
			[/message]
		[/then]
		[else]
			[message]
				speaker=Naga Queen
				message= _ "Hss... elves! Are they friends or enemies? Hss..."
			[/message]
			[message]
				speaker=Sir Gerrick
				message= _ "We are weary travelers, seeking our homes. If you but let us pass..."
			[/message]
			[message]
				speaker=Naga Queen
				message= _ "Hss... And humans! Humans drained our swamps and made them fields for farms, and now they have found my winter nest. The Land-Walkers must die! Hss..."
			[/message]
			[message]
				speaker=Sir Gerrick
				message= _ "She won't listen. If we leave these nagas here, they will ambush Deoran and Ethiliel! We must destroy them!"
			[/message]
		[/else]
	[/if]

	[objectives]
		side=1
			[objective]
				description= _ "Move Sir Gerrick to the north end of the woods"
				condition=win
			[/objective]
			[objective]
				description= _ "Defeat the Naga Queen"
				condition=win
			[/objective]
			[objective]
				description= _ "Death of Sir Gerrick"
				condition=lose
			[/objective]
			[objective]
				description= _ "Death of Ithelden"
				condition=lose
			[/objective]
			[objective]
				description= _ "Time runs out"
				condition=lose
			[/objective]
	[/objectives]
[/event]

# The Naga Queen dies...

[event]
	name=die
	[filter]
		description=Naga Queen
	[/filter]
	[message]
		speaker=Naga Queen
		message= _ "Hss... Who will watch over my brood now? Hss..."
	[/message]
[/event]

# The Wild Ogre  Translators: The ogre purposely has very bad grammer, because he's very stupid.

[event]
	name=sighted
	[filter]
		description=Wild Ogre
	[/filter]
	[message]
		speaker=Wild Ogre
		message= _ "Ho! Me see elves. Elves tasty? Me take elves to eat."
	[/message]
	[message]
		speaker=Ithelden
		message= _ "Err, Mr. Ogre, we are not very tasty."
	[/message]
	[message]
		speaker=Wild Ogre
		message= _ "Oh. Me only want tasty food. Go away."
	[/message]
		[message]
		speaker=Wild Ogre
		message= _ "..."
	[/message]
	[message]
		speaker=Wild Ogre
		message= _ "Wait! Me not believe you. Me eat you!"
	[/message]
[/event]

[event]
	name=die
	[filter]
		description=Wild Ogre
	[/filter]
	[message]
		speaker=Ogre
		message= _ "Bad food! It hurt me. Arrrrggghhhh!!"
	[/message]
[/event]


# The Dark Adept's Story
[event]
	name=sighted
	[filter]
		description=Abdur
	[/filter]
	[message]
		speaker=Abdur
		message= _ "Travelers in this desolate land! I seek that dark Sage who is rumored to dwell in these lands. Surely you have come from him?"
	[/message]
	[message]
		speaker=Sir Gerrick
		message= _ "Indeed! I just left my comrades, who were preparing to kill the vile Necromancer."
	[/message]
	[message]
		speaker=Abdur
		message= _ "Unworthy fools! I'll kill you for this sacrilege!"
	[/message]
[/event]

# Sir Gerrick moves to the head of the road
[event]
	name=moveto
	[filter]
		description=Sir Gerrick
		x,y=9,1
	[/filter]
	[message]
		speaker=Sir Gerrick
		message= _ "I will hasten back to Kerlath now and seek the advice of the Council of Westin..."
	[/message]
	[message]
		speaker=Ithelden
		message= _ "We too will return to our councils. We have much to tell them... Much indeed."
	[/message]
	[message]
		speaker=narrator
		message= _ "While the council debated the best course of action, Deoran and Ethiliel prepared to enter the caves under Mebrin's fortress..."
	[/message]

	[store_unit]
		variable=sir_gerrick_store
		[filter]
			description=Sir Gerrick
		[/filter]
		kill=yes
	[/store_unit]

	[endlevel]
		bonus=no
		result=continue
	[/endlevel]

[/event]

[/scenario]
