#textdomain wesnoth-l

#define SET_VILLAGE X Y SIDE
    [capture_village]
        x={X}
        y={Y}
        side={SIDE}
    [/capture_village]
#enddef

#
# This one changes a unit from one type to another
#

#define CHG_TYPE FILTER VALUE ALIGN
    [store_unit]
        [filter]
            {FILTER}
        [/filter]

        variable=chgtype_store
        kill=yes
    [/store_unit]

    {FOREACH chgtype_store i}
        [set_variable]
            name=chgtype_store[$i].type
            value={VALUE}
        [/set_variable]
        [set_variable]
            name=chgtype_store[$i].alignment
            value={ALIGN}
        [/set_variable]

        [unstore_unit]
            variable=chgtype_store[$i]
        [/unstore_unit]
    {NEXT i}

    {CLEAR_VARIABLE chgtype_store}
#enddef

#define OBJ_HOLY_ANKH X Y ID
    [event]
        name=moveto
        first_time_only=no
        [filter]
            x={X}
            y={Y}
            side=1
        [/filter]
        [object]
            id={ID}
            name= _ "Holy Ankh"
            image=items/ankh-necklace.png
            duration=level
            description= _ "You find a hefty pendant on a strange and ominous looking altar. It glows brightly when you pick it up!"
            cannot_use_message= _ "There is a strange altar here and a pendant on it. I don’t want to touch it."
            [filter]
                side=1
                x,y={X},{Y}
            [/filter]
            [then]
                [remove_item]
                    x,y={X},{Y}
                [/remove_item]
            [/then]
            [effect]
                apply_to=new_attack
                name=ankh
                description= _ "holy ankh"
                icon=attacks/lightbeam.png
                type=arcane
                range=ranged
                [specials]
                    {WEAPON_SPECIAL_MAGICAL}
                [/specials]
                damage=24
                number=1
            [/effect]

            [effect]
                apply_to=new_animation
                [attack_anim]
                    [filter_attack]
                        name=ankh
                    [/filter_attack]

                    {MISSILE_FRAME_LIGHT_BEAM}

                    [if]
                        hits=no
                        [frame]
                            begin=-200
                            end=0
                            sound={SOUND_LIST:HOLY_MISS}
                        [/frame]
                    [/if]
                    [else]
                        hits=yes
                        [frame]
                            begin=-200
                            end=0
                            sound={SOUND_LIST:HOLY}
                        [/frame]
                    [/else]
                [/attack_anim]
            [/effect]
        [/object]
    [/event]
#enddef

#define LIBERTY_DEATHS
    [event]
        name=last breath
        [filter]
            id=Baldras
        [/filter]
        [message]
            speaker=Baldras
            message= _ "Tell my wife... that I loved her!"
        [/message]
        [endlevel]
            result=defeat
        [/endlevel]
    [/event]

    [event]
        name=last breath
        [filter]
            id=Harper
        [/filter]
        [message]
            speaker=Harper
            #wmllint: local spelling Unngh
            message= _ "Unngh... Now our people may never be free..."
        [/message]
        [endlevel]
            result=defeat
        [/endlevel]
    [/event]

    [event]
        name=last breath
        [filter]
            id=Relana
        [/filter]
        [message]
            speaker=Relana
            message= _ "I am finished... will we ever be free?"
        [/message]
        [endlevel]
            result=defeat
        [/endlevel]
    [/event]

    [event]
        name=last breath
        [filter]
            id=Lord Maddock
        [/filter]
        [message]
            speaker=Lord Maddock
            message= _ "How can this be? We have lost."
        [/message]
        [endlevel]
            result=defeat
        [/endlevel]
    [/event]
#enddef

#define VILLAGE_BURNED
    # Generic "you lose" flavor event if there's no better specific one.
    [event]
        name=defeat

        [message]
            speaker=narrator
            image=wesnoth-icon.png
            message=_ "They returned to their village to find it destroyed, with those who fought left dead and the few survivors born away to unguessable fates. It was a bitter doom, but as Asheviere’s grip tightened they would live to see worse."
        [/message]
    [/event]
#enddef
