#textdomain wesnoth-sof

#define RED_WYRM_CS
~CS(20,-80,-50)#enddef

# wmlindent: start ignoring
#define RED_WYRM_CHAN
~CHAN(
    if((red < green*0.83) and (green - red > 10), red*1.9, red),
    if((red < green*0.83) and (blue < green*0.6), green*0.5, green*0.9),
    if((red < green*0.83) and (blue < green*0.6), blue*0.5, blue*0.9)
)#enddef
# wmlindent: stop ignoring

[unit_type]
    id=Red Wyrmlet
    name= _ "Red Wyrmlet"
    race=monster
    image="units/monsters/wyrmlet-se-3.png{RED_WYRM_CS}"
    profile="portraits/monsters/wyrm.webp{RED_WYRM_CHAN}"
    hide_help=yes
    hitpoints=16
    movement_type=smallfly
    movement=8
    experience=22
    level=0
    alignment=chaotic
    advances_to=Red Wyrm
    cost=13
    usage=scout
    description= _ "Red Wyrms are strange beasts, stout serpents with wings, but no legs, and their skin is like some reddish rock. The rocky skin seems to protect them from fire, but is quite brittle. They are relatively rare, and their presence is attributed to some eccentric wizard or dragon. The young are small, but hungry and aggressive."
    die_sound=bat-flapping.wav
    undead_variation=drake

    [resistance]
        fire=50
        arcane=100
        impact=120
    [/resistance]
    [defense]
        village=50
    [/defense]

    # based on the bats, though no north-facing frames yet
    [defend]
        # direction=s,sw,se
        [if]
            hits=miss
            offset=0.0~-0.15,-0.15~0.0
        [/if]
        start_time=-126
        [frame]
            image="units/monsters/wyrmlet-se-[3,4].png{RED_WYRM_CS}:[1,100]"
        [/frame]
        [if]
            hits=hit
            [frame]
                image="units/monsters/wyrmlet-se-4.png{RED_WYRM_CS}:150"
                sound={SOUND_LIST:BAT_HIT}
            [/frame]
        [/if]
        [else]
            hits=miss,kill
            [frame]
                image="units/monsters/wyrmlet-se-4.png{RED_WYRM_CS}:150"
            [/frame]
        [/else]
        [frame]
            image="units/monsters/wyrmlet-se-3.png{RED_WYRM_CS}:1"
        [/frame]
    [/defend]

    [standing_anim]
        # direction=s,se,sw
        start_time=0
        layer=60
        [frame]
            image="units/monsters/wyrmlet-se-[3~1,2~5,4].png{RED_WYRM_CS}:[50,60,80,60,50,60,80,60]"
        [/frame]
    [/standing_anim]
    [movement_anim]
        # direction=s,se,sw
        start_time=0
        [frame]
            image="units/monsters/wyrmlet-se-[3~1,2~5,4].png{RED_WYRM_CS}:[50,60,80,60,50,60,80,60]"
        [/frame]
    [/movement_anim]
    [attack]
        name=fangs
        description=_"fangs"
        icon=attacks/fangs-snake.png
        type=blade
        range=melee
        damage=5
        number=1
    [/attack]
    [attack]
        name=breath
        description=_"breath"
        icon=attacks/fireball.png
        type=fire
        range=ranged
        damage=6
        number=2
    [/attack]
    [attack_anim]
        [filter_attack]
            name=fangs
        [/filter_attack]
        # direction=s,se,sw
        offset=0.0~0.9:200,0.9~0.0:160
        start_time=-200
        [frame]
            image="units/monsters/wyrmlet-se-[3,2].png{RED_WYRM_CS}:30"
        [/frame]
        [frame]
            image="units/monsters/wyrmlet-se-1.png{RED_WYRM_CS}:30"
            sound=bat-flapping.wav
        [/frame]
        [frame]
            image="units/monsters/wyrmlet-se-[2~4,3,2,3].png{RED_WYRM_CS}:[30*2,70,50*2,40]"
        [/frame]
        {SOUND:HIT_AND_MISS bite-small.ogg {SOUND_LIST:MISS} -50}
    [/attack_anim]
    [attack_anim]
        [filter_attack]
            name=breath
        [/filter_attack]
        # direction=s,se,sw
        missile_start_time=-300
        [missile_frame]
            halo=projectiles/fire-breath-[1~10].png:[70*10]
            offset=0.0~1.0:300,1.0:350
        [/missile_frame]

        offset=0.0
        start_time=-300
        [frame]
            image="units/monsters/wyrmlet-se-[3,4,5].png{RED_WYRM_CS}:[200,200,300]"
        [/frame]
        {SOUND:HIT_AND_MISS fire.wav bow-puny-fire-miss.ogg -150}
    [/attack_anim]
[/unit_type]

#undef RED_WYRM_CS
#undef RED_WYRM_CHAN
