#textdomain wesnoth
# Macros for setting animations.

# These don't rely on any other macros.   Please don't change this.

#define STANDING_ANIM_DIRECTIONAL BASE_SE_IMAGE BASE_NE_IMAGE
    [standing_anim]
        start_time=0
        [if]
            direction=s,se,sw
            [frame]
                image={BASE_SE_IMAGE}:150
            [/frame]
        [/if]
        [else]
            direction=n,ne,nw
            [frame]
                image={BASE_NE_IMAGE}:150
            [/frame]
        [/else]
    [/standing_anim]
#enddef

#define LEADING_ANIM FULL_IMAGE HALFWAYS_IMAGE OFFSET_POSITION
    # Define an animation of a unit waving/raising their weapon,
    # with a gleam of light reflecting off it at the point specified by
    # OFFSET_POSITION
    [leading_anim]
        start_time=-126
        [frame]
            image={HALFWAYS_IMAGE}:1,{FULL_IMAGE}:250,{HALFWAYS_IMAGE}:1
        [/frame]

        halo_start_time=-100
        [halo_frame]
            halo="halo/misc/leadership-flare-[1~13].png:20"
            halo_x,halo_y={OFFSET_POSITION}
        [/halo_frame]
    [/leading_anim]
#enddef

#define DEFENSE_ANIM REACTION_IMAGE BASE_IMAGE HIT_SOUND
    # Define a defensive animation moving from a specified BASE_IMAGE
    # to REACTION_IMAGE, with HIT_SOUND playing only if a hit occurs.
    [defend]
        start_time=-126
        [frame]
            image={BASE_IMAGE}:1,{REACTION_IMAGE}:250,{BASE_IMAGE}:1
        [/frame]
        [if]
            hit_sound_start_time=-25
            hits=hit
            [hit_sound_frame]
                sound={HIT_SOUND}
            [/hit_sound_frame]
        [/if]
    [/defend]
#enddef

#define DEFENSE_ANIM_FILTERED REACTION_IMAGE BASE_IMAGE HIT_SOUND FILTER
    # Define a defensive animation moving from a specified BASE_IMAGE
    # to REACTION_IMAGE, with HIT_SOUND playing only if a hit occurs.  This
    # fires only if FILTER is matched.
    [defend]
        start_time=-126
        {FILTER}
        [frame]
            image={BASE_IMAGE}:1,{REACTION_IMAGE}:250,{BASE_IMAGE}:1
        [/frame]
        [if]
            hits=hit
            base_score=1   #necessary to eliminate duplication if filter contains match also
            hit_sound_start_time=-25
            [hit_sound_frame]
                sound={HIT_SOUND}
            [/hit_sound_frame]
        [/if]
    [/defend]
#enddef

#define DEFENSE_ANIM_DIRECTIONAL_FILTERED REACTION_SE_IMAGE BASE_SE_IMAGE REACTION_NE_IMAGE BASE_NE_IMAGE HIT_SOUND FILTER
    # Define a defensive animation depending on direction moving from a specified NE or SE Base image
    # to NE or SE Reaction image, with HIT_SOUND playing only if a hit occurs.  This
    # fires only if FILTER is matched.
    [defend]
        {FILTER}
        start_time=-126
        [if]
            direction=s,se,sw
            [frame]
                image={BASE_SE_IMAGE}:1,{REACTION_SE_IMAGE}:250,{BASE_SE_IMAGE}:1
            [/frame]
        [/if]
        [else]
            direction=n,ne,nw
            [frame]
                image={BASE_NE_IMAGE}:1,{REACTION_NE_IMAGE}:250,{BASE_NE_IMAGE}:1
            [/frame]
        [/else]

        [if]
            hits=hit
            base_score=1   #necessary to eliminate duplication if filter contains match also
            hit_sound_start_time=-25
            [hit_sound_frame]
                sound={HIT_SOUND}
            [/hit_sound_frame]
        [/if]
    [/defend]
#enddef

#define DEFENSE_ANIM_RANGE REACTION_IMAGE BASE_IMAGE HIT_SOUND RANGE
    # Define a defensive animation moving from a specified BASE_IMAGE
    # to REACTION_IMAGE, with HIT_SOUND playing only if a hit occurs.  This
    # fires only on the class of attacks specified by RANGE.
    [defend]
        start_time=-126
        [filter_attack]
            range={RANGE}
        [/filter_attack]
        [frame]
            image={BASE_IMAGE}:1,{REACTION_IMAGE}:250,{BASE_IMAGE}:1
        [/frame]
        [if]
            hit_sound_start_time=-25
            hits=hit
            [hit_sound_frame]
                sound={HIT_SOUND}
            [/hit_sound_frame]
        [/if]
    [/defend]
#enddef

#define DEFENSE_ANIM_DIRECTIONAL REACTION_SE_IMAGE BASE_SE_IMAGE REACTION_NE_IMAGE BASE_NE_IMAGE HIT_SOUND
    [defend]
        start_time=-126
        [if]
            direction=s,se,sw
            [frame]
                image={BASE_SE_IMAGE}:1,{REACTION_SE_IMAGE}:250,{BASE_SE_IMAGE}:1
            [/frame]
        [/if]
        [else]
            direction=n,ne,nw
            [frame]
                image={BASE_NE_IMAGE}:1,{REACTION_NE_IMAGE}:250,{BASE_NE_IMAGE}:1
            [/frame]
        [/else]

        [if]
            hit_sound_start_time=-25
            hits=hit
            [hit_sound_frame]
                sound={HIT_SOUND}
            [/hit_sound_frame]
        [/if]
    [/defend]
#enddef

#define DEFENSE_ANIM_DIRECTIONAL_RANGE REACTION_SE_IMAGE BASE_SE_IMAGE REACTION_NE_IMAGE BASE_NE_IMAGE HIT_SOUND RANGE
    [defend]
        [filter_attack]
            range={RANGE}
        [/filter_attack]
        start_time=-126
        [if]
            direction=s,se,sw
            [frame]
                image={BASE_SE_IMAGE}:1,{REACTION_SE_IMAGE}:250,{BASE_SE_IMAGE}:1
            [/frame]
        [/if]
        [else]
            direction=n,ne,nw
            [frame]
                image={BASE_NE_IMAGE}:1,{REACTION_NE_IMAGE}:250,{BASE_NE_IMAGE}:1
            [/frame]
        [/else]

        [if]
            hits=hit
            hit_sound_start_time=-25
            [hit_sound_frame]
                sound={HIT_SOUND}
            [/hit_sound_frame]
        [/if]
    [/defend]
#enddef

#define DEFENSE_ANIM_ELVEN_RANGE REACTION_IMAGE BASE_IMAGE HIT_SOUND RANGE
    # Define a defensive animation moving from a specified BASE_IMAGE
    # to REACTION_IMAGE, with HIT_SOUND playing only if a hit occurs and an
    # elven halo waxing and waning during the animation.  This
    # fires only on the class of attacks specified by RANGE.
    [defend]
        start_time=-175
        [filter_attack]
            range={RANGE}
        [/filter_attack]
        # wmlscope: start ignoring
        [frame]
            image={BASE_IMAGE}:50,{REACTION_IMAGE}:250,{BASE_IMAGE}:75
            halo=halo/elven/elven-shield-halo-[20,40,60,80,100,80,60,40,20]pct.png:[25*2,50*2,100,50,25*3]
        [/frame]
        # wmlscope: stop ignoring
        [if]
            hit_sound_start_time=-25
            hits=hit
            [hit_sound_frame]
                sound={HIT_SOUND}
            [/hit_sound_frame]
        [/if]
    [/defend]
#enddef

# this macro is called on top of every idle animation,
# to provide a standard set of conditions to play the idle animation

#define STANDARD_IDLE_FILTER
    # Poisoned units should have no idle animation.
    [filter]
        [not]
            [filter_wml]
                [status]
                    poisoned="yes"
                [/status]
            [/filter_wml]
        [/not]
    [/filter]
    # Units next to enemies should not have idle animations
    [filter]
        [filter_adjacent]
            is_enemy="yes"
            count=0
        [/filter_adjacent]
    [/filter]
#enddef

#define DRAKE_FLYING_ANIM STANDING_IMAGE FLYING_IMAGE
    [standing_anim]
        start_time=0
        [filter]
            [filter_location]
                terrain_type=!,W*,Qx*,Ql*
                [or]
                    terrain_type=Wwf,Wwr,*^V*
                [/or]
            [/filter_location]
        [/filter]
        [frame]
            image={STANDING_IMAGE}:150
        [/frame]
    [/standing_anim]

    [standing_anim]
        start_time=0
        layer=60
        submerge=0.01
        [filter]
            [filter_location]
                terrain_type=W*,Qx*,Ql*
                [not]
                    terrain_type=Wwf,Wwr,*^V*
                [/not]
            [/filter_location]
        [/filter]
        [frame]
            image={FLYING_IMAGE}:150
        [/frame]
    [/standing_anim]
#enddef

#define MISSILE_FRAME_WAIL
    # Animate a projectile for a wail attack.
    [if]
        direction=n,ne,nw

        missile_start_time=-300
        [missile_frame]
            image="projectiles/wailprojectile-n-[1~6].png:[70*2,160,40*3]"
            image_diagonal="projectiles/wailprojectile-ne-[1~6].png:[70*2,160,40*3]"
        [/missile_frame]
    [/if]
    [else]
        direction=s,se,sw
        ### The price of asymmetrical projectiles - here, we use a conditional because the game automatically flips the images for the south frame.  We have a separate set of images for the south part, which are not only flipped vertically, but also have their angle corrected for the sw direction.

        missile_start_time=-300
        [missile_frame]
            image="projectiles/wailprojectile-s-[1~6].png:[70*2,160,40*3]"
            image_diagonal="projectiles/wailprojectile-se-[1~6].png:[70*2,160,40*3]"
        [/missile_frame]
    [/else]
#enddef

#define MISSILE_FRAME_LIGHT_BEAM
    # Animate a beam of light coming down from the heavens.

    missile_start_time=-245

    [if]
        direction=n,ne,nw

        [missile_frame]
            halo="halo/holy/light-beam-[1~7,6~1].png:[30*6,130,70*6]"
            offset=1.0
        [/missile_frame]
    [/if]
    [else]
        direction=s,se,sw

        [missile_frame]
            halo="halo/holy/light-beam-[1~7,6~1].png~FL(vert):[30*6,130,70*6]"
            offset=1.0
        [/missile_frame]
    [/else]
#enddef

#define MISSILE_FRAME_FIRE_BREATH N_OFFSET_POSITION S_OFFSET_POSITION N_DIAGONAL_OFFSET_POSITION S_DIAGONAL_OFFSET_POSITION
    # Animate a projectile for a fire-breath attack.

    missile_start_time=-400

    [if]
        direction=n

        [missile_frame]
            halo=projectiles/fire-breath-n-[1~5].png:80
            halo_x,halo_y={N_OFFSET_POSITION}
        [/missile_frame]
    [/if]
    [else]
        direction=s

        [missile_frame]
            halo=projectiles/fire-breath-s-[1~5].png:80
            halo_x,halo_y={S_OFFSET_POSITION}
        [/missile_frame]
    [/else]
    [else]
        direction=ne,nw

        [missile_frame]
            halo=projectiles/fire-breath-ne-[1~5].png:80
            halo_x,halo_y={N_DIAGONAL_OFFSET_POSITION}
        [/missile_frame]
    [/else]
    [else]
        direction=se,sw

        [missile_frame]
            halo=projectiles/fire-breath-se-[1~5].png:80
            halo_x,halo_y={S_DIAGONAL_OFFSET_POSITION}
        [/missile_frame]
    [/else]
#enddef

#define MISSILE_FRAME_FIRE_BREATH_N OFFSET_POSITION
    # Animate a projectile for a fire-breath attack.
    missile_start_time=-400
    [missile_frame]
        halo=projectiles/fire-breath-n-[1~5].png:80
        halo_x,halo_y={OFFSET_POSITION}
    [/missile_frame]
#enddef

#define MISSILE_FRAME_FIRE_BREATH_S OFFSET_POSITION
    # Animate a projectile for a fire-breath attack.
    missile_start_time=-400
    [missile_frame]
        halo=projectiles/fire-breath-s-[1~5].png:80
        halo_x,halo_y={OFFSET_POSITION}
    [/missile_frame]
#enddef

#define MISSILE_FRAME_FIRE_BREATH_N_DIAGONAL OFFSET_POSITION
    # Animate a projectile for a fire-breath attack.
    missile_start_time=-400
    [missile_frame]
        halo=projectiles/fire-breath-ne-[1~5].png:80
        halo_x,halo_y={OFFSET_POSITION}
    [/missile_frame]
#enddef

#define MISSILE_FRAME_FIRE_BREATH_S_DIAGONAL OFFSET_POSITION
    # Animate a projectile for a fire-breath attack.
    missile_start_time=-400
    [missile_frame]
        halo=projectiles/fire-breath-se-[1~5].png:80
        halo_x,halo_y={OFFSET_POSITION}
    [/missile_frame]
#enddef

#define MISSILE_FRAME_FAERIE_FIRE
    # Animate a projectile for a faerie-fire attack.
    missile_start_time=-500
    [missile_frame]
        image="projectiles/icemissile-n-[1~7].png:[250,150*2,50*4]"
        image_diagonal="projectiles/icemissile-ne-[1~7].png:[250,150*2,50*4]"
        halo=halo/elven/ice-halo[1~5,1,2,6~9].png:[100*4,50*7]
        halo_x,halo_y=0,0
    [/missile_frame]
#enddef

#define MISSILE_FRAME_FIREBALL
    # Animate a projectile for a fireball attack.
    missile_start_time=-350
    [if]
        direction=n,ne,nw
        hits=yes

        [missile_frame]
            image="projectiles/fireball-[n-1,n-2,n,n-2,n-1].png:[40,100,125,55,30]"
            image_diagonal="projectiles/fireball-[nw-1,nw-2,nw,nw-2,nw-1].png:[40,100,125,55,30]"
            offset=0.0~0.9
        [/missile_frame]
        [missile_frame]
            halo="projectiles/fireball-impact-[1~16].png:60"
            offset=1.0
        [/missile_frame]
    [/if]
    [else]
        direction=s,se,sw
        hits=yes

        [missile_frame]
            image="projectiles/fireball-[n-1,n-2,n,n-2,n-1].png:[40,100,125,55,30]"
            image_diagonal="projectiles/fireball-[nw-1,nw-2,nw,nw-2,nw-1].png:[40,100,125,55,30]"
            offset=0.0~0.9
        [/missile_frame]
        [missile_frame]
            halo="projectiles/fireball-impact-[1~16].png~FL(vert):60"
            offset=1.0
        [/missile_frame]
    [/else]
    [else]
        direction=n,ne,nw
        hits=no

        missile_offset=0.0~0.20,0.20~0.35,0.35~0.40,0.4~0.45
        [missile_frame]
            halo="projectiles/fireball-fail-[1~7].png:100"
        [/missile_frame]
    [/else]
    [else]
        direction=s,se,sw
        hits=no

        missile_offset=0.0~0.20,0.20~0.35,0.35~0.40,0.4~0.45
        [missile_frame]
            halo="projectiles/fireball-fail-[1~7].png~FL(vert):100"
        [/missile_frame]
    [/else]
#enddef

#define MISSILE_FRAME_FIREBALL_XY OFFSET_X OFFSET_Y
    # Animate a projectile for a fireball attack with an X and Y start offset from centre of hex.
    missile_start_time=-350
    [if]
        direction=n,ne,nw
        hits=yes

        [missile_frame]
            image="projectiles/fireball-n-1.png~SCALE(60,60)~O(60%):40,projectiles/fireball-n-2.png~SCALE(80,80)~O(80%):100,projectiles/fireball-[n,n-2,n-1].png:[125,55,30]"
            image_diagonal="projectiles/fireball-nw-1.png~SCALE(60,60)~O(60%):40,projectiles/fireball-nw-2.png~SCALE(80,80)~O(80%):100,projectiles/fireball-[nw,nw-2,nw-1].png:[125,55,30]"
            offset=0.0~0.1,0.1~0.9
            directional_x={OFFSET_X}~0
            y={OFFSET_Y}~0
        [/missile_frame]
        [missile_frame]
            halo="projectiles/fireball-impact-[1~16].png:60"
            offset=1.0
        [/missile_frame]
    [/if]
    [else]
        direction=s,se,sw
        hits=yes

        [missile_frame]
            image="projectiles/fireball-n-1.png~SCALE(60,60)~O(60%):40,projectiles/fireball-n-2.png~SCALE(80,80)~O(80%):100,projectiles/fireball-[n,n-2,n-1].png:[125,55,30]"
            image_diagonal="projectiles/fireball-nw-1.png~SCALE(60,60)~O(60%):40,projectiles/fireball-nw-2.png~SCALE(80,80)~O(80%):100,projectiles/fireball-[nw,nw-2,nw-1].png:[125,55,30]"
            offset=0.0~0.1,0.1~0.9
            directional_x={OFFSET_X}~0
            y={OFFSET_Y}~0
        [/missile_frame]
        [missile_frame]
            halo="projectiles/fireball-impact-[1~16].png~FL(vert):60"
            offset=1.0
        [/missile_frame]
    [/else]
    [else]
        direction=n,ne,nw
        hits=no

        missile_offset=0.0~0.20,0.20~0.35,0.35~0.40,0.4~0.45
        [missile_frame]
            halo="projectiles/fireball-fail-[1~7].png:100"
            halo_x={OFFSET_X}~0
            halo_y={OFFSET_Y}~0
        [/missile_frame]
    [/else]
    [else]
        direction=s,se,sw
        hits=no

        missile_offset=0.0~0.20,0.20~0.35,0.35~0.40,0.4~0.45
        [missile_frame]
            halo="projectiles/fireball-fail-[1~7].png~FL(vert):100"
            halo_x={OFFSET_X}~0
            halo_y={OFFSET_Y}~0
        [/missile_frame]
    [/else]
#enddef

#define HALO_FRAME_SAURIAN
    halo_auto_vflip=false
    [halo_frame]
        duration=420
        halo=halo/saurian-magic-halo-[1~7].png:60
    [/halo_frame]
#enddef

#define MISSILE_FRAME_ICE
    missile_start_time=-200
    [if]
        hits=yes
        [missile_frame]
            duration=200
            image="projectiles/whitemissile-n.png"
            image_diagonal="projectiles/whitemissile-ne.png"
            sound=magicmissile.wav
            offset=0.0~0.8
        [/missile_frame]
        [missile_frame]
            duration=400
            halo="projectiles/whitemissile-impact-[1~8].png:50"
            offset=0.8,0.92,0.94,0.96,0.98,1.0,1.02,1.04
        [/missile_frame]
    [/if]
    [else]
        hits=no
        [missile_frame]
            duration=200
            image="projectiles/whitemissile-n.png"
            image_diagonal="projectiles/whitemissile-ne.png"
            sound=magicmissile.wav
            offset=0.0~0.8
            alpha=.8~0.0:200
        [/missile_frame]
    [/else]
#enddef

#define MISSILE_FRAME_HATCHET
    # Animate a projectile for a thrown-hatchet attack.
    missile_start_time=-200
    [missile_frame]
        duration=200
        image="projectiles/hatchet-[2~4,1].png"
        image_diagonal="projectiles/hatchet-[2~4,1].png"
    [/missile_frame]
#enddef

#define FIRE_BURST_SMALL
    missile_start_time=0
    [missile_frame]
        duration=600
        image="projectiles/fire-burst-small-[1~8].png"
        image_diagonal="projectiles/fire-burst-small-[1~8].png"
        offset=0.8~1.0
    [/missile_frame]
#enddef

#define LIGHTNING_BOLT DIRECTION_NUMBER
    missile_start_time=-250
    [if]
        direction=sw,s,se

        [missile_frame]
            halo=halo/lightning-bolt-{DIRECTION_NUMBER}-[1~4].png~FL(vert):100
            halo_y=-125
            offset=1.0
        [/missile_frame]
    [/if]
    [else]
        direction=nw,n,ne

        [missile_frame]
            halo=halo/lightning-bolt-{DIRECTION_NUMBER}-[1~4].png:100
            halo_y=-125
            offset=1.0
        [/missile_frame]
    [/else]
#enddef

#define MAGIC_MISSILE OFFSET_X OFFSET_Y
    magic_missile_start_time=-750

    magic_missile_trail_1_start_time=-350
    magic_missile_trail_2_start_time=-350
    magic_missile_trail_3_start_time=-350

    [magic_missile_frame]
        duration=400
        halo=halo/mage-halo[1~5].png
        halo_x={OFFSET_X}~0
        halo_y={OFFSET_Y}~-54
        offset=0.001~-0.083,-0.083~-0.25,-0.25~-0.5
    [/magic_missile_frame]
    [magic_missile_frame]
        duration=350
        halo=halo/mage-halo[1~5].png
        halo_y=-54~-45,-45~-27,-27~0
        offset=-0.5~-0.25,-0.25~0.25,0.25~1.0
    [/magic_missile_frame]

    [magic_missile_trail_1_frame]
        duration=350
        halo=misc/blank-hex.png:40,halo/mage-preparation-halo[1~7].png
        halo_y=-54:40,-54~-45,-45~-27,-27~0
        offset=0.001:40,-0.5~-0.25,-0.25~0.25,0.25~1.0
    [/magic_missile_trail_1_frame]
    [magic_missile_trail_2_frame]
        duration=350
        halo=misc/blank-hex.png:80,halo/mage-preparation-halo[1~7].png
        halo_y=-54:80,-54~-45,-45~-27,-27~0
        offset=0.001:80,-0.5~-0.25,-0.25~0.25,0.25~1.0
    [/magic_missile_trail_2_frame]
    [magic_missile_trail_3_frame]
        duration=350
        halo=misc/blank-hex.png:120,halo/mage-preparation-halo[1~7].png
        halo_y=-54:120,-54~-45,-45~-27,-27~0
        offset=0.001:120,-0.5~-0.25,-0.25~0.25,0.25~1.0
    [/magic_missile_trail_3_frame]
#enddef

#define MAGIC_MISSILE_STAFF_FLARE START_TIME DURATION_TIME OFFSET_X OFFSET_Y
    magic_missile_flare_start_time={START_TIME}

    [magic_missile_flare_frame]
        duration={DURATION_TIME}
        halo=halo/mage-preparation-halo[1~7].png
        halo_x={OFFSET_X}
        halo_y={OFFSET_Y}
        offset=0
    [/magic_missile_flare_frame]
#enddef

#define MERMAID_STAFF_FLARE OFFSET_X OFFSET_Y
    flare_start_time=-420
    [flare_frame]
        halo=halo/merfolk/staff-flare-[1~7].png:60
        halo_x,halo_y={OFFSET_X},{OFFSET_Y}
    [/flare_frame]
#enddef

#define MERMAID_WATER_BLAST_HALO
    water_start_time=-420
    [water_frame]
        halo=halo/merfolk/water-halo-[1~7].png:60
    [/water_frame]
#enddef

#define MISSILE_FRAME_MUZZLE_FLARE_MISS X Y
    missile_start_time=-250
    missile_offset=0.1
    missile_halo_x={X}
    missile_halo_y={Y}
    [missile_frame]
        halo="projectiles/misfire-spark-[1~4].png:100"
    [/missile_frame]
#enddef

#define MISSILE_FRAME_MUZZLE_FLARE_HIT_NORTH START_X START_Y
    missile_start_time=-250
    missile_offset=0.5~1.1:250,1.1~1.5:200,1.5~1.7:360
    missile_halo_x={START_X}~0
    missile_halo_y={START_Y}~0
    [missile_frame]
        halo="projectiles/muzzle-flash-n-[1~3].png:[100,80,70],projectiles/muzzle-flash-[4~14].png:60"
    [/missile_frame]
#enddef

#define MISSILE_FRAME_MUZZLE_FLARE_HIT_SOUTH START_X START_Y
    missile_start_time=-250
    missile_offset=0.5~1.1:250,1.1~1.5:200,1.5~1.7:360
    missile_halo_x={START_X}~0
    missile_halo_y={START_Y}~0
    [missile_frame]
        halo="projectiles/muzzle-flash-s-[1~3].png~FL(vertical):[100,80,70],projectiles/muzzle-flash-[4~14].png:60"
    [/missile_frame]
#enddef

#define MISSILE_FRAME_MUZZLE_FLARE_HIT_DIAG_NORTH START_X START_Y
    missile_start_time=-250
    missile_offset=0.5~1.1:250,1.1~1.5:200,1.5~1.7:360
    missile_halo_x={START_X}~0
    missile_halo_y={START_Y}~0
    [missile_frame]
        halo="projectiles/muzzle-flash-ne-[1~3].png:[100,80,70],projectiles/muzzle-flash-[4~14].png:60"
    [/missile_frame]
#enddef

#define MISSILE_FRAME_MUZZLE_FLARE_HIT_DIAG_SOUTH START_X START_Y
    missile_start_time=-250
    missile_offset=0.5~1.1:250,1.1~1.5:200,1.5~1.7:360
    missile_halo_x={START_X}~0
    missile_halo_y={START_Y}~0
    [missile_frame]
        halo="projectiles/muzzle-flash-se-[1~3].png~FL(vertical):[100,80,70],projectiles/muzzle-flash-[4~14].png:60"
    [/missile_frame]
#enddef

#define MISSILE_FRAME_DG_SECOND_MUZZLE_FLARE_HIT_NORTH START_X START_Y
    missile_start_time=-10
    missile_offset=1.05~1.1:10,1.1~1.5:200,1.5~1.7:360
    missile_halo_x={START_X}
    missile_halo_y={START_Y}
    [missile_frame]
        halo="projectiles/muzzle-flash-n-3.png:70"
    [/missile_frame]
    [missile_frame]
        halo="projectiles/muzzle-flash-[4~14].png:60"
    [/missile_frame]
#enddef

#define MISSILE_FRAME_DG_SECOND_MUZZLE_FLARE_HIT_SOUTH START_X START_Y
    missile_start_time=-10
    missile_offset=1.05~1.1:10,1.1~1.5:200,1.5~1.7:360
    missile_halo_x={START_X}
    missile_halo_y={START_Y}
    [missile_frame]
        halo="projectiles/muzzle-flash-s-3.png~FL(vertical):70"
    [/missile_frame]
    [missile_frame]
        halo="projectiles/muzzle-flash-[4~14].png~FL(vertical):60"
    [/missile_frame]
#enddef

#define MISSILE_FRAME_DG_SECOND_MUZZLE_FLARE_HIT_DIAG_NORTH START_X START_Y
    missile_start_time=-10
    missile_offset=1.05~1.1:10,1.1~1.5:200,1.5~1.7:360
    missile_halo_x={START_X}
    missile_halo_y={START_Y}
    [missile_frame]
        halo="projectiles/muzzle-flash-ne-3.png:70"
    [/missile_frame]
    [missile_frame]
        halo="projectiles/muzzle-flash-[4~14].png:60"
    [/missile_frame]
#enddef

#define MISSILE_FRAME_DG_SECOND_MUZZLE_FLARE_HIT_DIAG_SOUTH START_X START_Y
    missile_start_time=-10
    missile_offset=1.05~1.1:10,1.1~1.5:200,1.5~1.7:360
    missile_halo_x={START_X}
    missile_halo_y={START_Y}
    [missile_frame]
        halo="projectiles/muzzle-flash-se-3.png~FL(vertical):70"
    [/missile_frame]
    [missile_frame]
        halo="projectiles/muzzle-flash-[4~14].png~FL(vertical):60"
    [/missile_frame]
#enddef

#define MISSILE_FRAME_STONE_HIT OFFSET_X OFFSET_Y
    sling_stone_start_time=-200
    [sling_stone_frame]
        halo="projectiles/stone.png:200"
        halo_x={OFFSET_X}~0
        halo_y={OFFSET_Y}~0
        y=0~-5,-5~-8,-8~-9,-9~-10,-10~-9,-9~-8,-8~-5,-5~0
        offset=0.0~1.0
    [/sling_stone_frame]
#enddef

#define MISSILE_FRAME_STONE_MISS OFFSET_X OFFSET_Y
    sling_stone_start_time=-200
    [sling_stone_frame]
        halo="projectiles/stone.png:300"
        halo_x={OFFSET_X}~0
        halo_y={OFFSET_Y}~0
        y=0~-5,-5~-8,-8~-9,-9~-10,-10~-9,-9~-8,-8~-5,-5~0
        offset=0.0~1.5
    [/sling_stone_frame]
#enddef

#define MISSILE_FRAME_CHILL_WAVE X Y
    missile_start_time=-120
    [if]
        hits=yes
        [missile_frame]
            offset=0.0~0.9:120,0.9:160
            image="projectiles/icemissile-n-[1~7].png:40"
            image_diagonal="projectiles/icemissile-ne-[1~7].png:40"
            directional_x={X}~0
            y={Y}~0
        [/missile_frame]
    [/if]
    [else]
        hits=no
        [missile_frame]
            offset=0.0~0.9:150
            alpha=1~0
            image="projectiles/icemissile-n-[1~2,1].png:50"
            image_diagonal="projectiles/icemissile-ne-[1~2,1].png:50"
            directional_x={X}~0
            y={Y}~0
        [/missile_frame]
    [/else]
#enddef

#define MISSILE_FRAME_CHILL_TEMPEST X Y
    missile_1_start_time=-120
    missile_2_start_time=-90
    [if]
        hits=yes
        [missile_1_frame]
            offset=0.0~0.9:240,0.9:320
            image="projectiles/icemissile-n-[1~7].png~SCALE(60,60):80"
            image_diagonal="projectiles/icemissile-ne-[1~7].png~SCALE(60,60):80"
            x={X}~0
            y={Y}~0
            directional_x=0~20:80,20~-10:160,-10~0:80,0:240
            directional_y=0~20:80,20~-10:160,-10~0:80,0:240
        [/missile_1_frame]
        [missile_2_frame]
            offset=0.0~0.9:240,0.9:320
            image="projectiles/icemissile-n-[1~7].png~SCALE(60,60):80"
            image_diagonal="projectiles/icemissile-ne-[1~7].png~SCALE(60,60):80"
            x={X}~0
            y={Y}~0
            directional_x=0~-20:80,-20~10:160,10~0:80,0:240
            directional_y=0~-20:80,-20~10:160,10~0:80,0:240
        [/missile_2_frame]
    [/if]
    [else]
        hits=no
        [missile_1_frame]
            offset=0.0~0.9:300
            alpha=1~0
            image="projectiles/icemissile-n-[1~2,1].png~SCALE(60,60):100"
            image_diagonal="projectiles/icemissile-ne-[1~2,1].png~SCALE(60,60):100"
            x={X}~0
            y={Y}~0
            directional_x=0~20:100,20~-20:200
            directional_y=0~20:100,20~-20:200
        [/missile_1_frame]
        [missile_2_frame]
            offset=0.0~0.8:300
            alpha=1~0
            image="projectiles/icemissile-n-[1~2,1].png~SCALE(60,60):100"
            image_diagonal="projectiles/icemissile-ne-[1~2,1].png~SCALE(60,60):100"
            x={X}~0
            y={Y}~0
            directional_x=0~-20:100,-20~20:200
            directional_y=0~-20:100,-20~20:200
        [/missile_2_frame]
    [/else]
#enddef

#define MISSILE_FRAME_SHADOW_WAVE
    missile_start_time=-50
    shadow_start_time=-350
    [shadow_frame]
        duration=350
        offset=0.1~1.0:150,1.0:200
        alpha=0.0:1,0.8:149,0.8~0.0:200
        image=projectiles/darkmissile-n.png~CS(-250,-250,-250)
        image_diagonal=projectiles/darkmissile-ne.png~CS(-250,-250,-250)
        y=25
        layer=10
    [/shadow_frame]
    [missile_frame]
        duration=300
        offset=1.0
        auto_vflip=no
        auto_hflip=no
        halo="halo/undead/dark-magic-[6~1].png~CS(-150,-150,-150)~O([40%,50%,60%*2,50%,40%]):50"
        halo_y=8
    [/missile_frame]
#enddef

#define DRAKE_UNWALKABLE_TERRAINS
!,Wwf,*^B*,!,W*,W*^V*,Chs,Chw,S*,S*^V*,Q*,Mv#enddef

#define DRAKE_STANDING_ANIM DRAKE_NAME
    [standing_anim]
        [frame]
            image="units/drakes/{DRAKE_NAME}.png:50"
        [/frame]
    [/standing_anim]
    [standing_anim]
        start_time=0
        terrain_type={DRAKE_UNWALKABLE_TERRAINS}
        submerge=0.01
        # wmlscope: start ignoring
        [frame]
            image="units/drakes/{DRAKE_NAME}-fly-[1~5,4].png:100"
        [/frame]
        [frame]
            image="units/drakes/{DRAKE_NAME}-fly-[3,2]-upstroke.png:100"
        [/frame]
        # wmlscope: stop ignoring
    [/standing_anim]
    [pre_movement_anim]
        start_time=0
        terrain_type=!,{DRAKE_UNWALKABLE_TERRAINS}
        [frame]
            image="units/drakes/{DRAKE_NAME}-takeoff-[1~4].png:50"
        [/frame]
    [/pre_movement_anim]
    [movement_anim]
        start_time=0
        submerge=0.01
        # wmlscope: start ignoring
        [frame]
            image="units/drakes/{DRAKE_NAME}-fly-[1~5,4].png:100"
        [/frame]
        [frame]
            image="units/drakes/{DRAKE_NAME}-fly-[3,2]-upstroke.png:100"
        [/frame]
        # wmlscope: stop ignoring
    [/movement_anim]
    [post_movement_anim]
        terrain_type=!,{DRAKE_UNWALKABLE_TERRAINS}
        start_time=0
        [frame]
            image="units/drakes/{DRAKE_NAME}-takeoff-[4~1].png:100"
        [/frame]
    [/post_movement_anim]
#enddef

#define DRAKE_FIRE_ANIM DRAKE_NAME DIRECTION_SUFFIX DIRECTION OFFSET_X OFFSET_Y
    [attack_anim]
        [filter_attack]
            name=fire breath
        [/filter_attack]
        direction={DIRECTION}
        hits=yes

        offset=0.0

        impact_burst_start_time=-160
        [impact_burst_frame]
            duration=320
            halo=projectiles/fire-burst-small-[1~8].png
            offset=1.0
            layer=1
        [/impact_burst_frame]

        flame_trail_1_start_time=-450
        flame_trail_2_start_time=-400
        flame_trail_3_start_time=-350
        flame_trail_4_start_time=-300
        flame_trail_5_start_time=-250
        [flame_trail_1_frame]
            duration=500
            halo=projectiles/fire-breath-[1~10].png
            halo_x={OFFSET_X}~0:300,0
            halo_y={OFFSET_Y}~0:300,0
            offset=0.0~1.0:300,1.0~1.25:200
        [/flame_trail_1_frame]
        [flame_trail_2_frame]
            duration=500
            halo=projectiles/fire-breath-[1~10].png
            halo_x={OFFSET_X}~0:300,0
            halo_y={OFFSET_Y}~0:300,0
            offset=0.0~1.0:300,1.0~1.20:200
        [/flame_trail_2_frame]
        [flame_trail_3_frame]
            duration=500
            halo=projectiles/fire-breath-[1~10].png
            halo_x={OFFSET_X}~0:300,0
            halo_y={OFFSET_Y}~0:300,0
            offset=0.0~1.0:300,1.0~1.15:200
        [/flame_trail_3_frame]
        [flame_trail_4_frame]
            duration=500
            halo=projectiles/fire-breath-[1~10].png
            halo_x={OFFSET_X}~0:300,0
            halo_y={OFFSET_Y}~0:300,0
            offset=0.0~1.0:300,1.0~1.10:200
        [/flame_trail_4_frame]
        [flame_trail_5_frame]
            duration=500
            halo=projectiles/fire-breath-[1~10].png
            halo_x={OFFSET_X}~0:300,0
            halo_y={OFFSET_Y}~0:300,0
            offset=0.0~1.0:300,1.0~1.05:200
        [/flame_trail_5_frame]

        start_time=-900
        [frame]
            image="units/drakes/{DRAKE_NAME}-fire-inhale-[1~4,2].png:100"
        [/frame]
        [frame]
            image="units/drakes/{DRAKE_NAME}-fire-{DIRECTION_SUFFIX}-[1~3,2,1].png:100"
            sound=flame-big.ogg
        [/frame]
    [/attack_anim]

    [attack_anim]
        [filter_attack]
            name=fire breath
        [/filter_attack]
        direction={DIRECTION}
        hits=no

        offset=0.0

        flame_trail_1_start_time=-450
        flame_trail_2_start_time=-400
        flame_trail_3_start_time=-350
        flame_trail_4_start_time=-300
        flame_trail_5_start_time=-250
        [flame_trail_1_frame]
            duration=500
            halo=projectiles/fire-breath-[1~10].png
            halo_x={OFFSET_X}~0:300,0
            halo_y={OFFSET_Y}~0:300,0
            offset=0.0~1.0:300,1.0~1.5:200
        [/flame_trail_1_frame]
        [flame_trail_2_frame]
            duration=500
            halo=projectiles/fire-breath-[1~10].png
            halo_x={OFFSET_X}~0:300,0
            halo_y={OFFSET_Y}~0:300,0
            offset=0.0~1.0:300,1.0~1.4:200
        [/flame_trail_2_frame]
        [flame_trail_3_frame]
            duration=500
            halo=projectiles/fire-breath-[1~10].png
            halo_x={OFFSET_X}~0:300,0
            halo_y={OFFSET_Y}~0:300,0
            offset=0.0~1.0:300,1.0~1.3:200
        [/flame_trail_3_frame]
        [flame_trail_4_frame]
            duration=500
            halo=projectiles/fire-breath-[1~10].png
            halo_x={OFFSET_X}~0:300,0
            halo_y={OFFSET_Y}~0:300,0
            offset=0.0~1.0:300,1.0~1.2:200
        [/flame_trail_4_frame]
        [flame_trail_5_frame]
            duration=500
            halo=projectiles/fire-breath-[1~10].png
            halo_x={OFFSET_X}~0:300,0
            halo_y={OFFSET_Y}~0:300,0
            offset=0.0~1.0:300,1.0~1.1:200
        [/flame_trail_5_frame]

        start_time=-900
        [frame]
            image="units/drakes/{DRAKE_NAME}-fire-inhale-[1~4,2].png:100"
        [/frame]
        [frame]
            image="units/drakes/{DRAKE_NAME}-fire-{DIRECTION_SUFFIX}-[1~3,2,1].png:100"
            sound=flame-big-miss.ogg
        [/frame]
    [/attack_anim]
#enddef

#define DRAKE_FIRE_ANIM_S_DIAGONAL DRAKE_NAME OFFSET_POSITION
    [attack_anim]
        [filter_attack]
            name=fire breath
        [/filter_attack]
        direction=se,sw
        missile_start_time=-400
        [missile_frame]
            halo=projectiles/fire-breath-se-[1~5].png:80
            halo_x,halo_y={OFFSET_POSITION}
        [/missile_frame]
        start_time=-900
        [frame]
            image="units/drakes/{DRAKE_NAME}.png:20"
        [/frame]
        [frame]
            image="units/drakes/{DRAKE_NAME}-fire-inhale-[1~4,2].png:100"
        [/frame]
        {SOUND:HIT_AND_MISS flame-big.ogg flame-big-miss.ogg -480}
        [frame]
            image="units/drakes/{DRAKE_NAME}-fire-se-[1~3,2,1].png:100"
        [/frame]
    [/attack_anim]
#enddef

#define DRAKE_FIRE_ANIM_N_DIAGONAL_CURRENT DRAKE_NAME OFFSET_POSITION
    [attack_anim]
        [filter_attack]
            name=fire breath
        [/filter_attack]
        direction=ne,nw
        missile_start_time=-400
        [missile_frame]
            halo=projectiles/fire-breath-ne-[1~5].png:80
            halo_x,halo_y={OFFSET_POSITION}
        [/missile_frame]
        start_time=-900
        [frame]
            image="units/drakes/{DRAKE_NAME}.png:20"
        [/frame]
        [frame]
            image="units/drakes/{DRAKE_NAME}-fire-inhale-[1~4,2].png:100"
        [/frame]
        {SOUND:HIT_AND_MISS flame-big.ogg flame-big-miss.ogg -480}
        [frame]
            image="units/drakes/{DRAKE_NAME}-fire-se-[1~3,2,1].png:100"
        [/frame]
    [/attack_anim]
#enddef

#define DRAKE_FIRE_ANIM_S DRAKE_NAME OFFSET_POSITION
    [attack_anim]
        [filter_attack]
            name=fire breath
        [/filter_attack]
        direction=s
        missile_start_time=-400
        [missile_frame]
            halo=projectiles/fire-breath-s-[1~5].png:80
            halo_x,halo_y={OFFSET_POSITION}
        [/missile_frame]
        start_time=-900
        [frame]
            image="units/drakes/{DRAKE_NAME}.png:20"
        [/frame]
        [frame]
            image="units/drakes/{DRAKE_NAME}-fire-inhale-[1~4,2].png:100"
        [/frame]
        {SOUND:HIT_AND_MISS flame-big.ogg flame-big-miss.ogg -480}
        [frame]
            image="units/drakes/{DRAKE_NAME}-fire-s-[1~3,2,1].png:100"
        [/frame]
    [/attack_anim]
#enddef

#define DRAKE_FIRE_ANIM_N_CURRENT DRAKE_NAME OFFSET_POSITION
    [attack_anim]
        [filter_attack]
            name=fire breath
        [/filter_attack]
        direction=n
        missile_start_time=-400
        [missile_frame]
            halo=projectiles/fire-breath-n-[1~5].png:80
            halo_x,halo_y={OFFSET_POSITION}
        [/missile_frame]
        start_time=-900
        [frame]
            image="units/drakes/{DRAKE_NAME}.png:20"
        [/frame]
        [frame]
            image="units/drakes/{DRAKE_NAME}-fire-inhale-[1~4,2].png:100"
        [/frame]
        {SOUND:HIT_AND_MISS flame-big.ogg flame-big-miss.ogg -480}
        [frame]
            image="units/drakes/{DRAKE_NAME}-fire-s-[1~3,2,1].png:100"
        [/frame]
    [/attack_anim]
#enddef

#define DRAKE_MOVEMENT_ANIM DRAKE_NAME
    [movement_anim]
        start_time=0
        # wmlscope: start ignoring
        [frame]
            image="units/drakes/{DRAKE_NAME}-fly-[1~5,4].png:100,units/drakes/{DRAKE_NAME}-fly-[3,2]-upstroke.png:100"
        [/frame]
        # wmlscope: stop ignoring
    [/movement_anim]
#enddef

#define DRAKE_WEAPON_ANIM DRAKE_NAME
    [draw_weapon_anim]
        #landing, only do it when we're not already flying
        terrain_type={DRAKE_UNWALKABLE_TERRAINS}
        [frame]
            image="units/drakes/{DRAKE_NAME}-takeoff-[4~1].png:100"
        [/frame]
    [/draw_weapon_anim]
    [sheath_weapon_anim]
        #landing, only do it when we're not already flying
        terrain_type={DRAKE_UNWALKABLE_TERRAINS}
        [frame]
            image="units/drakes/{DRAKE_NAME}-takeoff-[1~4].png:100"
        [/frame]
    [/sheath_weapon_anim]
#enddef
