[scenario]
#textdomain wesnoth-sof
name= _ "Towards the Caves"
id=6_Towards_the_Caves
turns=12
map_data="{@campaigns/Sceptre_of_Fire/maps/6_Towards_the_Caves.map}"
next_scenario=7_Outriding_the_Outriders

	{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=Elvish Marshal
	description=Gaenlar
	user_description= _ "Gaenlar"
	side=2
	canrecruit=1
	recruit=Elvish Rider,Elvish Hero,Elvish Marksman,Elvish Ranger,Elvish Druid
	{GOLD 300 350 400}
	team_name=bad
		[ai]
			[protect_location]
			x,y=36,3
			radius=10
			value=100
			[/protect_location]
			[target]
			type=Gryphon,Gryphon Rider,Gryphon Master
			value=10
			[/target]
			[target]
			description=Alanin
			value=2
			[/target]
			[target]
			race=dwarf
			value=1
			[/target]
		[/ai]

	[/side]

	[side]
	type=Elvish Marshal
	description=Glinan
	user_description= _ "Glinan"
	side=3
	canrecruit=1
	recruit=Elvish Rider,Elvish Hero,Elvish Marksman,Elvish Ranger,Elvish Druid

	{GOLD 250 300 350}
	team_name=bad
		[ai]
			[protect_location]
			x,y=36,3
			radius=10
			value=100
			[/protect_location]
			[target]
			race=dwarf
			value=10
			[/target]
			[avoid]
			x=1-18
			y=1-38
			[/avoid]
		[/ai]
	[/side]

	[side]
	type=Elvish Captain
	description=Kalnar
	user_description= _ "Kalnar"
	side=4
	canrecruit=1
	recruit=Elvish Scout,Elvish Fighter,Elvish Archer,Elvish Shaman
	{GOLD 150 200 250}
	team_name=bad
		[ai]
			[target]
			description=Alanin
			value=10
			[/target]
			[target]
			race=dwarf
			value=1
			[/target]
		[/ai]
	[/side]

	[story]
		[part]
		story= _ "Durstorn's rash action led to many problems. Not the least of which was being surrounded by elves."
		[/part]
		[part]
		story= _ "The dwarves spent several years trapped in those caves, the elves besieging them. The dwarves could not leave, for there were far too many elves, and there was no way out of the caverns other than above ground. But the elves could not enter, for the magical dwarven gates were closed."
		[/part]
		[part]
		story= _ "During this time, Thursagan crafted the Sceptre of Fire, first cutting the jewel, then putting it, the gold and the cold steel into the heat of the flame. The sceptre was crafted, but something was not right. No matter what enchantment of runes he put on the sceptre, it did not fulfil its original purpose."
		[/part]
		[part]
		background=maps/wesnoth.png
		show_title=yes
		{DOT 309 153}
		{CROSS 322 157}
		[/part]
	[/story]

	{SOF_DEATHS}

	[event]
	name=prestart
		[objectives]
		side=1
			[objective]
			description= _ "Move Rugnur to the northeast cave entrance"
			condition=win
			[/objective]
			[objective]
			description= _ "Move Alanin to the southern border east of the river"
			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= _ "Time runs out"
			condition=lose
			[/objective]
		[/objectives]
	[/event]

	[event]
	name=start
		#alanin, baglur, krawg and thursagan
		[recall]
		description=Alanin
		[/recall]
		[recall]
		description=Baglur
		[/recall]
		[recall]
		description=Krawg
		[/recall]
		[recall]
		description=Thursagan
		[/recall]
		[recall]
		description=Durstorn
		[/recall]
		#dialogue starts
		[message]
		description=Rugnur
		message= _ "Well, Thursagan has reached a conclusion. He can't make the sceptre with the materials he has here, but he has the final plans for it, and all the jewels and gold he needs. Shouldn't we leave now?"
		[/message]
		[message]
		description=Durstorn
		message= _ "All this time and he couldn't make it? Fine, we should try to leave... but it's not like we could leave if we wanted to. We're surrounded!"
		[/message]
		[if]
			[have_unit]
			description=Baglur
			[/have_unit]
			[then]
				[message]
				description=Baglur
				message= _ "If you'll permit me to say so, sir, you're wrong. We could - "
				[/message]
				[message]
				description=Durstorn
				message= _ "Shut up, Baglur! You don't know what you're talking about. I've analyzed the situation, and we're doomed. Our best hope is to surrender. Perhaps if we give the elves the plans for the sceptre they will let us survive."
				[/message]
			[/then]
			[else]
				[message]
				description=Baglur
				message= _ "If you'll permit me to say so, sir, you're wrong. We could - "
				[/message]
				[message]
				description=Durstorn
				message= _ "Shut up, Rugnur! You don't know what you're talking about. I've analyzed the situation, and we're doomed. Our best hope is to surrender. Perhaps if we give the elves the plans for the sceptre they will let us survive."
				[/message]
			[/else]
		[/if]
		[message]
		description=Rugnur
		message= _ "Yes, of course, let's just all be cowards! What happened to your honor, Durstorn?!"
		[/message]
		[message]
		description=Durstorn
		message= _ "You little fool, honor is less important than life! So, I'm ordering Thursagan to give the plans and the ruby to the elves, as a peace offering. Then maybe we'll walk out of here alive."
		[/message]
		[message]
		description=Thursagan
		message= _ "You don't have authority over me, Durstorn. And I wouldn't give the sceptre to them even if you did. It's not yours to give, its mine, and Rugnur's, and Baglur's. Krawg's done more for its existence than you have! And yet, you still get the profits from selling it to Haldric."
		[/message]
		[message]
		description=Durstorn
		message= _ "So what, all of you want to die? Fine by me, but I won't die with you! And if you won't give the sceptre to the elves, I'll take it from you!"
		[/message]
		[message]
		speaker=narrator
		image=story/towards_the_caves1.png
		message= _ " *swoosh*"
		[/message]
		[message]
		description=Thursagan
		message= _ "Nice try, Durstorn, but you missed. Now, I'd say that attacking an ally constitutes treason, wouldn't you?"
		[/message]
		[message]
		description=Durstorn
		message= _ "You're not my ally. You're more against me than the elves are; all they want is the ruby, but you want us dead!"
		[/message]
		[message]
		description=Rugnur
		message= _ "If that's what you're thinking, you're not fit to be ruler over us! So step down, or we'll force you."
		[/message]
		[message]
		description=Durstorn
		message= _ "Never!"
		[/message]
		[message]
		speaker=narrator
		image=story/towards_the_caves2.png
		message= _ " *thud*"
		[/message]
		[kill]
		description=Durstorn
		animate=yes
		[/kill]
		#change music?
		[message]
		description=Rugnur
		message= _ "Well, I suppose we were right to silence him, but I don't like this. In any case, now we should try to get out of here."
		[/message]
		[message]
		description=Thursagan
		message= _ "Yes. So, see the area to the northeast of us?"
		[/message]
		[scroll_to]
		x,y=36,3
		[/scroll_to]
		[delay]
		time=1000
		[/delay]
		[message]
		description=Thursagan
		message= _ "That's where there are the least elvish guards, so we have the greatest chance of success there. I think we should try to get to it."
		[/message]
		[message]
		description=Alanin
		message= _ "This plan, it isn't worse than staying here to be killed, but it isn't likely to succeed either. Even if it does, what will it accomplish? We will be cornered there."
		[/message]
		[message]
		description=Thursagan
		message= _ "I don't know if we will be cornered. That cave looks like it goes deep, and we can lose the elves in the caves, they move so slow there."
		[/message]
		[message]
		description=Alanin
		message= _ "That's fine for you, you can run fast in caves, but I can't! What am I supposed to do?"
		[/message]
		[message]
		description=Rugnur
		message= _ "Well, you are a member of the Wesnothian army. Why don't you rejoin it? See if you can run past those elves to our southeast,"
		[/message]
		[scroll_to]
		x,y=31,37
		[/scroll_to]
		[delay]
		time=1000
		[/delay]
		[message]
		description=Rugnur
		message= _ "And then ride south until you reach one of your outposts."
		[/message]
		[message]
		description=Alanin
		message= _ "I'm not going to do that, its suicide! And in any case, I've been with you for 10 years, almost as long as I was in the Wesnothian army; I'd prefer to fight with you."
		[/message]
		[message]
		description=Thursagan
		message= _ "You going south has more of a chance of success for you than staying here or going to the caves! And getting news to Haldric of what has happened is also the best way to get help to us."
		[/message]
		[message]
		description=Alanin
		message= _ "I suppose..."
		[/message]
		[message]
		description=Glaenar
		message= _ "Come out, dwarves, and surrender! Or die in that cave, your choice."
		[/message]
	[/event]

	[event]
	name=turn 4
		[gold]
		side=2
		amount=200
		[/gold]
		[gold]
		side=3
		amount=200
		[/gold]
		[gold]
		side=4
		amount=200
		[/gold]
	[/event]

	[event]
	name=moveto
		[filter]
		description=Alanin
		x=22-40
		y=38
		[/filter]
		[if]
			[have_unit]
			description=Rugnur
			[/have_unit]
			[then]
				[message]
				description=Rugnur
				message= _ "Alanin, ride as fast as you can south. Tell Haldric we are going into a cave, and to send forces to help us as soon as he can!"
				[/message]
				[store_unit]
					[filter]
					description=Alanin
					[/filter]
				variable=alanin
				kill=yes
				[/store_unit]
				[set_variable]
				name=alanin.canrecruit
				value=1
				[/set_variable]
				[objectives]
				side=1
					[objective]
					description= _ "Move Rugnur to the northeast cave entrance"
					condition=win
					[/objective]
					[objective]
					description= _ "Death of Rugnur"
					condition=lose
					[/objective]
					[objective]
					description= _ "Death of Krawg"
					condition=lose
					[/objective]
					[objective]
					description= _ "Death of Thursagan"
					condition=lose
					[/objective]
					[objective]
					description= _ "Time runs out"
					condition=lose
					[/objective]
				[/objectives]
			[/then]
			[else]
				[message]
				description=Alanin
				message= _ "I have made it past those elves, but they will chase me, and elvish horses are faster than mine."
				[/message]
				[store_unit]
					[filter]
					description=Alanin
					[/filter]
				variable=alanin
				kill=yes
				[/store_unit]
				[endlevel]
				result=victory
				bonus=no
				[/endlevel]
			[/else]
		[/if]
	[/event]

	[event]
	name=moveto
		[filter]
		description=Rugnur
		x,y=36,3
		[/filter]
		[if]
			[have_unit]
			description=Alanin
			[/have_unit]
			[then]
				[message]
				description=Alanin
				message= _ "Rugnur, I am going south. What should I tell Haldric?"
				[/message]
				[message]
				description=Thursagan
				message= _ "Tell him to send forces north to aid us and fight the elves, but that we are probably going to die. We are going into the caves."
				[/message]
				[store_unit]
					[filter]
						[not]
						description=Alanin
						[/not]
					side=1
					[/filter]
				variable=dwarves
				kill=yes
				[/store_unit]
				[store_unit]
					[filter]
					description=Alanin
					[/filter]
				variable=alanin
				[/store_unit]
				[set_variable]
				name=alanin.canrecruit
				value=1
				[/set_variable]
				[unstore_unit]
				variable=alanin
				[/unstore_unit]
				[set_recruit]
				recruit=
				[/set_recruit]
				[objectives]
				side=1
					[objective]
					description= _ "Move Alanin to the southern border east of the river"
					condition=win
					[/objective]
					[objective]
					description= _ "Death of Alanin"
					condition=lose
					[/objective]
					[objective]
					description= _ "Time runs out"
					condition=lose
					[/objective]
				[/objectives]
			[/then]
			[else]
				[message]
				description=Rugnur
				message= _ "I don't know what is in these caves, but whatever it is can't be worse than staying here to die."
				[/message]
				[store_unit]
					[filter]
						[not]
						description=Alanin
						[/not]
					side=1
					[/filter]
				variable=dwarves
				kill=yes
				[/store_unit]
				[endlevel]
				result=victory
				bonus=no
				[/endlevel]
			[/else]
		[/if]
	[/event]

	[event]
	name=victory
		[unstore_unit]
		variable=alanin
		[/unstore_unit]
		[clear_variable]
		name=alanin
		[/clear_variable]
		[store_gold]
		[/store_gold]
		[set_recruit]
		recruit=
		[/set_recruit]
	[/event]
[/scenario]
