#textdomain wesnoth-dm

#define MEMOIRS_GENERATOR_SKELETON X Y TURN
    # set the generator's terrain
    [event]
        name=prestart
        [terrain]
            x={X}
            y={Y}
            terrain=Gs^Imb
        [/terrain]
    [/event]
    [event]
        name=turn {TURN}
        [terrain]
            x={X}
            y={Y}
            terrain=Gs^Ima
        [/terrain]
    [/event]
#enddef

#define MEMOIRS_GENERATOR
    # generate a unit each turn
    [event]
        name=new turn
        first_time_only=no

        [store_locations]
            terrain=*^Imb
            variable=monoliths
        [/store_locations]

        {FOREACH monoliths one}
            [scroll_to]
                x=$monoliths[$one].x
                y=$monoliths[$one].y
            [/scroll_to]
            [sound]
                name=heal.wav
            [/sound]
            {RANDOM (Skeleton,Skeleton Archer)}
            [unit]
                type=$random
                side=2
                x=$monoliths[$one].x
                y=$monoliths[$one].y
                animate=yes
            [/unit]
        {NEXT one}
    [/event]

    # if someone capable of destroying the generator moves there
    [event]
        name=moveto
        first_time_only=no
        [filter]
            side=1
            type=Mage of Light,White Mage,Great Mage,Arch Mage,Red Mage,Mage,Elder Mage,Paladin,Silver Mage,Journeyman Mage,Mage Leader,Mage Commander,Mage Magister
            [filter_location]
                terrain=Gs^Imb
            [/filter_location]
        [/filter]
        [message]
            speaker=unit
            message=_"I call upon all that is holy to break the power of this evil stone!"
        [/message]
        [sound]
            name=lightning.ogg
        [/sound]
        [colour_adjust]
            red=100
            green=100
            blue=100
        [/colour_adjust]
        [delay]
            time=10
        [/delay]
        [colour_adjust]
            red=0
            green=0
            blue=0
        [/colour_adjust]
        [terrain]
            x=$unit.x
            y=$unit.y
            terrain=Gg^Ima
        [/terrain]
    [/event]

    # if someone who can't destroy the generator moves there
    [event]
        name=moveto
        first_time_only=no
        [filter]
            side=1
            [not]
                type=Mage of Light,White Mage,Great Mage,Arch Mage,Red Mage,Mage,Elder Mage,Paladin,Silver Mage,Journeyman Mage,Mage Leader,Mage Commander,Mage Magister
            [/not]
            [filter_location]
                terrain=Gs^Imb
            [/filter_location]
        [/filter]

        [message]
            speaker=unit
            message=_"Evil emanates from this stone, but I have not the power to destroy it."
        [/message]
    [/event]
#enddef
