#textdomain wesnoth-httt

################################
#
# HTTT MACROS FOLLOW
#
################################

#
# HTTT-specific artifacts
#

#define OBJ_SWORD_FIRE X Y ID
	{PLACE_IMAGE items/flame-sword.png ({X}) ({Y})}
	{VARIABLE sword_taken 0}
	[event]
	name=moveto
	first_time_only=no
		[filter]
		side=1
		x={X}
		y={Y}
		[/filter]
		[if]
		[variable]
		name=sword_taken
		numerical_equals=0
		[/variable]
		[then]
			[message]
			speaker=narrator
			image="wesnoth-icon.png"
				message= _ "Do you want this unit to pick up the sword?"
				[option]
				message= _ "Yes"
					[command]
						[object]
						id={ID}
						name= _ "Flaming Sword"
						image=attacks/sword-flaming.png
						duration=forever
						description= _ "This massive blade was created centuries ago by long-forgotten elvish forgemasters, who managed to imbue the bluish steel with an inner magical fire. Tongues of flame dance on the surface, giving the bluish steel a flawless mirrored finish."
						cannot_use_message= _ "Only the leader of an army can wield this sword!"
							[filter]
							type=Fighter,Commander,Lord,Princess,Battle Princess,Elvish Captain,Elvish Hero,Elvish Marshal,Elvish Champion,Paladin
							x,y={X},{Y}
							[/filter]
							[then]
								[removeitem]
								x,y={X},{Y}
								[/removeitem]
								[message]
								speaker=narrator
								image="wesnoth-icon.png"
								message= _ "As you place your hand around the glittering leather hilt, the sword roars to life! Strangely, you feel no heat once you pick it up, yet the grass at your feet bursts into flame as you test the heft of this mighty weapon."
								[/message]
								{VARIABLE sword_taken 1}
							[/then]
							[effect]
							apply_to=new_attack
							name= _ "flaming sword"
							icon=attacks/sword-flaming.png
							type=fire
							range=melee
							special=magical
							damage=15
							number=4
								[animation]
									[frame]
										begin=-200
										end=-100
									[/frame]
									[if]
										hits=no
										[frame]
											begin=-100
											end=100
											sound={SOUND_LIST:MISS}
										[/frame]
									[/if]
									[else]
										hits=yes
										[frame]
											begin=-100
											end=100
											sound=fire.wav
										[/frame]
									[/else]
									[frame]
										begin=100
										end=200
									[/frame]
								[/animation]
							[/effect]
						[/object]
					[/command]
				[/option]
				[option]
				message= _ "No"
				[/option]
			[/message]
		[/then]
		[/if]
	[/event]
#enddef

#define OBJ_VOID_ARMOR X Y ID
	{PLACE_IMAGE items/armor.png ({X}) ({Y})}
	{VARIABLE armor_taken 0}
	[event]
	name=moveto
	first_time_only=no
		[filter]
		side=1
		x,y={X},{Y}
		[/filter]

		[if]
		[variable]
		name=armor_taken
		numerical_equals=0
		[/variable]
		[then]
			[message]
			speaker=narrator
			image="wesnoth-icon.png"
				message= _ "Do you want this unit to pick up the armor?"
				[option]
				message= _ "Yes"
					[command]
						[object]
						id={ID}
						name= _ "Void Armor"
						image="icon_armor.png"
						description= _ "A beautiful chest plate crafted from shimmering black steel, the Void Armor is virtually impenetrable to physical weapons!"
						cannot_use_message= _ "Only a powerful warrior may don this armor!"
						duration=forever
							[filter]
							side=1
							x,y={X},{Y}
							type=Fighter,Commander,Lord,Princess,Battle Princess,Elvish Lord,Elvish High Lord,Elvish Fighter,Elvish Captain,Elvish Hero,Elvish Marshal,Elvish Champion,Elvish Ranger,Elvish Avenger,Horseman,Knight,Lancer,Paladin,Grand Knight,Dwarvish Fighter,Dwarvish Steelclad,Dwarvish Lord,Dwarvish Guardsman,Dwarvish Stalwart,Dwarvish Sentinel
							[/filter]
							[then]
								[removeitem]
								x,y={X},{Y}
								[/removeitem]
								[message]
								speaker=narrator
								image="wesnoth-icon.png"
								message= _ "You struggle to lift and don the heavy plate. Once worn, however, it is amazingly comfortable. You have increased resistance to all physical damage!"
								[/message]
								{VARIABLE armor_taken 1}
							[/then]
							#
							# Set physical resistance to 50/40/40
							#
							[effect]
							apply_to=resistance
								replace=true
								[resistance]
								blade=50
								pierce=60
								impact=60
								[/resistance]
							[/effect]
							#
							# Increase fire resistance by 10%
							#
							[effect]
							apply_to=resistance
								[resistance]
								fire=-10
								[/resistance]
							[/effect]
						[/object]
					[/command]
				[/option]
				[option]
				message= _ "No"
				[/option]
			[/message]
		[/then]
		[/if]
	[/event]
#enddef

#
# This macro isn't actually used in the scenario "The Scepter of Fire"
# because of the random location issue.  We're keeping it here for
# posterity for the time being.
#

#define OBJ_SCEPTER_FIRE X Y ID
	{PLACE_IMAGE items/sceptre-of-fire.png ({X}) ({Y})}
	[event]
	name=moveto
	first_time_only=no
		[filter]
		side=1
		x={X}
		y={Y}
		[/filter]
		[object]
		id={ID}
		name= _ "Scepter of Fire"
		image=items/sceptre-of-fire.png
		duration=forever
		description= _ "This ancient Scepter was forged by the Dwarves. A symbol of the kingship of Wesnoth, the Scepter has the power to shoot fireballs at enemies of the bearer!"
		cannot_use_message= _ "This is the Scepter of Fire. Only a true successor to the throne can possibly dare to take this!"
			[filter]
			type=Princess,Battle Princess,Commander,Lord
			x,y={X},{Y}
			[/filter]
			[then]
				[removeitem]
				x,y={X},{Y}
				[/removeitem]
			[/then]
			[effect]
			apply_to=variation
			name=scepter
			[/effect]
		[/object]
	[/event]
#enddef

################################
#
# SCEPTER OF FIRE MACROS FOLLOW
#
################################


#define SOF_TERRAIN_MASK

[terrain_mask]
	x,y=1,1
	mask="
~~~~~~r~~~~~~~~r~r~r~r~rr~[r~~r~~r~~[~~~~~~~~r~~r~
~r~~~~~~r~~~~~~~rr[~r~~~r~~~rr~~~~~~~r~~~~~~~~~~~~
~~r~r~r~~~~rrrr~~rrrr[~~~~~rr~~~~[~~r~~~r~rr~~~r~r
~~~r~~r~~r~rrrrr~~~~rr~r~r~r~~~~r~r~~~~~r~[~~~[~~[
~~r~rrr~rrrr~~rrr~~rr~~rrr~~~~~rr~r~~~~~~~~~~~[~~~
rrr~~r~~~~r~rrrr~r~~~r~~~~~r~~~~~~~~~~~r~~~~r~~~rr
~rr~~~r~r~r~~r~r~[rrrrrr[~rr~r~~~r~~rr~~~~~r~~~~r~
[r~rr~~r~~r~rr~~~~~~r~~~~[~r~~r[~~r~~rr~~~~~rr~~r~
rrr~rr~r~[~~~~~rr~~rr~rr~r[~~~[~rr~~~~~rr~rr~~r~~~
r~~~rr~~[~~r~~r~~~~~rrr~~~~[~rrr~rr~~~r~~~r~~~r~~[
r~[~~r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
	new=rp][
	terrain=o
	[/rule]
	[rule]		# Make sure cave walls are not converted
	old=W
	new=rp][
	terrain=W
	[/rule]
	[rule]		# Make sure the keep is not converted
	old=K
	new=rp][
	terrain=K
	[/rule]
	[rule]		# Convert cave villages to stone villages
	old=D
	new=~rp][
	terrain=p
	[/rule]
	[rule]		# Add stone villages
	old=u
	new=p
	terrain=p
	[/rule]
	[rule]		# Add roads
	old=u
	new=r
	terrain=r
	[/rule]
	[rule]		# Add hilly caves
	old=u
	new=[
	terrain=[
	[/rule]
	[rule]		# Add a mushroom forest
	old=u
	new=]
	terrain=]
	[/rule]
[/terrain_mask]

#enddef

#define PLACE_SCEPTER
			[item]
			image=items/sceptre-of-fire.png
			[/item]

			[event]
			same_location_as_previous=yes
			name=moveto
			first_time_only=no
				[filter]
				side=1
				x=22
				y=32
				[/filter]
				[object]
				id=object_scepter
				name= _ "Scepter of Fire"
				image=items/sceptre-of-fire.png
				duration=forever
				description= _ "This ancient Scepter was forged by the great Dwarves of the Deep Mountains. A symbol of the kingship of Wesnoth, the Scepter has the power to shoot fireballs at enemies of the bearer!"
				cannot_use_message= _ "This is the Scepter of Fire. Only a true successor to the throne can possibly dare to take this!"
					[filter]
					type=Princess,Battle Princess,Fighter,Commander,Lord
					[/filter]
					[effect]
					apply_to=variation
					name=scepter
					[/effect]
				[/object]
			[/event]
#enddef

#define KONRAD_GETS_SCEPTER
			[event]
			same_location_as_previous=yes
			name=moveto
				[filter]
				description=Konrad
				[/filter]
				[set_variable]
				name=scepter
				value="Konrad"
				[/set_variable]
				[message]
				description=Konrad
				message= _ "Here it is at last, I have the Scepter!"
				[/message]
				[message]
				description=Kalenz
				message= _ "So it is in our hands! Now let us leave this stinking pit."
				[/message]
				[message]
				description=Li'sar
				message= _ "I think that if we travel just a little north, we might be able to get out."
				[/message]
				[endlevel]
				result=victory
				[/endlevel]
			[/event]
#enddef

#define LISAR_GETS_SCEPTER
			[event]
			same_location_as_previous=yes
			name=moveto
				[filter]
				description=Li'sar
				[/filter]
				[set_variable]
				name=scepter
				value="Li'sar"
				[/set_variable]
				[message]
				description=Li'sar
				message= _ "At last! I have the Scepter!"
				[/message]
				[message]
				description=Konrad
				message= _ "Indeed. You managed to reach it Li'sar. I hope you shall use it wisely."
				[/message]
				[message]
				description=Li'sar
				message= _ "Well my first use for it is going to be to help us get out of this hole! I hope you consider that wise."
				[/message]
				[message]
				description=Delfador
				message= _ "The Scepter makes its wielder powerful, but hardly immortal, child. Use it prudently. Now come, I believe there is an exit to the north!"
				[/message]
				[message]
				description=Li'sar
				message= _ "I think I know what I'm doing. Come, let us go!"
				[/message]

				[endlevel]
				result=victory
				[/endlevel]
			[/event]
#enddef

#define PASSAGE_NORMAL DESTINATION WIDTH WINDINESS JAGGED
[passage]
destination={DESTINATION}
width={WIDTH}
windiness={WINDINESS}
jagged={JAGGED}
[/passage]
#enddef

#define PASSAGE_CHANCE CHANCE DESTINATION WIDTH WINDINESS JAGGED
[passage]
chance={CHANCE}
destination={DESTINATION}
width={WIDTH}
windiness={WINDINESS}
jagged={JAGGED}
[/passage]
#enddef

#define ERASE_CASTLE SIDE LETTER
[store_unit]
variable=side_store
	[filter]
	side={SIDE}
	canrecruit=1
	[/filter]
[/store_unit]
{VARIABLE min_x $side_store.x}
{VARIABLE_OP min_x add -1}
{VARIABLE min_y $side_store.y}
{VARIABLE_OP min_y add -1}
{VARIABLE max_x $side_store.x}
{VARIABLE_OP max_x add 1}
{VARIABLE max_y $side_store.y}
{VARIABLE_OP max_y add 1}
{VARIABLE_OP x_range format ("$min_x|-|$max_x")}
{VARIABLE_OP y_range format ("$min_y|-|$max_y")}
[terrain]
x=$x_range
y=$y_range
letter={LETTER}
[/terrain]
#enddef

#textdomain wesnoth
#define UNDERGROUND_VOLCANO R G B
#
# -30, -40, -40 are the default good values for an underground
# reddish hue
#
		[time]
		id=underground
		name= _ "Underground"
		image=misc/schedule-underground.png
		lawful_bonus=-25
		red={R}
		green={G}
		blue={B}
		[/time]
#enddef
