#textdomain wesnoth-ei

#
# note that Mal-Ravanal's hitpoints and attack power varies by difficulty
# to prevent him being disproportionately strong on easy/normal
#
# drain+terror+reanimation makes it difficult to anticlimactically wear down mal-ravanal with hordes of low-level units
# instead, you need to hit him with veterans or high-level leadership, which IMO makes for a much more cinematic battle
# Dacyn (as befits the plot) is particularly strong against Mal-Ravanal, being level 5 with drain immunity and cold resist
# Owaec, Konrad, Paladins, and Silver Mages are also quite good
#
# basically, Mal-Ravanal should be an absolute pain to kill, and if he's not right now he probably needs to be
#

[unit_type]
    id=Dread Lich
    name= _ "Dread Lich"
    race=undead
    image=units/undead-ravanal/ancient-lich.png
    profile=portraits/mal-ravanal.webp
    hitpoints={ON_DIFFICULTY 90 110 130}
    movement_type=undeadfoot
    movement=4 # because 1) this helps his escort keep up in S18b and 2) slow movement looks cooler
    experience=300
    level=5 # affects his terror ability
    alignment=chaotic
    advances_to=null
    {AMLA_DEFAULT}
    cost=616
    usage=mixed fighter
    description= _ "Named thusly for the abject terror they awaken in their enemies, a so-called Dread Lich is an artisan of necromantic power, a consummate master of the dark magics they wield.

Invariably in command of a nigh limitless horde of risen warriors and undead monsters, a lich of this order has a mastery of dark sorcery that can bring dread to the most storied magi of human and elven kind. Such a figure usually marks a dark and bloody chapter in history, and in those times of need, it is only through the tireless efforts of the most valiant heroes that the rise of an Dread Lich has not led to the shadows ruling the world for the rest of time."
    die_sound=rumble.ogg
    {DEFENSE_ANIM "units/undead-necromancers/ancient-lich-defend.png" "units/undead-necromancers/ancient-lich.png" {SOUND_LIST:LICH_HIT} }

    halo=halo/elven/nature-halo[7~1].png~CS(-159,-255,-159)~O(0.5):250 # same as fallen_mage
    [standing_anim]
        {FRAME_DELAY 1500}
        {IDLE_LIGHTNING_FRAMES A[1~5]   "~O(0.7)~FL(vert)~FL(horiz)" } # MED staff
        {IDLE_LIGHTNING_FRAMES C[1~8]   "~O(0.7)~FL(vert)~FL(horiz)" } # LRG staff
        {FRAME_DELAY 1000}

        [frame]
            image="units/undead-ravanal/ancient-lich[1~3,3,3,2a,1,1].png:300"
            halo=halo/undead/idle-flash-[1~21].png:110                 # LRG ground
            halo_mod=~O(0.7)
        [/frame]
        {IDLE_LIGHTNING_FRAMES  [1~4]   "~O(0.7)~FL(horizontal)"     } # SML ground LEFT
        {FRAME_DELAY 1000}

        {IDLE_LIGHTNING_FRAMES A[2,1,5] "~O(0.7)~FL(vert)~FL(horiz)" } # SML staff
        {IDLE_LIGHTNING_FRAMES E[1~5]   "~O(0.7)~FL(vert)~FL(horiz)" } # MED staff 2
        {FRAME_DELAY 1000}

        {IDLE_LIGHTNING_FRAMES B[1~9]   "~O(0.7)"                    } # MED ground
        {IDLE_LIGHTNING_FRAMES E[2,1,5] "~O(0.7)~FL(vert)~FL(horiz)" } # SML staff 2
        {FRAME_DELAY 500}
        {IDLE_LIGHTNING_FRAMES C[1~8]   "~O(0.7)~FL(vert)~FL(horiz)" } # LRG staff
        {FRAME_DELAY 1500}

        {IDLE_LIGHTNING_FRAMES  [1~4]   "~O(0.7)~FL(horizontal)"     } # SML ground LEFT
        {IDLE_LIGHTNING_FRAMES B[1~9]   "~O(0.7)~FL(horizontal)"     } # MED ground LEFT
        {FRAME_DELAY 500}
        [frame]
            image="units/undead-ravanal/ancient-lich[1~8].png:300"
            halo=halo/undead/idle-flash-[1~21].png:110                 # LRG ground LEFT
        [/frame]
    [/standing_anim]

    [abilities]
        [dummy]
            id=reanimation
            name=_"reanimation"
            description= _ "This unit can reanimate its defeated allies and enemies.

When any of Mal-Ravanal’s recruits die, that unit will be reanimated as a weaker undead version of itself. Enemies killed by Mal-Ravanal will rise again as ghosts."
        [/dummy]
        {ABILITY_TERROR}
    [/abilities]
    [attack]
        name=touch
        #textdomain wesnoth-units
        description=_"touch"
        icon=attacks/touch-undead.png
        type=arcane
        range=melee
        damage=8
        number={ON_DIFFICULTY 2 3 4}
        [specials]
            {WEAPON_SPECIAL_GREATER_DRAIN}
        [/specials]
    [/attack]
    [attack]
        name=chill tempest
        description=_"chill tempest"
        type=cold
        [specials]
            {WEAPON_SPECIAL_MAGICAL}
            {WEAPON_SPECIAL_DRAIN}
        [/specials]
        range=ranged
        damage=13
        number={ON_DIFFICULTY 3 4 5}
        icon=attacks/iceball.png
    [/attack]
    [attack]
        name=ravanal_shadow_wave
        description=_"shadow wave"
        #textdomain wesnoth-ei
        type=arcane
        [specials]
            {WEAPON_SPECIAL_MAGICAL}
            {WEAPON_SPECIAL_DRAIN}
        [/specials]
        range=ranged
        damage=9
        number={ON_DIFFICULTY 3 4 5}
        icon=attacks/dark-missile.png
    [/attack]

    [recruiting_anim]
        [filter_second]
            race=undead
        [/filter_second]
        start_time=-300
        [frame]
            image="units/undead-necromancers/ancient-lich-magic-[1,2].png:75"
        [/frame]
        [frame]
            image="units/undead-necromancers/ancient-lich-magic-3.png"
            halo=halo/undead/black-magic-[1~5].png:[75*4,50]
        [/frame]
        sound_start_time=-75
        [sound_frame]
            sound=magic-dark-big.ogg
        [/sound_frame]
        [frame]
            image="units/undead-necromancers/ancient-lich-magic-[2,1].png:50"
        [/frame]
        [frame]
            image="units/undead-necromancers/ancient-lich.png:1"
        [/frame]
    [/recruiting_anim]

    [attack_anim]
        [filter_attack]
            name=chill tempest
        [/filter_attack]
        offset=0
        {MISSILE_FRAME_CHILL_TEMPEST 0 -15}
        start_time=-355
        [frame]
            image="units/undead-necromancers/ancient-lich-magic-[1,2].png:75"
        [/frame]
        [frame]
            image="units/undead-necromancers/ancient-lich-magic-3.png"
            halo=halo/undead/black-magic-[1~5].png:[75*4,50]
        [/frame]
        {SOUND:HIT_AND_MISS magic-dark-big.ogg magic-dark-big-miss.ogg -150}
        [frame]
            image="units/undead-necromancers/ancient-lich-magic-[2,1].png:50"
        [/frame]
    [/attack_anim]

    [attack_anim]
        [filter_attack]
            name=touch
        [/filter_attack]
        start_time=-250
        [frame]
            image="units/undead-necromancers/ancient-lich.png:50"
        [/frame]
        [frame]
            image="units/undead-necromancers/ancient-lich-melee-[1~2].png:[100,200]"
        [/frame]
        {SOUND:HIT_AND_MISS wail-sml.wav {SOUND_LIST:MISS} -100}
        [frame]
            image="units/undead-necromancers/ancient-lich-magic-1.png:75"
        [/frame]
        [frame]
            image="units/undead-necromancers/ancient-lich.png:75"
        [/frame]
    [/attack_anim]

    [animation]
        apply_to=summon

        start_time=-300
        [frame]
            image="units/undead-necromancers/ancient-lich-magic-[1~3,1].png:100"
        [/frame]
        sound_start_time=-200
        [sound_frame]
            sound=magic-dark-big.ogg
        [/sound_frame]
        [frame]
            image="units/undead-necromancers/ancient-lich.png:1"
        [/frame]
    [/animation]

    [animation]
        apply_to=pre_teleport
        {TELEPORT_OUT_ANIMATION}
    [/animation]
    [animation]
        apply_to=post_teleport
        {TELEPORT_IN_ANIMATION}
    [/animation]
    [animation]
        apply_to=recruited
        {TELEPORT_IN_ANIMATION}
    [/animation]
    [animation]
        apply_to=failed_teleport
        {TELEPORT_FAILED_ANIMATION}
    [/animation]

    [animation]
        apply_to=death
        start_time=0
        missile_start_time=-245
        burst_1_start_time=0
        burst_2_start_time=400
        burst_3_start_time=800
        smoke_1_start_time=1800
        smoke_2_start_time=2400
        smoke_3_start_time=3000
        [if]
            direction=n,ne,nw

            [missile_frame]
                halo="halo/holy/light-beam-[1~7,6~1].png:[30*6,130,70*6]"
            [/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]"
            [/missile_frame]
        [/else]
        [frame]
            duration=2000
            image="units/undead-necromancers/ancient-lich.png"
            blend_color=127,0,127
            blend_ratio=0~1
            sound=lich-die.ogg
        [/frame]
        [frame]
            duration=500
            image="misc/blank-hex.png~SCALE(144,144)~BLIT(units/undead-necromancers/ancient-lich.png~CS(127,0,127),36,36)~BL([15,10,20,30,40,50,60,70])"
            alpha=1,1~0
            blend_color=255,255,255
            blend_ratio=0~1
            sound=magicmissile.wav
        [/frame]

        [burst_1_frame]
            image="projectiles/fireball-impact-[1~16].png:60"
            alpha=0:1,1:960,0:1
            image_mod="B(63)~G(-31)"
            x,y=-15,-10
            auto_vflip=no
            sound=fire.wav
        [/burst_1_frame]
        [burst_2_frame]
            image="projectiles/fireball-impact-[1~16].png:60"
            alpha=0:1,1:960,0:1
            image_mod="B(63)~G(-31)"
            x,y=20,-5
            auto_vflip=no
            sound=fire.wav
        [/burst_2_frame]
        [burst_3_frame]
            image="projectiles/fireball-impact-[1~16].png:60"
            alpha=0:1,1:960,0:1
            image_mod="B(63)~G(-31)"
            x,y=-5,10
            auto_vflip=no
            sound=fire.wav
        [/burst_3_frame]

        [smoke_1_frame]
            image="terrain/misc/smoke-A[01~12,01~12,01~12,01~12,01~12,01~12].png~SCALE([72~143],[144~215]):50"
            alpha=0~1,1,1,1~0
            image_mod="~CS(-31,-255,-31)"
            y=0~-200
            auto_vflip=no
        [/smoke_1_frame]
        [smoke_2_frame]
            image="terrain/misc/smoke-A[01~12,01~12,01~12,01~12,01~12,01~12].png~SCALE([72~143],[144~215]):50"
            alpha=0~1,1,1,1~0
            image_mod="~CS(-31,-255,-31)"
            y=0~-200
            auto_vflip=no
        [/smoke_2_frame]
        [smoke_3_frame]
            image="terrain/misc/smoke-A[01~12,01~12,01~12,01~12,01~12,01~12].png~SCALE([72~143],[144~215]):50"
            alpha=0~1,1,1,1~0
            image_mod="~CS(-31,-255,-31)"
            y=0~-200
            auto_vflip=no
        [/smoke_3_frame]
    [/animation]

    [animation]
        apply_to=attack
        [filter_attack]
            name=ravanal_shadow_wave
        [/filter_attack]

        start_time=-750
        offset=0.0
        halo1_start_time=-750
        halo2_start_time=-600
        halo3_start_time=-500
        halo4_start_time=-400
        halo5_start_time=-200

        [halo1_frame]
            image="halo/elven/nature-halo[8~1].png~CS(-160,-240,-170):100"
            offset=1.0
            layer=60
        [/halo1_frame]

        [halo2_frame]
            image="halo/elven/shyde-stationary-halo[1~6].png~CS(-160,-240,-170):100"
            offset=0.0
            layer=41
        [/halo2_frame]

        [halo3_frame]
            image="halo/elven/nature-halo[1~8].png~CS(-160,-240,-170):75"
            offset=0.0
            alpha=0.7
            layer=41
        [/halo3_frame]

        [halo4_frame]
            image="halo/elven/ice-halo[1~8].png~CS(-150,-205,-160):100"
            alpha=0.0~1.0:300,1.0~0.0:400
            offset=1.0
            y=-5
            layer=60
        [/halo4_frame]

        [if]
            hits=yes
            [halo5_frame]
                duration=1
            [/halo5_frame]
            [halo5_frame]
                image="projectiles/whitemissile-impact-[1~8].png~CS(30,-40,-10):[50*4,100*4]"
                offset=1.0
                alpha=0.6
                y=-5
                layer=60
            [/halo5_frame]
            [halo5_frame]
                duration=1
            [/halo5_frame]
        [/if]

        [frame]
            image="units/undead-necromancers/ancient-lich-magic-1.png:850"
        [/frame]
        {SOUND:HIT_AND_MISS magic-faeriefire.ogg magic-faeriefire-miss.ogg 0}
        [frame]
            image="units/undead-necromancers/ancient-lich.png:250"
        [/frame]
    [/animation]

    {LIGHTNING_ANIMATION_RAVANAL 1}
    {LIGHTNING_ANIMATION_RAVANAL 2}
    {LIGHTNING_ANIMATION_RAVANAL 3}

    {LIGHTNING_ANIMATION_RAVANAL_SELF 1}
    {LIGHTNING_ANIMATION_RAVANAL_SELF 2}
    {LIGHTNING_ANIMATION_RAVANAL_SELF 3}
[/unit_type]
