[scenario]
#textdomain wesnoth-sof
name= _ "Hills of the Shorbear Clan"
id=5_Hills_of_the_Shorbear_Clan
turns=24
map_data="{@campaigns/Sceptre_of_Fire/maps/5_Hills_of_the_Shorbear_Clan.map}"
next_scenario=6_Towards_the_Caves

	{DEFAULT_MUSIC_PLAYLIST}

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

	[side]
	type=Dwarvish Fighter
	description=Rugnur
	side=1
	canrecruit=1
	controller=human
	recruit=Dwarvish Fighter,Dwarvish Thunderer,Dwarvish Guardsman,Gryphon Rider
	[/side]

	[side]
	type=Dwarvish Lord
	description=Glonoin
	user_description= _ "Glonoin"
	side=2
	canrecruit=1
	{RECRUIT (Dwarvish Berserker,Dwarvish Steelclad,Dwarvish Thunderer) (Dwarvish Berserker,Dwarvish Steelclad,Dwarvish Thunderguard,Dwarvish Thunderer) (Dwarvish Berserker,Dwarvish Steelclad,Dwarvish Thunderguard,Dwarvish Thunderer,Dwarvish Stalwart)}
	{GOLD 200 300 400}
		[ai]
		recruitment_pattern=fighter,fighter,fighter,mixed fighter
		aggression=-0.5
		caution=0.5
		village_value=0
		leader_value=0
		recruit_ignore_bad_movement=yes
		recruit_ignore_bad_combat=yes
		grouping=defensive
		protect_leader=4
		protect_leader_radius=4
		[/ai]
	team_name=baddies
	[/side]

	[side]
	no_leader=yes
	side=3
	{RECRUIT (Elvish Ranger,Elvish Scout,Elvish Hero) (Elvish Ranger,Elvish Marksman,Elvish Scout,Elvish Hero) (Elvish Ranger,Elvish Marksman,Elvish Scout,Elvish Hero)}
	{GOLD 250 300 350}
	{INCOME 6 7 8}
		[ai]
		recruitment_pattern=scout,scout,fighter,archer
		turns=1-6
		aggression=1.0
		caution=0.1
		village_value=2
		leader_value=1
		recruit_ignore_bad_combat=yes
		grouping=no
		protect_leader=0.5
		[/ai]
		[ai]
		recruitment_pattern=fighter,fighter,archer
		turns=6-20
		aggression=0.5
		caution=0.2
		village_value=2
		grouping=offensive
		protect_leader=1.0
		[/ai]
		[ai]
		recruitment_pattern=fighter,fighter,archer,scout
		turns=20-24
		aggression=1.0
		caution=0
		village_value=0
		leader_value=10
		grouping=no
		protect_leader=0
		[/ai]
	team_name=baddies
	[/side]

	[story]
		[part]
		story= _ "All dwarves are known for a love of gold and a heart of stone. The shorbears were no exception. They were crafters of crafters - they made tools. The best in the land. And they bartered well."
		[/part]
		[part]
		background=maps/wesnoth.png
		show_title=yes
		{DOT 271 109}
		{DOT 273 120}
		{DOT 284 130}
		{DOT 296 142}
		{CROSS 309 153}
		[/part]
	[/story]

	{SOF_DEATHS}

	[event]
	name=prestart
		[objectives]
		side=1
			[objective]
			description= _ "Defeat dwarvish leader"
			condition=win
			[/objective]
			[objective]
			description= _ "Death of Rugnur"
			condition=lose
			[/objective]
			[objective]
			description= _ "Death of Alanin"
			condition=lose
			[/objective]
			[objective]
			description= _ "Death of Krawg"
			condition=lose
			[/objective]
			[objective]
			description= _ "Death of Thursagan"
			condition=lose
			[/objective]
			[objective]
			description= _ "Death of Durstorn"
			condition=lose
			[/objective]
			[objective]
			description= _ "Time runs out"
			condition=lose
			[/objective]
		[/objectives]
	[/event]

	[event]
	name=start
		#durstorn, noiraran and kuhnar
		[unit]
		x,y=11,1
		type=Dwarvish Lord
		description=Durstorn
		user_description= _ "Durstorn"
		overlays=misc/hero-icon.png
		profile=portraits/durstorn.png
		[/unit]
		[unit]
		x,y=11,1
		type=Dwarvish Thunderguard
		description=Noiraran
		user_description= _ "Noiraran"
			[modifications]
			{TRAIT_LOYAL}
			{TRAIT_INTELLIGENT}
			[/modifications]
		[/unit]
		[unit]
		x,y=11,1
		type=Dwarvish Steelclad
		description=Kuhnar
		user_description= _ "Kuhnar"
			[modifications]
			{TRAIT_LOYAL}
			{TRAIT_STRONG}
			[/modifications]
		[/unit]
		#alanin, baglur, krawg and thursagan
		[recall]
		description=Alanin
		[/recall]
		[recall]
		description=Baglur
		[/recall]
		[recall]
		description=Krawg
		[/recall]
		[recall]
		description=Thursagan
		[/recall]
		#dialogue starts
		[message]
		description=Kuhnar
		message= _ "Here we are; the hills of the Shorbear clan. What are we here for, anyway?"
		[/message]
		[message]
		description=Rugnur
		message= _ "If I understand it correctly, we're here to bargain with the Shorbears, and arrange for us to use their tools to cut the ruby."
		[/message]
		[message]
		description=Thursagan
		message= _ "Exactly."
		[/message]
		[message]
		description=Durstorn
		message= _ "And I'll be doing the talking; I remember what happened last time you negotiated a deal! We lost five thousand pieces of silver."
		[/message]
		[message]
		description=Glonoin
		message= _ "Ay, its some of them cave-dwarves. What business do you have here?"
		[/message]
		[message]
		description=Durstorn
		message= _ "I'm Lord Durstorn, king of my tribe. I have been told you are great jeweler-workers, and so we come to rent some of your tools for a short time, a few years at most."
		[/message]
		[message]
		description=Glonoin
		message= _ "You're a king?! Must be a pretty small kingdom for you to come yourself to bargain with us!"
		[/message]
		[message]
		description=Durstorn
		message= _ "You insult me! Do you want my business, or not?"
		[/message]
		[message]
		description=Glonoin
		message= _ "Well, fine, I'll hear your offer."
		[/message]
		[message]
		description=Durstorn
		message= _ "We'd like to rent your best tools for a short period of time. We'll only be cutting one jewel with it. My starting offer is two hundred silver."
		[/message]
		[message]
		description=Glonoin
		message= _ "It must be worth a lot for you to come this way and offer that much! How much are you going to sell it for, eh?"
		[/message]
		[message]
		description=Durstorn
		message= _ "That's none of your concern!"
		[/message]
		[message]
		description=Glonoin
		message= _ "I'll take twenty-five hundred, minimum."
		[/message]
		[message]
		description=Rugnur
		message= _ "(whispered) Durstorn, that would be a quarter of all our profits!"
		[/message]
		[message]
		description=Durstorn
		message= _ "I know that. Uh, Glonoin, how about five hundred?"
		[/message]
		[message]
		description=Glonoin
		message= _ "Twenty-three hundred is my lowest offer. I can tell I don't need the money as much as you need the jewel cut!"
		[/message]
		[message]
		description=Durstorn
		message= _ "You must be mad! I'll offer one thousand, but no higher!"
		[/message]
		[message]
		description=Glonoin
		message= _ "Two thousand, and I'll go no lower!"
		[/message]
		[message]
		description=Rugnur
		message= _ "(whispered) What are we going to do? We can't go much higher!"
		[/message]
		[message]
		description=Baglur
		message= _ "(whispered) Offer him fifteen hundred, but don't go up, even if he refuses."
		[/message]
		[message]
		description=Durstorn
		message= _ "(whispered) Bah! Getting this cut isn't worth that much; what with Rugnur's mistake earlier, and all the other expenses, if we pay more than a thousand we'll barely even make a profit!"
		[/message]
		[message]
		description=Thursagan
		message= _ "(whispered) So what are you going to do?"
		[/message]
		[message]
		description=Durstorn
		message= _ "(whispered) Fight him, and take the tools by force."
		[/message]
		[message]
		description=Thursagan
		message= _ "Are you mad?!?"
		[/message]
		[message]
		description=Durstorn
		message= _ "Of course not! Now, Glonoin; one thousand was my final offer. If you won't accept it, we will take the tools from you by force!"
		[/message]
		[message]
		description=Glonoin
		message= _ "I'd like to see you try!"
		[/message]
		[message]
		description=Thursagan
		message= _ "You're making a mistake, Durstorn."
		[/message]
		[message]
		description=Durstorn
		message= _ "Shut up, all of you! Attack them!"
		[/message]
	[/event]

	[event]
	name=turn 3
		[unit]
		x,y=1,35
		side=3
		description=Lyndar
		user_description= _ "Lyndar"
		canrecruit=1
		type=Elvish Marshal
		[/unit]
		{MOVE_UNIT description=Lyndar 3 32}
		[message]
		description=Lyndar
		message= _ "Aha! I've spent years looking for you Dwarves, but now I've found you! Prepare to die!"
		[/message]
		[message]
		description=Glonoin
		message= _ "Who the devil are you?"
		[/message]
		[message]
		description=Rugnur
		message= _ "I thought we left the elves behind at the gates four years ago! It seems we have two enemies now."
		[/message]
		[message]
		description=Glonoin
		message= _ "So, elves, are you against these dwarves too? They're attacking my clan for absolutely no reason!"
		[/message]
		[message]
		description=Lyndar
		message= _ "I see. So you don't have the ruby?"
		[/message]
		[message]
		description=Glonoin
		message= _ "No, they do. They wanted to rent my tools to cut it, but they didn't offer me nearly enough!"
		[/message]
		[message]
		description=Lyndar
		message= _ "How about this - I help you defeat them, and you let me keep the ruby when we have?"
		[/message]
		[message]
		description=Glonoin
		message= _ "Deal!"
		[/message]
		[message]
		description=Durstorn
		message= _ "Ah, they don't scare me! We can take both of them!"
		[/message]
		[message]
		description=Thursagan
		message= _ "Don't be a fool! We can't take the elves, and it was a mistake to attack these dwarves, but if we have to fight we should retreat once we get what we came for, the tools!"
		[/message]
		[objectives]
		side=1
			[objective]
			description= _ "Defeat Glonoin, the Shorbear clan leader"
			condition=win
			[/objective]
			[objective]
			description= _ "Have all heroes in the Shorbear caves while no enemies are in the caves"
			condition=win
			[/objective]
			[objective]
			description= _ "Death of Rugnur"
			condition=lose
			[/objective]
			[objective]
			description= _ "Death of Alanin"
			condition=lose
			[/objective]
			[objective]
			description= _ "Death of Krawg"
			condition=lose
			[/objective]
			[objective]
			description= _ "Death of Thursagan"
			condition=lose
			[/objective]
			[objective]
			description= _ "Death of Durstorn"
			condition=lose
			[/objective]
			[objective]
			description= _ "Time runs out"
			condition=lose
			[/objective]
		[/objectives]
	[/event]

#define IN_CAVES
	[filter_location]
		x,y=19,16
		radius=6
		# x=16-22,15-23,13-25,15-22,17-21
		# y=   11,   12,13-19,   20,   21
	[/filter_location]
#enddef

#define NOT_IN_CAVES
	[filter_location]
		[not]
			x,y=19,16
			radius=6
			# x=16-22,15-23,13-25,15-22,17-21
			# y=   11,   12,13-19,   20,   21
		[/not]
	[/filter_location]
#enddef

	[event]
	name=die
		[filter]
		description=Glonoin
		[/filter]
		[kill]
			description=Glonoin
			animate=no
			fire_event=no
		[/kill]
		[message]
		description=Durstorn
		message= _ "Ha! Now we can get those tools easily, and go back to our own caves."
		[/message]
		[message]
		description=Thursagan
		message= _ "And how do you plan on doing that? There are elves swarming these hills, trying to kill us."
		[/message]
		[message]
		description=Durstorn
		message= _ "You are right... well, we will be able to break out eventually, and while we're here, we'll be able to finally make the sceptre."
		[/message]
		[if]
			[have_unit]
			description=Rugnur
			{IN_CAVES}
			[/have_unit]
			[have_unit]
			description=Alanin
			{IN_CAVES}
			[/have_unit]
			[have_unit]
			description=Krawg
			{IN_CAVES}
			[/have_unit]
			[have_unit]
			description=Thursagan
			{IN_CAVES}
			[/have_unit]
			[have_unit]
			description=Durstorn
			{IN_CAVES}
			[/have_unit]
			[then]
				[if]
					[have_unit]
					side=2,3
					{IN_CAVES}
					[/have_unit]
					[then]
						[message]
						description=Thursagan
						message= _ "Well, back to the battle - we are all in the caves, but there are still enemies in here also!"
						[/message]
						[message]
						description=Durstorn
						message= _ "Indeed. Kill them! And make sure no more enter. Then we can close the gates."
						[/message]

						{VARIABLE ready_to_close yes}

						[objectives]
						side=1
							[objective]
							description= _ "Have all heroes in the Shorbear caves while no enemies are in the caves"
							condition=win
							[/objective]
							[objective]
							description= _ "Death of Rugnur"
							condition=lose
							[/objective]
							[objective]
							description= _ "Death of Alanin"
							condition=lose
							[/objective]
							[objective]
							description= _ "Death of Krawg"
							condition=lose
							[/objective]
							[objective]
							description= _ "Death of Thursagan"
							condition=lose
							[/objective]
							[objective]
							description= _ "Death of Durstorn"
							condition=lose
							[/objective]
							[objective]
							description= _ "Time runs out"
							condition=lose
							[/objective]
						[/objectives]
					[/then]
					[else]
						[message]
						description=Thursagan
						message= _ "We have driven all of the dwarves and elves out of these caves. They are not ours, though, and we can't stay here forever."
						[/message]
						[message]
						description=Durstorn
						message= _ "True. I suspect these elves will try to besiege us here."
						[/message]
						[endlevel]
						result=victory
						bonus=no
						[/endlevel]
					[/else]
				[/if]
			[/then]
			[else]
				[message]
				description=Thursagan
				message= _ "Well, back to the battle - we need everyone to get into the Shorbear caves. And then stop any enemies from coming in here."
				[/message]
				[message]
				description=Durstorn
				message= _ "Indeed. Everyone to the caves, and kill those still inside!"
				[/message]

				{VARIABLE ready_to_close yes}

				[objectives]
				side=1
					[objective]
					description= _ "Have all heroes in the Shorbear caves while no enemies are in the caves"
					condition=win
					[/objective]
					[objective]
					description= _ "Death of Rugnur"
					condition=lose
					[/objective]
					[objective]
					description= _ "Death of Alanin"
					condition=lose
					[/objective]
					[objective]
					description= _ "Death of Krawg"
					condition=lose
					[/objective]
					[objective]
					description= _ "Death of Thursagan"
					condition=lose
					[/objective]
					[objective]
					description= _ "Death of Durstorn"
					condition=lose
					[/objective]
					[objective]
					description= _ "Time runs out"
					condition=lose
					[/objective]
				[/objectives]
			[/else]
		[/if]
	[/event]

	[event]
		name=die
		first_time_only=no

		[filter]
			side=2,3
		[/filter]

		[if]
			[variable]
			name=ready_to_close
			equals=yes
			[/variable]
			[have_unit]
			description=Rugnur
			{IN_CAVES}
			[/have_unit]
			[have_unit]
			description=Alanin
			{IN_CAVES}
			[/have_unit]
			[have_unit]
			description=Krawg
			{IN_CAVES}
			[/have_unit]
			[have_unit]
			description=Thursagan
			{IN_CAVES}
			[/have_unit]
			[have_unit]
			description=Durstorn
			{IN_CAVES}
			[/have_unit]
			[then]
				[if]
					[have_unit]
					side=2,3
					{IN_CAVES}
					[/have_unit]
					[else]
						[message]
						description=Durstorn
						message= _ "We have driven all of the dwarves and elves out of these caves! Now, seal the gates!"
						[/message]
						[endlevel]
						result=victory
						bonus=no
						[/endlevel]
					[/else]
				[/if]
			[/then]
		[/if]
	[/event]

	[event]
		name=moveto
		first_time_only=no

		[filter]
			side=1

			[not]
				[not]
					description=Rugnur
				[/not]
				[not]
					description=Alanin
				[/not]
				[not]
					description=Krawg
				[/not]
				[not]
					description=Thursagan
				[/not]
				[not]
					description=Durstorn
				[/not]
			[/not]
		[/filter]

		[if]
			[variable]
			name=ready_to_close
			equals=yes
			[/variable]
			[have_unit]
			description=Rugnur
			{IN_CAVES}
			[/have_unit]
			[have_unit]
			description=Alanin
			{IN_CAVES}
			[/have_unit]
			[have_unit]
			description=Krawg
			{IN_CAVES}
			[/have_unit]
			[have_unit]
			description=Thursagan
			{IN_CAVES}
			[/have_unit]
			[have_unit]
			description=Durstorn
			{IN_CAVES}
			[/have_unit]
			[then]
				[if]
					[have_unit]
					side=2,3
					{IN_CAVES}
					[/have_unit]
					[else]
						[message]
						description=Durstorn
						message= _ "We have driven all of the dwarves and elves out of these caves! Now, seal the gates!"
						[/message]
						[endlevel]
						result=victory
						bonus=no
						[/endlevel]
					[/else]
				[/if]
			[/then]
		[/if]
	[/event]

	[event]
		name=new turn
		first_time_only=no

		[if]
			[variable]
			name=ready_to_close
			equals=yes
			[/variable]
			[have_unit]
			description=Rugnur
			{IN_CAVES}
			[/have_unit]
			[have_unit]
			description=Alanin
			{IN_CAVES}
			[/have_unit]
			[have_unit]
			description=Krawg
			{IN_CAVES}
			[/have_unit]
			[have_unit]
			description=Thursagan
			{IN_CAVES}
			[/have_unit]
			[have_unit]
			description=Durstorn
			{IN_CAVES}
			[/have_unit]
			[then]
				[if]
					[have_unit]
					side=2,3
					{IN_CAVES}
					[/have_unit]
					[else]
						[message]
						description=Durstorn
						message= _ "We have driven all of the dwarves and elves out of these caves! Now, seal the gates!"
						[/message]
						[endlevel]
						result=victory
						bonus=no
						[/endlevel]
					[/else]
				[/if]
			[/then]
		[/if]
	[/event]

	[event]
	name=die
		[filter]
		description=Durstorn
		[/filter]
		[message]
		description=Durstorn
		message= _ "Gaanngh..."
		[/message]
		[endlevel]
		result=defeat
		[/endlevel]
	[/event]

	[event]
	name=turn 10
		[gold]
		side=3
		amount=200
		[/gold]
	[/event]
[/scenario]
