#textdomain wesnoth-dw
[unit_type]
    id=Merman Brawler
    name= _ "Merman Brawler"
    profile="portraits/brawler.png"
    race=merman
    image="units/merfolk/brawler.png"
    {MAGENTA_IS_THE_TEAM_COLOR}
    hitpoints=38
    movement_type=swimmer
    movement=6
    level=1
    experience=50
    {AMLA_DEFAULT}
    alignment=lawful
    cost=19
    usage=fighter
    description= _ "Exceptionally large and strong mermen are sometimes more comfortable with their own fists and tails than with other weapons."+{SPECIAL_NOTES}+{SPECIAL_NOTES_STUN}
    die_sound=mermen-die.ogg
    {DEFENSE_ANIM "units/merfolk/brawler-defend.png" "units/merfolk/brawler-defend.png" mermen-hit.wav }
    [portrait]
        size=400
        side="left"
        mirror="false"
        image="portraits/transparent/brawler.png"
    [/portrait]
    [portrait]
        size=400
        side="right"
        mirror="true"
        image="portraits/transparent/brawler.png"
    [/portrait]
    [attack]
        name=fist-merman
        description=_"fist"
        type=impact
        range=melee
        damage=5
        number=4
    [/attack]
    [attack]
        name=tail-merman
        description=_"tail"
        type=impact
        range=melee
        damage=9
        number=2
        [specials]
            {WEAPON_SPECIAL_STUN}
        [/specials]
    [/attack]

    [attack_anim]
        [filter_attack]
            name=fist-merman
        [/filter_attack]
        start_time=-300
        [frame]
            image="units/merfolk/brawler.png:50"
        [/frame]
        [frame]
            image="units/merfolk/brawler-fist-[1~3].png:[200,100*2]"
        [/frame]
        {SOUND:HIT_AND_MISS fist.ogg dagger-swish.wav -50}
        [frame]
            image="units/merfolk/brawler.png:50"
        [/frame]
    [/attack_anim]

    [attack_anim]
        [filter_attack]
            name=tail-merman
        [/filter_attack]
        start_time=-140
        {SOUND:HIT_AND_MISS fist.ogg dagger-swish.wav -50}
        [frame]
            image="units/merfolk/brawler-tail-land-[1,3,5~1].png:[30*2,80,30,80*3]"
        [/frame]
        [frame]
            image="units/merfolk/brawler.png:80"
        [/frame]
    [/attack_anim]

    [event]
        name=attacker_hits
        first_time_only=no

        [filter_attack]
            special=tail_stun
        [/filter_attack]

        [filter_second]
            [not]
                level=0
                [or]
                    [filter_wml]
                        [status]
                            stunned=yes
                        [/status]
                    [/filter_wml]
                [/or]
            [/not]
        [/filter_second]

        {VARIABLE second_unit.status.stunned yes}

        [if]
            [variable]
                name=second_unit.gender
                equals=female
            [/variable]

            [then]
                [set_variable]
                    name=tmp_stunned_text
                    value= _ "female^stunned"
                [/set_variable]
            [/then]

            [else]
                [set_variable]
                    name=tmp_stunned_text
                    value= _ "stunned"
                [/set_variable]
            [/else]
        [/if]

        [unstore_unit]
            variable=second_unit
            find_vacant=no
            text=$tmp_stunned_text
            red,green,blue=196,196,128
        [/unstore_unit]

        [object]
            silent=yes
            duration=turn

            [filter]
                x,y=$x2,$y2
            [/filter]

            [effect]
                apply_to=image_mod
                replace="CS(50,50,0)"
            [/effect]

            [effect]
                apply_to=zoc
                value=no
            [/effect]
        [/object]

        [clear_variable]
            name=tmp_stunned_text
        [/clear_variable]
    [/event]

    [event]
        name=defender_hits
        first_time_only=no

        [filter_second_attack]
            special=tail_stun
        [/filter_second_attack]

        [filter]
            [not]
                level=0
                [or]
                    [filter_wml]
                        [status]
                            stunned=yes
                        [/status]
                    [/filter_wml]
                [/or]
            [/not]
        [/filter]

        {VARIABLE unit.status.stunned yes}

        [if]
            [variable]
                name=unit.gender
                equals=female
            [/variable]

            [then]
                [set_variable]
                    name=tmp_stunned_text
                    value= _ "female^stunned"
                [/set_variable]
            [/then]

            [else]
                [set_variable]
                    name=tmp_stunned_text
                    value= _ "stunned"
                [/set_variable]
            [/else]
        [/if]

        [unstore_unit]
            variable=unit
            find_vacant=no
            text=$tmp_stunned_text
            red,green,blue=196,196,128
        [/unstore_unit]

        [object]
            silent=yes
            duration=turn

            [filter]
                x,y=$x1,$y1
            [/filter]

            [effect]
                apply_to=image_mod
                replace="CS(50,50,0)"
            [/effect]

            [effect]
                apply_to=zoc
                value=no
            [/effect]
        [/object]

        [clear_variable]
            name=tmp_stunned_text
        [/clear_variable]
    [/event]

    [event]
        name=turn refresh
        first_time_only=no

        [store_unit]
            [filter]
                side=$side_number
                [filter_wml]
                    [status]
                        stunned=yes
                    [/status]
                [/filter_wml]
            [/filter]
            variable=stunned
        [/store_unit]

        {FOREACH stunned i}
            {CLEAR_VARIABLE stunned[$i].status.stunned}

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

        {CLEAR_VARIABLE stunned}
    [/event]
[/unit_type]
