#textdomain wesnoth-ei

#define RAVANAL_ATTACK
    [animate_unit]
        [filter]
            id=Mal-Ravanal
        [/filter]
        flag=attack
        [primary_attack]
            range=ranged
            type=cold
        [/primary_attack]
        hits=no # otherwise there's a weird splash effect
    [/animate_unit]
#enddef
#define RAVANAL_ATTACK2
    [animate_unit]
        [filter]
            id=Mal-Ravanal
        [/filter]
        flag=attack
        [primary_attack]
            range=ranged
            type=arcane
        [/primary_attack]
        hits=no # otherwise there's a weird splash effect
    [/animate_unit]
#enddef
#define DACYN_ATTACK
    [animate_unit]
        [filter]
            id=Dacyn
        [/filter]
        flag=attack
        [primary_attack]
            range=ranged
        [/primary_attack]
    [/animate_unit]
#enddef
#define DACYN_FAKEATTACK
    [animate_unit]
        [filter]
            id=Dacyn
        [/filter]
        flag=fake_attack
        [primary_attack]
            range=ranged
        [/primary_attack]
    [/animate_unit]
#enddef

#define RAVANAL_LIGHTNING
    [animate_unit]
        [filter]
            id=Mal-Ravanal
        [/filter]
        flag=attack_lightning
        hits=yes
    [/animate_unit]
#enddef
#define DACYN_LIGHTNING
    [animate_unit]
        [filter]
            id=Dacyn
        [/filter]
        flag=attack_lightning
        hits=yes
    [/animate_unit]
#enddef

#define RAVANAL_LIGHTNING_SELF
    [animate_unit]
        [filter]
            id=Mal-Ravanal
        [/filter]
        flag=self_lightning
        hits=yes
    [/animate_unit]
#enddef
#define DACYN_LIGHTNING_SELF
    [animate_unit]
        [filter]
            id=Dacyn
        [/filter]
        flag=self_lightning
        hits=yes
    [/animate_unit]
#enddef

#     {IDLE_LIGHTNING_FRAMES  [1~21]  ""                } # LRG ground
#     {IDLE_LIGHTNING_FRAMES  [1~21]  "~FL(horizontal)" } # LRG ground LEFT
#
#     {IDLE_LIGHTNING_FRAMES B[1~9]   ""                } # MED ground
#     {IDLE_LIGHTNING_FRAMES B[1~9]   "~FL(horizontal)" } # MED ground LEFT
#
#     {IDLE_LIGHTNING_FRAMES  [1~4]   ""                } # SML ground
#     {IDLE_LIGHTNING_FRAMES  [1~4]   "~FL(horizontal)" } # SML ground LEFT
#
#     {IDLE_LIGHTNING_FRAMES A[2,1,5] "~FL(vertical)"   } # SML staff
#     {IDLE_LIGHTNING_FRAMES E[2,1,5] "~FL(vertical)"   } # SML staff 2
#     {IDLE_LIGHTNING_FRAMES A[1~5]   "~FL(vertical)"   } # MED staff
#     {IDLE_LIGHTNING_FRAMES E[1~5]   "~FL(vertical)"   } # MED staff 2
#     {IDLE_LIGHTNING_FRAMES C[1~8]   "~FL(vertical)"   } # LRG staff
#define IDLE_LIGHTNING_FRAMES FRAMES MOD
    [frame]
        halo=halo/undead/idle-flash-{FRAMES}.png:110
        halo_mod={MOD}
    [/frame]
#enddef
#define FRAME_DELAY DURATION
    [frame]
        duration={DURATION}
    [/frame]
#enddef

#define LIGHTNING_ANIMATION_RAVANAL DIRECTION_NUMBER
    [animation]
        apply_to=attack_lightning
        {LIGHTNING_BOLT_FAST {DIRECTION_NUMBER} }

        start_time=-1
        offset=0.0
        halo1_start_time=-25
        halo2_start_time=-15
        halo3_start_time=-5

        [halo1_frame]
            image="halo/elven/nature-halo[8~1].png~CS(-160,-240,-170):10"
            offset=0.0
            layer=60
        [/halo1_frame]
        [halo2_frame]
            image="halo/elven/shyde-stationary-halo[1~6].png~CS(-160,-240,-170):10"
            offset=0.0
            layer=41
        [/halo2_frame]
        [halo3_frame]
            image="halo/elven/nature-halo[1~8].png~CS(-160,-240,-170):5"
            offset=0.0
            alpha=0.7
            layer=41
        [/halo3_frame]

        [frame]
            image="units/undead-necromancers/ancient-lich-magic-1.png:30"
        [/frame]
        {SOUND:HIT_AND_MISS lightning.ogg lightning-miss.ogg -50}
        [frame]
            image="units/undead-necromancers/ancient-lich.png:20"
        [/frame]
    [/animation]
#enddef
#define LIGHTNING_ANIMATION_DACYN DIRECTION_NUMBER
    [animation]
        apply_to=attack_lightning
        {LIGHTNING_BOLT_FAST {DIRECTION_NUMBER} }
        start_time=-10
        [frame]
            image="units/dacyn/dacyn-L5-magic-[1,2].png:10"
        [/frame]
        {SOUND:HIT_AND_MISS lightning.ogg lightning-miss.ogg -50}
        [frame]
            image="units/dacyn/dacyn-L5-magic-3.png:5"
        [/frame]
        [frame]
            image="units/dacyn/dacyn-L5-magic-[2,1].png:10"
        [/frame]
    [/animation]
#enddef

#define LIGHTNING_ANIMATION_RAVANAL_SELF DIRECTION_NUMBER
    [animation]
        apply_to=self_lightning
        {LIGHTNING_BOLT_FAST_SELF {DIRECTION_NUMBER} }
        start_time=-10
        {SOUND:HIT_AND_MISS lightning.ogg lightning-miss.ogg -50}
    [/animation]
#enddef
#define LIGHTNING_ANIMATION_DACYN_SELF DIRECTION_NUMBER
    [animation]
        apply_to=self_lightning
        {LIGHTNING_BOLT_FAST_SELF {DIRECTION_NUMBER} }
        start_time=-10
        {SOUND:HIT_AND_MISS lightning.ogg lightning-miss.ogg -50}
    [/animation]
#enddef

#define LIGHTNING_BOLT_FAST DIRECTION_NUMBER
    missile_start_time=-100
    [missile_frame]
        halo=halo/lightning-bolt-{DIRECTION_NUMBER}-[1~4].png:100
        halo_y=-125
        offset=1.0
        auto_vflip=no
    [/missile_frame]
#enddef
#define LIGHTNING_BOLT_FAST_SELF DIRECTION_NUMBER
    missile_start_time=-100
    [missile_frame]
        halo=halo/lightning-bolt-{DIRECTION_NUMBER}-[1~4].png:100
        halo_y=-125
        auto_vflip=no
    [/missile_frame]
#enddef

# Campaign-specific failed teleport animation
#define TELEPORT_FAILED_ANIMATION
    start_time=-1200

    teleport_sparkle_1_start_time=-1200
    teleport_sparkle_2_start_time=-1000
    teleport_sparkle_3_start_time=-800

    [teleport_sparkle_1_frame]
        duration=800
        halo=misc/blank-hex.png:1,halo/teleport-[9,8,1,2,8,9].png,misc/blank-hex.png:400
        halo_x=-10
        halo_y=30~-30
    [/teleport_sparkle_1_frame]
    [teleport_sparkle_2_frame]
        duration=800
        halo=misc/blank-hex.png:1,halo/teleport-[9,8,1,8,9].png,misc/blank-hex.png:500
        halo_x=0
        halo_y=40~-40
    [/teleport_sparkle_2_frame]
    [teleport_sparkle_3_frame]
        duration=800
        halo=misc/blank-hex.png:1,halo/teleport-[9,8,9].png,misc/blank-hex.png:600
        halo_x=10
        halo_y=30~-30
    [/teleport_sparkle_3_frame]

    [frame]
        # default frame
    [/frame]
#enddef

#define LIGHT_SHIELD_OUT_ANIMATION
    start_time=-900

    teleport_ring_start_time=-900
    teleport_fill_start_time=-610

    [teleport_ring_frame]
        duration=900
        image=halo/light-shield-1.png
        alpha=0~1:290,1:320,1~0:290
    [/teleport_ring_frame]
    [teleport_fill_frame]
        duration=320
        image=halo/light-shield-2.png
        alpha=0~1:150,1:20,1~0:150
    [/teleport_fill_frame]

    [frame]
        # default frame
        duration=450
    [/frame]
    [frame]
        image=misc/blank-hex.png
        duration=450
    [/frame]
#enddef

#define LIGHT_SHIELD_IN_ANIMATION
    start_time=-900

    teleport_ring_start_time=-900
    teleport_fill_start_time=-610

    [teleport_ring_frame]
        duration=900
        image=halo/light-shield-1.png
        alpha=0~1:290,1:320,1~0:290
    [/teleport_ring_frame]
    [teleport_fill_frame]
        duration=320
        image=halo/light-shield-2.png
        alpha=0~1:150,1:20,1~0:150
    [/teleport_fill_frame]

    [frame]
        image=misc/blank-hex.png
        duration=450
    [/frame]
    [frame]
        # default frame
        duration=450
    [/frame]
#enddef

# Provide a simple "white-out" disappear and reappear animation

#define LIGHT_SHIELD_EFFECT_OBJECT_ID _ID_
    [object]
        silent=yes
        duration=turn
        [filter]
            id={_ID_}
        [/filter]
        [effect]
            apply_to=new_animation
            [animation]
                apply_to=disappear
                {LIGHT_SHIELD_OUT_ANIMATION}
            [/animation]
            [animation]
                apply_to=reappear
                {LIGHT_SHIELD_IN_ANIMATION}
            [/animation]
        [/effect]
    [/object]
#enddef

# A modified standing animation for Dacyn while he is casting a spell
#define DACYN_CASTING_SPELL_ANIMATION_OBJECT
    [object]
        silent=yes
        [filter]
            id=Dacyn
        [/filter]
        [effect]
            apply_to=new_animation
            [standing_anim]
                [filter]
                    type=Dacyn L2
                    [filter_wml]
                        [variables]
                            casting_the_spell=yes
                        [/variables]
                    [/filter_wml]
                [/filter]
                [frame]
                    duration=125
                    image="units/dacyn/dacyn-L2-magic-1.png"
                [/frame]
                [frame]
                    duration=125
                    image="units/dacyn/dacyn-L2-magic-2.png"
                [/frame]
                [frame]
                    image="units/dacyn/dacyn-L2-magic-3.png"
                    halo=halo/holy/halo[6,1~6].png:125
                [/frame]
                [frame]
                    duration=125
                    image="units/dacyn/dacyn-L2-magic-2.png"
                [/frame]
                [frame]
                    duration=125
                    image="units/dacyn/dacyn-L2-magic-1.png"
                [/frame]
            [/standing_anim]
            [standing_anim]
                [filter]
                    type=Dacyn L3
                    [filter_wml]
                        [variables]
                            casting_the_spell=yes
                        [/variables]
                    [/filter_wml]
                [/filter]
                [frame]
                    duration=125
                    image="units/dacyn/dacyn-L3-magic-1.png"
                [/frame]
                [frame]
                    duration=125
                    image="units/dacyn/dacyn-L3-magic-2.png"
                [/frame]
                [frame]
                    image="units/dacyn/dacyn-L3-magic-3.png"
                    halo=halo/holy/halo[6,1~6].png:125
                [/frame]
                [frame]
                    duration=125
                    image="units/dacyn/dacyn-L3-magic-2.png"
                [/frame]
                [frame]
                    duration=125
                    image="units/dacyn/dacyn-L3-magic-1.png"
                [/frame]
            [/standing_anim]
        [/effect]
    [/object]
#enddef

#define GLOBAL__ANIMATIONS_RECRUIT
    # some manual recruit animations for leaders who don't usually have them
    [event]
        name=prerecruit
        first_time_only=no
        [filter_second]
            type=Orcish Sovereign,Death Squire,Death Knight,Sergeant,Lieutenant,General
        [/filter_second]
        first_time_only=no
        [animate_unit]
            [filter]
                id=$second_unit.id
            [/filter]

            flag=leading
        [/animate_unit]
    [/event]
#enddef
