[scenario]
#textdomain wesnoth-httt
id=18_Scepter_of_Fire
name= _ "The Scepter of Fire"
next_scenario=19_A_Choice_Must_Be_Made
scenario_generation=cave

		#
		# If you think this is laying it on a bit thick, I'm open to suggestions
		# for better wording or something less melodramatic.
		#
		[story]
			[part]
			story= _ "Across the chasm, the air almost crackled with magical energy. It also became steadily warmer. The floor was smooth and glassy in places, and a faint glow provided a small reprieve from the thick blackness. Volcanic fumes drifted up from cracks in the floor."
			#background="maps/wesnoth-httt.jpg"
			show_title=no
			[/part]
			[part]
			story= _ "Distant rumbles and earthquakes made it difficult to keep steady footing. The very earth had come alive, heaving, and ready to be relieved of its century-old burden..."
			#background="maps/wesnoth-httt.jpg"
			show_title=no
			[/part]
		[/story]
		{BIGMAP_SCEPTER_OF_FIRE}

#
# Map generator code
#

[generator]

	[settings]
		name= _ "The Scepter of Fire"
		map_data="{campaigns/Heir_To_The_Throne/maps/Sceptre}"
		{DEFAULT_MUSIC_PLAYLIST}
		{TURNS 50 45 35}
		victory_when_enemies_defeated=no
		next_scenario=19_A_Choice_Must_Be_Made

		#
		# This is a custom schedule that gives everything a slight reddish hue
		# and gently pulsates.  -30, -40, -40 are default values that look good
		#
		{UNDERGROUND_VOLCANO -27 -37 -37}
		{UNDERGROUND_VOLCANO -28 -38 -38}
		{UNDERGROUND_VOLCANO -32 -42 -42}
		{UNDERGROUND_VOLCANO -36 -46 -46}
		{UNDERGROUND_VOLCANO -37 -47 -47}
		{UNDERGROUND_VOLCANO -36 -46 -46}
		{UNDERGROUND_VOLCANO -32 -42 -42}
		{UNDERGROUND_VOLCANO -28 -38 -38}

		[event]
		name=prestart
			[objectives]
			side=1
				[objective]
					description= _ "Capture the Scepter of Fire with Konrad or Li'sar"
					condition=win
				[/objective]
				[objective]
					description= _ "Death of Konrad"
					condition=lose
				[/objective]
				[objective]
					description= _ "Death of Delfador"
					condition=lose
				[/objective]
				[objective]
					description= _ "Death of Li'sar"
					condition=lose
				[/objective]
				[objective]
					description= _ "Death of Kalenz"
					condition=lose
				[/objective]
			[/objectives]

			{SOF_TERRAIN_MASK}
			#
			# Initialize the lava growing effect
			#
			{VARIABLE lava_count 1}
			{VARIABLE lava_x 25}
			{VARIABLE lava_y 35}
			[terrain]
			x=$lava_x
			y=$lava_y
			letter=l
			[/terrain]

			#
			# Except on hard, you only have to face 3 enemies instead of 4
			# This part randomly kills one of the 4 leaders
			#
#ifdef HARD
#else
			{VARIABLE_OP side_kill random 4..7}
			{ERASE_CASTLE $side_kill u}
			[kill]
			side=$side_kill
			[/kill]
#endif
			{VARIABLE_OP side_kill random 2..3}
			{ERASE_CASTLE $side_kill u}
			[kill]
			side=$side_kill
			[/kill]
			{CLEAR_VARIABLE side_kill}
		[/event]

		[event]
		name=start
			[recall]
			description=Delfador
			[/recall]
			[recall]
			description=Kalenz
			[/recall]
			[recall]
			description=Li'sar
			[/recall]
			[message]
			description=Konrad
			message= _ "The Scepter must be getting close now! Where shall we go?"
			[/message]
			[message]
			description=Kalenz
			message= _ "We cannot explore this much area by ourselves, especially if we are beset by the denizens of these caves. We must ask our dwarven allies to help search the caves with us."
			[/message]
			[message]
			description=Delfador
			message= _ "Yes, I feel it is near here! We must search for it carefully."
			[/message]
			{TREMOR}
			{TREMOR}
			[message]
			description=Li'sar
			message= _ "An earthquake! We'll be trapped!"
			[/message]
			[message]
			description=Kalenz
			message= _ "No, not an earthquake princess. I feel it too. Something is... aware... of us."
			[/message]
			[message]
			description=Li'sar
			message= _ "Aware? Who? Delfador, what does he mean?"
			[/message]
			[message]
			description=Delfador
			message= _ "The Scepter... the earth... the molten lava... the fire... the air around us... everything. It calls out to the heir - I can barely hold it back in my mind. It was forged here, not far north of where we now stand. The sheer power of it!"
			[/message]
			{TREMOR}
			[message]
			description=Konrad
			message= _ "Where? Where is it?"
			[/message]
			[message]
			description=Delfador
			message= _ "North. More than that, I cannot tell."
			[/message]
			[message]
			description=Li'sar
			message= _ "Konrad, as promised, here is my purse, full of gold."
			[/message]
			[sound]
			name=gold.ogg
			[/sound]
			[message]
			speaker=narrator
			image="wesnoth-icon.png"
			message= _ "You receive 300 pieces of gold!"
			[/message]
			[gold]
			side=1
			amount=300
			[/gold]

#
# Future capability, once I figure out how to access the scepter's random location
# and if this still sounds like a good idea.
#
#			[message]
#			description=Delfador
#			message= _ "I think... I think if I were to concentrate a bit I could tell you where it is."
#			[/message]
#			[message]
#			speaker=narrator
#			image="wesnoth-icon.png"
#			message= _ "If Delfador rests, he can concentrate on the location of the Scepter of Fire."
#			[/message]
		[/event]

		#
		# Some volcanic ambiance
		#
		[event]
		name=moveto
		first_time_only=no
			[allow_undo]
			[/allow_undo]
			[filter]
			side=1,4,5
			[/filter]
			{VARIABLE_OP rumble_test random 1..35}
			[if]
				[variable]
				name=rumble_test
				numerical_equals=1
				[/variable]
				[then]
					{TREMOR}
					{VARIABLE_OP lava_count add 1}
					[store_locations]
					variable=lava_flow_hexes
					x=$lava_x
					y=$lava_y
					terrain=W
					radius=$lava_count
					[/store_locations]
					{FOREACH lava_flow_hexes i}
						{VARIABLE_OP temp_x to_variable lava_flow_hexes[$i].x}
						{VARIABLE_OP temp_y to_variable lava_flow_hexes[$i].y}
						[terrain]
						x=$temp_x
						y=$temp_y
						letter=l
						[/terrain]
					{NEXT i}
					#
					# Reset the counter if it gets too large (it slows things down)
					#
					[if]
						[variable]
						name=lava_count
						numerical_equals=3
						[/variable]
						[then]
							{VARIABLE lava_count 0}
							{VARIABLE_OP lava_x random (10..40)}
							{VARIABLE_OP lava_y random (15..45)}
						[/then]
					[/if]
				[/then]
			[/if]
			{CLEAR_VARIABLE rumble_test}
		[/event]

		{campaigns/Heir_To_The_Throne/utils/deaths.cfg}

	[/settings]

	map_width=50
	map_height=70
	flipx_chance=50
	village_density=20

	#
	# The chamber with the player. Somewhere in the far south
	#
	[chamber]
	id=player
	x=15-35
	y=68
	size=8
	jagged=50
		[items]
			[side]
			type=Commander
			description=Konrad
			user_description= _ "Konrad"
			unrenamable=yes
			side=1
			canrecruit=1
			controller=human
			shroud=yes
			[/side]
		[/items]
	[/chamber]

	#
	# The antechambers
	#
	[chamber]
	id=antechamber_1
	x=10-25
	y=50-60
	size=7
	jagged=5
		{PASSAGE_NORMAL player 2 10 10}
		[items]
			[side]
			type=Goblin Rouser
			side=2
			canrecruit=1
			controller=ai
			recruit=Goblin Spearman
			team_name=orcs
			gold=70
				[ai]
				aggression=1.0
				village_value=0.0
				leader_value=50.0
				villages_per_scout=0.0
				[/ai]
			[/side]
		[/items]
	[/chamber]
	[chamber]
	id=antechamber_2
	x=25-40
	y=50-60
	size=7
	jagged=2
		{PASSAGE_NORMAL player 2 3 1}
		{PASSAGE_CHANCE 40 antechamber_1 1 9 9}
		[items]
			[side]
			type=Goblin Rouser
			side=3
			canrecruit=1
			controller=ai
			recruit=Goblin Spearman
			team_name=orcs
			gold=70
				[ai]
				aggression=1.0
				village_value=0.0
				leader_value=50.0
				villages_per_scout=0.0
				[/ai]
			[/side]
		[/items]
	[/chamber]

	#
	# The central volcano
	#
	[chamber]
	id=center
	x=25-26
	y=35-36
	size=2
	jagged=1
		{PASSAGE_NORMAL antechamber_1 1 20 3}
		{PASSAGE_NORMAL antechamber_2 1 20 3}
	[/chamber]

	#
	# The 5 minichambers encircling the central volcano and a 6th chamber to serve as the exit
	#
	[chamber]
	id=mini_1
	x=10-16
	y=36-40
	size=5
	jagged=2
		{PASSAGE_NORMAL center 1 5 2}
		{PASSAGE_NORMAL antechamber_1 2 5 2}
	[/chamber]
	[chamber]
	id=mini_2
	x=8-20
	y=17-26
	size=5
	jagged=3
		{PASSAGE_NORMAL center 1 5 2}
		{PASSAGE_NORMAL mini_1 1 5 2}
	[/chamber]
	[chamber]
	id=mini_3
	x=1-50
	y=14-30
	size=3
	jagged=4
		{PASSAGE_NORMAL center 1 5 2}
		{PASSAGE_NORMAL mini_2 2 5 2}
		[items]
			#
			# These macros handle the placement and attainment of the scepter,
			# including ending the level in victory.
			# I moved them to the utils file to make the chamber WML more readable
			#
			# The scepter will always be in mini chamber 3, but the location of this
			# particular chamber is highly variable
			#
			{PLACE_SCEPTER}
			{KONRAD_GETS_SCEPTER}
			{LISAR_GETS_SCEPTER}
		[/items]
	[/chamber]
	[chamber]
	id=mini_4
	x=30-42
	y=17-26
	size=5
	jagged=5
		{PASSAGE_NORMAL center 1 5 2}
		{PASSAGE_NORMAL mini_3 2 5 2}
	[/chamber]
	[chamber]
	id=mini_5
	x=34-40
	y=36-40
	size=5
	jagged=5
		{PASSAGE_NORMAL mini_4 2 5 2}
		{PASSAGE_NORMAL center 1 5 2}
		{PASSAGE_NORMAL antechamber_2 2 5 2}
	[/chamber]
	[chamber]
	id=exit
	x=25
	y=1
	size=2
	jagged=1
		{PASSAGE_NORMAL mini_2 1 5 2}
		{PASSAGE_NORMAL mini_3 1 5 2}
		{PASSAGE_NORMAL mini_4 1 5 2}
	[/chamber]

	#
	# There are 4 chambers for enemies randomly scattered on the map
	#
	[chamber]
	id=enemy_1
	x=1-10
	y=45-55
	size=5
	jagged=3
		{PASSAGE_NORMAL mini_1 2 5 2}
		{PASSAGE_CHANCE 60 mini_2 1 5 2}
		{PASSAGE_CHANCE 40 antechamber_2 1 5 2}
		[items]
			[side]
			type=Orcish Warlord
			facing=reverse
			side=4
			canrecruit=1
			controller=ai
				[ai]
				leader_value=10
				{ATTACK_DEPTH 5 5 6}
				[/ai]
			recruit=Wolf Rider,Orcish Grunt,Orcish Archer
			team_name=orcs

			{GOLD 30 40 50}
			{INCOME 2 4 6}
			[/side]
		[/items]
	[/chamber]
	[chamber]
	id=enemy_2
	x=1-10
	y=1-35
	size=5
	jagged=3
		{PASSAGE_NORMAL mini_2 2 5 2}
		{PASSAGE_NORMAL enemy_1 2 5 5}
		{PASSAGE_CHANCE 60 mini_1 1 5 2}
		{PASSAGE_CHANCE 40 mini_3 1 5 2}
		[items]
			[side]
			type=Troll Warrior
			side=5
			canrecruit=1
			controller=ai
				[ai]
				{ATTACK_DEPTH 5 5 6}
				leader_value=10
				recruitment_pattern=fighter
				[/ai]
#ifdef EASY
			recruit=Troll Whelp,Ogre
#else
			recruit=Troll Whelp,Troll,Troll Warrior,Ogre
#endif
			team_name=orcs
			{GOLD 30 40 50}
			{INCOME 2 4 6}
			[/side]
		[/items]
	[/chamber]
	[chamber]
	id=enemy_3
	x=40-50
	y=1-35
	size=5
	jagged=3
		{PASSAGE_NORMAL mini_4 2 5 2}
		{PASSAGE_CHANCE 60 mini_5 1 5 2}
		{PASSAGE_CHANCE 40 mini_3 1 5 2}
		[items]
			[side]
			type=Orcish Warlord
			side=6
			canrecruit=1
			controller=ai
				[ai]
				{ATTACK_DEPTH 5 5 6}
				leader_value=10
				recruitment_pattern=fighter,fighter,scout
				[/ai]
#ifdef EASY
			recruit=Ogre,Goblin Knight,Wolf Rider,Troll Whelp
#else
			recruit=Troll,Ogre,Goblin Knight,Wolf Rider,Troll Whelp,Saurian Skirmisher
#endif
			team_name=orcs

			{GOLD 10 20 30}
			{INCOME 2 4 6}
			[/side]
		[/items]
	[/chamber]
	[chamber]
	id=enemy_4
	x=40-50
	y=45-55
	size=5
	jagged=3
		{PASSAGE_NORMAL mini_5 2 5 2}
		{PASSAGE_NORMAL enemy_3 2 5 5}
		{PASSAGE_CHANCE 60 mini_4 1 5 2}
		{PASSAGE_CHANCE 40 antechamber_2 1 5 2}
		[items]
			[side]
			type=Orcish Warlord
			side=7
			canrecruit=1
			controller=ai
				[ai]
				{ATTACK_DEPTH 5 5 6}
				leader_value=10
				recruitment_pattern=fighter,fighter,scout
				[/ai]
#ifdef EASY
			recruit=Wolf Rider,Goblin Impaler
#else
			recruit=Goblin Knight,Wolf Rider,Goblin Spearman,Goblin Impaler,Saurian Skirmisher
#endif
			team_name=orcs
			{GOLD 20 30 40}
			{INCOME 2 4 6}
			[/side]
		[/items]
	[/chamber]

[/generator]
[/scenario]
