# Level 7.2: Talking to Trolls

[scenario]
#textdomain wesnoth-utbs

id="7_2_TrollInterlude"
name= _ "Talking with Trolls"
label= _ "Talking with Trolls"

map_data="{campaigns/Under_the_Burning_Suns/maps/7_2TrollInterlude.map}"

[music]
name=underground.ogg
[/music]

next_scenario=8_OutoftheFryingPan

#no turn limit for this cutscene
turns=-1

#don't display snapshot of map in saved games
snapshot=no
victory_when_enemies_defeated=no

{UNDERGROUND}

[side]
	side=1
	description=Kaleh
	type=Desert Fighter
	canrecruit=1
	{INCOME -2 -2 -2}
	controller=human
	#recruit=Desert Fighter3, Desert Archer3, Desert Hunter3, Desert Shaman3, Desert Scout3
	shroud=no
	fog=no
	team_name=ally
[/side]

#side=2 Troll Leader
[side]
	description=Great Leader Darmog
	user_description= _ "Great Leader Darmog"
	type=Great Troll
	side=2
	canrecruit=no
	[modifications]
		{TRAIT_INTELLIGENT}
		{TRAIT_STRONG}
	[/modifications]
	ai_special=guardian
	gold=0
	income=0
	controller=ai
	shroud=no
	fog=no
	team_name=ally
[/side]


[story]
	[part]
	story= _ "Chapter 7: We returned quickly and found the rest of our people, safely hidden a few miles back from the fighting. Once we had assured the rest of the elves that the trolls were our allies, Zurg led us silently and quickly away from the front lines through a maze of secret tunnels."
	[/part]

	[part]
	story= _ "I do not know how long we tramped through those tiny dark passages; time seemed to flow differently down there, deep under the earth. But finally we stepped out into a large cavern. Dominating the cavern were the remains of what must have originally been a dwarf city. The large stone walls were riddled with giant holes and the iron gates had been blasted asunder. As we entered through the gates, we saw dead dwarves and other more grisly signs of recent battle. All around us were many trolls, working hard to repair the walls and other defenses. Zurg led us through the chaos to several side caverns which had until recently been used as storerooms. There was plenty of space for us to bed down and stay out of the way, and the dwarves had left behind plenty of provisions. "
	[/part]

	[part]
	story= _ "Zurg told us that they had just captured this city from the dwarves, and that the Great Leader had moved here to set up his base of operations. They were clearly worried about a dwarf counterattack. Luckily the trolls were quite skilled at stonework and the walls were quickly repaired. The trolls didn't talk much, but were very intelligent and clearly weren't the bloodthirsty savages they were purported to be. Overall they actually seemed quite peaceful, except when provoked. I learned that the leadership was balanced between the warriors and the shamans. The troll's military leader was chosen and advised by a council of their shamans."
	[/part]

	[part]
	story= _ "I wish I could have spent more time learning about these misunderstood creatures, but we could not tarry long. Even protected by the trolls, caught in the middle of this great war, I feared for the safety of my people. And so after waiting a few days, I was able to get an audience with the Great Leader."
	[/part]

[/story]


# Prestart functions:
# set starting scenario objectives
# keep cost of recruiting units the same
# recall main heroes
# initialize starting variables
# create starting guards

[event]
name=prestart

# set starting scenario objectives

[objectives]
	summary= _ "Starting Objectives:"
	[objective]
		description= _ "Choose a Unit to Take the Fire Blade"
		condition=win
	[/objective]
[/objectives]

	#keep cost of units constant from previous scenario
	[if]

		[variable]
		name=scen3
		numerical_equals=2
		[/variable]

		[then]

		#go from 3 to 4

		[disallow_recruit]
			type=Desert Fighter, Desert Archer, Desert Hunter, Desert Shaman, Desert Scout
			side=1
		[/disallow_recruit]

		[disallow_recruit]
			type=Desert Fighter2, Desert Archer2, Desert Hunter2, Desert Shaman2, Desert Scout2
			side=1
		[/disallow_recruit]

		[disallow_recruit]
			type=Desert Fighter3, Desert Archer3, Desert Hunter3, Desert Shaman3, Desert Scout3
			side=1
		[/disallow_recruit]

		[allow_recruit]
			type=Desert Fighter4, Desert Archer4, Desert Hunter4, Desert Shaman4, Desert Scout4
			side=1
		[/allow_recruit]

		[/then]

		[else]

		[if]
			[variable]
			name=scen3
			numerical_equals=1
			[/variable]

			[then]

			#go from 2 to 3

			[disallow_recruit]
				type=Desert Fighter, Desert Archer, Desert Hunter, Desert Shaman, Desert Scout
				side=1
			[/disallow_recruit]

			[disallow_recruit]
				type=Desert Fighter2, Desert Archer2, Desert Hunter2, Desert Shaman2, Desert Scout2
				side=1
			[/disallow_recruit]

			[allow_recruit]
				type=Desert Fighter3, Desert Archer3, Desert Hunter3, Desert Shaman3, Desert Scout3
				side=1
			[/allow_recruit]

			[/then]
		[/if]

		[if]
			[variable]
			name=scen3
			numerical_equals=3
			[/variable]

			[then]

			#go from 4 to 5

			[disallow_recruit]
				type=Desert Fighter, Desert Archer, Desert Hunter, Desert Shaman, Desert Scout
				side=1
			[/disallow_recruit]

			[disallow_recruit]
				type=Desert Fighter2, Desert Archer2, Desert Hunter2, Desert Shaman2, Desert Scout2
				side=1
			[/disallow_recruit]

			[disallow_recruit]
				type=Desert Fighter3, Desert Archer3, Desert Hunter3, Desert Shaman3, Desert Scout3
				side=1
			[/disallow_recruit]

			[disallow_recruit]
				type=Desert Fighter4, Desert Archer4, Desert Hunter4, Desert Shaman4, Desert Scout4
				side=1
			[/disallow_recruit]

			[allow_recruit]
				type=Desert Fighter5, Desert Archer5, Desert Hunter5, Desert Shaman5, Desert Scout5
				side=1
			[/allow_recruit]

			[/then]
		[/if]

		[/else]
	[/if]


	#add rubble and other items
	{PLACE_IMAGE scenery/rubble.png 9 9}
	{PLACE_IMAGE scenery/rubble.png 12 9}
	{PLACE_IMAGE scenery/rubble.png 11 7}
	{PLACE_IMAGE scenery/rubble.png 13 10}
	{PLACE_IMAGE scenery/rubble.png 7 12}

	{PLACE_IMAGE scenery/rubble.png 8 7}
	{PLACE_IMAGE scenery/rubble.png 12 7}

	#recall heroes
	[recall]
		description=Nym
	[/recall]
	[recall]
		description=Zhul
	[/recall]
	[recall]
		description=Elyssa
	[/recall]

	#recall other dwarves
	[recall]
		description=Grog
	[/recall]

	[recall]
		description=Thu'lok
	[/recall]
	[recall]
		description=Harpo
	[/recall]
	[recall]
		description=Groucho
	[/recall]
	[recall]
		description=Chico
	[/recall]
	[recall]
		description=Groo
	[/recall]

	#teleport trolls to correct locations

	[teleport]
		[filter]
			description=Grog
		[/filter]
		x,y=8,12
	[/teleport]

	[teleport]
		[filter]
			description=Thu'lok
		[/filter]
		x,y=12,12
	[/teleport]

	[teleport]
		[filter]
			description=Harpo
		[/filter]
		x,y=11,13
	[/teleport]

	[teleport]
		[filter]
			description=Groucho
		[/filter]
		x,y=13,12
	[/teleport]

	[teleport]
		[filter]
			description=Chico
		[/filter]
		x,y=12,13
	[/teleport]

	[teleport]
		[filter]
			description=Groo
		[/filter]
		x,y=13,13
	[/teleport]


	#teleport heroes to correct locations
	[teleport]
		[filter]
			description=Elyssa
		[/filter]
		x,y=10,11
	[/teleport]

	[teleport]
		[filter]
			description=Zhul
		[/filter]
		x,y=11,10
	[/teleport]

	[teleport]
		[filter]
			description=Nym
		[/filter]
		x,y=9,10
	[/teleport]

	#convert Thu'lok, Groucho, Harpo, Chico, Groo to side 2

	[store_unit]
	[filter]
		description=Thu'lok
	[/filter]
	variable=trollstats
	[/store_unit]

	[set_variable]
	name=trollstats.side
	value=2
	[/set_variable]

	[unstore_unit]
	variable=trollstats
	[/unstore_unit]

	[store_unit]
	[filter]
		description=Groucho
	[/filter]
	variable=trollstats
	[/store_unit]

	[set_variable]
	name=trollstats.side
	value=2
	[/set_variable]

	[unstore_unit]
	variable=trollstats
	[/unstore_unit]

	[store_unit]
	[filter]
		description=Harpo
	[/filter]
	variable=trollstats
	[/store_unit]

	[set_variable]
	name=trollstats.side
	value=2
	[/set_variable]

	[unstore_unit]
	variable=trollstats
	[/unstore_unit]

	[store_unit]
	[filter]
		description=Chico
	[/filter]
	variable=trollstats
	[/store_unit]

	[set_variable]
	name=trollstats.side
	value=2
	[/set_variable]

	[unstore_unit]
	variable=trollstats
	[/unstore_unit]

	[store_unit]
	[filter]
		description=Groo
	[/filter]
	variable=trollstats
	[/store_unit]

	[set_variable]
	name=trollstats.side
	value=2
	[/set_variable]

	[unstore_unit]
	variable=trollstats
	[/unstore_unit]

	{CLEAR_VARIABLE trollstats}


	#initialize starting variables

	[if]
		[have_unit]
			description=Grog
		[/have_unit]

		[then]

		[set_variable]
			name=troll_name
			value=Grog
		[/set_variable]

		[/then]

		[else]

		[set_variable]
			name=troll_name
			value=Nog
		[/set_variable]

		# Nog's traits are is intentionally inferior to Grog's
		[unit]
		type=Troll
		description=Nog
		user_description= _ "Nog"
		profile=portraits/grog.png
		x=8
		y=12
		side=1
		[modifications]
			{TRAIT_QUICK}
			{TRAIT_LOYAL}
		[/modifications]
		[/unit]

		[/else]
	[/if]

	#create starting dwarf guards
	#all have special AI guardian, so that they won't move

	[unit]
	type=Troll
	description=Troll Guard
	user_description= _ "Troll Guard"
	x=9
	y=14
	side=2
	ai_special=guardian
	[modifications]
		{TRAIT_LOYAL}
		{TRAIT_RESILIENT}
	[/modifications]
	[/unit]

	[unit]
	type=Troll
	description=Troll Guard
	user_description= _ "Troll Guard"
	x=11
	y=14
	side=2
	ai_special=guardian
	[modifications]
		{TRAIT_LOYAL}
		{TRAIT_QUICK}
	[/modifications]
	[/unit]

	[unit]
	type=Troll Shaman
	description=Spiritual Advisor
	user_description= _ "Spiritual Advisor"
	x=9
	y=6
	side=2
	ai_special=guardian
	[modifications]
		{TRAIT_LOYAL}
		{TRAIT_STRONG}
	[/modifications]
	[/unit]

	[unit]
	type=Troll Shaman
	description=Spiritual Advisor
	user_description= _ "Spiritual Advisor"
	x=11
	y=6
	side=2
	ai_special=guardian
	[modifications]
		{TRAIT_LOYAL}
		{TRAIT_INTELLIGENT}
	[/modifications]
	[/unit]

	[unit]
	type=Troll Rocklobber
	description=Troll Guard
	user_description= _ "Troll Guard"
	x=7
	y=8
	side=2
	ai_special=guardian
	[modifications]
		{TRAIT_LOYAL}
		{TRAIT_QUICK}
	[/modifications]
	[/unit]

	[unit]
	type=Troll Rocklobber
	description=Troll Guard
	user_description= _ "Troll Guard"
	x=13
	y=8
	side=2
	ai_special=guardian
	[modifications]
		{TRAIT_LOYAL}
		{TRAIT_RESILIENT}
	[/modifications]
	[/unit]

	[unit]
	type=Troll Whelp
	description=Troll Guard
	user_description= _ "Troll Guard"
	x=6
	y=9
	side=2
	ai_special=guardian
	[modifications]
		{TRAIT_LOYAL}
		{TRAIT_RESILIENT}
	[/modifications]
	[/unit]

	[unit]
	type=Troll Whelp
	description=Troll Guard
	user_description= _ "Troll Guard"
	x=6
	y=11
	side=2
	ai_special=guardian
	[modifications]
		{TRAIT_LOYAL}
		{TRAIT_RESILIENT}
	[/modifications]
	[/unit]

	[unit]
	type=Troll Whelp
	description=Troll Guard
	user_description= _ "Troll Guard"
	x=14
	y=9
	side=2
	ai_special=guardian
	[modifications]
		{TRAIT_LOYAL}
		{TRAIT_RESILIENT}
	[/modifications]
	[/unit]

	[unit]
	type=Troll Whelp
	description=Troll Guard
	user_description= _ "Troll Guard"
	x=14
	y=11
	side=2
	ai_special=guardian
	[modifications]
		{TRAIT_LOYAL}
		{TRAIT_RESILIENT}
	[/modifications]
	[/unit]

[/event]

# starting dialogue
[event]
name=start

[message]
	speaker=narrator
	message= _ "It is clear that this chamber used to be quite ornately decorated, but almost all of it has been destroyed, revealing a stone and dirt floor. What remains is a large stone throne, which has been covered with skulls and animal skins and bright paint. The walls were once covered with frescoes and dwarven runes, but several trolls are busy chipping them off. The floor was once tiled in dark slate, but only two small patches of tiles remain around the two chairs in this chamber. You're surprised to see that small tile path running up the center of the chamber has been left untouched. It leads to a small stone chair facing the large throne."
[/message]

[message]
	description=Great Leader Darmog
	message= _ "I, Great Leader Darmog, greet you, Kaleh."
[/message]

[message]
	description=Kaleh
	message= _ "I Kaleh, leader of the Quenoth Elves, thank you for meeting with me."
[/message]

[message]
	description=Great Leader Darmog
	message= _ "On behalf of all trolls, Darmog thank you for great victory over the dwarves. You have helped drive back the nasty dwarves and given us time to strengthen our defenses. Us trolls not always enemies of dwarves. Until recently we not have much contact with small people. But dwarves invade our tunnels, defile our holy places and kill our women and young. Dwarf not care about anything except gold and pretty gems. The shamans say that the spirits of our kin cry out for vengeance and Darmog will not rest until every dwarf is dead!"
[/message]

[message]
	description=Spiritual Advisor
	message= _ "But I am curious, we do not know of your kind. We thank you for your help, but who are you and why do you come down here with so many of your people?"
[/message]

[message]
	description=Kaleh
	message= _ "It's a long story, but we come from the south, where we lived above ground in the desert. Our village was destroyed, and I am leading my people on a journey to find a new home. Our god Eloh appeared to me in a vision, and told me to go north, but when we came to the mountains she said I should go under them instead of trying to cross the snowy peaks. We do not want to live down here, we are just trying to find a way to the other side of the mountains. "
[/message]

[message]
	description=Great Leader Darmog
	message= _ "Darmog has never been aboveground, but Darmog understand your story. A leader must protect and care for his people. Every people deserve to find their own home. If we can help you we will."
[/message]

[message]
	description=Spiritual Advisor
	message= _ "We may be able to help you find a way back to the sunlit lands. In our temples we do keep records of the past. We have not walked above the earth for many many generations, not since the darkness drove us underground. But we are masters of the underground lands, and we have explored many tunnels. Recently one of our scouts found a path that leads north back to the sunlit lands, I think it may be the way you are trying to go. In reward for your achievements, we will help you. $troll_name has volunteered to protect you and lead you back to the sunlight lands."
[/message]

[if]
	[variable]
		name=saw_troll_prisoner
		numerical_equals=1
	[/variable]

	[then]

	[message]
		description=Grog
		message= _ "You saved Grog's life. Grog still owe you a debt of thanks. In return Grog will protect little elves and show them the way back to lighted lands. "
	[/message]

	[message]
		description=Nog
		message= _ "You rescued Nog's brother, and he died like a warrior in battle, not like a coward in chains. Nog is very grateful. You proved yourselves to be brave strong warriors, and Nog will help you find way back to lighted lands."
	[/message]

	[/then]

	[else]

	[message]
		description=$troll_name
		message= _ "You did trolls big service. $troll_name like to wander in tunnels, and chief say that he knows the upper tunnels the best. $troll_name want to help elves so even though he not want to leave battle, he agrees to show elves way back to lighted lands."
	[/message]

	[/else]
[/if]

[message]
	description=Kaleh
	message= _ "Thank you very much for your help. We were worried about getting lost in all these twisting tunnels. And we would be honored to have you come with us, $troll_name"
[/message]

[if]
	[have_unit]
		x,y=12-14,12-14
	[/have_unit]

	[then]

	[message]
		description=Great Leader Darmog
		message= _ "The trolls who fought with you also want to thank you. They tell great tales of your valor."
	[/message]

	[message]
		x,y=12-14,12-14
		message= _ "We thank you for all you have done for trolls. You are bravest small people we know. We will tell stories of your battles to all our families so that none will forget. We wish we could come with you and fight more, but Great Leader need us to protect this city. Many dwarves still left, much fighting still to do. Griknagh will protect us, may he watch over you too."
	[/message]

	[message]
		description=Kaleh
		message= _ "I understand. Thank you, you were a huge help to us. It was an honor to fight by your side."
	[/message]

	[/then]
[/if]

[if]
	[have_unit]
		description=Elyssa
	[/have_unit]

	[then]

	[message]
		description=Elyssa
		message= _ "I'm afraid, Kaleh, that the time has come for our paths to separate."
	[/message]

	[message]
		description=Kaleh
		message= _ "What?!"
	[/message]

	[message]
		description=Elyssa
		message= _ "I have learned a lot about the trolls in my time here, and yet there's so much more to learn. Their magic is amazing. Have you seen their shamans? They make fire with their bare hands. They are very interested in my magic and they have offered to teach me how they create fire. I thought I was one of the last people still practicing magic, who knew I would find trolls still teaching it deep under the earth? There is just so much that I can learn from them, I can't leave now."
	[/message]

	[message]
		description=Nym
		message= _ "But we need you! What would we do without you?"
	[/message]

	[message]
		description=Elyssa
		message= _ "With the help of the trolls, I think you will do just fine. I don't know what home your god has planned for you, Kaleh, but I believe in you, and I know that you will find a place for your people. My place is here, with the trolls. And you don't really need me, you have each other."
	[/message]

	[message]
		description=Kaleh
		message= _ "If your mind is set, then I won't try to convince you. But we will miss you."
	[/message]

	[message]
		description=Zhul
		message= _ "I thank Eloh for the brief time that she has let you spend with us."
	[/message]

	[message]
		description=Nym
		message= _ "You take care of yourself, and someday maybe we'll meet again."
	[/message]

	[message]
		description=Elyssa
		message= _ "Thank you. And I owe you so much for helping me discover the trolls. I never would have come down here myself. I found this sword when we were fighting the dwarves and with some help from the trolls I have enchanted this fire blade for you. May its flames always light your path, and strike down your enemies. I give this to all of you as a token of my gratitude."
	[/message]

	{PLACE_IMAGE items/flame-sword.png 10 10}

	[message]
		description=Kaleh
		message= _ "A flaming sword. That's amazing. I just don't know who should use it. "
	[/message]

	[message]
		description=Elyssa
		message= _ "I will let you decide; use it in the best way that you see fit."
	[/message]

	[message]
		speaker=narrator
		message= _ "You can choose which unit you want to take the flaming sword. If you want another unit to wield the sword, Kaleh can recruit or recall other units."
	[/message]

	[/then]

	[else]

	[message]
		description=Great Leader Darmog
		message= _ "And now Darmog think you should be off as soon as possible. The dwarves are sneaky, they retreat today but may attack again tomorrow. The sooner you leave the safer you will be."
	[/message]

	[message]
		description=Nym
		message= _ "I heartily agree, I for one can't wait to feel the sun upon my face again and the wind in my hair."
	[/message]

	[endlevel]
	result=continue
	[/endlevel]

	[/else]
[/if]

[/event]

[event]
name=moveto
first_time_only=no

	[filter]
	x=10
	y=10
	[not]
		description=Elyssa
	[/not]
	side=1
	[/filter]


	[message]
	speaker=unit

	message= _ "Should I take this sword?"
	[option]
		message= _ "Yes, I'll take it."

		[command]

			[object]

			[filter]
			x=10
			y=10
			side=1
			[/filter]

			id=FlamingSword
			image=items/flame-sword.png
			name= _ "Flaming Sword"
			description= _ "This sword will make all your melee attacks do fire damage."

			[effect]
			apply_to=attack
			range=melee
			set_type=fire
			[/effect]

			[/object]
		[/command]

		[command]

			[message]
			speaker=unit
			message= _ "I will wield this blade proudly, and whenever I look upon it I shall remember you, Elyssa."
			[/message]
		[/command]

		[command]
			[message]
			description=Great Leader Darmog
		message= _ "And now Darmog think you should be off as soon as possible. The dwarves are sneaky, they retreat today but may attack again tomorrow. The sooner you leave the safer you will be."
			[/message]
		[/command]

		[command]
			[message]
			description=Nym
			message= _ "This is a marvelous city, but I for one can't wait to feel the sun upon my face again and the wind in my hair."
			[/message]
		[/command]

		[command]
			[endlevel]
			result=continue
			[/endlevel]
		[/command]

	[/option]

	[option]
	message= _ "No, I think someone else should wield it."
	[/option]

	[/message]

[/event]

{@campaigns/Under_the_Burning_Suns/utils/global-events.cfg}
[/scenario]
