#textdomain wesnoth-Invasion_from_the_Unknown

[scenario]
    id=23C_Broken_Heart
    name= _ "Broken Heart"
    {MAP 23C_Broken_Heart.map}
    turns=-1
    next_scenario=23Cx_Finale
    victory_when_enemies_defeated=no
    {NO_RECALLS}

    {SCENARIO_MUSIC       "the_city_falls.ogg"}
    {EXTRA_SCENARIO_MUSIC "casualties_of_war.ogg"}
    {EXTRA_SCENARIO_MUSIC "legends_of_the_north.ogg"}

    {DEEP_UNDERGROUND} {SCHEDULE_LIGHTING -20 -40 -10}

    {DEATHS_ACT_4}

    # wmllint: validate-off
    [side]
        side=1
        controller=human
        team_name=good
        user_team_name= _ "team_name^Galas"

        shroud=yes

        {NO_ECONOMY}

        # wmllint: recognize Galas
        {CHARACTER_STATS_GALAS}
    [/side]
    # wmllint: validate-on

    [side]
        side=2
        team_name=enemies
        user_team_name= _ "team_name^Uria"
        {CHAOS_FLAG}
        color=gold

        no_leader=yes
        hidden=yes
        {NO_ECONOMY}

        {ai/aliases/stable_singleplayer.cfg}
        [ai]
            {AI_SIMPLE_ALWAYS_ASPECT village_value          0.00}
            {AI_SIMPLE_ALWAYS_ASPECT leader_ignores_keep     yes}
        [/ai]

        {SIDE_GENERIC_GUARD (Demon Zephyr)  18 51}
        {SIDE_GENERIC_GUARD (Demon Zephyr)  24 48}
        {SIDE_GENERIC_GUARD (Demon Zephyr)  28 53}
    [/side]

    [side]
        side=3
        team_name=enemies
        user_team_name= _ "team_name^Dark Hive"
        {CHAOS_FLAG}
        color=brown

        no_leader=yes
        hidden=yes
        {NO_ECONOMY}

        {ai/aliases/stable_singleplayer.cfg}
        [ai]
            {AI_SIMPLE_ALWAYS_ASPECT aggression             9.00}
            {AI_SIMPLE_ALWAYS_ASPECT caution                0.00}
            {AI_SIMPLE_ALWAYS_ASPECT village_value          0.00}
            {AI_SIMPLE_ALWAYS_ASPECT simple_targeting        yes}
            {AI_SIMPLE_ALWAYS_ASPECT grouping                 no}
        [/ai]

        # Used to disable mood music on hero deaths.
        [unit]
            type=Tux
            id=Tux
            x,y=1,1
        [/unit]

        {SIDE_GENERIC_GUARD (Shaxthal Drone)         22 47} {VARIATION surface}

        {SIDE_GENERIC_GUARD (Shaxthal Drone)         11 30}

        {SIDE_GENERIC_GUARD (Shaxthal Sentry Drone)  19 25}
        {SIDE_GENERIC_GUARD (Shaxthal Sentry Drone)  20 30}
        {SIDE_GENERIC_GUARD (Shaxthal Assault Drone)  8 23} {FACING se}
        {SIDE_GENERIC_GUARD (Shaxthal Rayblade)      19 33} {FACING nw}

        {SIDE_GENERIC_GUARD (Shaxthal Runner Drone)  23 30} {FACING nw}

        {SIDE_GENERIC_GUARD (Shaxthal Assault Drone) 31 27}
        {SIDE_GENERIC_GUARD (Shaxthal Drone)         16 31}
        {SIDE_GENERIC_GUARD (Shaxthal Drone)         34 34}
        {SIDE_GENERIC_GUARD (Shaxthal Drone)         34 36}

        {SIDE_GENERIC_GUARD (Shaxthal Sentry Drone)  39 32} {FACING nw}

        {SIDE_GENERIC_GUARD (Shaxthal Rayblade)      36 21}

        {SIDE_GENERIC_GUARD (Shaxthal Sentry Drone)  27 15} {FACING se}
        {SIDE_GENERIC_GUARD (Shaxthal Sentry Drone)  25 15} {FACING se}

        {SIDE_GENERIC_GUARD (Shaxthal Assault Drone) 33 13}

        {SIDE_GENERIC_GUARD (Shaxthal Drone)         37  6} {VARIATION surface}
        {SIDE_GENERIC_GUARD (Shaxthal Drone)         39  5} {VARIATION surface}
        {SIDE_GENERIC_GUARD (Shaxthal Drone)         38  7} {VARIATION surface}

#ifndef EASY

#ifdef HARD
        {SIDE_GENERIC_GUARD (Shaxthal Assault Drone) 38  1}
        {SIDE_GENERIC_GUARD (Shaxthal Assault Drone) 26  3}
#else
        {SIDE_GENERIC_GUARD (Shaxthal Drone)         38  1}
        {SIDE_GENERIC_GUARD (Shaxthal Drone)         26  3}
#endif

#endif
    [/side]

    [side]
        side=4
        team_name=enemies
        user_team_name= _ "team_name^Chaos Empire"
        {CHAOS_FLAG}

        no_leader=yes
        hidden=yes
        {NO_ECONOMY}

        {ai/aliases/stable_singleplayer.cfg}
        [ai]
            {AI_SIMPLE_ALWAYS_ASPECT village_value          0.00}
            {AI_SIMPLE_ALWAYS_ASPECT leader_ignores_keep     yes}
        [/ai]
    [/side]

    [side]
        side=5
        team_name=enemies
        user_team_name= _ "team_name^Dark Hive"
        {CHAOS_FLAG}
        color=black

        no_leader=yes
        hidden=yes
        {NO_ECONOMY}

        {ai/aliases/stable_singleplayer.cfg}
        [ai]
            # These are more cowardly units fleeing the destruction.
            {AI_SIMPLE_ALWAYS_ASPECT aggression             0.10}
            {AI_SIMPLE_ALWAYS_ASPECT caution                1.00}
            {AI_SIMPLE_ALWAYS_ASPECT village_value          0.00}
            {AI_SIMPLE_ALWAYS_ASPECT simple_targeting        yes}
            {AI_SIMPLE_ALWAYS_ASPECT grouping                 no}
        [/ai]

        {SIDE_GENERIC_GUARD (Chaos Invoker) 31 18}
        {SIDE_GENERIC_GUARD (Chaos Invader) 35 21}
        {SIDE_GENERIC_GUARD (Chaos Invader) 40 15}
        {SIDE_GENERIC_GUARD (Chaos Hound)   40 24}
        {SIDE_GENERIC_GUARD (Chaos Hound)   41 26}
        {SIDE_GENERIC_GUARD (Chaos Invader) 29 26}
        {SIDE_GENERIC_GUARD (Chaos Invoker) 27 31}
        {SIDE_GENERIC_GUARD (Chaos Invader) 36 34}

        {SIDE_GENERIC_GUARD (Chaos Bowman)  13 26}
        {SIDE_GENERIC_GUARD (Chaos Invoker) 18 28}
        {SIDE_GENERIC_GUARD (Chaos Invoker) 18 31}
    [/side]

    [side]
        side=6
        team_name=enemies
        user_team_name= _ "team_name^Dark Hive"
        {CHAOS_FLAG}
        color=black

        no_leader=yes
        hidden=yes
        {NO_ECONOMY}
    [/side]

    {HIVE_NOISE_2_SOUND_SOURCE}
    [+sound_source]
        id=floor1_ss # wmllint: ignore
    [/sound_source]

    {OBJ_HEALING_GLYPH  8 30}
    {OBJ_HEALING_GLYPH 14 24}
    {OBJ_HEALING_GLYPH 30 30}
    {OBJ_HEALING_GLYPH 37 27}
    {OBJ_HEALING_GLYPH 35 23}
    {OBJ_HEALING_GLYPH 35 14}

    {SETUP_SHAXTHAL_ROAMING_SOUND_EFFECTS}

    [event]
        name=prestart

        [setup_doors]
            side=6
        [/setup_doors]

        # wmllint: recognize Elynia
        {RECALL_ELYNIA_AT      7 60}
        # wmllint: recognize Mal Keshar
        {RECALL_MAL_KESHAR_AT  7 58}
        # wmllint: recognize Lédinor
        {RECALL_LEDINOR_AT     9 58}
        # wmllint: recognize Igor
        {RECALL_IGOR_AT        7 59}

        [fire_event]
            name=checkpoint 0
        [/fire_event]

        {OBJECTIVES (
            {OBJECTIVE_VICTORY ( _ "Find an exit from the Heart fortress and move Galas, Elynia, or Mal Keshar to it")}

            {OBJECTIVE_DEFEAT ( _ "Death of Galas")}
            {OBJECTIVE_DEFEAT ( _ "Death of Elynia")}
            {OBJECTIVE_DEFEAT ( _ "Death of Mal Keshar")}
            {OBJECTIVE_DEFEAT ( _ "Death of Lédinor")}

            {TURNS_RUN_OUT}

            {OBJECTIVE_FULL_CARRYOVER}
        )}
    [/event]

    {FINAL_SCENARIO_PLAYER_RECRUITMENT_WITH_AUTORECALL}

    [event]
        name=prestart

        # Need to do this in a separate event due to the autorecall code.

        {FACE_DIRECTION side=1 ne}

        {FACE_DIRECTION id=Elynia sw}
    [/event]

    [event]
        name=start

        [message]
            speaker=Lédinor
            message= _ "We must not waste any more time, unless we want to be buried alive!"
        [/message]

        [delay]
            time=750
        [/delay]

        [message]
            speaker=Galas
            sound=rumble.ogg
            message= _ "Elynia, it’s over now. There is nothing more for us to do here. We must focus on surviving."
        [/message]

        [delay]
            time=250
        [/delay]

        {FACE_UNIT id=Elynia id=Galas}

        {QUAKE cave-in.ogg}

        [message]
            speaker=Elynia
            message= _ "... I know."
        [/message]
    [/event]

#define F_CHECKPOINT _CHECKPOINT_NUMBER _TURN_LIMIT _GOAL_SLF
    [event]
        name="checkpoint "+{_CHECKPOINT_NUMBER}

        [item]
            {_GOAL_SLF}
            image=items/gohere.png
        [/item]

        [modify_turns]
            add={_TURN_LIMIT}
        [/modify_turns]
    [/event]

    [event]
        name=enter hex
        [filter]
            id=Elynia,Galas,Mal Keshar
            [filter_location]
                {_GOAL_SLF}
            [/filter_location]
        [/filter]

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

        [print]
            text= _ "Checkpoint cleared"
            size=22 # slightly smaller than UI alerts
            {COLOR_HEAL}
        [/print]

        [fire_event]
            name="checkpoint $(1 + "+{_CHECKPOINT_NUMBER}+")"
        [/fire_event]
    [/event]
#enddef

    # Checkpoint 0 is enabled on prestart.

    {F_CHECKPOINT 0 8
    (
        x=20-21,22
        y=   46,45
    )}

    {F_CHECKPOINT 1 8
    (
        x,y=22,27
    )}

    {F_CHECKPOINT 2 10
    (
        x,y=38,11
    )}

    {F_CHECKPOINT 3 6
    (
        x=30-31,32
        y=    2, 1
    )}

    # Final checkpoint triggers victory.

    [event]
        name=checkpoint 4

        {ENDLEVEL_QUIET} {NO_START_OF_SCENARIO_SAVE}
    [/event]

#define F_PRE_MOVE_UNITS_TO_FLOOR_2 _SUF _X _Y
    #{VARIABLE p $floor_2_units.length}

    [store_unit]
        [filter]
            {_SUF}
            # Force on-map.
            x=1-1000
            y=1-1000
        [/filter]
        mode=append
        variable=floor_2_units
        kill=yes
    [/store_unit]

    [while]
        {VARIABLE_NUMERICAL_LESS_THAN_OR_EQUAL p "$($floor_2_units.length - 1)"}
        [do]
            [set_variables]
                mode=merge
                name="floor_2_units[$p]"
                [value]
                    moves=$floor_2_units[$p].max_moves
                    attacks_left=$floor_2_units[$p].max_attacks
                    x={_X}
                    y={_Y}
                [/value]
            [/set_variables]

            {VARIABLE_INC p}
        [/do]
    [/while]
#enddef

    [event]
        name=checkpoint 1

        {LOCK_VIEW}

        #
        # Move all units to floor 2.
        #

        {VARIABLE p 0}

        # The zeroth unit is always Galas, some code relies on this later.
        {F_PRE_MOVE_UNITS_TO_FLOOR_2 id=Galas         6 35}
        {F_PRE_MOVE_UNITS_TO_FLOOR_2 id=Elynia        7 35}
        {F_PRE_MOVE_UNITS_TO_FLOOR_2 (id=Mal Keshar)  5 35}
        {F_PRE_MOVE_UNITS_TO_FLOOR_2 id=Igor          6 36}

        [delay]
            time=750
        [/delay]

        [message]
            speaker=Lédinor
            message= _ "Huh?"
        [/message]

        {F_PRE_MOVE_UNITS_TO_FLOOR_2 id=Lédinor       6 34}
        {F_PRE_MOVE_UNITS_TO_FLOOR_2 side=1           6 35} # Remaining units.

        [hide_unit][/hide_unit]

        {FADE_TO_BLACK}

        [scroll_to]
            x,y=6,35
            {WARP}
        [/scroll_to]

        [place_shroud]
            side=1
        [/place_shroud]

        [redraw][/redraw]

        [fade_out_sound_effects][/fade_out_sound_effects]

        {REMOVE_SOUND_SOURCE floor1_ss}

        {CAVE_NOISE_SOUND_SOURCE}

        [reset_sound_effects][/reset_sound_effects]

        [replace_schedule]
            {INDOORS_HIVE} {SCHEDULE_LIGHTING 20 -30 -60}
        [/replace_schedule]

        {CLEAR_CAVE_SHROUD x,y,radius=6,35,6}

        [redraw][/redraw]

        {FADE_IN}

        [unhide_unit][/unhide_unit]

        [move_unit_fake]
            type=$floor_2_units[0].type
            side=$floor_2_units[0].side
            x= 6,$floor_2_units[0].x
            y=38,$floor_2_units[0].y
        [/move_unit_fake]

        [foreach]
            array=floor_2_units
            [do]
                {VARIABLE this_item.facing ne}

                [unstore_unit]
                    variable=this_item
                    find_vacant=yes
                    check_passability=yes
                [/unstore_unit]
            [/do]
        [/foreach]

        # This is needed for some reason, otherwise everyone is invisible until
        # Mal Keshar speaks (1.12.4+dev).
        [redraw][/redraw]

        {CLEAR_VARIABLE floor_2_units,p}

        [delay]
            time=750
        [/delay]

        [message]
            speaker=Igor
            message= _ "Lava! These tunnels are flooding with lava!"
        [/message]

        [message]
            speaker=Mal Keshar
            message= _ "It’s troubling that I am actually considering the possibility of returning to Inferno to escape this insanity."
        [/message]

        [message]
            speaker=Galas
            message= _ "Nonsense! We just must make haste and get to the surface! There ought to be an exit through the hive itself."
        [/message]

        [message]
            speaker=Lédinor
            message= _ "May I ask if anyone else heard that creature?"
        [/message]

        [message]
            speaker=Galas
            message= _ "What creature? Where?"
        [/message]

        [message]
            speaker=Lédinor
            message= _ "On the way to this section, in the snow-covered area... It may have been just my imagination, but I believe I heard somebody scream furiously from above."
        [/message]

        [modify_side]
            side=1
            fog=yes
        [/modify_side]

        # Force fog refresh now, otherwise fog covers player units.
        [redraw]
            side=1
        [/redraw]

        {UNLOCK_VIEW}

        #
        # And then Lédinor snaps in a few turns.
        #

        [event]
            delayed_variable_substitution=no
            name="turn $($turn_number + 2)"

            [fire_event]
                name=boss foreshadowing 1
            [/fire_event]
        [/event]

        [event]
            delayed_variable_substitution=no
            name="turn $($turn_number + 3)"

            [fire_event]
                name=boss foreshadowing 2
            [/fire_event]
        [/event]

        [event]
            delayed_variable_substitution=no
            name="turn $($turn_number + 5)"

            [fire_event]
                name=boss entrance
            [/fire_event]
        [/event]
    [/event]

    [event]
        name=boss foreshadowing 1

        [message]
            speaker=Lédinor
            message= _ "Ugh... This is no place for an elder like me. I feel ill. Perhaps it would be best for you if—"
        [/message]

        [message]
            speaker=Galas
            message= _ "NO! ... I mean... I apologize for that, my lord, but I must beg of you to keep going. I don’t want to lose anyone else after all we have been through."
        [/message]

        [message]
            speaker=Lédinor
            message= _ "... Fair enough. (coughs)"
        [/message]
    [/event]

    [event]
        name=boss foreshadowing 2

        [message]
            speaker=Lédinor
            message= _ "(coughs)"
        [/message]

        [message]
            speaker=Mal Keshar
            message= _ "Is something the matter, old elf?"
        [/message]

        [message]
            speaker=Lédinor
            message= _ "It’s only getting worse... it feels as if something wanted to burst out of my head. I pray to the Lords of Light that I may survive this ordeal..."
        [/message]
    [/event]

    #
    # Uria's revenge
    #

    [event]
        name=boss entrance

        [message]
            speaker=Lédinor
            message= _ "I can’t... continue... Galas, please go on without me..."
        [/message]

        [message]
            speaker=Galas
            message= _ "I refuse, my lord. I—"
        [/message]

        [message]
            speaker=Lédinor
            message= _ "ARGH! Galas, please— I— I remember that voice now—"
        [/message]

        [message]
            speaker=Lédinor
            message= _ "Her voice... She is—"
        [/message]

        {THUNDER (
            [store_unit]
                [filter]
                    id=Lédinor
                [/filter]
                variable=ledinor_store
            [/store_unit]

            [unit]
                side=2

                type=Shadow Courier
                id=Corrupted Lédinor
                name= _ "Lédinor"

                overwrite=yes
                x,y=$ledinor_store.x,$ledinor_store.y

                facing=$ledinor_store.facing
                experience=$ledinor_store.experience
                max_experience=$ledinor_store.max_experience

                {IS_BOSS}

                [modifications]
                    {TRAIT_STRONG}
                    {TRAIT_SLOW}
                [/modifications]
            [/unit]

            [repeat]
                times={DIFF 1 2 3}
                [do]
                    [unit]
                        side=2
                        type=Shadow Minion
                        x,y=$ledinor_store.x,$ledinor_store.y
                        passable=yes

                        random_traits=yes
                        random_gender=yes
                        generate_name=yes
                    [/unit]
                [/do]
            [/repeat]

            {CLEAR_VARIABLE ledinor_store}

            {BOSS_POPUP}
        )}

        [delay]
            time=1000
        [/delay]

        # wmllint: local spelling Ehhhhh

        [message]
            speaker=Mal Keshar
            message= _ "Ehhhhh... yuck. I thought it was only a figure of speech."
        [/message]

        [message]
            speaker=Galas
            message= _ "What are you?! What did you— What did you do to Lord Léd—" # wmllint: no spellcheck
        [/message]

        [message]
            speaker=Corrupted Lédinor
            # po: Corrupted Lédinor is actually Uria remote-possessing his
            # po: body, so "his" grammatical first person is feminine.
            message= _ "You may have escaped to Irdya, but I will not allow you to march away without due punishment for murdering my precious, most loyal vassal!"
        [/message]

        [message]
            speaker=Galas
            message= _ "Your vassal? Are you... No... It can’t be..."
        [/message]

        [message]
            speaker=Elynia
            message= _ "Galas... I fear that no matter what we try, we may never get Lédinor back. Uria must have infected his body in some way before we found him. This is—"
        [/message]
    [/event]

    #
    # The player *can* leave Lédinor behind, although he will most certainly
    # die (and odds are he will follow the player anyway).
    #

    [event]
        name=last breath
        [filter]
            id=Corrupted Lédinor
        [/filter]

        [message]
            speaker=Corrupted Lédinor
            message= _ "This is only the beginning, Lady of Light. The beginning of your downfall. Everything and everyone you hold dear shall perish in time. I—"
        [/message]

        [message]
            speaker=Mal Keshar
            message= _ "Take your words to the grave, spawn of Uria!"
        [/message]
    [/event]

    [event]
        name=die
        [filter]
            id=Corrupted Lédinor
        [/filter]

        [message]
            speaker=Igor
            message= _ "That was terrifying... I fear now to think of who’ll be next..."
        [/message]

        [message]
            speaker=Galas
            message= _ "He said he remembered her, Uria... She must have done this to him. It’s the only explanation... the only logical explanation..."
        [/message]

        [message]
            speaker=Elynia
            message= _ "We... really ought to make haste and get out of this dreadful place... lest we find out the exact method Uria uses to possess people like this."
        [/message]
    [/event]

    #
    # Random earthquake effect when units move.
    #

    [event]
        name=moveto,side turn
        first_time_only=no

        [lua]
            code= <<
                local rumble_seed = unsynced_random(1, 100)

                if rumble_seed % 5 == 0 then -- 20% chance
                    wesnoth.wml_actions.quake({ sound = "cave-in.ogg" })
                end

                if rumble_seed % 29 == 0 then -- 9.09% chance
                    wesnoth.wml_actions.sound({ name = "cave-in.ogg,cave-in.ogg,rumble.ogg" })
                end

                if rumble_seed % 51 == 0 then -- 1.96% chance
                    wesnoth.wml_actions.quake({ sound = "rumble.ogg" })
                end
            >>
        [/lua]

        [allow_undo][/allow_undo]
    [/event]

#define F_GLYPH _X _Y _MSG
    {ITEM_CRYSTAL_GLYPH_MESSAGE {_X} {_Y} }

    [event]
        name=moveto
        [filter]
            x={_X}
            y={_Y}
            side=1
        [/filter]

        [allow_undo][/allow_undo]

        {MSG_GLYPH ({_MSG})}
    [/event]
#enddef

    {F_GLYPH 27 40 (   "Winners don’t use debug mode.")}

    {F_GLYPH 34 39 ( _ "Your journey has just begun.")}

    #
    # Literally rocks fall, everybody dies.
    #

    [event]
        name=time over

        {QUAKE (rumble.ogg)}
        {QUAKE ()}
        {QUAKE ()}
        {QUAKE (rumble.ogg)}

        [message]
            speaker=Galas
            message= _ "No! The tunnel is collapsing on us! We weren’t fast enough—"
        [/message]

        [kill]
            side=1
            animate=yes
            fire_event=yes
        [/kill]
    [/event]

    #
    # One last challenge before the end.
    #

    [event]
        name=moveto
        [filter]
            side=1
            [filter_location]
                x,y,radius=39,10,6
            [/filter_location]
        [/filter]

        [unit]
            side=4
            canrecruit=yes
            type=Death Knight
            id=Lord Azghiel
            name= _ "Lord Azghiel"
            placement=leader
            facing=sw
            [modifications]
                {TRAIT_UNDEAD}
                {TRAIT_RESILIENT}
            [/modifications]
        [/unit]

        [unit]
            side=4
            type=Death Baron
            id=Darius
            name= _ "Darius"
            x,y=38,9
            facing=sw
            [modifications]
                {TRAIT_UNDEAD}
                {TRAIT_LOYAL}
            [/modifications]
        [/unit]

        [unit]
            type=Death Baron
            id=Durstrag
            name= _ "Durstrag"
            unrenamable=yes
            side=4
            x,y=40,10
            facing=sw
            [modifications]
                {TRAIT_UNDEAD}
                {TRAIT_LOYAL}
            [/modifications]
        [/unit]

        {CLEAR_CAVE_SHROUD x,y,radius=39,10,6}

        [redraw]
            side=1
        [/redraw]

        [scroll_to_unit]
            id=Lord Azghiel
        [/scroll_to_unit]

        [delay]
            time=750
        [/delay]

        [message]
            speaker=Lord Azghiel
            message= _ "There they are, the heathens! The Iron Council wants their heads. Get to it!"
        [/message]

        [message]
            speaker=Mal Keshar
            message= _ "(shakes head) Not again..."
        [/message]

        [message]
            speaker=Galas
            message= _ "Your emperor has fallen and this fortress is crumbling with him. Flee and get out of our way or we will have to destroy you!"
        [/message]
    [/event]

    [event]
        name=victory

        [message]
            speaker=Mal Keshar
            message= _ "Keep moving!"
        [/message]

        [set_variables]
            mode=replace
            name=finale_stats
            [literal]
                igor_died=no
                abandoned_ledinor=no
            [/literal]
        [/set_variables]

        [if]
            [have_unit]
                id=Lédinor
            [/have_unit]
            [then]
                #
                # This can't really happen unless the player has been cheating
                # to mess with the turn counter or unit movement points. But
                # anyway, for the sake of completeness...
                #

                [fire_event]
                    name=boss foreshadowing 2
                [/fire_event]

                [fire_event]
                    name=boss entrance
                [/fire_event]
            [/then]
        [/if]

        [if]
            [have_unit]
                id=Corrupted Lédinor
            [/have_unit]
            [then]
                [message]
                    speaker=Galas
                    message= _ "We can’t leave Lord Lédinor behind! We must—"
                [/message]

                [message]
                    speaker=Elynia
                    message= _ "It’s hopeless, Galas... Please, you must understand..."
                [/message]

                [message]
                    speaker=Mal Keshar
                    message= _ "Come on, boy, you ought to know better than this by now, after seeing what became of the Master of Darkness."
                [/message]

                [delay]
                    time=750
                [/delay]

                [message]
                    speaker=Galas
                    message= _ "I am sorry, my lord. I am so sorry..."
                [/message]

                {VARIABLE finale_stats.abandoned_ledinor yes}
            [/then]
        [/if]

        [if]
            [not]
                [have_unit]
                    id=Igor
                [/have_unit]
            [/not]
            [then]
                {VARIABLE finale_stats.igor_died yes}
            [/then]
        [/if]
    [/event]
[/scenario]

#undef F_GLYPH
#undef F_CHECKPOINT
#undef F_PRE_MOVE_UNITS_TO_FLOOR_2

# kate: indent-mode normal; encoding utf-8; space-indent on;


#textdomain wesnoth-Invasion_from_the_Unknown

[scenario]
    id=24_Epilogue
    name= _ "Epilogue"
    {MAP 24_Epilogue.map}
    turns=-1
    next_scenario=null
    victory_when_enemies_defeated=no
    {NO_RECALLS}

    {FULLSCREEN_CUTSCENE_UI}

    {SCENARIO_MUSIC "wanderer.ogg"} {CONTINUE_PLAYING_STORY_MUSIC_FIRST}

    {DAWN1}

    {STORYTXT_EPILOGUE}

    # wmllint: validate-off
    [side]
        side=1
        controller=human
        team_name=good
        user_team_name= _ "team_name^Galas"

        # Disable map preview.
        shroud=yes

        {NO_ECONOMY}

        # wmllint: recognize Galas
        {CHARACTER_STATS_GALAS}
    [/side]
    # wmllint: validate-on

    [event]
        name=prestart

        [modify_side]
            side=1
            shroud=no
        [/modify_side]

        # wmllint: recognize Elynia
        {RECALL_ELYNIA_AT     17 14}
        # wmllint: recognize Mal Keshar
        {RECALL_MAL_KESHAR_AT 20 13}
        # wmllint: recognize Igor
        {RECALL_IGOR_AT       17 11}

        {UNIT_TO_GLOBAL_STORE "Galas"      ending_stats_galas}
        {UNIT_TO_GLOBAL_STORE "Elynia"     ending_stats_elynia}
        {UNIT_TO_GLOBAL_STORE "Mal Keshar" ending_stats_malin}
        {UNIT_TO_GLOBAL_STORE "Igor"       ending_stats_igor}

        {FACE_UNIT      side=1    id=Elynia}
        {FACE_DIRECTION id=Elynia        sw}

        [teleport]
            [filter]
                id=Galas
            [/filter]
            x,y=19,12
        [/teleport]

        {BLACK_SCREEN}

        {LOCK_VIEW}
    [/event]

    [event]
        name=start

        {FADE_IN}

        [scroll_to_unit]
            id=Galas
        [/scroll_to_unit]

        [delay]
            time=2000
        [/delay]

        [message]
            speaker=Elynia
            message= _ "I understand that you wish to travel with me, Mal Keshar. But, what about you Galas? What will become of the elves who followed you to the Northlands?"
        [/message]

        [message]
            speaker=Galas
            message= _ "I have served my people long enough, I would say. To be honest, once Lord Inodien and Lady Unarye became more involved, my presence in our councils became somewhat redundant. And without Anlindë to guide my decisions anymore... Regardless, I was appointed by Lord Lédinor; now that my own appointed successors lead our people and the Chaos Emperor is no more, I feel I have fulfilled my duty."
        [/message]

        [delay]
            time=500
        [/delay]

        {FACE_UNIT id=Elynia id=Galas}

        [delay]
            time=500
        [/delay]

        [message]
            speaker=Elynia
            message= _ "So..."
        [/message]

        [message]
            speaker=Galas
            message= _ "For the first time in ages, I feel free and able to make my own choices again without the weight of an entire civilization resting on my shoulders. So, I must ask you... Would it be all right if I accompanied you on your next journey, Elynia? Because I suspect you are not planning on sitting here idly."
        [/message]

        [message]
            speaker=Elynia
            message= _ "... If that is what you want."
        [/message]

        [delay]
            time=500
        [/delay]

        {FACE_DIRECTION id=Elynia sw}

        [delay]
            time=500
        [/delay]

        [message]
            speaker=Elynia
            message= _ "There is a place I would like to visit... That island Althurin mentioned, Zocthanol."
        [/message]

        [message]
            speaker=Elynia
            message= _ "I fear that the collapse of the Heart fortress may have erased much information about the origins of Uria and Yechnagoth that could have helped us otherwise. However, the Quenoth elves did establish their new home on that island after destroying Yechnagoth; it is possible that they may have found out more about the nature of our enemies since then. I want to meet Quetor’el’s lore-keepers and see what else they might know that could help us."
        [/message]

        [message]
            speaker=Galas
            message= _ "That seems fair enough. But, how are we going to get there?"
        [/message]

        {FACE_UNIT id=Elynia id=Galas}

        [message]
            speaker=Elynia
            message= _ "Uh, we’ll sail across the ocean, of course. Surely our northern friends won’t mind if we borrow a ship or two."
        [/message]

        [message]
            speaker=Mal Keshar
            message= _ "There is something unsettling about all this, though. Even though we set Argan free from his suffering, and the destruction of his capital severed the connection Irdya had with Inferno, the demons of Uria continue to roam our world in large numbers, just as before. Is she still able to influence our world? Are there other gateways to Inferno still intact elsewhere? And we never really saw the Chaos Warlord again. If she somehow survived—"
        [/message]

        [message]
            speaker=Elynia
            message= _ "Then we’ll have to deal with her again, eventually. I know..."
        [/message]

        [delay]
            time=750
        [/delay]

        [message]
            speaker=Mal Keshar
            message= _ "And then there is that Mal Hekuba and the Iron Council. I don’t suspect they will give up easily, and we are still in enemy territory."
        [/message]

        [message]
            speaker=Elynia
            message= _ "Between the ongoing war and the loss of their capital, my hope is that they will be too preoccupied struggling against the Alliance in the north to hunt us down. (sighs)"
        [/message]

        {FACE_DIRECTION id=Elynia sw}

        [delay]
            time=750
        [/delay]

        [message]
            speaker=Elynia
            message= _ "I understand your concern, but there is hardly anything we can do with the scarce information we possess regarding Uria and her followers right now."
        [/message]

        {IF_HAVE_IGOR (
            [message]
                speaker=Galas
                message= _ "What about you, Igor? What will you do next?"
            [/message]

            [message]
                speaker=Igor
                message= _ "Well... I actually wonder how I survived all that... I feel like a legend now, heh. But... perhaps it’s time I find a nice place to settle in and live the rest of my days in peace, you know? Obviously not here, not in these lands with those wicked men everywhere. Could I follow you on a journey a last time? If that’s all right with you, that is."
            [/message]

            [message]
                speaker=Mal Keshar
                message= _ "Oh, of course it is. I would not even think of abandoning you and your trusty steed now that we have been reduced to such a small band of fugitives. (turns menacingly) I do need to raise a new army to protect us, after all."
            [/message]

            {FACE_UNIT id=Elynia (id=Mal Keshar)}

            [message]
                speaker=Elynia
                message= _ "(glaring) Don’t you dare."
            [/message]

            [message]
                speaker=Mal Keshar
                message= _ "You always ruin everything for me. Why do I even tolerate this, I wonder..."
            [/message]

            [message]
                speaker=Galas
                message= _ "It is fine, Igor. We will miss you when we finally part ways."
            [/message]

            [message]
                speaker=Igor
                message= _ "Oh, I’ll miss you too, friends. (sniffles)"
            [/message]
        )}

        [message]
            speaker=Galas
            message= _ "Let us return to the Far North, then. I would like to pay a visit to our people as well."
        [/message]

        [message]
            speaker=Mal Keshar
            message= _ "Hah! So you do miss being in a position of power after all!"
        [/message]

        [message]
            speaker=Galas
            message= _ "No, no, it’s nothing like that. I just want to speak to my comrades again — it has been far too long since I last saw their faces."
        [/message]

        [delay]
            time=750
        [/delay]

        [kill][/kill]

        {FADE_TO_BLACK}

        [modify_side]
            side=1
            shroud=yes
        [/modify_side]

        [place_shroud]
            side=1
        [/place_shroud]

        [redraw][/redraw]

        [fade_out_music]
            duration=4000
        [/fade_out_music]

        [outro_teaser][/outro_teaser]

        {REPLACE_SCENARIO_MUSIC return_to_wesnoth.ogg}

        {ENDLEVEL_QUIET} {NO_REPLAY_SAVE}

        [+endlevel]
            end_text=" "
            # Approx. duration of the RtW fanfare minus 2000 ms
            end_text_duration=1330
        [/endlevel]
    [/event]
[/scenario]

# kate: indent-mode normal; encoding utf-8; space-indent on;


#textdomain wesnoth-Invasion_from_the_Unknown

# Include units WML directory
{LD /units/alien-verlissh}

# kate: indent-mode normal; encoding utf-8; space-indent on;


#textdomain wesnoth-Invasion_from_the_Unknown

# Include units WML directories
{LD /units/demons}


#textdomain wesnoth-Invasion_from_the_Unknown

# Include units WML directory
{LD /units/dwarves}

# kate: indent-mode normal; encoding utf-8; space-indent on;


#textdomain wesnoth-Invasion_from_the_Unknown

# Include units WML directory
{LD /units/elves-wood}

#
# Setup unit type clones for variable-cost recruitment of
# elvish units starting from scenario 5 (or 4 in the case of
# the Elvish Scout).
#

#define VARIABLE_COST_RECRUIT _UNIT_TYPE_ID _SCENARIO_NUM _COST
    [unit_type]
        [base_unit]
            id={_UNIT_TYPE_ID}
        [/base_unit]
        id={_UNIT_TYPE_ID}+" scenario"+{_SCENARIO_NUM}
        cost={_COST}
        hide_help=true

        [event]
            id="variable_cost_recruit_controller:"+{_UNIT_TYPE_ID}+" scenario"+{_SCENARIO_NUM}
            name=prerecruit
            first_time_only=no
            [filter]
                type={_UNIT_TYPE_ID}+" scenario"+{_SCENARIO_NUM}
            [/filter]

            {VARIABLE unit.type ({_UNIT_TYPE_ID})}

            [unstore_unit]
                variable=unit
                find_vacant=no
            [/unstore_unit]
        [/event]
    [/unit_type]
#enddef

#define VCR_ELVISH_ARCHER _SCENARIO_NUM _COST
    {VARIABLE_COST_RECRUIT ("Elvish Archer") ({_SCENARIO_NUM}) ({_COST})}
#enddef

{VCR_ELVISH_ARCHER  5 18}
{VCR_ELVISH_ARCHER  6 18}
{VCR_ELVISH_ARCHER  7 19}
{VCR_ELVISH_ARCHER  8 20}
{VCR_ELVISH_ARCHER  9 21}
{VCR_ELVISH_ARCHER 10 22}
{VCR_ELVISH_ARCHER 11 23}
{VCR_ELVISH_ARCHER 14 24}
{VCR_ELVISH_ARCHER 15 25}
{VCR_ELVISH_ARCHER 16 26}
{VCR_ELVISH_ARCHER 17 27}
{VCR_ELVISH_ARCHER 18 28}

#undef VCR_ELVISH_ARCHER

#define VCR_ELVISH_CIVILIAN _SCENARIO_NUM _COST
    {VARIABLE_COST_RECRUIT ("Elvish Civilian") ({_SCENARIO_NUM}) ({_COST})}
#enddef

{VCR_ELVISH_CIVILIAN  5  8}
{VCR_ELVISH_CIVILIAN  6  8}
{VCR_ELVISH_CIVILIAN  7  8}
{VCR_ELVISH_CIVILIAN  8  9}
{VCR_ELVISH_CIVILIAN  9  9}
{VCR_ELVISH_CIVILIAN 10  9}
{VCR_ELVISH_CIVILIAN 11 10}
{VCR_ELVISH_CIVILIAN 14 10}
{VCR_ELVISH_CIVILIAN 15 10}
{VCR_ELVISH_CIVILIAN 16 11}
{VCR_ELVISH_CIVILIAN 17 11}
{VCR_ELVISH_CIVILIAN 18 11}

#undef VCR_ELVISH_CIVILIAN

#define VCR_ELVISH_HUNTER _SCENARIO_NUM _COST
    {VARIABLE_COST_RECRUIT ("Elvish Hunter") ({_SCENARIO_NUM}) ({_COST})}
#enddef

{VCR_ELVISH_HUNTER  5 17}
{VCR_ELVISH_HUNTER  6 18}
{VCR_ELVISH_HUNTER  7 19}
{VCR_ELVISH_HUNTER  8 20}
{VCR_ELVISH_HUNTER  9 21}
{VCR_ELVISH_HUNTER 10 22}
{VCR_ELVISH_HUNTER 11 23}
{VCR_ELVISH_HUNTER 14 24}
{VCR_ELVISH_HUNTER 15 25}
{VCR_ELVISH_HUNTER 16 26}
{VCR_ELVISH_HUNTER 17 27}
{VCR_ELVISH_HUNTER 18 28}

#undef VCR_ELVISH_HUNTER

#define VCR_ELVISH_FIGHTER _SCENARIO_NUM _COST
    {VARIABLE_COST_RECRUIT ("Elvish Fighter") ({_SCENARIO_NUM}) ({_COST})}
#enddef

{VCR_ELVISH_FIGHTER  5 15}
{VCR_ELVISH_FIGHTER  6 16}
{VCR_ELVISH_FIGHTER  7 17}
{VCR_ELVISH_FIGHTER  8 18}
{VCR_ELVISH_FIGHTER  9 19}
{VCR_ELVISH_FIGHTER 10 20}
{VCR_ELVISH_FIGHTER 11 21}
{VCR_ELVISH_FIGHTER 14 22}
{VCR_ELVISH_FIGHTER 15 23}
{VCR_ELVISH_FIGHTER 16 24}
{VCR_ELVISH_FIGHTER 17 25}
{VCR_ELVISH_FIGHTER 18 26}

#undef VCR_ELVISH_FIGHTER

#define VCR_ELVISH_SCOUT _SCENARIO_NUM _COST
    {VARIABLE_COST_RECRUIT ("Elvish Scout") ({_SCENARIO_NUM}) ({_COST})}
#enddef

# Sustaining and breeding horses is even harder,
# so these become more expensive a scenario earlier
# than the rest.
{VCR_ELVISH_SCOUT  4 19}
{VCR_ELVISH_SCOUT  5 20}
{VCR_ELVISH_SCOUT  6 21}
{VCR_ELVISH_SCOUT  7 22}
{VCR_ELVISH_SCOUT  8 23}
{VCR_ELVISH_SCOUT  9 24}
{VCR_ELVISH_SCOUT 10 25}
{VCR_ELVISH_SCOUT 11 26}
{VCR_ELVISH_SCOUT 14 27}
{VCR_ELVISH_SCOUT 15 28}
{VCR_ELVISH_SCOUT 16 29}
{VCR_ELVISH_SCOUT 17 30}
{VCR_ELVISH_SCOUT 18 31}

#undef VCR_ELVISH_SCOUT

#define VCR_ELVISH_SHAMAN _SCENARIO_NUM _COST
    {VARIABLE_COST_RECRUIT ("Elvish Shaman") ({_SCENARIO_NUM}) ({_COST})}
#enddef

{VCR_ELVISH_SHAMAN  5 15}
{VCR_ELVISH_SHAMAN  6 15}
{VCR_ELVISH_SHAMAN  7 15}
{VCR_ELVISH_SHAMAN  8 15}
{VCR_ELVISH_SHAMAN  9 16}
{VCR_ELVISH_SHAMAN 10 16}
{VCR_ELVISH_SHAMAN 11 16}
{VCR_ELVISH_SHAMAN 14 16}
{VCR_ELVISH_SHAMAN 15 17}
{VCR_ELVISH_SHAMAN 16 17}
{VCR_ELVISH_SHAMAN 17 17}
{VCR_ELVISH_SHAMAN 18 17}

#undef VCR_ELVISH_SHAMAN

#undef VARIABLE_COST_RECRUIT

# kate: indent-mode normal; encoding utf-8; space-indent on;


#textdomain wesnoth-Invasion_from_the_Unknown

# Include units WML directory
{LD /units/faeries}


#textdomain wesnoth-Invasion_from_the_Unknown

# Fake units WML stub
#
# NOTE: in ./fake we should put only those units which have a mainline race= value set,
# otherwise it's not guaranteed that at the time of WML parsing these dirs the race= was
# already declared in a [race] structure for the linear cache, and would result in an invalid race id.
# Which we don't want if the unit is not intended for something else than a [move_unit_fake]

# Include units WML directory
{LD /units/fake}


#textdomain wesnoth-Invasion_from_the_Unknown

# Include units WML directory
{LD /units/mechanical}


#textdomain wesnoth-Invasion_from_the_Unknown

#define NPC_MAY_NOT_ENTER_VILLAGES
    [movement_costs]
        village={UNREACHABLE}
    [/movement_costs]
#enddef

# Include units WML directory
{LD /units/monsters}

#undef NPC_MAY_NOT_ENTER_VILLAGES


#textdomain wesnoth-Invasion_from_the_Unknown

# Include units WML directory
{LD /units/shaxthal}


#textdomain wesnoth-Invasion_from_the_Unknown

[race]
    id=elvish_spirits
    male_name= _ "race^Elvish Spirit"
    female_name= _ "race+female^Elvish Spirit"
    plural_name= _ "race^Elvish Spirits"
    description= _ "Many mighty elven warriors of ancient have died in such a way that their desire of fighting for a last time is not fulfilled. Thus, their souls cannot rest in peace forever, and seek to return to this world for getting their thirst quenched with a last glorious confrontation.

However, they usually cannot do so without help of necromancy. Since elves have always been opposed to allowing necromancy and their practitioners amongst their people, their ancestors have not had the opportunity to return to assist their kind, till now."
    num_traits=1
    ignore_global_traits=yes
    {TRAIT_UNDEAD}
    markov_chain_size=3
    {ELVISH_NAMES}
[/race]

[movetype]
    name=woodspirit
    flies=true
    [movement_costs]
        deep_water=2
        shallow_water=2
        reef=2
        swamp_water=1
        flat=1
        sand=1
        forest=1
        fungus=1
        hills=1
        mountains=1
        village=1
        castle=1
        cave=1
        unwalkable=1
        impassable=100
        frozen=1
    [/movement_costs]
    [defense]
        deep_water=50
        shallow_water=50
        swamp_water=50
        reef=50
        flat=50
        sand=50
        forest=40
        hills=50
        mountains=50
        village=50
        castle=50
        cave=50
        unwalkable=50
        frozen=50
        fungus=50
    [/defense]
    [resistance]
        blade=60
        pierce=60
        impact=60
        fire=100
        cold=80
        arcane=150
    [/resistance]
[/movetype]

[movetype]
    name=undeadmountedfoot
    [movement_costs]
        deep_water=5
        shallow_water=4
        swamp_water=4
        reef=3
        flat=1
        sand=2
        forest=3
        hills=2
        mountains=5
        village=1
        castle=1
        cave=2
        frozen=2
        unwalkable={UNREACHABLE}
        impassable={UNREACHABLE}
        fungus=3
    [/movement_costs]
    [defense]
        deep_water=90
        shallow_water=80
        swamp_water=80
        reef=70
        flat=60
        sand=70
        forest=70
        hills=60
        mountains=80
        village=60
        castle=60
        cave=60
        frozen=70
        unwalkable=80
        impassable=80
        fungus=70
    [/defense]
    [resistance]
        blade=90
        pierce=70
        impact=110
        fire=120
        cold=40
        # arcane was 200 in the original
        arcane=150
    [/resistance]
[/movetype]

# Make sure mainline Death Knight is not advancing from any other
# unit
#ifdef ENABLE_DEATH_KNIGHT
#undef ENABLE_DEATH_KNIGHT
#endif

# Include units WML directory
{LD /units/undead}


#textdomain wesnoth-Invasion_from_the_Unknown

[hide_help]
    race=merman,ogre,wose,drake
    # Heavy Infantryman is unfortunately still used by some chaos players
    type_adv_tree=Peasant,Bowman,Horseman,Cavalryman,Sergeant,Mage,Fencer
    type=Elder Mage,Royal Warrior,Chocobone,Elvish Lady,Elvish Sylph
[/hide_help]


#textdomain wesnoth-Invasion_from_the_Unknown

[unit_type]
    id=Prong Bug
    name= _ "Prong Bug"
    race=verlissh
    image="units/alien-verlissh/prongbug.png"
    hitpoints=32
    movement_type=fly
    movement=7
    experience=50
    level=1
    alignment=neutral
    advances_to=null
    {AMLA_DEFAULT}
    cost=19
    usage=scout
    description= _ "Amongst the Verlissh attack forces, some people have spotted strange creatures that resemble beetles, except for being larger than a wolf. Fortunately enough, these creatures’ performance in battle is nothing to fear, and their only apparent purpose seems to be scouting."
    die_sound=hiss-die.wav
    {DEFENSE_ANIM "units/alien-verlissh/prongbug.png" "units/alien-verlissh/prongbug.png" {SOUND_LIST:BAT_HIT} }
    [attack]
        name=fangs
        description={I18N:ATTACK_FANGS}
        icon=attacks/fangs-spider.png
        type=blade
        range=melee
        damage=6
        number=3
    [/attack]
    [attack_anim]
        [filter_attack]
            name=fangs
        [/filter_attack]
        start_time=-100
        [if]
            hits=yes
            [frame]
                duration=200
                image="units/alien-verlissh/prongbug.png"
                sound=bite-small.ogg
            [/frame]
        [/if]
        [else]
            hits=no
            [frame]
                duration=200
                image="units/alien-verlissh/prongbug.png"
                sound={SOUND_LIST:MISS}
            [/frame]
        [/else]
    [/attack_anim]
[/unit_type]


#textdomain wesnoth-Invasion_from_the_Unknown

[unit_type]
    id=Shadow Courier
    name= _ "Shadow Courier"
    race=demon
    image="units/demons/shadow-courier.png"
    halo="halo/obscures-aura.png"
    hitpoints=62
    movement_type=demonfoot
    movement=4
    experience=200
    level=4
    alignment=chaotic
    advances_to=null
    {AMLA_DEFAULT}
    cost=75
    usage=healer
    [abilities]
        {ABILITY_CURES}
        {ABILITY_OBSCURE}
    [/abilities]
    description= _ "A few chosen ones from the ranks of the Chaos Lorekeepers are given knowledge and abilities that are forbidden to the common followers; they are the closest to the Emperor that anyone has ever been, and serve him as his right-hands. Although physically weak and slow after turning into demons, their magic skills more than compensate for such lack, making them opponents that should never be fought directly if possible."
    die_sound={SOUND_LIST:HUMAN_DIE}
    {DEFENSE_ANIM "units/demons/shadow-courier.png" "units/demons/shadow-courier.png" {SOUND_LIST:HUMAN_HIT} }
    [attack]
        name=plague staff
        description={TSTR_ATTACK_NAME_PLAGUE_STAFF}
        icon=attacks/staff-plague.png
        type=impact
        range=melee
        damage=7
        number=3
        [specials]
            {WEAPON_SPECIAL_PLAGUE}
        [/specials]
    [/attack]
    [attack]
        name=infernal chill
        description= _ "infernal chill"
        type=cold
        range=ranged
        [specials]
            {WEAPON_SPECIAL_MAGICAL}
        [/specials]
        damage=14
        number=3
        icon=attacks/iceball.png
    [/attack]
    [attack]
        name=noctum
        description= _ "noctum"
        type=arcane
        range=ranged
        damage=12
        number=4
        [specials]
            {WEAPON_SPECIAL_MAGICAL}
        [/specials]
    [/attack]
    [attack_anim]
        [filter_attack]
            name=noctum
        [/filter_attack]
        start_time=-400
        {MISSILE_FRAME_DARKNESS_BEAM}
        [frame]
            duration=180
            image="units/demons/shadow-courier.png"
        [/frame]
        [if]
            hits=yes
            [frame]
                duration=180
                image="units/demons/shadow-courier.png"
                sound=magic-dark-big.ogg
            [/frame]
        [/if]
        [else]
            hits=no
            [frame]
                duration=180
                image="units/demons/shadow-courier.png"
                sound=magic-dark-big-miss.ogg
            [/frame]
        [/else]
        [frame]
            duration=140
            image="units/demons/shadow-courier.png"
        [/frame]
    [/attack_anim]
    [attack_anim]
        [filter_attack]
            name=infernal chill
        [/filter_attack]
        {MISSILE_FRAME_INFERNAL_CHILL}
        [frame]
            begin=-300
            end=-250
            image="units/demons/shadow-courier.png"
            halo=halo/saurian-magic-halo-1.png
        [/frame]
        [frame]
            begin=-250
            end=-190
            image="units/demons/shadow-courier.png"
            halo=halo/saurian-magic-halo-2.png
            sound=magicmissile.wav
        [/frame]
        [frame]
            begin=-190
            end=-120
            image="units/demons/shadow-courier.png"
            halo=halo/saurian-magic-halo-3.png
        [/frame]
        [frame]
            begin=-120
            end=-40
            image="units/demons/shadow-courier.png"
            halo=halo/saurian-magic-halo-4.png
        [/frame]
        [frame]
            begin=-40
            end=50
            image="units/demons/shadow-courier.png"
            halo=halo/saurian-magic-halo-5.png
        [/frame]
        [frame]
            begin=50
            end=150
            image="units/demons/shadow-courier.png"
            halo=halo/saurian-magic-halo-6.png
        [/frame]
        [frame]
            begin=150
            end=250
            image="units/demons/shadow-courier.png"
            halo=halo/saurian-magic-halo-7.png
        [/frame]
    [/attack_anim]
    [attack_anim]
        [filter_attack]
            name=plague staff
        [/filter_attack]

        start_time=-200
        [frame]
            image="units/demons/shadow-courier.png:400"
        [/frame]

        {SOUND:HIT_AND_MISS staff.ogg staff-miss.ogg -125}
    [/attack_anim]
[/unit_type]


#textdomain wesnoth-Invasion_from_the_Unknown

[unit_type]
    id=Dwarvish Flamethrower
    name= _ "Dwarvish Flamethrower"
    race=dwarf
    image="units/dwarves/flamethrower.png"
    hitpoints=42
    movement_type=dwarvishfoot
    movement=4
    experience=100
    level=2
    alignment=neutral
    advances_to=null
    {AMLA_DEFAULT}
    [advancefrom]
        unit=Dwarvish Thunderer
    [/advancefrom]
    undead_variation=dwarf
    cost=35
    usage=mixed fighter
    description= _ "It is said that the Dwarven Flamethrowers have strange staves of wood and iron, similar to those of the Thunderguards; but instead of making a thunderous noise and shooting a projectile, their weapon generates a continuous tongue of flame."
    die_sound={SOUND_LIST:DWARF_DIE}
    #{DEFENSE_ANIM "units/dwarves/flamethrower-defend.png" "units/dwarves/flamethrower.png" {SOUND_LIST:DWARF_HIT} }
    {DEFENSE_ANIM "units/dwarves/flamethrower.png" "units/dwarves/flamethrower.png" {SOUND_LIST:DWARF_HIT} }
    [attack]
        name=dagger
        description={I18N:ATTACK_DAGGER}
        icon=attacks/dagger-human.png
        type=blade
        range=melee
        damage=7
        number=2
    [/attack]
    [attack]
        name=firestick
        description= _ "firestick"
        type=fire
        range=ranged
        damage=16
        number=3
        icon=attacks/thunderstick.png
    [/attack]
    [attack_anim]
        [filter_attack]
            name=dagger
        [/filter_attack]
        [frame]
            begin=-250
            end=-200
            image="units/dwarves/flamethrower.png"
        [/frame]
        [frame]
            begin=-200
            end=-100
            image="units/dwarves/flamethrower.png"
        [/frame]
        [if]
            hits=no
            [frame]
                begin=-100
                end=50
                #image="units/dwarves/thunderguard-attack1.png"
                image="units/dwarves/flamethrower.png"
                sound={SOUND_LIST:MISS}
            [/frame]
        [/if]
        [else]
            hits=yes
            [frame]
                begin=-100
                end=50
                #image="units/dwarves/thunderguard-attack1.png"
                image="units/dwarves/flamethrower.png"
                sound=dagger-swish.wav
            [/frame]
        [/else]
        [frame]
            begin=50
            end=100
            #image="units/dwarves/thunderguard-attack2.png"
            image="units/dwarves/flamethrower.png"
        [/frame]
        [frame]
            begin=100
            end=125
            image="units/dwarves/flamethrower.png"
        [/frame]
    [/attack_anim]
    [attack_anim]
        [filter_attack]
            name=firestick
        [/filter_attack]
        {MISSILE_FRAME_FIRE_BREATH 9,-34 9,15 22,-22 24,10}
        [if]
            hits=no
            [frame]
                begin=-400
                end=-350
                #image="units/dwarves/thunderguard-attack-ranged-s.png"
                image="units/dwarves/flamethrower.png"
                sound=flame-big-miss.ogg
            [/frame]
        [/if]
        [else]
            hits=yes
            [frame]
                begin=-400
                end=-350
                #image="units/dwarves/thunderguard-attack-ranged-s.png"
                image="units/dwarves/flamethrower.png"
                sound=flame-big.ogg
            [/frame]
        [/else]
        [frame]
            begin=-350
            end=-150
            #image="units/dwarves/thunderguard-attack-ranged-s.png"
            image="units/dwarves/flamethrower.png"
        [/frame]
        [frame]
            begin=-150
            end=0
            image="units/dwarves/flamethrower.png"
        [/frame]
    [/attack_anim]
[/unit_type]


#textdomain wesnoth-Invasion_from_the_Unknown

[unit_type]
    id=Dwarvish Steamwheel
    name= _ "Steamwheel"
    race=dwarf
    {TRAIT_ARMORED}
    image="units/dwarves/steamwheel.png"
    hitpoints=36
    movement_type=mounted
    movement=8
    experience=40
    level=1
    alignment=neutral
    advances_to=Dwarvish Thunderwheel
    cost=15
    undead_variation=dwarf
    usage=scout
    description= _ "Some Dwarves use strange vehicles that can move fast without a horse. It is said that these great wheeled vehicles are powered by invisible steam genies, and thus they are called ‘Steamwheels’."
    die_sound={SOUND_LIST:DWARF_DIE}
    {DEFENSE_ANIM "units/dwarves/steamwheel.png" "units/dwarves/steamwheel.png" {SOUND_LIST:DWARF_HIT} }
    [resistance]
        blade=100
        pierce=100
        impact=120
        fire=100
        cold=100
        arcane=90
    [/resistance]
    [attack]
        name=slam
        description={TSTR_ATTACK_NAME_SLAM}
        icon=attacks/blank-attack.png
        type=impact
        range=melee
        damage=14
        number=1
        [specials]
            {WEAPON_SPECIAL_CHARGE}
        [/specials]
    [/attack]
    [attack_anim]
        [filter_attack]
            name=slam
        [/filter_attack]
        [if]
            hits=no
            [frame]
                begin=-50
                end=150
                sound={SOUND_LIST:MISS}
            [/frame]
        [/if]
        [else]
            hits=yes
            [frame]
                begin=-50
                end=150
                sound=fist.ogg
            [/frame]
        [/else]
    [/attack_anim]
[/unit_type]


#textdomain wesnoth-Invasion_from_the_Unknown

[unit_type]
    id=Dwarvish Thunderwheel
    name= _ "Thunderwheel"
    race=dwarf
    {TRAIT_ARMORED}
    image="units/dwarves/thunderwheel.png"
    hitpoints=45
    movement_type=mounted
    movement=9
    experience=60
    level=2
    alignment=neutral
    advances_to=Dwarvish Warwheel
    cost=25
    undead_variation=dwarf
    usage=scout
    description= _ "With the help of one more steam genies, these noisy vehicles are able to move faster than horses."
    die_sound={SOUND_LIST:DWARF_DIE}
    {DEFENSE_ANIM "units/dwarves/thunderwheel.png" "units/dwarves/thunderwheel.png" {SOUND_LIST:DWARF_HIT} }
    [resistance]
        blade=100
        pierce=100
        impact=120
        fire=100
        cold=100
        arcane=90
    [/resistance]
    [attack]
        name=slam
        description={TSTR_ATTACK_NAME_SLAM}
        icon=attacks/blank-attack.png
        type=impact
        range=melee
        damage=20
        number=1
        [specials]
            {WEAPON_SPECIAL_CHARGE}
        [/specials]
    [/attack]
    [attack_anim]
        [filter_attack]
            name=slam
        [/filter_attack]
        [if]
            hits=no
            [frame]
                begin=-50
                end=150
                sound={SOUND_LIST:MISS}
            [/frame]
        [/if]
        [else]
            hits=yes
            [frame]
                begin=-50
                end=150
                sound=fist.ogg
            [/frame]
        [/else]
    [/attack_anim]
[/unit_type]


#textdomain wesnoth-Invasion_from_the_Unknown

[unit_type]
    id=Dwarvish Warwheel
    name= _ "Warwheel"
    race=dwarf
    {TRAIT_ARMORED}
    image="units/dwarves/warwheel.png"
    hitpoints=60
    movement_type=mounted
    movement=10
    experience=150
    level=3
    alignment=neutral
    advances_to=null
    {AMLA_DEFAULT}
    cost=35
    undead_variation=dwarf
    usage=scout
    description= _ "Warwheels are faster and more heavily armored than Steamwheels, and can breach enemy lines with their fearsome charge."
    die_sound={SOUND_LIST:DWARF_DIE}
    {DEFENSE_ANIM "units/dwarves/warwheel.png" "units/dwarves/warwheel.png" {SOUND_LIST:DWARF_HIT} }
    [resistance]
        blade=100
        pierce=100
        impact=120
        fire=100
        cold=100
        arcane=90
    [/resistance]
    [attack]
        name=slam
        description={TSTR_ATTACK_NAME_SLAM}
        icon=attacks/blank-attack.png
        type=impact
        range=melee
        damage=26
        number=1
        [specials]
            {WEAPON_SPECIAL_CHARGE}
        [/specials]
    [/attack]
    [attack_anim]
        [filter_attack]
            name=slam
        [/filter_attack]
        [if]
            hits=no
            [frame]
                begin=-50
                end=150
                sound={SOUND_LIST:MISS}
            [/frame]
        [/if]
        [else]
            hits=yes
            [frame]
                begin=-50
                end=150
                sound=fist.ogg
            [/frame]
        [/else]
    [/attack_anim]
[/unit_type]


#textdomain wesnoth-Invasion_from_the_Unknown

[unit_type]
    id=Anlinde Elvish Ascetic
    name= _ "female^Elvish Ascetic"
    race=elf
    gender=female
    image="units/elves-wood/anlinde-ascetic.png"
    profile="portraits/anlinde.png"
    hitpoints=43
    movement_type=woodland
    movement=5
    experience=100
    level=2
    alignment=neutral
    advances_to=Anlinde Elvish Mystic
    cost=35
    usage=mixed fighter
    [abilities]
        {ABILITY_UNPOISON}
    [/abilities]
    description= _ "Some elves have studied varieties of magic better suited for offensive purposes. Whence their knowledge and mastery of such arts came is not known, and they do not reveal their secrets. All that is known of their training is that they may spend a long time alone in the wilderness, not to appear for years, or in extreme cases, centuries.

For these ascetics, knowledge may be a curse at times, as their people tend to expect from them more that what they can offer without violating their own principles. Nonetheless, they may use their mastery of magic to lend a hand to fate--or to twist it. They possess good knowledge of both offensive and defensive spells. They often also have basic notions of medicine and can cure other creatures from the effects of poison."
    die_sound={SOUND_LIST:ELF_FEMALE_HIT}
    [resistance]
        arcane=100
    [/resistance]
    [attack]
        name=staff
        description={I18N:ATTACK_STAFF}
        icon="attacks/druidstaff.png"
        type=impact
        range=melee
        damage=4
        number=2
        range=melee
    [/attack]
    [attack]
        name=gossamer
        description={I18N:ATTACK_GOSSAMER}
        icon="attacks/web.png"
        type=impact
        [specials]
            {WEAPON_SPECIAL_SLOW}
        [/specials]
        damage=5
        number=2
        range=ranged
    [/attack]
    [attack]
        name=ethereal zephyr
        description=_"ethereal zephyr"
        icon="attacks/dark-missile.png"
        type=arcane
        damage=8
        number=3
        range=ranged
        [specials]
            {WEAPON_SPECIAL_MAGICAL}
        [/specials]
    [/attack]
    {DEFENSE_ANIM_RANGE "units/elves-wood/anlinde-ascetic.png" "units/elves-wood/anlinde-ascetic.png" {SOUND_LIST:ELF_FEMALE_HIT} melee }
    {DEFENSE_ANIM_ELVEN_RANGE "units/elves-wood/anlinde-ascetic.png" "units/elves-wood/anlinde-ascetic.png" {SOUND_LIST:ELF_FEMALE_HIT} ranged }
    [attack_anim]
        [filter_attack]
            name=ethereal zephyr
        [/filter_attack]
        start_time=-450
        {MISSILE_FRAME_FAERIE_FIRE}

        [if]
            hits=yes
            [frame]
                duration=75
                #image="units/elves-wood/anlinde-ascetic-magic.png"
                image="units/elves-wood/anlinde-ascetic.png"
                sound=magic-faeriefire.ogg

                halo=halo/elven/faerie-fire-halo1.png
                halo_x,halo_y=0,-28
            [/frame]
        [/if]
        [else]
            hits=no
            [frame]
                duration=75
                #image="units/elves-wood/anlinde-ascetic-magic.png"
                image="units/elves-wood/anlinde-ascetic.png"
                sound=magic-faeriefire-miss.ogg

                halo=halo/elven/faerie-fire-halo1.png
                halo_x,halo_y=0,-28
            [/frame]
        [/else]

        [frame]
            duration=75
            #image="units/elves-wood/anlinde-ascetic-magic.png"
            image="units/elves-wood/anlinde-ascetic.png"
            halo=halo/elven/faerie-fire-halo2.png
            halo_x,halo_y=0,-28
        [/frame]
        [frame]
            duration=75
            #image="units/elves-wood/anlinde-ascetic-magic.png"
            image="units/elves-wood/anlinde-ascetic.png"
            halo=halo/elven/faerie-fire-halo3.png
            halo_x,halo_y=0,-28
        [/frame]
        [frame]
            duration=75
            #image="units/elves-wood/anlinde-ascetic-magic.png"
            image="units/elves-wood/anlinde-ascetic.png"
            halo=halo/elven/faerie-fire-halo4.png
            halo_x,halo_y=0,-28
        [/frame]
        [frame]
            duration=75
            #image="units/elves-wood/anlinde-ascetic-magic.png"
            image="units/elves-wood/anlinde-ascetic.png"
            halo=halo/elven/faerie-fire-halo5.png
            halo_x,halo_y=0,-28
        [/frame]
        [frame]
            duration=75
            #image="units/elves-wood/anlinde-ascetic-magic.png"
            image="units/elves-wood/anlinde-ascetic.png"
            halo=halo/elven/faerie-fire-halo6.png
            halo_x,halo_y=0,-28
        [/frame]
        [frame]
            duration=75
            #image="units/elves-wood/anlinde-ascetic-magic.png"
            image="units/elves-wood/anlinde-ascetic.png"
            halo=halo/elven/faerie-fire-halo7.png
            halo_x,halo_y=0,-28
        [/frame]
    [/attack_anim]
    [attack_anim]
        [filter_attack]
            name=gossamer
        [/filter_attack]
        missile_start_time=-200
        start_time=-450
        [missile_frame]
            duration=250
            image="projectiles/web.png"
            image_diagonal="projectiles/web.png"
        [/missile_frame]
        [frame]
            duration=75
            #image="units/elves-wood/anlinde-ascetic-magic.png"
            image="units/elves-wood/anlinde-ascetic.png"
            halo=halo/elven/faerie-fire-halo1.png
            halo_x,halo_y=0,-28
        [/frame]
        [frame]
            duration=75
            #image="units/elves-wood/anlinde-ascetic-magic.png"
            image="units/elves-wood/anlinde-ascetic.png"
            halo=halo/elven/faerie-fire-halo2.png
            halo_x,halo_y=0,-28
        [/frame]
        [frame]
            duration=75
            #image="units/elves-wood/anlinde-ascetic-magic.png"
            image="units/elves-wood/anlinde-ascetic.png"
            halo=halo/elven/faerie-fire-halo3.png
            halo_x,halo_y=0,-28
        [/frame]
        [frame]
            duration=75
            #image="units/elves-wood/anlinde-ascetic-magic.png"
            image="units/elves-wood/anlinde-ascetic.png"
            halo=halo/elven/faerie-fire-halo4.png
            halo_x,halo_y=0,-28
        [/frame]
        [frame]
            duration=75
            #image="units/elves-wood/anlinde-ascetic-magic.png"
            image="units/elves-wood/anlinde-ascetic.png"
            halo=halo/elven/faerie-fire-halo5.png
            halo_x,halo_y=0,-28
        [/frame]
        [frame]
            duration=75
            #image="units/elves-wood/anlinde-ascetic-magic.png"
            image="units/elves-wood/anlinde-ascetic.png"
            halo=halo/elven/faerie-fire-halo6.png
            sound=entangle.wav
            halo_x,halo_y=0,-28
        [/frame]
        [frame]
            duration=75
            #image="units/elves-wood/anlinde-ascetic-magic.png"
            image="units/elves-wood/anlinde-ascetic.png"
            halo=halo/elven/faerie-fire-halo7.png
            halo_x,halo_y=0,-28
        [/frame]
    [/attack_anim]
    [attack_anim]
        [filter_attack]
            name=staff
        [/filter_attack]

        start_time=-200
        [frame]
            image="units/elves-wood/anlinde-ascetic.png:400"
        [/frame]

        {SOUND:HIT_AND_MISS staff.ogg staff-miss.ogg -125}
    [/attack_anim]

    [healing_anim]
        start_time=-300
        [frame]
            duration=75
            image="units/elves-wood/anlinde-ascetic.png"
            halo="halo/elven/druid-healing1.png"
        [/frame]
        [frame]
            duration=75
            image="units/elves-wood/anlinde-ascetic.png"
            halo="halo/elven/druid-healing2.png"
        [/frame]
        [frame]
            duration=75
            image="units/elves-wood/anlinde-ascetic.png"
            halo="halo/elven/druid-healing3.png"
        [/frame]
        [frame]
            duration=75
            image="units/elves-wood/anlinde-ascetic.png"
            halo="halo/elven/druid-healing4.png"
        [/frame]
        [frame]
            duration=75
            image="units/elves-wood/anlinde-ascetic.png"
            halo="halo/elven/druid-healing5.png"
        [/frame]
        [frame]
            duration=75
            image="units/elves-wood/anlinde-ascetic.png"
            halo="halo/elven/druid-healing6.png"
        [/frame]
        [frame]
            duration=75
            image="units/elves-wood/anlinde-ascetic.png"
            halo="halo/elven/druid-healing7.png"
        [/frame]
        [frame]
            duration=75
            image="units/elves-wood/anlinde-ascetic.png"
            halo="halo/elven/druid-healing8.png"
        [/frame]
    [/healing_anim]
[/unit_type]


#textdomain wesnoth-Invasion_from_the_Unknown

[unit_type]
    id=Anlinde Elvish Avatar
    name= _ "female^Elvish Avatar"
    race=elf
    gender=female
    image="units/elves-wood/anlinde-avatar.png"
    profile="portraits/anlinde.png"
    hitpoints=66
    movement_type=woodlandfloat
    movement=6
    experience=200
    level=4
    alignment=neutral
    advances_to=null
    {AMLA_FAERIE_TOUCH_DRAINS}
    {AMLA_GOSSAMER_L1}
    {AMLA_VITALITY}
    cost=110
    usage=mixed fighter
    [abilities]
        {ABILITY_CURES}
    [/abilities]
    description= _ "The great power attained by some mystics is often dreaded by the enemies of elvenkind. After a long path of learning — often lasting their entire lifetime — these avatars of wind and storm master the natural elements, and are capable of commanding them at their will.

Needless to say, these skills could be used to destroy the elvish civilization. Avatars are thus highly respected, often feared sages of their people. Power is both a gift and a curse — understanding and bearing this great responsibility is perhaps one of the last challenges that must be mastered by these mystics."
    die_sound={SOUND_LIST:ELF_FEMALE_HIT}
    [resistance]
        arcane=80
        fire=90
    [/resistance]
    [attack]
        name=faerie touch
        description={I18N:ATTACK_FAERIE_TOUCH}
        icon=attacks/touch-faerie.png
        type=impact
        [specials]
            {WEAPON_SPECIAL_MAGICAL}
        [/specials]
        range=melee
        damage=7
        number=3
        range=melee
    [/attack]
    [attack]
        name=gossamer
        description={I18N:ATTACK_GOSSAMER}
        icon="attacks/web.png"
        type=impact
        [specials]
            {WEAPON_SPECIAL_SLOW}
        [/specials]
        damage=8
        number=3
        range=ranged
    [/attack]
    [attack]
        name=ethereal storm
        description=_"ethereal storm"
        type=arcane
        [specials]
            {WEAPON_SPECIAL_MAGICAL}
        [/specials]
        damage=10
        number=5
        range=ranged
        icon=attacks/faerie-fire.png
    [/attack]
    #{DEFENSE_ANIM_RANGE "units/elves-wood/anlinde-avatar-defend.png" "units/elves-wood/anlinde-avatar.png" {SOUND_LIST:ELF_FEMALE_HIT} melee }
    #{DEFENSE_ANIM_ELVEN_RANGE "units/elves-wood/anlinde-avatar-defend.png" "units/elves-wood/anlinde-avatar.png" {SOUND_LIST:ELF_FEMALE_HIT} ranged }
    {DEFENSE_ANIM_RANGE "units/elves-wood/anlinde-avatar.png" "units/elves-wood/anlinde-avatar.png" {SOUND_LIST:ELF_FEMALE_HIT} melee }
    {DEFENSE_ANIM_ELVEN_RANGE "units/elves-wood/anlinde-avatar.png" "units/elves-wood/anlinde-avatar.png" {SOUND_LIST:ELF_FEMALE_HIT} ranged }
    [attack_anim]
        [filter_attack]
            name=ethereal storm
        [/filter_attack]
        start_time=-450
        {MISSILE_FRAME_FAERIE_FIRE}

        [if]
            hits=yes
            [frame]
                duration=75
                #image="units/elves-wood/anlinde-avatar-magic.png"
                image="units/elves-wood/anlinde-avatar.png"
                sound=magic-faeriefire.ogg

                halo=halo/elven/faerie-fire-halo1.png
                halo_x,halo_y=0,-28
            [/frame]
        [/if]
        [else]
            hits=no
            [frame]
                duration=75
                #image="units/elves-wood/anlinde-avatar-magic.png"
                image="units/elves-wood/anlinde-avatar.png"
                sound=magic-faeriefire-miss.ogg

                halo=halo/elven/faerie-fire-halo1.png
                halo_x,halo_y=0,-28
            [/frame]
        [/else]

        [frame]
            duration=75
            #image="units/elves-wood/anlinde-avatar-magic.png"
            image="units/elves-wood/anlinde-avatar.png"
            halo=halo/elven/faerie-fire-halo2.png
            halo_x,halo_y=0,-28
        [/frame]
        [frame]
            duration=75
            #image="units/elves-wood/anlinde-avatar-magic.png"
            image="units/elves-wood/anlinde-avatar.png"
            halo=halo/elven/faerie-fire-halo3.png
            halo_x,halo_y=0,-28
        [/frame]
        [frame]
            duration=75
            #image="units/elves-wood/anlinde-avatar-magic.png"
            image="units/elves-wood/anlinde-avatar.png"
            halo=halo/elven/faerie-fire-halo4.png
            halo_x,halo_y=0,-28
        [/frame]
        [frame]
            duration=75
            #image="units/elves-wood/anlinde-avatar-magic.png"
            image="units/elves-wood/anlinde-avatar.png"
            halo=halo/elven/faerie-fire-halo5.png
            halo_x,halo_y=0,-28
        [/frame]
        [frame]
            duration=75
            #image="units/elves-wood/anlinde-avatar-magic.png"
            image="units/elves-wood/anlinde-avatar.png"
            halo=halo/elven/faerie-fire-halo6.png
            halo_x,halo_y=0,-28
        [/frame]
        [frame]
            duration=75
            #image="units/elves-wood/anlinde-avatar-magic.png"
            image="units/elves-wood/anlinde-avatar.png"
            halo=halo/elven/faerie-fire-halo7.png
            halo_x,halo_y=0,-28
        [/frame]
    [/attack_anim]
    [attack_anim]
        [filter_attack]
            name=gossamer
        [/filter_attack]
        missile_start_time=-200
        start_time=-450
        [missile_frame]
            duration=250
            image="projectiles/web.png"
            image_diagonal="projectiles/web.png"
        [/missile_frame]
        [frame]
            duration=75
            #image="units/elves-wood/anlinde-avatar-magic.png"
            image="units/elves-wood/anlinde-avatar.png"
            halo=halo/elven/faerie-fire-halo1.png
            halo_x,halo_y=0,-28
        [/frame]
        [frame]
            duration=75
            #image="units/elves-wood/anlinde-avatar-magic.png"
            image="units/elves-wood/anlinde-avatar.png"
            halo=halo/elven/faerie-fire-halo2.png
            halo_x,halo_y=0,-28
        [/frame]
        [frame]
            duration=75
            #image="units/elves-wood/anlinde-avatar-magic.png"
            image="units/elves-wood/anlinde-avatar.png"
            halo=halo/elven/faerie-fire-halo3.png
            halo_x,halo_y=0,-28
        [/frame]
        [frame]
            duration=75
            #image="units/elves-wood/anlinde-avatar-magic.png"
            image="units/elves-wood/anlinde-avatar.png"
            halo=halo/elven/faerie-fire-halo4.png
            halo_x,halo_y=0,-28
        [/frame]
        [frame]
            duration=75
            #image="units/elves-wood/anlinde-avatar-magic.png"
            image="units/elves-wood/anlinde-avatar.png"
            halo=halo/elven/faerie-fire-halo5.png
            halo_x,halo_y=0,-28
        [/frame]
        [frame]
            duration=75
            #image="units/elves-wood/anlinde-avatar-magic.png"
            image="units/elves-wood/anlinde-avatar.png"
            halo=halo/elven/faerie-fire-halo6.png
            sound=entangle.wav
            halo_x,halo_y=0,-28
        [/frame]
        [frame]
            duration=75
            #image="units/elves-wood/anlinde-avatar-magic.png"
            image="units/elves-wood/anlinde-avatar.png"
            halo=halo/elven/faerie-fire-halo7.png
            halo_x,halo_y=0,-28
        [/frame]
    [/attack_anim]
    [attack_anim]
        [filter_attack]
            name=faerie touch
        [/filter_attack]
        [frame]
            begin=-200
            end=-100
            #image="units/elves-wood/anlinde-avatar-magic.png"
            image="units/elves-wood/anlinde-avatar.png"
        [/frame]
        [frame]
            begin=-100
            end=100
            #image="units/elves-wood/anlinde-avatar-melee.png"
            image="units/elves-wood/anlinde-avatar.png"
        [/frame]
        [frame]
            begin=100
            end=200
            #image="units/elves-wood/anlinde-avatar-magic.png"
            image="units/elves-wood/anlinde-avatar.png"
        [/frame]
    [/attack_anim]
    [healing_anim]
        start_time=-300
        [frame]
            duration=75
            image="units/elves-wood/anlinde-avatar.png"
            halo="halo/elven/druid-healing1.png"
        [/frame]
        [frame]
            duration=75
            image="units/elves-wood/anlinde-avatar.png"
            halo="halo/elven/druid-healing2.png"
        [/frame]
        [frame]
            duration=75
            image="units/elves-wood/anlinde-avatar.png"
            halo="halo/elven/druid-healing3.png"
        [/frame]
        [frame]
            duration=75
            image="units/elves-wood/anlinde-avatar.png"
            halo="halo/elven/druid-healing4.png"
        [/frame]
        [frame]
            duration=75
            image="units/elves-wood/anlinde-avatar.png"
            halo="halo/elven/druid-healing5.png"
        [/frame]
        [frame]
            duration=75
            image="units/elves-wood/anlinde-avatar.png"
            halo="halo/elven/druid-healing6.png"
        [/frame]
        [frame]
            duration=75
            image="units/elves-wood/anlinde-avatar.png"
            halo="halo/elven/druid-healing7.png"
        [/frame]
        [frame]
            duration=75
            image="units/elves-wood/anlinde-avatar.png"
            halo="halo/elven/druid-healing8.png"
        [/frame]
    [/healing_anim]
[/unit_type]


#textdomain wesnoth-Invasion_from_the_Unknown

[unit_type]
    id=Anlinde Elvish Mystic
    name= _ "female^Elvish Mystic"
    race=elf
    gender=female
    image="units/elves-wood/anlinde-mystic.png"
    profile="portraits/anlinde.png"
    hitpoints=52
    movement_type=woodland
    movement=5
    experience=230
    level=3
    alignment=neutral
    advances_to=Anlinde Elvish Avatar
    cost=70
    usage=mixed fighter
    [abilities]
        {ABILITY_HEALS}
        {ABILITY_UNPOISON}
    [/abilities]
    description= _ "Experienced mystics are of great value in the new Elvish society. Their great knowledge of history and magic, tolerance and fair judgement is what is sought for in a leader or advisor. In times of need, they are in charge of assisting their lords with worthy advice or even support on the battlefield. But they have not finished learning yet, and still wander about the world, seeking new questions to answer."
    die_sound={SOUND_LIST:ELF_FEMALE_HIT}
    [resistance]
        arcane=90
        fire=90
    [/resistance]
    [attack]
        name=staff
        description={I18N:ATTACK_STAFF}
        icon="attacks/druidstaff.png"
        type=impact
        range=melee
        damage=6
        number=3
        range=melee
    [/attack]
    [attack]
        name=gossamer
        description={I18N:ATTACK_GOSSAMER}
        icon="attacks/web.png"
        type=impact
        [specials]
            {WEAPON_SPECIAL_SLOW}
        [/specials]
        damage=6
        number=3
        range=ranged
    [/attack]
    [attack]
        name=ethereal zephyr
        description=_"ethereal zephyr"
        icon="attacks/dark-missile.png"
        type=arcane
        damage=9
        number=4
        range=ranged
        [specials]
            {WEAPON_SPECIAL_MAGICAL}
        [/specials]
    [/attack]
    #     {DEFENSE_ANIM_RANGE "units/elves-wood/anlinde-mystic-defend.png" "units/elves-wood/anlinde-mystic.png" {SOUND_LIST:ELF_FEMALE_HIT} melee }
    #     {DEFENSE_ANIM_ELVEN_RANGE "units/elves-wood/anlinde-mystic-defend.png" "units/elves-wood/anlinde-mystic.png" {SOUND_LIST:ELF_FEMALE_HIT} ranged }
    {DEFENSE_ANIM_RANGE "units/elves-wood/anlinde-mystic.png" "units/elves-wood/anlinde-mystic.png" {SOUND_LIST:ELF_FEMALE_HIT} melee }
    {DEFENSE_ANIM_ELVEN_RANGE "units/elves-wood/anlinde-mystic.png" "units/elves-wood/anlinde-mystic.png" {SOUND_LIST:ELF_FEMALE_HIT} ranged }
    [attack_anim]
        [filter_attack]
            name=ethereal zephyr
        [/filter_attack]
        start_time=-450
        {MISSILE_FRAME_FAERIE_FIRE}

        [if]
            hits=yes
            [frame]
                duration=75
                #image="units/elves-wood/anlinde-mystic-magic.png"
                image="units/elves-wood/anlinde-mystic.png"
                sound=magic-faeriefire.ogg

                halo=halo/elven/faerie-fire-halo1.png
                halo_x,halo_y=0,-28
            [/frame]
        [/if]
        [else]
            hits=no
            [frame]
                duration=75
                #image="units/elves-wood/anlinde-mystic-magic.png"
                image="units/elves-wood/anlinde-mystic.png"
                sound=magic-faeriefire-miss.ogg

                halo=halo/elven/faerie-fire-halo1.png
                halo_x,halo_y=0,-28
            [/frame]
        [/else]

        [frame]
            duration=75
            #image="units/elves-wood/anlinde-mystic-magic.png"
            image="units/elves-wood/anlinde-mystic.png"
            halo=halo/elven/faerie-fire-halo2.png
            halo_x,halo_y=0,-28
        [/frame]
        [frame]
            duration=75
            #image="units/elves-wood/anlinde-mystic-magic.png"
            image="units/elves-wood/anlinde-mystic.png"
            halo=halo/elven/faerie-fire-halo3.png
            halo_x,halo_y=0,-28
        [/frame]
        [frame]
            duration=75
            #image="units/elves-wood/anlinde-mystic-magic.png"
            image="units/elves-wood/anlinde-mystic.png"
            halo=halo/elven/faerie-fire-halo4.png
            halo_x,halo_y=0,-28
        [/frame]
        [frame]
            duration=75
            #image="units/elves-wood/anlinde-mystic-magic.png"
            image="units/elves-wood/anlinde-mystic.png"
            halo=halo/elven/faerie-fire-halo5.png
            halo_x,halo_y=0,-28
        [/frame]
        [frame]
            duration=75
            #image="units/elves-wood/anlinde-mystic-magic.png"
            image="units/elves-wood/anlinde-mystic.png"
            halo=halo/elven/faerie-fire-halo6.png
            halo_x,halo_y=0,-28
        [/frame]
        [frame]
            duration=75
            #image="units/elves-wood/anlinde-mystic-magic.png"
            image="units/elves-wood/anlinde-mystic.png"
            halo=halo/elven/faerie-fire-halo7.png
            halo_x,halo_y=0,-28
        [/frame]
    [/attack_anim]
    [attack_anim]
        [filter_attack]
            name=gossamer
        [/filter_attack]
        missile_start_time=-200
        start_time=-450
        [missile_frame]
            duration=250
            image="projectiles/web.png"
            image_diagonal="projectiles/web.png"
        [/missile_frame]
        [frame]
            duration=75
            #image="units/elves-wood/anlinde-mystic-magic.png"
            image="units/elves-wood/anlinde-mystic.png"
            halo=halo/elven/faerie-fire-halo1.png
            halo_x,halo_y=0,-28
        [/frame]
        [frame]
            duration=75
            #image="units/elves-wood/anlinde-mystic-magic.png"
            image="units/elves-wood/anlinde-mystic.png"
            halo=halo/elven/faerie-fire-halo2.png
            halo_x,halo_y=0,-28
        [/frame]
        [frame]
            duration=75
            #image="units/elves-wood/anlinde-mystic-magic.png"
            image="units/elves-wood/anlinde-mystic.png"
            halo=halo/elven/faerie-fire-halo3.png
            halo_x,halo_y=0,-28
        [/frame]
        [frame]
            duration=75
            #image="units/elves-wood/anlinde-mystic-magic.png"
            image="units/elves-wood/anlinde-mystic.png"
            halo=halo/elven/faerie-fire-halo4.png
            halo_x,halo_y=0,-28
        [/frame]
        [frame]
            duration=75
            #image="units/elves-wood/anlinde-mystic-magic.png"
            image="units/elves-wood/anlinde-mystic.png"
            halo=halo/elven/faerie-fire-halo5.png
            halo_x,halo_y=0,-28
        [/frame]
        [frame]
            duration=75
            #image="units/elves-wood/anlinde-mystic-magic.png"
            image="units/elves-wood/anlinde-mystic.png"
            halo=halo/elven/faerie-fire-halo6.png
            sound=entangle.wav
            halo_x,halo_y=0,-28
        [/frame]
        [frame]
            duration=75
            #image="units/elves-wood/anlinde-mystic-magic.png"
            image="units/elves-wood/anlinde-mystic.png"
            halo=halo/elven/faerie-fire-halo7.png
            halo_x,halo_y=0,-28
        [/frame]
    [/attack_anim]
    [attack_anim]
        [filter_attack]
            name=staff
        [/filter_attack]

        start_time=-200
        [frame]
            image="units/elves-wood/anlinde-mystic.png:400"
        [/frame]

        {SOUND:HIT_AND_MISS staff.ogg staff-miss.ogg -125}
    [/attack_anim]
    [healing_anim]
        start_time=-300
        [frame]
            duration=75
            image="units/elves-wood/anlinde-mystic.png"
            halo="halo/elven/druid-healing1.png"
        [/frame]
        [frame]
            duration=75
            image="units/elves-wood/anlinde-mystic.png"
            halo="halo/elven/druid-healing2.png"
        [/frame]
        [frame]
            duration=75
            image="units/elves-wood/anlinde-mystic.png"
            halo="halo/elven/druid-healing3.png"
        [/frame]
        [frame]
            duration=75
            image="units/elves-wood/anlinde-mystic.png"
            halo="halo/elven/druid-healing4.png"
        [/frame]
        [frame]
            duration=75
            image="units/elves-wood/anlinde-mystic.png"
            halo="halo/elven/druid-healing5.png"
        [/frame]
        [frame]
            duration=75
            image="units/elves-wood/anlinde-mystic.png"
            halo="halo/elven/druid-healing6.png"
        [/frame]
        [frame]
            duration=75
            image="units/elves-wood/anlinde-mystic.png"
            halo="halo/elven/druid-healing7.png"
        [/frame]
        [frame]
            duration=75
            image="units/elves-wood/anlinde-mystic.png"
            halo="halo/elven/druid-healing8.png"
        [/frame]
    [/healing_anim]
[/unit_type]


#textdomain wesnoth-Invasion_from_the_Unknown
# Thanks to Shadow/Wayfarer for the unit idea
[unit_type]
    id=Elvish Civilian
    name= _ "Elvish Civilian"
    race=elf
    gender=male,female
    image="units/elves-wood/civilian.png"
    profile="portraits/elves/fighter.png"
    hitpoints=22
    movement_type=woodland
    movement=5
    experience=25
    level=0
    alignment=neutral
    advances_to=Elvish Fighter,Elvish Archer,Elvish Hunter,Elvish Shaman
    cost=8
    usage=fighter
    description= _ "Despite not being of a particularly warlike nature, most elves are taught at very early age the basics of swordplay and archery. This enables them to defend themselves and form a militia to guard their homes in times of need."
    die_sound={SOUND_LIST:ELF_HIT}
    [attack]
        name=sword
        description={I18N:ATTACK_SWORD}
        icon=attacks/sword-elven.png
        type=blade
        range=melee
        damage=4
        number=3
    [/attack]
    [attack]
        name=bow
        description={I18N:ATTACK_BOW}
        icon=attacks/bow-short.png
        type=pierce
        range=ranged
        damage=3
        number=2
    [/attack]
    {DEFENSE_ANIM_RANGE "units/elves-wood/civilian-defend.png" "units/elves-wood/civilian.png" {SOUND_LIST:ELF_HIT} melee }
    {DEFENSE_ANIM_RANGE "units/elves-wood/civilian-defend.png" "units/elves-wood/civilian-bow.png" {SOUND_LIST:ELF_HIT} ranged }
    [attack_anim]
        [filter_attack]
            name=bow
        [/filter_attack]
        [missile_frame]
            begin=-150
            end=0
            image="projectiles/missile-n.png"
            image_diagonal="projectiles/missile-ne.png"
        [/missile_frame]
        [frame]
            begin=-445
            end=-380
            image="units/elves-wood/civilian-bow.png"
        [/frame]
        [if]
            hits=yes
            [frame]
                begin=-380
                end=-305
                image="units/elves-wood/civilian-bow.png"
                sound=bow.ogg
            [/frame]
        [/if]
        [else]
            hits=no
            [frame]
                begin=-380
                end=-305
                image="units/elves-wood/civilian-bow.png"
                sound=bow-miss.ogg
            [/frame]
        [/else]
        [frame]
            begin=-305
            end=-230
            image="units/elves-wood/civilian-bow.png"
        [/frame]
        [frame]
            begin=-230
            end=-130
            image="units/elves-wood/civilian-bow.png"
        [/frame]
        [frame]
            begin=-130
            end=0
            image="units/elves-wood/civilian-bow.png"
        [/frame]
        [frame]
            begin=0
            end=65
            image="units/elves-wood/civilian-bow.png"
        [/frame]
    [/attack_anim]
    [attack_anim]
        [filter_attack]
            name=sword
        [/filter_attack]
        [frame]
            begin=-175
            end=-100
            image="units/elves-wood/civilian.png"
        [/frame]
        [if]
            hits=yes
            [frame]
                begin=-100
                end=100
                image="units/elves-wood/civilian-melee.png"
                sound={SOUND_LIST:SWORD_SWISH}
            [/frame]
        [/if]
        [else]
            hits=no
            [frame]
                begin=-100
                end=100
                image="units/elves-wood/civilian-melee.png"
                sound={SOUND_LIST:MISS}
            [/frame]
        [/else]
        [frame]
            begin=100
            end=150
            image="units/elves-wood/civilian.png"
        [/frame]
        [frame]
            begin=150
            end=175
            image="units/elves-wood/civilian.png"
        [/frame]
    [/attack_anim]

    [male]
        gender=male
        advances_to=Elvish Fighter,Elvish Archer,Elvish Hunter
    [/male]

    # TODO: make female graphics and add them to [female] structure, so that there's an actual gender
    # differentiation aside from the markov name generator array, death and defense sounds.
    [female]
        name= _ "female^Elvish Civilian"
        gender=female
        profile="portraits/elves/archer+female.png"
        advances_to=Elvish Archer,Elvish Hunter,Elvish Shaman
        die_sound={SOUND_LIST:ELF_FEMALE_HIT}
        {DEFENSE_ANIM_RANGE "units/elves-wood/civilian-defend.png" "units/elves-wood/civilian.png" {SOUND_LIST:ELF_FEMALE_HIT} melee }
        {DEFENSE_ANIM_RANGE "units/elves-wood/civilian-defend.png" "units/elves-wood/civilian-bow.png" {SOUND_LIST:ELF_FEMALE_HIT} ranged }
    [/female]
[/unit_type]


#textdomain wesnoth-Invasion_from_the_Unknown

# From scenario 13_Face_your_Fate:
#
# Anlindë's death event
# TODO: she has already performed her death animation - now it would be
#       nice to put a sprite of her lying on the floor, almost dead, for
#       this event.
#
# Rather than a blank hex, this unit should have a sprite someday.

# wmllint: notecheck off
[unit_type]
    id=Anlinde Dead
    name= _ "female^Elvish Avatar"
    race=elf
    gender=female
    image="misc/blank-hex.png"
    profile="portraits/anlinde.png"
    ellipse=none
    hitpoints=66
    movement_type=none
    movement=6
    experience=200
    level=4
    alignment=neutral
    advances_to=null
    {AMLA_DEFAULT}
    cost=110
    usage=mixed fighter
    hide_help=true
    [abilities]
        {ABILITY_CURES}
    [/abilities]
    description="GO AWAY" # wmllint: noconvert
[/unit_type]
# wmllint: notecheck on


#textdomain wesnoth-Invasion_from_the_Unknown

[unit_type]
    id=Lady of Light
    name= _ "female^Lady of Light"
    race=faerie
    gender=female
    image="units/faeries/elynia.png"
    profile="portraits/elynia.png"
    halo="halo/elynia-stationary-halo[1~6].png:150"
    # initial base hitpoints
    hitpoints=64
    movement_type=elynia_lowfloat
    movement=6
    experience=70
    level=4
    alignment=neutral
    advances_to=null
    # Custom AMLAs below
    {AMLA_STRENGTH_L1}
    {AMLA_STRENGTH_L2}
    {AMLA_STRENGTH_L3}
    {AMLA_STRENGTH_L4}
    {AMLA_STRENGTH_L5}
    {AMLA_THORNS_L1}
    {AMLA_THORNS_L2}
    {AMLA_THORNS_L3}
    {AMLA_FOCUS_L1}
    {AMLA_FOCUS_L2}
    {AMLA_FOCUS_L3}
    {AMLA_SHIELDING_L1}
    {AMLA_SHIELDING_L2}
    {AMLA_SHIELDING_L3}
    {AMLA_VITALITY}
    cost=114
    usage=healer
    description= _ "While it is not exactly rare for elves to attain a faerie-like affinity with nature, none in recorded history can claim to have done so to the same degree as the legendary Lady of Light. Elynia’s divine heritage allows her to channel the power of the Lords of Light and cast a glow in even the darkest depths of Irdya, wielding it against all those who oppose the natural order.

Very little is known of her ultimate power, the Union of Light and Darkness once invoked by her and the Master of Darkness against the powerful Demon Lord Zhangor. And now that the Union has been fractured by a cruel twist of fate, it is doubtful that the mystery will ever be elucidated. Nevertheless, the essence of Light continues to radiate from her very skin and provide her with the strength to assist her people in their hour of need."
    die_sound={SOUND_LIST:ELF_FEMALE_HIT}
    [abilities]
        {ABILITY_SYLVAN_ESSENCE}
    [/abilities]
    [attack]
        name=staff
        description={I18N:ATTACK_STAFF}
        icon=attacks/staff-niryone.png
        type=impact
        damage=6
        number=3
        range=melee
    [/attack]
    [attack]
        name=ensnare
        description={I18N:ATTACK_ENSNARE}
        type=impact
        [specials]
            {WEAPON_SPECIAL_SLOW}
        [/specials]
        damage=8
        number=4
        range=ranged
        icon=attacks/entangle.png
    [/attack]
    [attack]
        name=faerie fire
        description={I18N:ATTACK_FAERIE_FIRE}
        type=arcane
        [specials]
            {WEAPON_SPECIAL_MAGICAL}
        [/specials]
        damage=10
        number=4
        range=ranged
        icon=attacks/faerie-fire.png
    [/attack]

    # Elynia's animations
    {ELYNIA_ANIM_DEFEND}
    {ELYNIA_ANIM_HEALING}
    {ELYNIA_ANIM_ATTACK_STAFF}
    {ELYNIA_ANIM_ATTACK_ENSNARE}
    {ELYNIA_ANIM_ATTACK_FAERIE_FIRE}
    {ELYNIA_ANIM_ATTACK_THORNS}
    {ELYNIA_ANIM_ATTACK_UNION}
    {ELYNIA_ANIM_EXTRA}
[/unit_type]

# kate: indent-mode normal; encoding utf-8; space-indent on;


#textdomain wesnoth-Invasion_from_the_Unknown

[unit_type]
    id=Sylvan Warden
    name= _ "female^Sylvan Warden"
    race=faerie
    gender=female
    image="units/faeries/elynia.png"
    profile="portraits/elynia.png"
    halo="halo/elynia-noillum-stationary-halo[1~6].png:150"
    hitpoints=61
    movement_type=elynia_lowfloat
    movement=6
    experience=150
    # She has levelled down after being rid of the Union
    level=3
    alignment=neutral
    advances_to=null
    {AMLA_VITALITY}
    cost=110
    usage=healer
    hide_help=true
    description= _ "Elynia’s mastery of faerie magic remains unrivaled on Irdya, even without the legendary power of the Union of Light and Darkness. Always dutiful as the sworn protector of elvenkind and the forests of Irdya, she will do anything to stop those who may threaten her people or upset the delicate balance of nature."
    die_sound={SOUND_LIST:ELF_FEMALE_HIT}
    [abilities]
        {ABILITY_SYLVAN_ESSENCE_NOUNION}
    [/abilities]
    [attack]
        name=staff
        description={I18N:ATTACK_STAFF}
        icon=attacks/staff-niryone.png
        type=impact
        damage=6
        number=3
        range=melee
    [/attack]
    [attack]
        name=ensnare
        description={I18N:ATTACK_ENSNARE}
        type=impact
        [specials]
            {WEAPON_SPECIAL_SLOW}
        [/specials]
        damage=6
        number=3
        range=ranged
        icon=attacks/entangle.png
    [/attack]
    [attack]
        name=mystic fire
        description= _ "mystic fire"
        icon=attacks/fireball.png
        type=fire
        [specials]
            {WEAPON_SPECIAL_MAGICAL}
        [/specials]
        damage=5
        number=5
        range=ranged
    [/attack]

    # Elynia's animations
    {ELYNIA_ANIM_DEFEND}
    {ELYNIA_ANIM_HEALING}
    {ELYNIA_ANIM_ATTACK_STAFF}
    {ELYNIA_ANIM_ATTACK_ENSNARE}
    {ELYNIA_ANIM_MYSTIC_FIRE}
    {ELYNIA_ANIM_EXTRA}
[/unit_type]

# kate: indent-mode normal; encoding utf-8; space-indent on;