#textdomain wesnoth-After_the_Storm

[scenario]
    id=11_After_the_Storm
    name= _ "After the Storm"
    {NO_MAP_DATA}
    turns=-1
    next_scenario=12_Destiny_part_3
    victory_when_enemies_defeated=no
    disallow_recall=yes
    {DO_NOT_REMOVE_FROM_CARRYOVER_ON_DEFEAT}

    {FULLSCREEN_CUTSCENE_UI}

    {SCENARIO_MUSIC "silence.ogg"} # {CONTINUE_PLAYING_STORY_MUSIC_FIRST}

    {STORYTXT_AFTER_THE_STORM}

    {UNDERGROUND}

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

        shroud=yes
        hidden=yes

        {NO_ECONOMY}

        # wmllint: recognize Anya
        {CHARACTER_STATS_ANYA}
        canrecruit=yes
        type=Guardian of Darkness Anya
        # clobber IS_HERO from the stats macro
        {NO_OVERLAYS_NO_ELLIPSE}
    [/side]

    [side]
        side=2
        controller=human
        save_id=Durvan
        team_name=good
        user_team_name= _ "team_name^Durvan"

        shroud=yes
        hidden=yes

        {NO_ECONOMY}

        # wmllint: recognize Durvan
        {CHARACTER_STATS_DURVAN}
        canrecruit=yes
        # clobber IS_HERO from the stats macro
        {NO_OVERLAYS_NO_ELLIPSE}
    [/side]
    # wmllint: validate-on

    [side]
        # Cutscene enemy units
        side=3
        team_name=evil
        user_team_name= _ "team_name^Uria"
        controller=null
        color=black

        shroud=yes
        hidden=yes
        no_leader=yes

        {NO_ECONOMY}
    [/side]

    [event]
        name=prestart

        {BUG_ON (
            [not]
                {VARIABLE_BOOLEAN_EQUALS coming_from_e3s10 yes}
                {VARIABLE_NUMERICAL_EQUALS elynia_store.length 1}
                {VARIABLE_NUMERICAL_EQUALS elyssa_store.length 1}
            [/not]
        ) ("Data from E3S10 missing; did you use debug mode to skip it?")}

        {CLEAR_VARIABLE coming_from_e3s10}

        [store_unit]
            [filter]
                id=Anya
            [/filter]
            variable=anya_store
            kill=yes
        [/store_unit]

        [store_unit]
            [filter]
                id=Durvan
            [/filter]
            variable=durvan_store
            kill=yes
        [/store_unit]

        {VARIABLE map1 "{ME}/11_After_the_Storm_01.map"}

        {VARIABLE map2 "{ME}/11_After_the_Storm_02.map"}

        {VARIABLE map3 "{ME}/08A_Interim_02.map"       }

        {VARIABLE map4 "{ME}/11_After_the_Storm_04.map"}

        {BLACK_SCREEN}

        {LOCK_VIEW}
    [/event]

    [event]
        name=start

        [fire_event]
            name=cutscene 1
        [/fire_event]

        [fire_event]
            name=cutscene 2
        [/fire_event]

        [fire_event]
            name=cutscene 3
        [/fire_event]

        [fire_event]
            name=cutscene 4
        [/fire_event]

        [fire_event]
            name=credits
        [/fire_event]

        {UNLOCK_VIEW}

        {ENDLEVEL_QUIET} {NO_REPLAY_SAVE}
    [/event]

    [event]
        name=victory

        {CLEAR_VARIABLE anya_store,durvan_store}

        {CLEAR_VARIABLE map1,map2,map3,map4,map5}

        # Goodbye, girls.
        {CLEAR_VARIABLE elynia_store,elyssa_store}
    [/event]

#define FINALE_C_CONFIGURE_CUTSCENE _NUM
    [replace_map]
        map_file="$map"+{_NUM}
        shrink,expand=yes,yes
    [/replace_map]

    [redraw][/redraw]
#enddef

#define FINALE_C_FADE_OUT
    [hide_unit][/hide_unit]

    [remove_item][/remove_item]

    {FADE_TO_BLACK}

    [place_shroud]
        side=1
        # EVERYWHERE
    [/place_shroud]
#enddef

#define FINALE_C_RED_OUT
    [hide_unit][/hide_unit]

    [remove_item][/remove_item]

    {RED_SCREEN}

    [delay]
        time=100
    [/delay]

    {BLACK_SCREEN}

    [place_shroud]
        side=1
        # EVERYWHERE
    [/place_shroud]
#enddef

#define FINALE_C_FADE_IN
    [remove_shroud]
        side=1
        # EVERYWHERE
    [/remove_shroud]

    {FADE_IN}

    [unhide_unit][/unhide_unit]
#enddef

#define FINALE_C_KILL_ON_MAP_UNITS
    [kill]
        [not]
            x,y=recall,recall
        [/not]
    [/kill]
#enddef

#define FINALE_C_XIAEL_THOUGHTS _MESSAGE
    [message]
        speaker=narrator
        caption= _ "Aradellys"
        image= # wmllint: ignore
        message=""+{_MESSAGE}+"" # wmllint: ignore
    [/message]
#enddef

#define FINALE_C_ELYNIA_THOUGHTS _MESSAGE
    [message]
        speaker=narrator
        caption= _ "Elynia"
        image= # wmllint: ignore
        message=""+{_MESSAGE}+"" # wmllint: ignore
    [/message]
#enddef

#define FINALE_C_ELYSSA_THOUGHTS _MESSAGE
    [message]
        speaker=narrator
        caption= _ "Elyssa"
        image= # wmllint: ignore
        message=""+{_MESSAGE}+"" # wmllint: ignore
    [/message]
#enddef

#define FINALE_C_NPC _SIDE _TYPE _X _Y
    [hidden_unit]
        side={_SIDE}
        type={_TYPE}
        x={_X}
        y={_Y}
        random_gender=yes
        random_traits=yes
        generate_name=yes
    [/hidden_unit]
#enddef

    ############################################################################
    #                                                                          #
    #                                CUTSCENE #1                               #
    #                                                                          #
    ############################################################################

    [event]
        name=cutscene 1

        {FINALE_C_CONFIGURE_CUTSCENE 1}

        [set_variables]
            name=elynia_store
            mode=merge
            [value]
                hitpoints=$elynia_store.max_hitpoints
                moves=$elynia_store.max_moves
                attacks_left=$elynia_store.max_attacks
                x,y=25,30
                facing=sw
            [/value]
        [/set_variables]

        [set_variables]
            name=elyssa_store
            mode=merge
            [value]
                hitpoints=$elyssa_store.max_hitpoints
                moves=$elyssa_store.max_moves
                attacks_left=$elyssa_store.max_attacks
                x,y=29,30
                facing=ne
            [/value]
        [/set_variables]

        # wmllint: recognize Elynia

        [hidden_unit]
            {CHARACTER_STATS_ELYNIA}
            type=Guardian of Earth Elynia
            canrecruit=no
            facing=$elynia_store.facing
            side=1
            x,y=$elynia_store.x,$elynia_store.y
            level=$elynia_store.level
            max_hitpoints=1
            variation=injured
        [/hidden_unit]

        # wmllint: recognize Elyssa

        [hidden_unit]
            {CHARACTER_STATS_ELYSSA}
            type=Guardian of Darkness Elyssa
            canrecruit=no
            facing=$elyssa_store.facing
            side=1
            x,y=$elyssa_store.x,$elyssa_store.y
            level=$elyssa_store.level
            max_hitpoints=1
            variation=injured
        [/hidden_unit]

        {FINALE_C_FADE_IN}

        [delay]
            time=750
        [/delay]

        [scroll_to_unit]
            id=Elynia
        [/scroll_to_unit]

        [delay]
            time=2000
        [/delay]

        {FINALE_C_XIAEL_THOUGHTS ( _ "Rise up, Elynia-Thanadria, Guardian of Earth.")}

        [delay]
            time=750
        [/delay]

        [unstore_unit]
            variable=elynia_store
            find_vacant=no
        [/unstore_unit]

        [redraw][/redraw]

        [delay]
            time=750
        [/delay]

        {FACE_DIRECTION id=Elynia se}

        [redraw][/redraw]

        [delay]
            time=750
        [/delay]

        [scroll_to_unit]
            id=Elyssa
        [/scroll_to_unit]

        [delay]
            time=750
        [/delay]

        {REPLACE_SCENARIO_MUSIC "snowfall.ogg"}

        {FINALE_C_XIAEL_THOUGHTS ( _ "You and the heiress of the First Guardian of Darkness have much work left to do.")}

        [delay]
            time=250
        [/delay]

        {FINALE_C_FADE_OUT}

        [delay]
            time=5000
        [/delay]

        [message]
            speaker=Elyssa
            message= _ "Elynia?"
        [/message]

        [message]
            speaker=Elynia
            message= _ "I am here."
        [/message]

        [delay]
            time=1000
        [/delay]

        [message]
            speaker=Elyssa
            message= _ "Have I mentioned yet how much I despise you?"
        [/message]

        [delay]
            time=5000
        [/delay]

        {FINALE_C_KILL_ON_MAP_UNITS}
    [/event]

    ############################################################################
    #                                                                          #
    #                                CUTSCENE #2                               #
    #                                                                          #
    ############################################################################

    [event]
        name=cutscene 2

        [replace_schedule]
            {ENDLESS_NIGHT}
        [/replace_schedule]

        {FINALE_C_ELYNIA_THOUGHTS ( _ "Dear Anya,

I am sure that by the time you find the glyph containing this encoded message you will have won the battle on the surface and proven yourself worthy of your title as the Lost Guardian of Darkness on Irdya. I am also certain that Ergea will have finally revealed to you the destiny that was laid for me by the will of our creators.

You will surely know by then as well what Uria’s plan entails for all of us. As Elorran said, Irdya is not the only world at peril.

There are many other worlds like ours which will be similarly wiped from existence if Uria gets hold of the Body of the Union and the Seed of Life on Ethea.")}

        {FINALE_C_CONFIGURE_CUTSCENE 2}

        {FINALE_C_NPC 2 "Chaos Invader" 19 17}
        {FINALE_C_NPC 2 "Chaos Invader" 30 17}
        {FINALE_C_NPC 2 "Chaos Invader" 43 18}
        {FINALE_C_NPC 2 "Chaos Invader" 30 31}
        {FINALE_C_NPC 2 "Chaos Invader" 37 35}
        {FINALE_C_NPC 2 "Chaos Bowman" 25 31}
        {FINALE_C_NPC 2 "Chaos Arbalestier" 23 34}
        {FINALE_C_NPC 2 "Goblin Knight" 5 35}
        {FINALE_C_NPC 2 "Goblin Knight" 20 7}
        {FINALE_C_NPC 2 "Orcish Warlord" 31 11}
        {FINALE_C_NPC 2 "Goblin Rouser" 31 12}
        {FINALE_C_NPC 1 "Fire Faerie" 32 13}
        {FINALE_C_NPC 2 "Goblin Rouser" 37 18}
        {FINALE_C_NPC 1 "Highwayman" 38 19}
        {FINALE_C_NPC 1 "Elvish Mystic" 43 20}
        {FINALE_C_NPC 2 "Chaos Cataphract" 3 13}
        {FINALE_C_NPC 2 "Goblin Pillager" 26 3}
        {FINALE_C_NPC 2 "Aragwaith Longswordsman" 24 10}
        {FINALE_C_NPC 1 "Necromancer" 26 17}
        {FINALE_C_NPC 1 "Death Knight" 25 19}
        {FINALE_C_NPC 2 "Gryphon Master" 37 25}
        {FINALE_C_NPC 2 "Dwarvish Dragonguard" 38 26}
        {FINALE_C_NPC 1 "Spectre" 37 36}
        {FINALE_C_NPC 1 "Merman Fighter" 12 24}
        {FINALE_C_NPC 1 "Merman Fighter" 26 22}
        {FINALE_C_NPC 1 "Mermaid Initiate" 23 24}
        {FINALE_C_NPC 1 "Merman Hoplite" 17 23}

        [store_map_dimensions][/store_map_dimensions]

        [scroll_to]
            x=1
            y=$map_size.height
            {WARP}
        [/scroll_to]

        {FINALE_C_FADE_IN}

        [delay]
            time=1000
        [/delay]

        {FINALE_C_ELYNIA_THOUGHTS ( _ "Our mission is to stop Uria at all costs.

We know that not all of the worlds seeded to have a Guardian have reached maturity yet. We know that Ethea might not have its own Guardian of Life yet. But it is our hope that we might be able to find her before Uria herself does, and ensure that we have a chance to stop her somehow. We know that the Guardian of Water from Norsula has arrived there, and may have already seized its seed. Our main concern for the moment is finding the real heiress of Uria on Ethea, and the Body of the Union. Unfortunately for us, we do not know much about Ethea or where to begin our search.")}

        [scroll_to]
            x=$map_size.width
            y=$map_size.height
        [/scroll_to]

        [delay]
            time=750
        [/delay]

        {FINALE_C_ELYNIA_THOUGHTS ( _ "Sitting idly here on Irdya would not accomplish anything for the continuance of our existence. According to Elyssa, and the Guardian of Earth on Silida, my work here is complete. Irdya has slowly come back to life over the last few centuries, a feat which would have been impossible without my presence.

I have seen both life and destruction take place since I was woken up from my slumber. Darkness has been an opposing force for very long, but as Mal Keshar, Anlindë, and Elyssa herself proved to me, it can also be revitalizing for a world that needs the means to protect itself from two scorching suns and the malignant forces that broke the previous balance.")}

        [scroll_to]
            x=35
            y=17
        [/scroll_to]

        [delay]
            time=750
        [/delay]

        [scroll_to]
            x=1
            y=1
        [/scroll_to]

        [delay]
            time=750
        [/delay]

        {FINALE_C_FADE_OUT}

        {FINALE_C_KILL_ON_MAP_UNITS}

        {CLEAR_VARIABLE map_size}
    [/event]

    ############################################################################
    #                                                                          #
    #                                CUTSCENE #3                               #
    #                                                                          #
    ############################################################################

    [event]
        name=cutscene 3

        [replace_schedule]
            {INDOORS_HIVE} {SCHEDULE_LIGHTING -60 -80 0}
        [/replace_schedule]

        {FINALE_C_CONFIGURE_CUTSCENE 3}

        [terrain]
            x=0-25,26-29
            y=0-18, 0-10
            terrain=Qxua
        [/terrain]

        [set_variables]
            name=elynia_store
            mode=merge
            [value]
                x,y=29,22
                facing=se
            [/value]
        [/set_variables]

        [set_variables]
            name=elyssa_store
            mode=merge
            [value]
                x,y=26,20
                facing=nw
            [/value]
        [/set_variables]

        [store_locations]
            terrain=Cud^Xo
            variable=spire_locs
        [/store_locations]

        [foreach]
            array=spire_locs
            variable=spire
            [do]
                [hidden_unit]
                    type=Verlissh Control Spire
                    side=3
                    x,y=$spire.x,$spire.y
                    upkeep=free
                    ai_special=guardian
                    [modifications]
                        [object]
                            silent=yes
                            [effect]
                                apply_to=remove_attacks
                                name=noctum
                            [/effect]
                        [/object]
                    [/modifications]
                [/hidden_unit]
            [/do]
        [/foreach]

        {CLEAR_VARIABLE spire_locs}

        {FINALE_C_FADE_IN}

        [unstore_unit]
            variable=elyssa_store
        [/unstore_unit]

        [unstore_unit]
            variable=elynia_store
        [/unstore_unit]

        {FINALE_C_ELYNIA_THOUGHTS ( _ "The impenetrable darkness currently shrouding Irdya protects it from the gaze of the Seer of Uria, but if it lasts for too long, all life on Irdya will end as well.

While Elyssa was previously responsible for this barrier within the frontiers of the Chaos Empire, the power that recently extended it far and beyond is not hers. It is yours.

I never got the chance to speak to you about these matters because of how distant I became ever since I had to kill Argan. I thought that opening up and letting others into my life could only cause more harm to them.

But I finally realized that this did not solve anything. By isolating myself from the world I only made things worse for everyone, something which even Elyssa could see. Perhaps she understood this better than I because of our shared curse, or maybe it was something she learned while under Argan’s protection.")}

        [scroll_to_unit]
            id=Elynia
        [/scroll_to_unit]

        [delay]
            time=750
        [/delay]

        {FINALE_C_ELYNIA_THOUGHTS ( _ "Then again, it also appears to be natural for Guardians of Darkness to see through that invisible veil that conceals people’s fragile minds. And you are a Guardian of Darkness too — the power to peer into my feelings is a part of your self, and you were unconsciously making use of it all along.

All this time, you tried to reach into me, and I would not let you in. But now it is all clear.")}

        [delay]
            time=750
        [/delay]

        [item]
            [filter]
                id=Elyssa
            [/filter]
            halo="halo/heart-aura.png"
            image="misc/blank-hex.png"
        [/item]

        [delay]
            time=750
        [/delay]

        {MOVE_UNIT id=Elynia 28 21}

        [redraw][/redraw]

        [delay]
            time=250
        [/delay]

        [item]
            [filter]
                id=Elynia
            [/filter]
            halo="halo/heart-aura.png~CS(-255,128,16)"
            image="misc/blank-hex.png"
        [/item]

        [delay]
            time=250
        [/delay]

        {FINALE_C_ELYNIA_THOUGHTS ( _ "I am sorry, Anya.

I am sorry for not realizing any of this before. I should have let you reach into my heart. We should have done this together like you wanted.

Even though things did not turn out as either of us hoped, you were a good friend.")}

        [delay]
            time=750
        [/delay]

        {FINALE_C_RED_OUT}

        [delay]
            time=750
        [/delay]

        {FINALE_C_ELYNIA_THOUGHTS ( _ "A better friend than I deserved, perhaps.")}

        [delay]
            time=750
        [/delay]

        {FINALE_C_ELYNIA_THOUGHTS ( _ "There are so many things you do not know yet, Anya...")}

        [delay]
            time=750
        [/delay]

        {FINALE_C_KILL_ON_MAP_UNITS}
    [/event]

    ############################################################################
    #                                                                          #
    #                                CUTSCENE #4                               #
    #                                                                          #
    ############################################################################

    [event]
        name=cutscene 4

        [replace_schedule]
            {INDOORS_HIVE}
        [/replace_schedule]

        {FINALE_C_CONFIGURE_CUTSCENE 4}

        [scroll_to]
            x,y=25,10
            {WARP}
        [/scroll_to]

        # wmllint: recognize Ergea

        [store_unit]
            [filter]
                id=Ergea
            [/filter]
            variable=ergea_store
            kill=yes
        [/store_unit]

        # wmllint: recognize Cron

        [store_unit]
            [filter]
                id=Cron
            [/filter]
            variable=cron_store
            kill=yes
        [/store_unit]

        # wmllint: recognize Irylean

        [store_unit]
            [filter]
                id=Irylean
            [/filter]
            variable=irylean_store
            kill=yes
        [/store_unit]

        # wmllint: recognize Igor

        [store_unit]
            [filter]
                id=Igor
            [/filter]
            variable=igor_store
            kill=yes
        [/store_unit]

        [set_variables]
            name=anya_store
            mode=merge
            [value]
                hitpoints=$anya_store.max_hitpoints
                moves=$anya_store.max_moves
                attacks_left=$anya_store.max_attacks
                x,y=24,11
                facing=nw
            [/value]
        [/set_variables]

        [set_variables]
            name=durvan_store
            mode=merge
            [value]
                hitpoints=$durvan_store.max_hitpoints
                moves=$durvan_store.max_moves
                attacks_left=$durvan_store.max_attacks
                x,y=24,13
                facing=nw
            [/value]
        [/set_variables]

        [set_variables]
            name=irylean_store
            mode=merge
            [value]
                hitpoints=$irylean_store.max_hitpoints
                moves=$irylean_store.max_moves
                attacks_left=$irylean_store.max_attacks
                x,y=25,13
                facing=nw
            [/value]
        [/set_variables]

        [set_variables]
            name=ergea_store
            mode=merge
            [value]
                hitpoints=$ergea_store.max_hitpoints
                moves=$ergea_store.max_moves
                attacks_left=$ergea_store.max_attacks
                x,y=22,10
                facing=se
            [/value]
        [/set_variables]

        [set_variables]
            name=cron_store
            mode=merge
            [value]
                hitpoints=$cron_store.max_hitpoints
                moves=$cron_store.max_moves
                attacks_left=$cron_store.max_attacks
                x,y=25,10
                facing=sw
            [/value]
        [/set_variables]

        [if]
            {VARIABLE_ARRAY_NOT_EMPTY igor_store}
            [then]
                [set_variables]
                    name=igor_store
                    mode=merge
                    [value]
                        hitpoints=$igor_store.max_hitpoints
                        moves=$igor_store.max_moves
                        attacks_left=$igor_store.max_attacks
                        x,y=23,14
                        facing=nw
                    [/value]
                [/set_variables]
            [/then]
        [/if]

        {ITEM_CRYSTAL_GLYPH_MESSAGE 23 11}

        {FINALE_C_FADE_IN}

        [unstore_unit]
            variable=anya_store
        [/unstore_unit]

        [unstore_unit]
            variable=ergea_store
        [/unstore_unit]

        [unstore_unit]
            variable=durvan_store
        [/unstore_unit]

        [unstore_unit]
            variable=cron_store
        [/unstore_unit]

        [unstore_unit]
            variable=irylean_store
        [/unstore_unit]

        [if]
            {VARIABLE_ARRAY_NOT_EMPTY igor_store}
            [then]
                [unstore_unit]
                    variable=igor_store
                [/unstore_unit]
            [/then]
        [/if]

        {PLACE_IMAGE ("items/book1.png")           22 12}
        {PLACE_IMAGE ("items/book4.png~FL(horiz)") 27 12}
        {PLACE_IMAGE ("items/ball-magenta.png")    21 10}

        [delay]
            time=750
        [/delay]

        {FINALE_C_ELYNIA_THOUGHTS ( _ "I am no-one to decide your fate for you, Anya, but the first thing you must do is to come at peace with your feelings and end the night.

And once you have made a decision, you must ensure that the breach remains well guarded and protected. We do not know how to seal it yet, but if we can defeat Uria, we will surely find a way to undo the damage she has caused on Irdya and Urvatha over the years.

And then, I will return and keep the promise I made to you.")}

        [delay]
            time=750
        [/delay]

        {FINALE_C_ELYNIA_THOUGHTS ( _ "Goodbye, my friend.")}

        [delay]
            time=750
        [/delay]

        {FINALE_C_FADE_OUT}

        # For E3S12.
        {RESET_AND_SEND_TO_RECALL_LIST id=Anya,Durvan,Cron,Ergea,Irylean,Igor}

        {CLEAR_VARIABLE anya_store,durvan_store,cron_store,ergea_store,irylean_store,igor_store}

        [delay]
            time=750
        [/delay]

        {FINALE_C_ELYNIA_THOUGHTS ( _ "Trust your heart.")}

        [fade_out_music]
            duration=5000
        [/fade_out_music]

        [delay]
            time=5000
        [/delay]
    [/event]

    ############################################################################
    #                                                                          #
    #                                END CREDITS                               #
    #                                                                          #
    ############################################################################

    # These are the combined IftU & AtS credits

    [event]
        name=credits

        [replace_schedule]
            {NEUTRAL_TOD}
        [/replace_schedule]

        [credits_sequence]
            {LD /about-final.cfg}
        [/credits_sequence]

        [delay]
            time=8000
        [/delay]

        {FINALE_C_FADE_OUT}
    [/event]
[/scenario]

#undef FINALE_C_NPC
#undef FINALE_C_FADE_OUT
#undef FINALE_C_CONFIGURE_CUTSCENE
#undef FINALE_C_RED_OUT
#undef FINALE_C_XIAEL_THOUGHTS
#undef FINALE_C_ELYSSA_THOUGHTS
#undef FINALE_C_ELYNIA_THOUGHTS
#undef FINALE_C_KILL_ON_MAP_UNITS
#undef FINALE_C_FADE_IN

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


#textdomain wesnoth-After_the_Storm

[scenario]
    id=12_Destiny_part_3
    name= _ "Destiny — Part 3"
    {SEGMENTED_SCENARIO}
    turns=-1
    next_scenario=null
    victory_when_enemies_defeated=no
    disallow_recall=yes
    # We do not need this because the player 'Anya' is never used again after
    # this point.
    #{DO_NOT_REMOVE_FROM_CARRYOVER_ON_DEFEAT}

    {FULLSCREEN_CUTSCENE_UI}

    {FINALE_AMLA_EVENTS}

    {ADD_SEGMENT "{LE /maps/12_Destiny_part_3.map}"
    ({INDOORS_HIVE}) ()}

    {ADD_SEGMENT "{LE /maps/08A_Interim_02.map}"
    ({INDOORS_HIVE} {SCHEDULE_LIGHTING -60 -80 0}) ()}

    {SCENARIO_MUSIC "silence.ogg"} {CONTINUE_PLAYING_STORY_MUSIC_FIRST}

    {STORYTXT_DESTINY_PART_3}

    {INDOORS_HIVE}

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

        shroud=yes

        {NO_ECONOMY}

        # wmllint: recognize Anya
        {CHARACTER_STATS_ANYA}
        canrecruit=yes
        type=Guardian of Darkness Anya
        # clobber IS_HERO from the stats macro
        {NO_OVERLAYS_NO_ELLIPSE}
    [/side]
    # wmllint: validate-on

    [side]
        # Cutscene enemy units
        side=2
        team_name=evil
        user_team_name= _ "team_name^Shaxthals"
        {CHAOS_FLAG}
        color=black

        shroud=yes
        hidden=yes
        no_leader=yes

        {NO_ECONOMY}

        {ai/aliases/stable_singleplayer.cfg}
        [ai]
            {AI_SIMPLE_ALWAYS_ASPECT aggression        9.00}
            {AI_SIMPLE_ALWAYS_ASPECT leader_aggression 9.00}
            {AI_SIMPLE_ALWAYS_ASPECT caution           0.00}
            {AI_SIMPLE_ALWAYS_ASPECT grouping            no}
        [/ai]
    [/side]

    [side]
        side=3
        team_name=good,evil
        user_team_name= _ "team_name^?"
        {RAGGED_FLAG}
        color=lightblue
        share_vision=none
        scroll_to_leader=no

        no_leader=yes
        hidden=yes
        controller=null
        {NO_ECONOMY}

        {ai/aliases/stable_singleplayer.cfg}
        [ai]
            ai_algorithm=idle_ai
        [/ai]
    [/side]

    {FORCE_CHANCE_TO_HIT (id=Anya) () 100 ()}

    [event]
        name=prestart

        {VARIABLE used_language_glyph no}

        [modify_side]
            side=1
            gold=0
        [/modify_side]

        {REMOVE_RECRUIT_LIST 1}

        #
        # Enter first floor.
        #

        {SWITCH_FLOOR 1}

        {RESET_UNIT_STATUSES id=Anya}

        [teleport]
            [filter]
                id=Anya
            [/filter]
            x,y=58,11
        [/teleport]

        {FACE_DIRECTION id=Anya nw}

        [hide_unit][/hide_unit]

        [place_shroud]
            side=1
        [/place_shroud]

        {BLACK_SCREEN}
    [/event]

#define FINALE_C_GUARDIAN _SIDE _TYPE _X _Y
    {GENERIC_UNIT ({_SIDE}) ({_TYPE}) ({_X}) ({_Y})} {GUARDIAN} {NO_UPKEEP_NO_OVERLAY}
#enddef

    [event]
        name=setup floor 1
        first_time_only=yes

        {ITEM_CRYSTAL_GLYPH_MESSAGE 57 11}

        {ITEM_CRYSTAL_GLYPH_MESSAGE 32 38}
        {ITEM_CRYSTAL_GLYPH_MESSAGE 34 39}
        {ITEM_CRYSTAL_GLYPH_MESSAGE 36 40}

        {ITEM_CRYSTAL_GLYPH_MESSAGE 27 41}
        {ITEM_CRYSTAL_GLYPH_MESSAGE 29 42}
        {ITEM_CRYSTAL_GLYPH_POWERUP 31 43}

        {ITEM_TOUCHPLATE 39 44}

        {ITEM_CRYSTAL_GLYPH_POWERUP 48 33}
        {ITEM_CRYSTAL_GLYPH_POWERUP 16 41}
        {ITEM_CRYSTAL_GLYPH_POWERUP 61 49}

        {OBJ_HEALING_GLYPH 34  8}

        {OBJ_HEALING_GLYPH 28 11}

        {OBJ_HEALING_GLYPH 13 18}

        {FINALE_C_GUARDIAN 2 (Abomination) 40 49} {FACING ne}
        {FINALE_C_GUARDIAN 2 (Abomination) 43 53} {FACING nw}

        {FINALE_C_GUARDIAN 2 (Shaxthal Sentry Drone) 24 44} {FACING ne} {PALETTE shaxthal_drone_base shaxthal_drone_purple}
        {FINALE_C_GUARDIAN 2 (Shaxthal Sentry Drone) 36 44} {FACING nw} {PALETTE shaxthal_drone_base shaxthal_drone_purple}
        {FINALE_C_GUARDIAN 2 (Shaxthal Sentry Drone) 38 43} {FACING nw} {PALETTE shaxthal_drone_base shaxthal_drone_purple}
        {FINALE_C_GUARDIAN 2 (Shaxthal Sentry Drone) 39 37} {FACING nw} {PALETTE shaxthal_drone_base shaxthal_drone_purple}

        {FINALE_C_GUARDIAN 2 (Shaxthal Sentry Drone) 18 38} {FACING ne} {PALETTE shaxthal_drone_base shaxthal_drone_purple}
        {FINALE_C_GUARDIAN 2 (Shaxthal Sentry Drone) 14 34} {FACING sw} {PALETTE shaxthal_drone_base shaxthal_drone_purple}
        {FINALE_C_GUARDIAN 2 (Shaxthal Sentry Drone) 24 30} {FACING sw} {PALETTE shaxthal_drone_base shaxthal_drone_purple}
        {FINALE_C_GUARDIAN 2 (Shaxthal Sentry Drone) 19 22} {FACING sw} {PALETTE shaxthal_drone_base shaxthal_drone_purple}

        {FINALE_C_GUARDIAN 2 (Shaxthal Drone) 21 16} {FACING nw}
        {FINALE_C_GUARDIAN 2 (Shaxthal Drone) 20 11} {FACING ne}
        {FINALE_C_GUARDIAN 2 (Shaxthal Drone) 17 15} {FACING ne}

        {FINALE_C_GUARDIAN 2 (Shaxthal War Drone) 18  4} {FACING sw} {PALETTE shaxthal_drone_surface shaxthal_drone_base}

        {FINALE_C_GUARDIAN 2 (Shaxthal Drone) 29  9} {FACING se}
        {FINALE_C_GUARDIAN 2 (Shaxthal Drone) 39 14} {FACING sw}
        {FINALE_C_GUARDIAN 2 (Shaxthal Drone) 43 13} {FACING nw}
        {FINALE_C_GUARDIAN 2 (Shaxthal Drone) 35 16} {FACING ne}
        {FINALE_C_GUARDIAN 2 (Shaxthal Drone) 43 11} {FACING nw}
        {FINALE_C_GUARDIAN 2 (Shaxthal Drone) 38  7} {FACING nw}

        {FINALE_C_GUARDIAN 2 (Shaxthal Drone) 42 25} {FACING ne}
        {FINALE_C_GUARDIAN 2 (Shaxthal Drone) 44 26} {FACING nw}
        {FINALE_C_GUARDIAN 2 (Shaxthal Drone) 42 28} {FACING nw}
    [/event]

    [event]
        name=main music playlist
        first_time_only=no

        {REPLACE_SCENARIO_MUSIC "everlasting_night.ogg"}
        {APPEND_MUSIC           "heroes_rite.ogg"}
        {APPEND_MUSIC           "nunc_dimittis.ogg"}
    [/event]

#define FINALE_C_RESET_MUSIC
    [fire_event]
        name=main music playlist
    [/fire_event]
#enddef

    [event]
        name=start

        [place_shroud]
            side=1
        [/place_shroud]

        {LOCK_VIEW}

        [mute_sound_effects][/mute_sound_effects]

        [scroll_to]
            x,y=58,11
            {WARP}
        [/scroll_to]

        {CAVE_NOISE_SOUND_SOURCE}
        [+sound_source]
            id=cave_noise # wmllint: ignore
        [/sound_source]

        [fade_in_sound_effects]
            duration=2000
        [/fade_in_sound_effects]

        {CLEAR_CAVE_SHROUD (
            x,y=58,11
            radius=6
        )}

        [redraw]
            side=1
        [/redraw]

        {FADE_IN}

        [unhide_unit][/unhide_unit]

        [redraw][/redraw]

        {FINALE_C_RESET_MUSIC}

        [delay]
            time=2750
        [/delay]

        [message]
            speaker=narrator
            image=wesnoth-icon.png
            # po: The narrator refers to Anya in second person throughout
            # po: this scenario, and interacts directly with her at the end.
            message= _ "You are now the Guardian of Darkness.

On Irdya."
        [/message]

        [delay]
            time=750
        [/delay]

        [message]
            speaker=narrator
            image=wesnoth-icon.png
            message= _ "No...

Actually, you do not consider the title befitting of your actual role. Ever since you recovered from the gruesome attack of Zhangor’s beasts, Ergea has used you as an instrument to liberate both her people and Irdya from Uria’s influence. They call you the “Dark Lady”, “Yechnagoth revived”, the “Goddess of Darkness”, and a myriad other titles you do not actually deserve or care for.

You feel like a pawn in someone’s game. But you are not quite sure anymore for which side you play.

Things were far easier when Elynia was around. You admired her stalwart sense of righteousness. You admired her courage in confronting the most fearsome enemies faced by Irdya in this era; enemies once thought invincible, now fallen and destroyed forever."
        [/message]

        [message]
            speaker=narrator
            image=wesnoth-icon.png
            message= _ "However, after reading the journals of Galas, Elynia, and Argan, you cannot help but feel profoundly disheartened.

You grew up hearing of Elynia’s feats from Elorran and Tara. Now that you know more about her and are nearly her equal in power, it all suddenly feels vain and pointless. So many things could have been avoided if Uria and her people did not monopolize access to knowledge about your destiny...

A sentiment of uselessness suddenly overwhelms you. You are a fraud. You have not even been able to control the darkness that keeps Naia and Sela’s light from reaching Irdya’s surface. For how long does Ergea intend you to play your act for the Chaos rebels?"
        [/message]

        [message]
            speaker=narrator
            image=wesnoth-icon.png
            message= _ "If only you could consult with Elynia about the matter. If only the other Guardian of Darkness, Elyssa, had stayed on Irdya instead of taking your friend to that alien world.

“If only”...

Elynia told you to trust your heart, but you are not quite sure you can do that anymore. After all, it was your heart that deceived you in the first place; it blinded you to Elynia’s actual plan, and it fooled you into thinking that perhaps she would ever consider you as anything more than a ‘friend’."
        [/message]

        [message]
            speaker=narrator
            image=wesnoth-icon.png
            message= _ "But enough of that emotional nonsense. Your role as a Guardian of Darkness is to make decisions with your mind, not your heart. You have gathered all the knowledge you need for making a decision now.

What does your mind tell you?"
        [/message]

        [delay]
            time=2000
        [/delay]

        {OBJECTIVES (
            side=1
            victory_string= _ "Current Objective:"
            {OBJECTIVE_VICTORY ( _ "Find the teleport glyph leading to the breach site")}

            {OBJECTIVE_NO_CARRYOVER}
        )}

        {UNLOCK_VIEW}

        {RESET_THEME}
    [/event]

    [event]
        name=moveto
        first_time_only=no
        [filter]
            side=1
            x,y=57,11
        [/filter]

        [allow_undo][/allow_undo]

        [message]
            speaker=narrator
            image=wesnoth-icon.png
            message= _ "There is absolutely nothing else of value encoded into this crystal glyph. Time to move on."
        [/message]
    [/event]

    [event]
        name=moveto
        [filter]
            id=Anya
            x,y=48,33
        [/filter]

        {LOCK_VIEW}

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

        [store_unit]
            [filter]
                id=Anya
            [/filter]
            kill=yes
            variable=anya_store
        [/store_unit]

        [hide_unit][/hide_unit]

        {FADE_TO_BLACK}

        # wmllint: recognize Daeira

        # Set up Daeira if the player kept her around and is en route to E3S13
        [if]
            [have_unit]
                side=1
                id=Daeira
                search_recall_list=yes
            [/have_unit]

            {VARIABLE_BOOLEAN_EQUALS have_argans_missing_pages     yes}

            # These two shouldn't ever hold true with an extant Daeira, but
            # just in case...
            {VARIABLE_BOOLEAN_EQUALS swam_in_fountain_of_courage   yes}
            {VARIABLE_BOOLEAN_EQUALS anya_has_mermaid_pendant      yes}

            [then]
                [modify_side]
                    side=3
                    controller=ai
                    hidden=no
                [/modify_side]

                [store_starting_location]
                    side=3
                [/store_starting_location]

                {RECALL_DAEIRA_AT_LOCATION $location.x $location.y}

                [modify_unit]
                    [filter]
                        id=Daeira
                    [/filter]
                    side=3
                [/modify_unit]

                {FACE_DIRECTION id=Daeira se}

                {CLEAR_VARIABLE location}
            [/then]
        [/if]

        [place_shroud]
            side=1
        [/place_shroud]

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

        {REMOVE_SOUND_SOURCE cave_noise}

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

        [delay]
            time=750
        [/delay]

        [set_variables]
            name=anya_store
            mode=merge
            [value]
                x,y=35,1
                facing=s
                moves=$anya_store.max_moves
                attacks_left=$anya_store.max_attacks
            [/value]
        [/set_variables]

        {CLEAR_CAVE_SHROUD (
            x,y=35,4
            radius=6
        )}

        {FADE_IN}

        [unhide_unit][/unhide_unit]

        [unstore_unit]
            variable=anya_store
        [/unstore_unit]

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

        [redraw]
            side=1
        [/redraw]

        {CLEAR_VARIABLE anya_store}

        {MOVE_UNIT id=Anya 35 4}

        [redraw]
            side=1
        [/redraw]

        [delay]
            time=1000
        [/delay]

        [message]
            speaker=narrator
            image=wesnoth-icon.png
            message= _ "That was not the right glyph.

The crude maps you found of these underground levels show a plethora of teleport glyphs without any indication as to their respective destinations. It is ridiculous. Whoever built this stronghold did not know the first thing about proper organization!

Well, there is no going back now."
        [/message]

        {UNLOCK_VIEW}
    [/event]

    [event]
        name=moveto
        [filter]
            side=1
            id=Anya
            [filter_adjacent]
                id=Daeira
            [/filter_adjacent]
        [/filter]

        {LOCK_VIEW}

        # For debug purposes
        {VARIABLE_DEFAULT anya_wants_cake               no}
        {VARIABLE_DEFAULT anya_gets_meta                no}
        {VARIABLE_DEFAULT anya_wants_love               no}
        {VARIABLE_DEFAULT anya_wants_to_see_the_manager no}

        [scroll_to_unit]
            id=Daeira
        [/scroll_to_unit]

        {FACE_UNIT id=Anya id=Daeira}

        [fade_out_music]
            duration=500
        [/fade_out_music]

        [message]
            speaker=Anya
            message= _ "Oh. It is you again. I thought you disappeared for good this time."
        [/message]

        [delay]
            time=250
        [/delay]

        {FACE_UNIT id=Daeira id=Anya}

        {REPLACE_SCENARIO_MUSIC nunc_dimittis.ogg}

        [delay]
            time=250
        [/delay]

        [message]
            speaker=Daeira
            message= _ "It has been a while."
        [/message]

        # Only one of these [if] blocks actually results in dialogue for a
        # single playthrough, with the exception of anya_gets_meta, which has
        # an alternative that other dialogues may segue into, while itself
        # segues into the final part of the story of Anya's parents if that was
        # her choice.

        [if]
            {VARIABLE_BOOLEAN_EQUALS anya_wants_cake yes}
            [then]
                [message]
                    speaker=Daeira
                    message= _ "Did you find the cake you wanted?"
                [/message]

                [message]
                    speaker=Anya
                    message= _ "No... I did not. I have hardly eaten anything in weeks. My mind has just been... sort of wandering off constantly. I feel like I shouldn’t be here."
                [/message]
            [/then]
        [/if]

        [if]
            {VARIABLE_BOOLEAN_EQUALS anya_wants_love yes}
            [then]
                [message]
                    speaker=Daeira
                    message= _ "You seem even more despondent than before."
                [/message]

                [message]
                    speaker=Anya
                    message= _ "... This whole situation is just too overwhelming. I feel lost. Ergea is not helpful — she wants me to play a role that wasn’t meant for me."
                [/message]

                [message]
                    speaker=Daeira
                    message= _ "This is about Elynia, am I correct?"
                [/message]

                [message]
                    speaker=Anya
                    message= _ "What do you mean?"
                [/message]

                [message]
                    speaker=Daeira
                    message= _ "You feel lost without her."
                [/message]

                [message]
                    speaker=Anya
                    # po: This line is repeated later in the scenario.
                    message= _ "... I do. I really do."
                [/message]
            [/then]
        [/if]

        [if]
            {VARIABLE_BOOLEAN_EQUALS anya_gets_meta yes}
            [then]
                [message]
                    speaker=Anya
                    message= _ "I have been thinking about what you said about destiny... You know, after becoming this... thing... I became, I somehow feel even less in control of my life than I was before."
                [/message]

                [message]
                    speaker=Daeira
                    message= _ "How so, exactly?"
                [/message]

                [message]
                    speaker=Anya
                    #po: This is indeed meant to be reminiscent of Elyssa's thoughts in E3S8A.
                    message= _ "My actions have constantly been dictated by someone else. Elorran, Elynia, Ergea... I have never truly been free, have I? Just constantly following orders like a machine, unquestioning. But all of a sudden I feel compelled to question everything, if that makes sense? And the worst part is that I can’t tell if it’s because of my connection to Darkness, or because I became a Guardian and now I feel this constant pain within my heart..."
                [/message]

                [message]
                    speaker=Daeira
                    message= _ "Would that be your actual heart, or the divine instrument demonkind calls the Energy Heart?"
                [/message]

                [message]
                    speaker=Anya
                    message= _ "I can’t even tell the difference anymore."
                [/message]

                [message]
                    speaker=Daeira
                    message= _ "I can only speculate about the nature and extent of your powers, but I would expect Guardians of Darkness to be better in touch with the notion of agency seeing as how their domain revolves around the matters of mind. If the gift you now possess comes with greater self-awareness, then it is up to you to make use of it in a way that can advance your own existence towards a positive outcome."
                [/message]

                [message]
                    speaker=Anya
                    message= _ "But what if the only path forward I see involves leaving people behind?"
                [/message]

                [message]
                    speaker=Daeira
                    message= _ "The future is constantly clouded in darkness, but you need not be afraid of the core substance of your being, do you? We are not always given a choice, but when we are, it is up to us to make the right one — and a Guardian’s choices carry more weight upon our reality than anyone else’s."
                [/message]
            [/then]
            [else]
                [message]
                    speaker=Daeira
                    message= _ "Have you pondered the matter of destiny yet?"
                [/message]

                [message]
                    speaker=Anya
                    message= _ "I... uh... What do you mean?"
                [/message]

                [message]
                    speaker=Daeira
                    message= _ "I must not have talked to you about it. My apologies. You need not worry about it for now."
                [/message]

                [message]
                    speaker=Anya
                    message= _ "I have so many questions..."
                [/message]

                [message]
                    speaker=Daeira
                    message= _ "Xia’el does not have answers for you anymore, sadly."
                [/message]
            [/else]
        [/if]

        [if]
            {VARIABLE_BOOLEAN_EQUALS anya_wants_to_see_the_manager yes}
            [then]
                [message]
                    speaker=Anya
                    message= _ "Am I ever going to find out what happened to my parents after I was born?"
                [/message]

                [message]
                    speaker=Daeira
                    message= _ "As a matter of fact, yes. I opted not to tell you the entire story out of concern for your emotional state in battle, but I can finish it now if you would like."
                [/message]

                [message]
                    speaker=Anya
                    message= _ "What?! You knew the rest of the story but didn’t tell it to me?! I thought you said you were just a medium and you didn’t have it!"
                [/message]

                [message]
                    speaker=Daeira
                    message= _ "I said your question was already answered, and it was. I never specified whether I was able to intentionally postpone delivering a non-essential part of the answer or not. I apologize, but it had to be done."
                [/message]

                [message]
                    speaker=Anya
                    message= _ "(<i>sighs</i>) I understand. And... I’m sorry for my outburst."
                [/message]

                [message]
                    speaker=Daeira
                    message= _ "So, let us pick up from where we left last time..."
                [/message]

                [message]
                    speaker=Daeira
                    message= _ "The hearts of Mintha and the Nameless One were overflowing with newfound happiness and purpose after conceiving a child that they could call their own. The offspring would be a new free creature born of faerie and demonkind, a unique combination completely unheard of before. The future of the two lovers seemed bright for once."
                [/message]

                [message]
                    speaker=Daeira
                    message= _ "It was not rare for travelers to get lost in the forests of Glamdrol, and Mintha and the Nameless One routinely guided them out of the forest without overtly revealing themselves. However, one fateful night, a mysterious interloper found them first. The couple did not know what to make of the situation. How did he manage to enter their home entirely unnannounced?

The Wanderer came to them to impart his knowledge of events past, and events that had not yet come to pass. He told them of the looming threat of the Chaos Empire, Merthiaal’s legacy, the War Against the Unknown, and the return of the Lady of Light. And he told them of one possible fate that awaited the unborn child and its parents — for the Nameless One had not fully escaped Uria’s grasp, and the keen-nosed Demon Lord Nar-hamoth personally sought to make the shapeshifter pay a hefty price for their transgressions."
                [/message]

                [message]
                    speaker=Daeira
                    # po: Reminder that Nar-Hamoth is the Shadow of Uria.
                    message= _ "The couple were uncertain as to whether to believe the Wanderer’s words or not. How could their child just so happen to be the one destined to become the New Guardian of Darkness? If their offspring would indeed be found along with them by Uria’s forces before coming of age, then it would all have been for naught, and the world would be plunged into an eternal darkness — one much deeper and more pervasive than even that of the Endless Night, a darkness that would cause even the Seed of Earth to wither and die, and then all life would simply cease to be.

Before departing, the Wanderer offered them an alternative: Mintha could give birth and hold the child in her bosom for one month, but afterwards she would have to leave it in the care of a human family — more specifically, one already fraught with loss. Finally, if the Nameless One hoped to escape the Shadow of Uria for good, they would have to either die, or relinquish their physical form for good.

Upon saying that, the man left as silently as he came, fading into the dark of the night. They considered going after him to ask more questions, but somehow he did not even leave a trail for them to follow."
                [/message]

                [message]
                    speaker=Daeira
                    message= _ "Nine months they spent pondering the Wanderer’s words. Nine months they spent hoping that what they heard was naught but the ravings of a senile man. But rumors of Chaos Empire incursions began to spread around the marches, and the Nameless Shapeshifter caught wind of them as well. Their rendezvous with the vengeful Demon Lord was imminent.

Neither of them ever imagined they would be faced with a decision that would concern not only the fruit of their love, but also the fate of an entire world. Could they really risk dooming their child to certain death when they had the option to give it some semblance of a proper life with humans until the day of its awakening?"
                [/message]

                [message]
                    speaker=Daeira
                    message= _ "And so it came to pass that the child was born. Their offspring subconsciously took on some of Mintha’s features due to her being the very first thing it saw in the world. The Nameless One and Mintha cared for it for a month, regarding it as the most precious thing in their lives.

Stricken with grief, Mintha traveled into the northern country and left the creature in the care of a farmer couple. She thought the exchange would be fair for them, as they had just lost their own newborn to a deadly plague. The humans never thought to question the nature of the unfamiliar child left by their front door in the night. They decided to give her the name of their late daughter and raise her as their own."
                [/message]

                [message]
                    speaker=Daeira
                    message= _ "The Faerie of Resurrection finally returned to Glamdrol, and shared a last passionate kiss with the Nameless Shapeshifter. Together they cast a spell that unbind the soul of the demon from their mortal body. The lovers had agreed to spend the rest of eternity together no matter if they were unable to embrace one another again.

And it was so that the soul of the Nameless One went to an eucalyptus tree, and Mintha went back to her original form to keep them company, right where she first found them."
                [/message]

                {FACE_UNIT id=Anya id=Daeira} {OPPOSITE_FACING}

                [message]
                    speaker=Daeira
                    message= _ "When the Demon Lord Nar-hamoth found the corpse of his former slave he could only growl and trample the forest in frustration for being denied his revenge."
                [/message]

                [delay]
                    time=1000
                [/delay]

                [message]
                    speaker=Anya
                    message= _ "I don’t know what I was expecting... I— I think I know exactly which forest that was. I had been there before... I... I..."
                [/message]

                [message]
                    speaker=Daeira
                    message= _ "They would not have been able to tell you."
                [/message]

                [message]
                    speaker=Anya
                    message= _ "That entire forest... it doesn’t exist anymore... the entire place... Oh gods..."
                [/message]

                [delay]
                    time=500
                [/delay]

                {FACE_UNIT id=Anya id=Daeira}

                [delay]
                    time=500
                [/delay]

                [message]
                    speaker=Anya
                    message= _ "I could’ve killed him. I could’ve killed Nar-hamoth..."
                [/message]

                [message]
                    speaker=Daeira
                    message= _ "You did not know."
                [/message]

                {FACE_UNIT id=Anya id=Daeira} {OPPOSITE_FACING}

                [message]
                    speaker=Anya
                    message= _ "Heh, but it wouldn’t have changed anything, would it..."
                [/message]

                [delay]
                    time=750
                [/delay]

                {FACE_UNIT id=Anya id=Daeira}

                [message]
                    speaker=Anya
                    message= _ "They could have both taken me with them deep into the country and we would have all survived together..."
                [/message]

                [message]
                    speaker=Daeira
                    message= _ "It was a risk they chose not to take."
                [/message]

                [message]
                    speaker=Anya
                    message= _ "Choices, huh... it’s all down to choices... Do they even matter in the end?"
                [/message]

                [delay]
                    time=500
                [/delay]

                {FACE_UNIT id=Anya id=Daeira} {OPPOSITE_FACING}

                [delay]
                    time=500
                [/delay]
            [/then]
        [/if]

        [message]
            speaker=Anya
            message= _ "What am I supposed to do now?"
        [/message]

        [message]
            speaker=Daeira
            message= _ "I think you already know what you are going to do. It is not even going to be a choice, is it?"
        [/message]

        {FACE_UNIT id=Anya id=Daeira}

        [message]
            speaker=Anya
            message= _ "What do you mean?"
        [/message]

        [message]
            speaker=Daeira
            message= _ "What you do next is a constant. No matter how you get here, you always do what you want to do, as well as what is expected of you. They do not <i>have</i> to be mutually exclusive concepts, after all."
        [/message]

        {FACE_UNIT id=Anya id=Daeira} {OPPOSITE_FACING}

        [message]
            speaker=Anya
            message= _ "I suppose so..."
        [/message]

        # Blackout

        [mute_sound_effects][/mute_sound_effects]

        {REPLACE_SCENARIO_MUSIC silence.ogg}

        [kill]
            id=Daeira
        [/kill]

        [modify_side]
            side=3
            controller=null
            hidden=yes
        [/modify_side]

        [store_unit]
            [filter]
                id=Anya
            [/filter]
            kill=yes
            variable=anya_store
        [/store_unit]

        [hide_unit][/hide_unit]

        [store_shroud]
            side=1
            variable=shroud_map
        [/store_shroud]

        [place_shroud]
            side=1
        [/place_shroud]

        {BLACK_SCREEN}

        [redraw][/redraw]

        [delay]
            time=250
        [/delay]

        {RESET_SCREEN}

        [unhide_unit][/unhide_unit]

        {VARIABLE anya_store.facing nw}

        [unstore_unit]
            variable=anya_store
        [/unstore_unit]

        [set_shroud]
            side=1
            shroud_data=$shroud_map
        [/set_shroud]

        [redraw][/redraw]

        [delay]
            time=250
        [/delay]

        # This is meant to be a jarring transition

        [message]
            speaker=Anya
            message= _ "How long have I spent staring into this pond?"
        [/message]

        [delay]
            time=750
        [/delay]

        [reset_sound_effects][/reset_sound_effects]

        {FINALE_C_RESET_MUSIC}

        {UNLOCK_VIEW}
    [/event]

    [event]
        name=moveto
        [filter]
            id=Anya
            x,y=16,41
        [/filter]

        {LOCK_VIEW}

        [message]
            speaker=narrator
            image="items/crystal-glyph-powerup.png"
            sound="gate.ogg"
            message= _ "Access denied."
        [/message]

        [delay]
            time=2000
        [/delay]

        [message]
            speaker=narrator
            image=wesnoth-icon.png
            message= _ "All right. That was unexpected.

Perhaps this is the teleport glyph you have been looking for all along, and it was locked on purpose?

Maybe Elynia and Elyssa did not want you to follow them after all."
        [/message]

        [delay]
            time=750
        [/delay]

        {QUAKE ("cave-in.ogg")}

        [terrain]
            x=25-27,26
            y=38   ,37
            terrain=Cud
        [/terrain]

        [message]
            speaker=narrator
            image=wesnoth-icon.png
            message= _ "A wall moves."
        [/message]

        {CLEAR_CAVE_SHROUD (
            x,y=25,37
            radius=2
        )}

        {CLEAR_FOG 1 25 37 6}

        [redraw]
            side=1
        [/redraw]

        [scroll_to]
            x,y=26,37
        [/scroll_to]

        {HIGHLIGHT_GOAL (x,y="25,26","38,37")}

        [scroll_to_unit]
            id=Anya
        [/scroll_to_unit]

        {UNCLEAR_FOG}

        [redraw]
            side=1
        [/redraw]

        {UNLOCK_VIEW}

        {OBJECTIVES (
            side=1
            victory_string= _ "Current Objective:"
            {OBJECTIVE_VICTORY ( _ "Find another access way to the breach site")}

            {OBJECTIVE_NO_CARRYOVER}
        )}
    [/event]

#define __MSG_GLYPH _MSG
    [message]
        speaker=narrator
        image=items/crystal-glyph-message.png
        caption= _ "Crystal Glyph (Argan)"
        message={_MSG} # wmllint: ignore
    [/message]
#enddef

#define __MSG_GLYPH_2 _MSG
    [message]
        speaker=narrator
        image=items/crystal-glyph-message.png
        caption= _ "Crystal Glyph (Elyssa)"
        message={_MSG} # wmllint: ignore
    [/message]
#enddef

    [event]
        name=moveto
        [filter]
            side=1
            x,y=32,38
        [/filter]

        [allow_undo][/allow_undo]

        # po: This line is Argan speaking about Uria.
        {__MSG_GLYPH ( _ "Her mission as the Guardian of Life of our cycle was subverted by her own will through a series of unfortunate circumstances, but not stopped. Whereas a normal Guardian of Life should ensure that life can prosper and thrive in their world, Uria has destroyed the lives of countless people on Urvatha and Irdya. However, she has also <i>created</i> life by stealing and embracing technology created on Norsula, as well as ancient Irdya. The scriptures say that a Guardian of Life should not be able to <i>create</i> life!")}
    [/event]

    [event]
        name=moveto
        [filter]
            side=1
            x,y=34,39
        [/filter]

        [allow_undo][/allow_undo]

        # po: This line is still Argan speaking.
        {__MSG_GLYPH ( _ "The fact that the Norsulans have access to unprecedented knowledge of the guardians’ biological aspect has been useful to Uria so far, but she fears the day that was foretold by the Seer, in which “the new Guardian of Water will arise and attempt to rob the Guardian of Life’s rightful prize”. Although Uria has agents on Norsula trying to find this man — or beast — before his awakening can take place, such a task is doomed to failure.")}
    [/event]

    [event]
        name=moveto
        [filter]
            side=1
            x,y=36,40
        [/filter]

        [allow_undo][/allow_undo]

        # po: This line is still Argan speaking.
        {__MSG_GLYPH ( _ "Norsula is a large world, even larger than Ethea or Irdya. Around the time I first arrived on Irdya, Norsulans were still a largely ignorant bunch, lacking the boon of magic that the Irdyans embraced early on in their world’s history. But at some point, their technological development rate suddenly surpassed that of Irdya or even Ethea. Some say that an external influence contributed to their accelerated evolution as a world.")}
    [/event]

    [event]
        name=moveto
        first_time_only=no
        [filter]
            side=1
            [and]
                x,y=27,41
                [or]
                    x,y=29,42
                [/or]
            [/and]
        [/filter]
        [filter_condition]
            {VARIABLE_BOOLEAN_EQUALS used_language_glyph no}
        [/filter_condition]

        [allow_undo][/allow_undo]

        [message]
            speaker=narrator
            image=wesnoth-icon.png
            message= _ "The glyph’s contents seem to be in a language you have never read nor heard before."
        [/message]
    [/event]

    [event]
        name=moveto
        [filter]
            id=Anya
            x,y=31,43
        [/filter]

        [message]
            speaker=narrator
            image=wesnoth-icon.png
            message= _ "This glyph seems different from the rest. It seems to encode some kind of spell instead of a message.

You wonder what would happen if you try it out."
        [/message]

        [sound]
            name=magic-1.ogg
        [/sound]

        [delay]
            time=750
        [/delay]

        [message]
            speaker=narrator
            image=wesnoth-icon.png
            message= _ "Nothing.

This is absolutely pointless."
        [/message]

        {VARIABLE used_language_glyph yes}
    [/event]

    [event]
        name=moveto
        [filter]
            side=1
            [and]
                x,y=27,41
                [or]
                    x,y=29,42
                [/or]
            [/and]
        [/filter]
        [filter_condition]
            {VARIABLE_BOOLEAN_EQUALS used_language_glyph yes}
        [/filter_condition]

        [message]
            speaker=narrator
            image=wesnoth-icon.png
            message= _ "Wait a moment.

This glyph’s message seemed unintelligible to you before, but now it is not."
        [/message]
    [/event]

    [event]
        name=moveto
        [filter]
            side=1
            x,y=27,41
        [/filter]
        [filter_condition]
            {VARIABLE_BOOLEAN_EQUALS used_language_glyph yes}
        [/filter_condition]

        [allow_undo][/allow_undo]

        # po: Elyssa speaking.
        {__MSG_GLYPH_2 ( _ "Just as Norsula’s technological advancements were the consequence of external influence, much of Ethea’s technological and cultural advancements have been the consequence of secret exchanges with Norsula and lesser worlds over centuries. In fact, only very recently has Norsula’s existence been revealed to Ethean commoners, sparking all kinds of conflicts between the many ruling countries.")}
    [/event]

    [event]
        name=moveto
        [filter]
            side=1
            x,y=29,42
        [/filter]
        [filter_condition]
            {VARIABLE_BOOLEAN_EQUALS used_language_glyph yes}
        [/filter_condition]

        [allow_undo][/allow_undo]

        [message]
            speaker=narrator
            image=wesnoth-icon.png
            message= _ "The contents of this glyph seem to have been encoded quite a while ago, given what you already know from Elynia."
        [/message]

        # po: Elyssa speaking.
        {__MSG_GLYPH_2 ( _ "Ethean technology is said to not be very advanced, but the persistent meddling of Valdir’s successor and his people have slowly yet steadily changed the status quo. Uria’s agents have traveled from the unprotected Norsula and infiltrated Ethea to arrange the scenario for her eventual arrival, but everything seems to indicate that the Guardian of Water also has an agenda of his own involving the seed on that world.

The Seer’s ramblings on the matter are hazy and confusing, mentioning more and more nonsensical titles that cannot be accurately attributed to any known key individuals. The only thing that we know for sure is that the Seer will eventually be slain, thus making it impossible for us to know what happens past that point in time.")}
    [/event]

    [event]
        name=moveto
        [filter]
            id=Anya
            x,y=39,44
        [/filter]

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

        [terrain]
            x=40
            y=44
            terrain=Urb
        [/terrain]

        [message]
            speaker=narrator
            image=wesnoth-icon.png
            message= _ "Touchplate triggered. A wall moves."
        [/message]

        [redraw]
            side=1
        [/redraw]
    [/event]

    [event]
        name=moveto
        [filter]
            id=Anya
            x,y=61,49
        [/filter]

        [message]
            speaker=narrator
            image="items/crystal-glyph-powerup.png"
            message= _ "Access granted."
        [/message]
    [/event]

    [event]
        name=moveto
        first_time_only=no
        [filter]
            id=Anya
            x,y=61,49
        [/filter]

        [message]
            speaker=narrator
            image=wesnoth-icon.png
            message= _ "This seems to be the teleport glyph you were searching for. But... do you really want to proceed with this plan?

Are you absolutely sure that it is worth it?"

            [option]
                label= _ "female^Yes, I am absolutely sure. I need to see Elynia again. I need her."
                [command]
                    [fire_event]
                        name=the end
                        [primary_unit]
                            x,y=$x1,$y1
                        [/primary_unit]
                    [/fire_event]
                [/command]
            [/option]
            [option]
                label= _ "female^No. Perhaps I will explore around a little more and try to make up my mind about this."
                [command]
                    [allow_undo][/allow_undo]
                [/command]
            [/option]
            [option]
                label= _ "female^No."
                [command]
                    [allow_undo][/allow_undo]
                [/command]
            [/option]
        [/message]
    [/event]

    [event]
        name=the end

        {LOCK_VIEW}

        {CLEAR_LABELS}

        [fade_out_music]
            duration=2000
        [/fade_out_music]

        {REPLACE_SCENARIO_MUSIC "silence.ogg"}
        {INCIDENTAL_MUSIC       "love_theme.ogg"}

        [delay]
            time=3000
        [/delay]

        [message]
            speaker=Anya
            message= _ "No matter how much I want, Irdya will never be my true home. I’ve always been an outcast. I don’t belong with either species. And I don’t want to take part in Ergea’s plans anymore."
        [/message]

        [message]
            speaker=Anya
            message= _ "At least on Ethea I might be able to find Elynia... and tell her... that I want to be with her..."
        [/message]

        [message]
            speaker=narrator
            image=wesnoth-icon.png
            message= _ "Do you?"
        [/message]

        [message]
            speaker=Anya
            message= _ "Yes, I do. I really do."
        [/message]

        [message]
            speaker=narrator
            image=wesnoth-icon.png
            message= _ "Is this your heart speaking, or your mind?"
        [/message]

        [message]
            speaker=Anya
            message= _ "... I guess it’s both."
        [/message]

        [message]
            speaker=Anya
            message= _ "Oh dear gods... Am I really speaking to myself now?"
        [/message]

        [message]
            speaker=Anya
            message= _ "... Forgive me, Durvan, Ergea, Irylean..."
        [/message]

        [delay]
            time=1000
        [/delay]

        [store_unit]
            [filter]
                id=Anya
            [/filter]
            kill=yes
            variable=anya_store
        [/store_unit]

        #
        # Kill off everyone, on map or otherwise.
        #
        [kill][/kill]

        {CLEAR_FOG 1 $anya_store.x $anya_store.y $anya_store.max_moves}

        [redraw]
            side=1
        [/redraw]

        [fade_out_music]
            duration=2000
        [/fade_out_music]

        #
        # ??????
        #

        [move_unit_fake]
            side=2
            type=Shaxthal Worm
            image_mods="PAL(shaxthal_drone_base>shaxthal_drone_surface)"
            x=61,61
            y=52,49
        [/move_unit_fake]

        [redraw][/redraw]

        [delay]
            time=500
        [/delay]

        {UNCLEAR_FOG}

        [remove_item][/remove_item]

        {FADE_TO_BLACK}

        [place_shroud]
            side=1
        [/place_shroud]

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

        {SWITCH_FLOOR 2}

        #
        # The cutscene is played by the enter floor 2 event handler
        # invoked above. It leads directly to the end of the game.
        #
    [/event]

    [event]
        name=setup floor 2

        {REMOVE_SOUND_SOURCE hive_noise}

        #
        # We don't set up a new ambience sound source, this is intentional
        # since it's an emotional scene of sorts.
        #

        [scroll_to]
            x,y=44,29
            {WARP}
        [/scroll_to]

        [terrain]
            x=0-25,26-29
            y=0-18, 0-10
            terrain=Qxua
        [/terrain]

        {CLEAR_VARIABLE anya_store.status}

        [set_variables]
            name=anya_store
            mode=merge
            [value]
                hitpoints=$anya_store.max_hitpoints
                moves=$anya_store.max_moves
                attacks_left=$anya_store.max_attacks
                x,y=44,29
                facing=nw
            [/value]
        [/set_variables]

        [store_locations]
            terrain=Cud^Xo
            variable=spire_locs
        [/store_locations]

        [foreach]
            array=spire_locs
            variable=spire
            [do]
                [hidden_unit]
                    type=Verlissh Control Spire
                    side=2
                    x,y=$spire.x,$spire.y
                    upkeep=free
                    ai_special=guardian
                    [modifications]
                        [object]
                            silent=yes
                            [effect]
                                apply_to=remove_attacks
                                name=noctum
                            [/effect]
                        [/object]
                    [/modifications]
                [/hidden_unit]
            [/do]
        [/foreach]

        {CLEAR_VARIABLE spire_locs}
    [/event]

    [event]
        name=enter floor 2

        {SET_THEME {FULLSCREEN_CUTSCENE_UI}}

        [scroll_to]
            x,y=36,25
            {WARP}
        [/scroll_to]

        [remove_shroud]
            side=1
        [/remove_shroud]

        {FADE_IN}

        [unhide_unit][/unhide_unit]

        [unstore_unit]
            variable=anya_store
        [/unstore_unit]

        {CLEAR_VARIABLE anya_store}

        {MOVE_UNIT id=Anya 41 28}

        [delay]
            time=250
        [/delay]

        {MOVE_UNIT id=Anya 36 25}

        [delay]
            time=250
        [/delay]

        [message]
            speaker=narrator
            image=wesnoth-icon.png
            message= _ "Why do you still hesitate, girl? You are almost there."
        [/message]

        [message]
            speaker=Anya
            message= _ "... What if Elynia rejects me? What if I am not actually supposed to do this?"
        [/message]

        [message]
            speaker=narrator
            image=wesnoth-icon.png
            message= _ "<i>Trust your heart.</i> Those were Elynia’s own words."
        [/message]

        [message]
            speaker=Anya
            message= _ "That is correct. I..."
        [/message]

        [delay]
            time=250
        [/delay]

        {MOVE_UNIT id=Anya 33 24}

        {MOVE_UNIT id=Anya 31 23}

        [scroll_to]
            x,y=26,20
        [/scroll_to]

        [message]
            speaker=Anya
            message= _ "I will do this."
        [/message]

        {MOVE_UNIT id=Anya 26 20}

        [delay]
            time=1000
        [/delay]

        [message]
            speaker=Anya
            message= _ "I am sorry, Elynia. But... I need you..."
        [/message]

        [item]
            [filter]
                id=Anya
            [/filter]
            halo="halo/heart-aura.png~B(255)"
            image="misc/blank-hex.png"
        [/item]

        [delay]
            time=750
        [/delay]

        [message]
            speaker=narrator
            caption= _ "Anya"
            image=misc/blank-hex.png
            message= _ "<i>... I need you...</i>"
        [/message]

        [delay]
            time=750
        [/delay]

        [scroll_to]
            x,y=1,1
        [/scroll_to]

        [kill][/kill]

        [remove_item][/remove_item]

        {FADE_TO_BLACK}

        [place_shroud]
            side=1
        [/place_shroud]

        [delay]
            time=1000
        [/delay]

        [fade_out_music]
            duration=5000
        [/fade_out_music]

        {UNLOCK_VIEW}

        [if]
            {VARIABLE_BOOLEAN_EQUALS have_argans_missing_pages no}
            [then]
                [transient_message]
                    message= _ "You feel as though a certain other Guardian of Darkness may have missed something..."
                [/transient_message]

                {ENDLEVEL_QUIET} {NO_END_CREDITS} {NO_END_TEXT} {NO_START_OF_SCENARIO_SAVE}
            [/then]
            [else]
                {ENDLEVEL_QUIET}
                [+endlevel]
                    next_scenario=13_Epilogue
                [/endlevel]
            [/else]
        [/if]
    [/event]

    [event]
        name=victory

        {CLEAR_VARIABLE used_language_glyph}
    [/event]
[/scenario]

#undef __MSG_GLYPH
#undef __MSG_GLYPH_2
#undef FINALE_C_GUARDIAN
#undef FINALE_C_RESET_MUSIC

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


#textdomain wesnoth-After_the_Storm

[scenario]
    id=13_Epilogue
    name= _ "Epilogue"
    {MAP 13_Epilogue_01.map}
    turns=-1
    next_scenario=null
    victory_when_enemies_defeated=no
    disallow_recall=yes

    {FULLSCREEN_CUTSCENE_UI}

    {SCENARIO_MUSIC "frantic.ogg"}

    {STORYTXT_EPILOGUE}

    {FIRST_WATCH} {SCHEDULE_LIGHTING -20 -40 0}

    [side]
        side=1
        controller=human
        persistent=no
        team_name=evil
        user_team_name= _ "team_name^Uria"
        {CHAOS_FLAG}
        color=gold

        {NO_ECONOMY}

        shroud=yes
        hidden=yes

        canrecruit=yes
        type=Guardian of Life Uria
        id=Uria
        name= _ "Uria"
        facing=se
        #profile="portraits/uria.png"
        unrenamable=yes
        [modifications] # Should match Elynia
            {TRAIT_RESILIENT}
            {TRAIT_DEXTROUS}
        [/modifications]
    [/side]

    [side]
        side=2
        team_name=good
        user_team_name= _ "team_name^Aradellys"
        color=teal

        {NO_ECONOMY}

        hidden=yes

        canrecruit=yes
        type=Guardian of Earth Aradellys
        id=Aradellys
        name= _ "Aradellys"
        #profile="portraits/aradellys.png"
        unrenamable=yes
        facing=ne
        [modifications]
            {TRAIT_INTELLIGENT}
            {TRAIT_FEARLESS}
        [/modifications]
    [/side]

    {STARTING_VILLAGES_ALL 2}

#define EPI_ECC_NPC _VARIATION _X _Y _FACING
    [unit]
        type=Epilogue Cutscene Controller
        x={_X}
        y={_Y}
        facing={_FACING}
        variation={_VARIATION}
        generate_name=yes
        random_traits=yes
        random_gender=yes
    [/unit]
#enddef

#define EPI_GEN_NPC _TYPE _X _Y _FACING
    [unit]
        type={_TYPE}
        x={_X}
        y={_Y}
        facing={_FACING}
        generate_name=yes
        random_traits=yes
        random_gender=yes
    [/unit]
#enddef

    [side]
        side=3
        team_name=good
        user_team_name= _ "team_name^Aradellys"
        color=red

        {NO_ECONOMY}

        hidden=yes
        no_leader=yes

        # NOTE: We use the ECC version of the Naiad unit type here instead of
        #       the regular Naiad so the unit type isn't revealed in the help
        #       system by just reaching the scenario without fulfilling the
        #       requirements to see Daeira in the main story.

        {EPI_GEN_NPC (Faerie Spirit) 15 49 ne} {PALETTE faerie_spirit_hair_base faerie_spirit_hair_gold}
        {EPI_GEN_NPC (Faerie Spirit) 14 52 ne} {PALETTE faerie_spirit_hair_base faerie_spirit_hair_gold}
        {EPI_GEN_NPC (Faerie Spirit) 16 53 ne}

        {EPI_ECC_NPC naiad 15 50 ne}

        {EPI_GEN_NPC (Faerie Sprite) 15 58 ne}
        {EPI_GEN_NPC (Faerie Sprite)  4 59 ne} {PALETTE faerie_sylvan_wings faerie_neutral_wings}
        {EPI_GEN_NPC (Faerie Sprite) 17 66 ne}
        {EPI_GEN_NPC (Faerie Sprite) 17 72 ne} {PALETTE faerie_sylvan_wings faerie_neutral_wings}

        {EPI_GEN_NPC (Faerie Sprite) 45 69 nw}
        {EPI_GEN_NPC (Faerie Sprite) 39 73 nw} {PALETTE faerie_sylvan_wings faerie_sylvan_bright_wings}
        {EPI_GEN_NPC (Faerie Sprite) 32 65 nw} {PALETTE faerie_sylvan_wings faerie_neutral_wings}
        {EPI_GEN_NPC (Faerie Sprite) 42 61 nw}

        {EPI_GEN_NPC (Faerie Dryad) 46 69 nw} {PALETTE faerie_sylvan_wings faerie_neutral_wings}

        {EPI_ECC_NPC naiad 38 56 nw}
        {EPI_ECC_NPC naiad 45 55 nw}
        {EPI_ECC_NPC naiad 49 61 nw}

        {EPI_GEN_NPC (Faerie Dryad) 41 62 nw}
        {EPI_GEN_NPC (Faerie Dryad) 35 64 nw} {PALETTE faerie_sylvan_wings faerie_sylvan_bright_wings}

        {EPI_ECC_NPC eventide_dancer 38 65 nw}
        {EPI_ECC_NPC eventide_dancer 35 61 nw}
        {EPI_ECC_NPC eventide_dancer 41 49 nw}

        {EPI_ECC_NPC eventide_dancer 16 60 ne}
        {EPI_ECC_NPC eventide_dancer  5 66 ne}
        {EPI_ECC_NPC eventide_dancer 28 68 nw}

        {EPI_ECC_NPC domain_guard 24 54 ne} {PALETTE faerie_guard_wings faerie_sylvan_wings}
        {EPI_ECC_NPC domain_guard 24 52 ne} {PALETTE faerie_guard_wings faerie_sylvan_wings}
        {EPI_ECC_NPC domain_guard 24 50 ne} {PALETTE faerie_guard_wings faerie_sylvan_wings}
        {EPI_ECC_NPC domain_guard 28 54 nw} {PALETTE faerie_guard_wings faerie_sylvan_wings}
        {EPI_ECC_NPC domain_guard 28 52 nw} {PALETTE faerie_guard_wings faerie_sylvan_wings}
        {EPI_ECC_NPC domain_guard 28 50 nw} {PALETTE faerie_guard_wings faerie_sylvan_wings}

        {EPI_ECC_NPC domain_guard 32 52 nw}
        {EPI_ECC_NPC domain_guard 20 52 ne}

        {EPI_ECC_NPC domain_guard 24 61 nw}
        {EPI_ECC_NPC domain_guard 21 60 nw}
        {EPI_ECC_NPC domain_guard 28 61 ne}
        {EPI_ECC_NPC domain_guard 31 60 ne}

        {EPI_ECC_NPC domain_guard  5 58 ne}
        {EPI_ECC_NPC domain_guard  9 64 ne}
        {EPI_ECC_NPC domain_guard 15 69 ne}
        {EPI_ECC_NPC domain_guard 23 68 ne}

        {EPI_ECC_NPC domain_guard 29 71 nw}
        {EPI_ECC_NPC domain_guard 38 69 nw}
        {EPI_ECC_NPC domain_guard 38 61 nw}

        {EPI_ECC_NPC domain_guard 32 50 nw}
        [+unit]
            generate_name=no
            name= _ "Kri’tan"
        [/unit]

        {EPI_GEN_NPC (Fire Faerie) 43 66 nw}

        {EPI_GEN_NPC (Elvish Sylph) 49 71 nw}
        {EPI_GEN_NPC (Elvish Sylph) 43 45 nw}
        {EPI_GEN_NPC (Elvish Sylph)  5 48 ne}

        {EPI_GEN_NPC (Faerie Hamadryad)  7 53 se}
        {EPI_GEN_NPC (Faerie Hamadryad)  4 62 se}
        {EPI_GEN_NPC (Faerie Hamadryad) 43 72 nw}
        {EPI_GEN_NPC (Faerie Hamadryad) 44 51 sw}

        {EPI_GEN_NPC (Faerie Hamadryad) 18 54 ne}
        {EPI_GEN_NPC (Faerie Hamadryad) 19 58 se}
        {EPI_GEN_NPC (Faerie Hamadryad) 34 54 nw}
        {EPI_GEN_NPC (Faerie Hamadryad) 33 58 sw}
    [/side]

    [event]
        name=prestart

        {BLACK_SCREEN}

        [store_unit]
            [filter]
                id=Uria
            [/filter]
            variable=uria_store
            kill=yes
        [/store_unit]

        [place_shroud]
            side=1
            x=0-53
            y=0-12
        [/place_shroud]

        [hide_unit][/hide_unit]

        {LOCK_VIEW}
    [/event]

#define EPI_FADE_TO_BLACK_QUICK
    {FADE_STEP -64 5}
    {FADE_STEP -128 5}
    {FADE_STEP -192 5}
    {FADE_STEP -500 5}
#enddef

#define EPI_FADE_IN_QUICK
    {FADE_STEP -500 5}
    {FADE_STEP -192 5}
    {FADE_STEP -128 5}
    {FADE_STEP -64 5}
    {FADE_STEP 0 5}
#enddef

#define EPI_YELLOW_STEP _VAL
    [color_adjust]
        red={_VAL}
        green={_VAL}
        blue=0
    [/color_adjust]
#enddef

#define EPI_SET_XIAEL_VARIATION _VARIATION_ID
    [object]
        silent=yes
        [filter]
            id=Aradellys
        [/filter]
        [effect]
            apply_to=variation
            name={_VARIATION_ID}
        [/effect]
    [/object]

    [redraw][/redraw]
#enddef

#define EPI_ECC_KILLALL _STEP
    {VARIABLE ecc_advance_step {_STEP} }

    {VARIABLE ecc_step_image_mod "NOP()"}
    {VARIABLE ecc_step_ellipse   "misc/ellipse"}
    {VARIABLE ecc_step_hp_factor 1.0}

    [switch]
        variable=ecc_advance_step
        [case]
            value=1
            {VARIABLE ecc_step_image_mod ("CS(-32,-32,-32)")}
        [/case]
        [case]
            value=2
            {VARIABLE ecc_step_image_mod ("CS(-96,-96,-96)")}
            {VARIABLE ecc_step_ellipse   "misc/ellipse-nozoc"}
            {VARIABLE ecc_step_hp_factor 0.80}
        [/case]
        [case]
            value=3
            {VARIABLE ecc_step_image_mod ("CS(-196,-196,-196)~O(0.75)")}
            {VARIABLE ecc_step_ellipse   "misc/ellipse-nozoc"}
            {VARIABLE ecc_step_hp_factor 0.80}
        [/case]
        [case]
            value=4
            {VARIABLE ecc_step_image_mod ("CS(-255,-255,-255)~O(0.50)")}
            {VARIABLE ecc_step_ellipse   none}
            {VARIABLE ecc_step_hp_factor 0.40}
        [/case]
        [case]
            value=5
            {VARIABLE ecc_step_image_mod ("CS(-255,-255,-255)~O(0.30)")}
            {VARIABLE ecc_step_ellipse   none}
            {VARIABLE ecc_step_hp_factor 0.20}
        [/case]
        [case]
            value=6
            {VARIABLE ecc_step_image_mod ("CS(-255,-255,-255)~O(0.10)")}
            {VARIABLE ecc_step_ellipse   none}
            {VARIABLE ecc_step_hp_factor 0.10}
        [/case]
    [/switch]

    [store_unit]
        [filter]
            side=3
        [/filter]
        variable=ecc_npcs_store
        kill=no
    [/store_unit]

    [foreach]
        array=ecc_npcs_store
        variable=npc
        [do]
            [if]
                {VARIABLE_NUMERICAL_NOT_EQUALS ecc_step_hp_factor 1.0}
                [then]
                    {VARIABLE_MUL npc.max_hitpoints $ecc_step_hp_factor}

                    [unstore_unit]
                        variable=npc
                        find_vacant=no
                    [/unstore_unit]
                [/then]
            [/if]

            [if]
                {VARIABLE_NUMERICAL_LESS_THAN_OR_EQUAL ecc_advance_step 6}
                [then]
                    [object]
                        silent=yes
                        [filter]
                            x,y=$npc.x,$npc.y
                        [/filter]
                        [effect]
                            apply_to=image_mod
                            replace="$ecc_step_image_mod"
                        [/effect]
                        [effect]
                            apply_to=ellipse
                            ellipse="$ecc_step_ellipse" # wmllint: no ellipsecheck
                        [/effect]
                    [/object]
                [/then]
                [else]
                    [kill]
                        x,y=$npc.x,$npc.y
                        animate=no
                        fire_event=no
                    [/kill]
                [/else]
            [/if]
        [/do]
    [/foreach]

    {CLEAR_VARIABLE ecc_advance_step,ecc_npcs_store,ecc_step_image_mod,ecc_step_ellipse}

    [redraw][/redraw]

    [delay]
        time=120
    [/delay]
#enddef

#define EPI_MOVE_MIRRORED_UNIT _FILTER _X _Y
    [store_unit]
        [filter]
            {_FILTER}
        [/filter]
        kill=yes
        variable=temp_EPI_MMU
    [/store_unit]

    [move_unit_fake]
        x=$temp_EPI_MMU.x,{_X}
        y=$temp_EPI_MMU.y,{_Y}
        variation=$temp_EPI_MMU.variation
        type=$temp_EPI_MMU.type
        side=$temp_EPI_MMU.side
        gender=$temp_EPI_MMU.gender
        image_mods="FL(horiz)"
    [/move_unit_fake]

    [unstore_unit]
        find_vacant=yes
        variable=temp_EPI_MMU
        x={_X}
        y={_Y}
    [/unstore_unit]

    {CLEAR_VARIABLE temp_EPI_MMU}
#enddef

    [event]
        name=start

        #
        # Camera to bottom edge
        #

        [scroll_to]
            {WARP}
            x,y=26,74
        [/scroll_to]

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

        [redraw]
            side=1
        [/redraw]

        {FADE_IN}

        [unhide_unit][/unhide_unit]

        [delay]
            time=750
        [/delay]

        {EPI_MOVE_MIRRORED_UNIT id=Aradellys 26 58}

        [scroll_to]
            x,y=11,51
        [/scroll_to]

        [delay]
            time=750
        [/delay]

        [scroll_to]
            x,y=43,62
        [/scroll_to]

        [delay]
            time=750
        [/delay]

        [scroll_to_unit]
            id=Aradellys
        [/scroll_to_unit]

        [hide_unit][/hide_unit]

        {EPI_FADE_TO_BLACK_QUICK}

        {VARIABLE uria_store.x 26}
        {VARIABLE uria_store.y 36}

        [scroll_to]
            x,y=$uria_store.x,$uria_store.y
            {WARP}
        [/scroll_to]

        {EPI_FADE_IN_QUICK}

        [unhide_unit][/unhide_unit]

        [unstore_unit]
            variable=uria_store
        [/unstore_unit]

        {CLEAR_VARIABLE uria_store}

        # NOTE: Not mirrored using EPI_MOVE_MIRRORED_UNIT, she's
        # descending from the sky.
        {MOVE_UNIT id=Uria 26 42}

        [delay]
            time=750
        [/delay]

        [scroll_to_unit]
            id=Aradellys
        [/scroll_to_unit]

        [delay]
            time=750
        [/delay]

        [message]
            speaker=Uria
            message= _ "Ha ha ha ha ha! It has been hundreds of years since my last visit to Silida, and yet, nothing has changed. I am so delighted to see your subjects here, Xia’el — it is such a warm welcome. Did you miss me?"
        [/message]

        [message]
            speaker=Aradellys
            message= _ "What brings you here?"
        [/message]

        [message]
            speaker=Uria
            message= _ "We had a pact of neutrality and mutual respect, Xia’el. You would not interfere with my plans, and I would let you govern your precious people here in peace. But it has come to my attention that there has been a breach of terms on your part. My Seer just revealed some... troubling things to me."
        [/message]

        [scroll_to_unit]
            id=Aradellys
        [/scroll_to_unit]

        [message]
            speaker=Uria
            scroll=no
            message= _ "You have been meddling with my personal playground in the main branch of our universe; corrupting and manipulating he who used to serve as my Voice on Irdya, as well as his treacherous protégé. What did you expect to accomplish with this? To circumvent our pact by utilizing the Guardian of Earth on Irdya as your piece for your next move? Did you truly believe I would never find out?"
        [/message]

        [message]
            speaker=Aradellys
            message= _ "My only intention was to fulfill my duty as the Guardian of Earth and point my children on Irdya in the correct direction. That is to say, as far away from your grasp as possible so they may stage your ultimate downfall."
        [/message]

        [message]
            speaker=Uria
            scroll=no
            message= _ "On Ethea? Hm, hm, well, it just so happens that my forces are already on their way there, and this time I will personally take care of any opposition we find."
        [/message]

        [message]
            speaker=Aradellys
            message= _ "Even the new Guardian of Water? I received word that he is already there."
        [/message]

        [message]
            speaker=Uria
            message= _ "..."
        [/message]

        [message]
            speaker=Aradellys
            scroll=no
            message= _ "You fear him, don’t you? Of course, he poses as much danger to our existence as you do, but he at least manages to keep his destructive tendencies under control. You, on the other hand... you are a corrupted goddess, Lyphanea — if I may not stop you, then someone else has to take up that mission for me."
        [/message]

        [fade_out_music]
            duration=750
        [/fade_out_music]

        [delay]
            time=250
        [/delay]

        {REPLACE_SCENARIO_MUSIC "one_thousand_suns.ogg"}

        [message]
            speaker=Uria
            message= _ "(enraged) I see how it is, then! But tell me, Aradellys, did you forget the Rule of One?"
        [/message]

        [message]
            speaker=Aradellys
            scroll=no
            message= _ "I did not."
        [/message]

        [message]
            speaker=Uria
            message= _ "Your insolence cannot go unpunished. Even though I knew from the very beginning that things would come to this... I cannot allow you to interfere with my plans any further. You are a poor excuse for a Guardian of Earth, and this is not even your rightful domain. The true Guardian of Earth is awake, so your purpose in this universe has been fulfilled."
        [/message]

        [message]
            speaker=Uria
            message= _ "Now that you have helpfully advanced my pieces to the world on which I needed them in the first place, the game is over for you. After all, there can only be one."
        [/message]

        [message]
            speaker=Aradellys
            message= _ "I am willing to face oblivion at your hand for my transgressions. But you shall spare my people."
        [/message]

        [message]
            speaker=Uria
            message= _ "Hm, hm, what makes you think that I have to keep my word anymore?"
        [/message]

        [scroll_to_unit]
            id=Aradellys
        [/scroll_to_unit]

        [delay]
            time=750
        [/delay]

        [message]
            speaker=Aradellys
            message= _ "Please, if there is anything left of the kind Lyphanea in your heart, you shall spare my people as we agreed—"
        [/message]

        [message]
            speaker=Uria
            scroll=no
            message= _ "Lyphanea is no more."
        [/message]

        [delay]
            time=750
        [/delay]

        [scroll_to_unit]
            id=Uria
        [/scroll_to_unit]

        [delay]
            time=750
        [/delay]

        [store_unit]
            [filter]
                id=Uria
            [/filter]
            variable=uria_store
            kill=no
        [/store_unit]

        [object]
            silent=yes
            [filter]
                id=Uria
            [/filter]
            [effect]
                apply_to=variation
                name=powered
            [/effect]
        [/object]

        [redraw][/redraw]

        [delay]
            time=750
        [/delay]

        [message]
            speaker=Uria
            message= _ "If it helps, your subjects will be able to enjoy whatever afterlife is in store for them. But you... will not. Farewell, Xia’el. Your reign on Silida is over."
        [/message]

        [scroll_to_unit]
            id=Aradellys
        [/scroll_to_unit]

        [item]
            [filter]
                id=Aradellys
            [/filter]
            halo="halo/heart-aura.png~CS(-255,128,16)"
            image="misc/blank-hex.png"
        [/item]

        [sound]
            name=explosion-big.ogg
        [/sound]

        {EPI_YELLOW_STEP 32}
        {EPI_SET_XIAEL_VARIATION dying_1}
        {EPI_ECC_KILLALL 1}

        {EPI_YELLOW_STEP 64}
        {EPI_ECC_KILLALL 2}

        {EPI_YELLOW_STEP 96}
        {EPI_SET_XIAEL_VARIATION dying_2}
        {EPI_ECC_KILLALL 3}

        [sound]
            name=rumble.ogg
        [/sound]

        {EPI_YELLOW_STEP 128}
        {EPI_ECC_KILLALL 4}

        {EPI_YELLOW_STEP 196}
        {EPI_ECC_KILLALL 5}

        [sound]
            name=dragonstick.ogg
        [/sound]

        {EPI_YELLOW_STEP 255}
        {EPI_SET_XIAEL_VARIATION dying_3}
        {EPI_ECC_KILLALL 6}

        {EPI_YELLOW_STEP 500}
        {EPI_ECC_KILLALL 7}

        {EPI_SET_XIAEL_VARIATION dying_4}

        [redraw][/redraw]

        [delay]
            time=250
        [/delay]

        [remove_item]
            [filter]
                id=Aradellys
            [/filter]
        [/remove_item]

        [redraw][/redraw]

        [kill]
            id=Aradellys
            animate=yes
        [/kill]

        [hide_unit][/hide_unit]

        {WHITE_SCREEN}

        [delay]
            time=2000
        [/delay]

        [kill]
            [not]
                id=Uria
            [/not]
        [/kill]

        [replace_map]
            map="{LE /maps/13_Epilogue_02.map}"
            shrink,expand=yes,yes
        [/replace_map]

        [redraw]
            side=1
        [/redraw]

        [delay]
            time=1000
        [/delay]

        [delay]
            time=100
        [/delay]

        {RESET_SCREEN}

        [unhide_unit]
            id=Uria
        [/unhide_unit]

        [redraw]
            side=1
        [/redraw]

        {QUAKE ("explosion-big.ogg")}

        {QUAKE ()}

        {QUAKE ()}

        {QUAKE ()}

        [delay]
            time=5000
        [/delay]

        [message]
            speaker=Uria
            message= _ "Soon there will be a reckoning, Elynia-Thanadria — mark my words. Do not forget who made the resurrection of your new ally possible in the first place..."
        [/message]

        [unstore_unit]
            variable=uria_store
            find_vacant=no
        [/unstore_unit]

        [redraw][/redraw]

        {CLEAR_VARIABLE uria_store}

        {EPI_MOVE_MIRRORED_UNIT id=Uria 26 36}
        [+move_unit_fake]
            force_scroll=no
        [/move_unit_fake]

        [kill][/kill]

        {FADE_TO_BLACK}

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

        [place_shroud]
            side=1
            x=0-53
            y=0-12
        [/place_shroud]

        [fade_out_music]
            duration=4000
        [/fade_out_music]

        [delay]
            time=6000
        [/delay]

        {ENDLEVEL_QUIET} {NO_END_CREDITS} {NO_END_TEXT} {NO_START_OF_SCENARIO_SAVE} {NO_REPLAY_SAVE}
    [/event]
[/scenario]

#undef EPI_ECC_NPC
#undef EPI_GEN_NPC
#undef EPI_FADE_TO_BLACK_QUICK
#undef EPI_FADE_IN_QUICK
#undef EPI_YELLOW_STEP
#undef EPI_SET_XIAEL_VARIATION
#undef EPI_ECC_KILLALL
#undef EPI_MOVE_MIRRORED_UNIT

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