#textdomain wesnoth-sof
#define RECRUIT E N H
#ifdef EASY
recruit={E}
#endif
#ifdef NORMAL
recruit={N}
#endif
#ifdef HARD
recruit={H}
#endif
#enddef

#define MOVE_UNIT_FAKE X1 Y1 XM YM X2 Y2
[store_unit]
	[filter]
	x,y={X1},{Y1}
	[/filter]
variable=temp
kill=yes
[/store_unit]
[move_unit_fake]
x={X1},{XM},{X2}
y={Y1},{YM},{Y2}
type=$temp.type
[/move_unit_fake]
[set_variable]
name=temp.x
value={X2}
[/set_variable]
[set_variable]
name=temp.y
value={Y2}
[/set_variable]
[unstore_unit]
variable=temp
[/unstore_unit]
[clear_variable]
name=temp
[/clear_variable]
[redraw]
[/redraw]
#enddef

#define SOF_DEATHS
	[event]
	name=die
		[filter]
		description=Rugnur
		[/filter]
		[message]
		description=Rugnur
		message= _ "Gahahh..."
		[/message]
		[endlevel]
		result=defeat
		[/endlevel]
	[/event]
	[event]
	name=die
		[filter]
		description=Haldric II
		[/filter]
		[message]
		description=Haldric II
		message= _ "Maghah..."
		[/message]
		[endlevel]
		result=defeat
		[/endlevel]
	[/event]
	[event]
	name=die
		[filter]
		description=Alanin
		[/filter]
		[message]
		description=Alanin
		message= _ "Ahhgg..."
		[/message]
		[endlevel]
		result=defeat
		[/endlevel]
	[/event]
	[event]
	name=die
		[filter]
		description=Baglur
		[/filter]
		[message]
		description=Alanin
		message= _ "Gaanngh..."
		[/message]
	[/event]
	[event]
	name=die
		[filter]
		description=Krawg
		[/filter]
		[message]
		description=Krawg
		message= _ "Kraa..."
		[/message]
		[endlevel]
		result=defeat
		[/endlevel]
	[/event]
	[event]
	name=die
		[filter]
		description=Thursagan
		[/filter]
		[message]
		description=Thursagan
		message= _ "Ayahahh..."
		[/message]
		[endlevel]
		result=defeat
		[/endlevel]
	[/event]
#enddef

#define FORMAT VARIABLE TEMP_VARIABLE ELEMENT
[set_variable]
name={VARIABLE}_{TEMP_VARIABLE}_{ELEMENT}
to_variable={VARIABLE}[${TEMP_VARIABLE}].{ELEMENT}
[/set_variable]
#enddef

#define FOREACH_FORMAT VARIABLE TEMP_VARIABLE
{FOREACH {VARIABLE} {TEMP_VARIABLE}}
	{FORMAT {VARIABLE} {TEMP_VARIABLE} x}
	{FORMAT {VARIABLE} {TEMP_VARIABLE} y}
#enddef

#define ROLEMACRO X
[role]
role=temp{X}
type=Dwarvish Lord,Dwarvish Dragonguard,Dwarvish Runemaster_alt,Dwarvish Sentinel,Dwarvish Steelclad,Dwarvish Thunderguard,Dwarvish Runesmith,Dwarvish Stalwart,Gryphon Master,Gryphon Rider,Dwarvish Thunderer,Dwarvish Guardsman,Dwarvish Fighter
[/role]
[store_unit]
	[filter]
	role=temp{X}
	[/filter]
variable=temp{X}
kill=yes
[/store_unit]
#enddef

#define HEROMACRO X
[store_unit]
	[filter]
	description={X}
	[/filter]
variable=temp{X}
kill=yes
[/store_unit]
#enddef

#define RECALLMACRO X
[unstore_unit]
variable=temp{X}
[/unstore_unit]
[recall]
role=temp{X}
[/recall]
[recall]
description={X}
[/recall]
[clear_variable]
name=temp{X}
[/clear_variable]
#enddef



###################
#FOLLOWING MACROS BORROWED
#FROM "FLIGHT TO FREEDOM"
#BY MADMAX
###################
#to be used like this:
# {RANDOM_TRAIT_UNIT (
# type=Elvish Champion
# x=20
# y=14
# )}

#define RANDOM_TRAIT_UNIT STATS
[unit]
	{STATS}
	random_traits=yes
[/unit]
#enddef

###################
#/FOLLOWING MACROS BORROWED
#/FROM "FLIGHT TO FREEDOM"
#/BY MADMAX
###################
