#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
        side=$temp.side
    [/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=Baglur
            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 DESCRIPTION
    [store_unit]
        [filter]
            description={DESCRIPTION}
        [/filter]
        variable=temp{DESCRIPTION}
        kill=yes
    [/store_unit]
#enddef

#define RECALLMACRO VALUE
    [unstore_unit]
        variable=temp{VALUE}
    [/unstore_unit]
    [recall]
        role=temp{VALUE}
    [/recall]
    [recall]
        description={VALUE}
    [/recall]
    [clear_variable]
        name=temp{VALUE}
    [/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_WML
    [unit]
        {STATS_WML}
        random_traits=yes
    [/unit]
#enddef

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