#textdomain wesnoth-After_the_Storm

[scenario]
    id=08C_Breakdown
    name= _ "Breakdown"
    {MAP 08C_Breakdown.map}
    turns=-1
    next_scenario=08D_Destiny_part_2
    victory_when_enemies_defeated=no
    disallow_recall=yes

    {FULLSCREEN_CUTSCENE_UI}

    {I_DEATHS}

    {FINALE_AMLA_EVENTS}

    {SCENARIO_MUSIC "silence.ogg"}

    {STORYTXT_BREAKDOWN}

    {SPAWN_CONTROLLER}

    {INDOORS_HIVE}

#define INT_STANDARD_ENEMY_AI
    {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]
#enddef

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

        shroud=yes

        hidden=yes

        {NO_ECONOMY}

        # wmllint: recognize Elynia
        {CHARACTER_STATS_ELYNIA}
        type=Guardian of Earth Elynia
        canrecruit=yes
    [/side]
    # wmllint: validate-on

    [side]
        side=2
        team_name=evil
        user_team_name= _ "team_name^Zhangor"
        {CHAOS_FLAG}

        # High level enemies

        hidden=yes
        no_leader=yes

        {NO_ECONOMY}

        {INT_STANDARD_ENEMY_AI}
    [/side]

    [side]
        side=3
        team_name=evil
        user_team_name= _ "team_name^Zhangor"
        {CHAOS_FLAG}

        # Low level enemies

        hidden=yes
        no_leader=yes

        {NO_ECONOMY}

        {INT_STANDARD_ENEMY_AI}
    [/side]

    [side]
        side=4
        team_name=evil
        user_team_name= _ "team_name^Zhangor"
        {CHAOS_FLAG}

        # Shaxthals

        hidden=yes
        no_leader=yes

        {NO_ECONOMY}

        {INT_STANDARD_ENEMY_AI}
    [/side]

    [side]
        side=5
        team_name=evil
        user_team_name= _ "team_name^Zhangor"
        {CHAOS_FLAG}
        controller=null

        # Doors

        hidden=yes
        no_leader=yes

        {NO_ECONOMY}
    [/side]

    [side]
        side=6
        team_name=evil
        user_team_name= _ "team_name^Elyssa"
        {RAGGED_FLAG}
        color=red
        controller=null

        hidden=yes
        no_leader=yes

        {NO_ECONOMY}
    [/side]

    [side]
        side=7
        team_name=evil
        # Cutscene shaxthals
        user_team_name= _ "team_name^Zhangor"
        {CHAOS_FLAG}

        hidden=yes
        no_leader=yes

        {NO_ECONOMY}
    [/side]

#undef INT_STANDARD_ENEMY_AI

#define INT_FLASH_RED
    {RED_SCREEN}

    [delay]
        time=100
    [/delay]

    {BLACK_SCREEN}
#enddef

#define INT_RED_AURA
    [item]
        [filter]
            id=Elynia
        [/filter]
        halo="halo/heart-aura.png"
        image="misc/blank-hex.png"
    [/item]
#enddef

#define INT_REMOVE_RED_AURA
    [remove_item]
        image="misc/blank-hex.png"
    [/remove_item]
#enddef

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

    {TIMED_DRONE_SPAWNER ({DIFF 4 3 2}) (type,facing="Shaxthal Sentry Drone",sw) 4 24 21}

    {TIMED_DRONE_SPAWNER 4 (type,facing="Shaxthal Sentry Drone",ne)   4 11 22}
    {TIMED_DRONE_SPAWNER 6 (type,facing="Shaxthal Enforcer Drone",se) 4 12 17}
    {TIMED_DRONE_SPAWNER 5 (type,facing="Shaxthal Sentry Drone",sw)   4 15 16}

    {TIMED_DRONE_SPAWNER 4 (type="Shaxthal Drone") 4 35 42}

    {TIMED_DRONE_SPAWNER 4 (type="Shaxthal Drone") 4 26 48}
    {TIMED_DRONE_SPAWNER 6 (type="Shaxthal Drone") 4 26 47}

    {TIMED_DRONE_SPAWNER 7 (type="Shaxthal Sentry Drone") 4 30 46}

    {TIMED_DRONE_SPAWNER 5 (type="Shaxthal Drone") 4 22 45}
    {TIMED_DRONE_SPAWNER 4 (type="Shaxthal Drone") 4 18 43}

    {TIMED_DRONE_SPAWNER 2 (type="Shaxthal Drone") 4 13 49}
    {TIMED_DRONE_SPAWNER 3 (type="Shaxthal Drone") 4 16 49}
    {TIMED_DRONE_SPAWNER 4 (type="Shaxthal Drone") 4 11 49}

    {TIMED_DRONE_SPAWNER 8 (type="Shaxthal Worm")  4 23 44}
    {TIMED_DRONE_SPAWNER 8 (type="Shaxthal Worm")  4 36 44}
    {TIMED_DRONE_SPAWNER 8 (type="Shaxthal Worm")  4 28 45}

    {TIMED_DRONE_SPAWNER 8 (type="Shaxthal Worm")  4 16 15}
    {TIMED_DRONE_SPAWNER 8 (type="Shaxthal Worm")  4  8 19}
    {TIMED_DRONE_SPAWNER 8 (type="Shaxthal Worm")  4  9 21}

    {BIND_UNIT_TO_UNIT_MOVEMENT_RANGE id=Elyssa id=Elynia}

    [event]
        name=prestart

        #
        # HACK: the spawner controller doesn't provide a clean interface
        #       for post-prestart spawns, so we must juggle around its units
        #       between the initial events so they are preserved after the
        #       marshmallow girl cutscene.
        #

        [store_unit]
            [filter]
                side=4
            [/filter]
            kill=yes
            variable=delayed_hive_spawns
        [/store_unit]
    [/event]

    #
    # Due to our map replacement during the start event for the purposes of
    # a short "meanwhile on the surface" cutscene, we must postpone the set-up
    # of elements such as [item]s and enemy [unit]s until later. This custom
    # event handler is invoked when we are ready to proceed with that.
    #
    [event]
        name=finalize scenario setup

        {ITEM_CRYSTAL_GLYPH_MESSAGE 30 23}

        {ITEM_CRYSTAL_GLYPH_MESSAGE 34 21}

        {ITEM_CRYSTAL_GLYPH_MESSAGE 34 25}

        {ITEM_CRYSTAL_GLYPH_MESSAGE 39 24}

        {ITEM_CRYSTAL_GLYPH_MESSAGE 14 49}

        {PLACE_IMAGE ("items/bones.png~FL(horiz)") 44 43}
        {PLACE_IMAGE ("items/bones.png")           14 50}

        {PLACE_IMAGE ("items/box.png") 44 21}
        {PLACE_IMAGE ("items/box.png") 51 16}

        {PLACE_IMAGE ("items/barrel.png") 44 20}

        {PLACE_IMAGE ("items/potion-green.png") 40 24}

        #
        # Restore hive spawns.
        #

        [foreach]
            array=delayed_hive_spawns
            [do]
                [unstore_unit]
                    variable=this_item
                [/unstore_unit]
            [/do]
        [/foreach]

        {CLEAR_VARIABLE delayed_hive_spawns}

        {GENERIC_UNIT 4 (Shaxthal Rayblade) 21 44} {NO_UPKEEP_NO_OVERLAY} {GUARDIAN} {FACING se}
        {GENERIC_UNIT 4 (Shaxthal Rayblade) 14 42} {NO_UPKEEP_NO_OVERLAY} {GUARDIAN} {FACING se}

        {GENERIC_UNIT 4 (Shaxthal Assault Drone) 41 45} {NO_UPKEEP_NO_OVERLAY} {GUARDIAN} {FACING se}

        {GENERIC_UNIT 4 (Shaxthal Rayblade) 49 42} {NO_UPKEEP_NO_OVERLAY} {GUARDIAN} {FACING se}

        {GENERIC_UNIT 3 (Demon) 60 37} {NO_UPKEEP_NO_OVERLAY} {GUARDIAN} {FACING nw} {GENDER male}
        {GENERIC_UNIT 3 (Demon) 54 38} {NO_UPKEEP_NO_OVERLAY} {GUARDIAN} {FACING ne} {GENDER female}

        {GENERIC_UNIT 3 (Chaos Magus) 58 38} {NO_UPKEEP_NO_OVERLAY} {GUARDIAN} {FACING nw}

        {GENERIC_UNIT 4 (Psy Mindraider) 63 41} {NO_UPKEEP_NO_OVERLAY} {GUARDIAN} {FACING nw}

        {GENERIC_UNIT 4 (Psy Crawler)    66 41} {NO_UPKEEP_NO_OVERLAY} {GUARDIAN} {FACING nw}

        {GENERIC_UNIT 4 (Psy Crawler)    57 44} {NO_UPKEEP_NO_OVERLAY} {GUARDIAN} {FACING ne}
        {GENERIC_UNIT 4 (Psy Crawler)    60 44} {NO_UPKEEP_NO_OVERLAY} {GUARDIAN} {FACING ne}

        {GENERIC_UNIT 2 (Chaos Lorekeeper) 52 43} {NO_UPKEEP_NO_OVERLAY} {GUARDIAN} {FACING se}

        {GENERIC_UNIT 3 (Valdemon Basher) 44 47} {NO_UPKEEP_NO_OVERLAY} {GUARDIAN} {FACING ne}
        {GENERIC_UNIT 3 (Valdemon Basher) 42 43} {NO_UPKEEP_NO_OVERLAY} {GUARDIAN} {FACING se}
        {GENERIC_UNIT 3 (Valdemon Basher) 41 46} {NO_UPKEEP_NO_OVERLAY} {GUARDIAN} {FACING ne}

        {GENERIC_UNIT 3 (Chaos Invader) 39 13} {NO_UPKEEP_NO_OVERLAY} {GUARDIAN} {FACING ne}
        {GENERIC_UNIT 3 (Chaos Invader) 42 10} {NO_UPKEEP_NO_OVERLAY} {GUARDIAN} {FACING sw}

        {GENERIC_UNIT 3 (Chaos Invader) 41 14} {NO_UPKEEP_NO_OVERLAY} {GUARDIAN} {FACING ne}
        {GENERIC_UNIT 3 (Chaos Invader) 44 11} {NO_UPKEEP_NO_OVERLAY} {GUARDIAN} {FACING sw}

        {GENERIC_UNIT 3 (Chaos Invader) 46 12} {NO_UPKEEP_NO_OVERLAY} {GUARDIAN} {FACING ne}
        {GENERIC_UNIT 3 (Chaos Invader) 43 15} {NO_UPKEEP_NO_OVERLAY} {GUARDIAN} {FACING sw}

        {GENERIC_UNIT 2 (Gutwrencher Imp) 48 15} {NO_UPKEEP_NO_OVERLAY} {GUARDIAN} {FACING nw}

        {GENERIC_UNIT 2 (Hellhound) 39 9} {NO_UPKEEP_NO_OVERLAY} {GUARDIAN} {FACING sw}

        {GENERIC_UNIT 2 (Goliath) 45 24} {NO_UPKEEP_NO_OVERLAY} {GUARDIAN} {FACING n}
        {GENERIC_UNIT 3 (Automaton) 46 26} {NO_UPKEEP_NO_OVERLAY} {GUARDIAN} {FACING n}
        {GENERIC_UNIT 3 (Automaton) 45 28} {NO_UPKEEP_NO_OVERLAY} {GUARDIAN} {FACING n}

        {GENERIC_UNIT 4 (Shaxthal Assault Drone) 55 32} {NO_UPKEEP_NO_OVERLAY} {GUARDIAN} {FACING nw}

        {GENERIC_UNIT 4 (Shaxthal Assault Drone) 25 13} {NO_UPKEEP_NO_OVERLAY} {GUARDIAN} {FACING sw}

        {GENERIC_UNIT 2 (Nightgaunt) 46 42} {NO_UPKEEP_NO_OVERLAY} {GUARDIAN}
        {GENERIC_UNIT 2 (Nightgaunt) 47 48} {NO_UPKEEP_NO_OVERLAY} {GUARDIAN}

        {GENERIC_UNIT 3 (Shadow) 59 36} {NO_UPKEEP_NO_OVERLAY} {GUARDIAN} {FACING sw}

        [store_starting_location]
            side=2
        [/store_starting_location]

        [unit]
            canrecruit=yes
            side=2
            type=Armageddon Imp
            id="Jeru'unog"
            name= _ "Jeru’unog"
            x,y=$location.x,$location.y
            facing=ne
            [modifications]
                {TRAIT_STRONG}
                {TRAIT_RESILIENT}
            [/modifications]
        [/unit]

        [capture_village]
            side=2
            # everywhere
        [/capture_village]

        {CLEAR_VARIABLE location}

        #
        # Open passages at the start of the scenario.
        #

        [remove_terrain_overlays]
            x=22-24,28
            y=22   ,24
        [/remove_terrain_overlays]

        [modify_turns]
            {QUANTITY value 66 63 60}
        [/modify_turns]

        {CAVE_WATER_SOUND_SOURCE 21 30}
        {CAVE_WATER_SOUND_SOURCE 19 19}
        {CAVE_WATER_SOUND_SOURCE 27 11}

        {REPLACE_SCENARIO_MUSIC "northerners.ogg"}
        {APPEND_MUSIC           "suspense.ogg"}

        {OBJECTIVES (
            victory_string= _ "Current Objective:"
            {OBJECTIVE_VICTORY ( _ "Locate the entrance to the lowest level")}

            {OBJECTIVE_DEFEAT  ( _ "Death of Elyssa")}
            {OBJECTIVE_DEFEAT  ( _ "Death of Elynia")}

            {TURNS_RUN_OUT}

            {OBJECTIVE_NO_CARRYOVER}

            {LIMITED_CHARACTER_MOVES_NOTE}
        )}
    [/event]

    [event]
        name=prestart

        {BUG_ON ({VARIABLE_NUMERICAL_EQUALS breakdown_cutscene_units.length 0}) ("No cutscene units stored! Did you skip E3S8B using debug mode?")}

        [kill]
            id=Elynia
        [/kill]

        [unit]
            # wmllint: recognize Elynia
            {CHARACTER_STATS_ELYNIA}
            type=Guardian of Earth Elynia
            variation=unknown_unit_type_label
            canrecruit=yes
            facing=ne
            to_variable=elynia_store
            [+modifications]
                [object]
                    silent=yes
                    [effect]
                        apply_to=remove_ability
                        [abilities]
                            [dummy]
                                id=aspect_of_earth
                            [/dummy]
                        [/abilities]
                    [/effect]
                [/object]
            [/modifications]
        [/unit]

        {BLACK_SCREEN}
    [/event]

#define INT_TERRAIN_MOD_1
    [terrain]
        x=24,24-25,26-27,27
        y=34,35   ,36   ,37
        terrain=Uh
    [/terrain]

    [terrain]
        x=25
        y=36
        terrain=Uu
    [/terrain]
#enddef

#define INT_TERRAIN_MOD_2
    [terrain_mask]
        x,y=1,1
        {MASK 08C_Breakdown_1.mask}
        border=yes
    [/terrain_mask]
#enddef

    [event]
        name=start

        {LOCK_VIEW}

        [store_starting_location]
            side=1
        [/store_starting_location]

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

        [delay]
            time=1500
        [/delay]

        [message]
            speaker=narrator
            image=misc/blank-hex.png
            message= _ "... The darkness..."
        [/message]

        [delay]
            time=1500
        [/delay]

        [message]
            speaker=narrator
            image=misc/blank-hex.png
            message= _ "... The silence..."
        [/message]

        [delay]
            time=2000
        [/delay]

        [message]
            speaker=narrator
            image=misc/blank-hex.png
            message= _ "... And then..."
        [/message]

        [delay]
            time=750
        [/delay]

        [message]
            speaker=narrator
            image=misc/blank-hex.png
            message= _ "... The pain..."
        [/message]

        [delay]
            time=500
        [/delay]

        [message]
            speaker=narrator
            image=misc/blank-hex.png
            message= _ "... A pain so strong..."
        [/message]

        [delay]
            time=250
        [/delay]

        {INT_FLASH_RED}

        [delay]
            time=750
        [/delay]

        {INT_FLASH_RED}

        [delay]
            time=1000
        [/delay]

        {INT_FLASH_RED}

        [delay]
            time=250
        [/delay]

        {INT_FLASH_RED}

        [delay]
            time=200
        [/delay]

        {INT_FLASH_RED}

        [delay]
            time=150
        [/delay]

        {RED_SCREEN}

        [delay]
            time=600
        [/delay]

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

        [delay]
            time=150
        [/delay]

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

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

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

        #
        # This micro-delay is needed to ensure the sound source starts playing
        # before the next [message] is executed.
        #
        [delay]
            time=10
        [/delay]

        {RESET_THEME}

        {RESET_SCREEN}

        [unstore_unit]
            variable=elynia_store
            x,y=$location.x,$location.y
        [/unstore_unit]

        {CLEAR_VARIABLE location}

        {INT_RED_AURA}

        [redraw]
            side=1
        [/redraw]

        [message]
            speaker=Elynia
            message= _ "<big>Aaaaaaaaaaaaaaaaahhh!</big>" # wmllint: no spellcheck
        [/message]

        {CLEAR_VARIABLE elynia_store}

        [delay]
            time=1500
        [/delay]

        {INT_ELYNIA_THOUGHTS ( _ "The pain was excruciating. It was absolutely unlike any other pain I had ever felt. This pain was not just emotional. My very soul was coming apart at the seams.

I closed my eyes and tried to wake up from what I wished were just a horrible nightmare...")}

        {INT_REMOVE_RED_AURA}

        [hide_unit][/hide_unit]

        {FADE_TO_BLACK}

        [delay]
            time=750
        [/delay]

        {RED_SCREEN}

        [delay]
            time=100
        [/delay]

        {RESET_SCREEN}

        [unhide_unit][/unhide_unit]

        {INT_RED_AURA}

        [redraw][/redraw]

        [delay]
            time=750
        [/delay]

        # po: 'Glare' is used here in the sense of a powerful light, not some creature's stare.
        {INT_ELYNIA_THOUGHTS ( _ "... to no avail. Where darkness used to be, there was a powerful eye-piercing glare.

The pain would not go away, no matter what I did. Instead, it was seeping through my veins and growing greater every passing instant. With my mind clouded by the horror, I could only think of one possible form of relief...")}

        [delay]
            time=250
        [/delay]

        {FACE_DIRECTION id=Elynia sw}

        [redraw][/redraw]

        [delay]
            time=750
        [/delay]

        {INT_ELYNIA_THOUGHTS ( _ "Destruction.")}

        [hide_unit][/hide_unit]

        {RED_SCREEN}

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

        {INT_TERRAIN_MOD_1}

        {CLEAR_CAVE_SHROUD (
            x,y=25,36
            radius=4
        )}

        [redraw]
            side=1
        [/redraw]

        {RESET_SCREEN}

        [unhide_unit][/unhide_unit]

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

        [delay]
            time=1000
        [/delay]

        {INT_ELYNIA_THOUGHTS ( _ "I felt compelled to give in to those dark urges. Perhaps if I released enough energy from my body, the pain would entirely vanish... or the dream world that held me captive would crumble away and I would be released back to reality...")}

        [delay]
            time=500
        [/delay]

        [scroll_to]
            x,y=29,30
        [/scroll_to]

        [delay]
            time=500
        [/delay]

        [hide_unit][/hide_unit]

        {RED_SCREEN}

        {INT_TERRAIN_MOD_2}

        [redraw]
            side=1
        [/redraw]

        {RESET_SCREEN}

        [unhide_unit][/unhide_unit]

        {INT_REMOVE_RED_AURA}

        [redraw][/redraw]

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

        [delay]
            time=1000
        [/delay]

        {FACE_DIRECTION id=Elynia se}

        [redraw][/redraw]

        [delay]
            time=500
        [/delay]

        {INT_ELYNIA_THOUGHTS ( _ "My chest continued to burn with that energy. For a moment I considered jumping into the nearby abyss in an attempt to wake up. But that moment was cut short by a familiar presence.")}

        [delay]
            time=750
        [/delay]

        {FACE_DIRECTION id=Elynia nw}

        [redraw][/redraw]

        [delay]
            time=500
        [/delay]

        {INT_ELYNIA_THOUGHTS ( _ "Could it be?")}

        [delay]
            time=250
        [/delay]

        {MOVE_UNIT id=Elynia 29 30}

        [redraw]
            side=1
        [/redraw]

        {MOVE_UNIT id=Elynia 29 28}

        [redraw]
            side=1
        [/redraw]

        {MOVE_UNIT id=Elynia 27 27}

        {FACE_DIRECTION id=Elynia sw}

        {CLEAR_CAVE_SHROUD (
            x,y=15,31
            radius=6
        )}

        [redraw]
            side=1
        [/redraw]

        [scroll_to]
            x,y=15,31
        [/scroll_to]

        [delay]
            time=750
        [/delay]

        [unit]
            # wmllint: recognize Elyssa
            {CHARACTER_STATS_ELYSSA}
            canrecruit=yes
            type=Guardian of Darkness Elyssa
            side=6
            x,y=15,31
            facing=ne
            animate=yes
        [/unit]

        [delay]
            time=250
        [/delay]

        {INT_ELYNIA_THOUGHTS ( _ "She was there, watching me from a distance, silent, smirking.")}

        [delay]
            time=750
        [/delay]

        [teleport]
            [filter]
                id=Elynia
            [/filter]
            x,y=16,30
            animate=yes
        [/teleport]

        {INT_ELYNIA_THOUGHTS ( _ "The next thing I knew, I was standing in front of her, about to blast her face like I did to that cave.")}

        [delay]
            time=100
        [/delay]

        {INT_RED_AURA}

        [delay]
            time=150
        [/delay]

        [hide_unit][/hide_unit]

        {RED_SCREEN}

        [delay]
            time=500
        [/delay]

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

        [delay]
            time=50
        [/delay]

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

        [delay]
            time=200
        [/delay]

        {RESET_SCREEN}

        [unhide_unit][/unhide_unit]

        {INT_REMOVE_RED_AURA}

        [redraw][/redraw]

        [animate_unit]
            [filter]
                id=Elyssa
            [/filter]
            flag=defense_half
            with_bars=yes
        [/animate_unit]

        [delay]
            time=750
        [/delay]

        [message]
            speaker=Elyssa
            message= _ "Your recovery took longer than I expected. Save your energy for later, dear."
        [/message]

        [store_unit]
            [filter]
                id=Elyssa
            [/filter]
            variable=elyssa_store
            kill=yes
        [/store_unit]

        #
        # Go through Elynia instead of finding a path
        # around her with MOVE_UNIT/[move_unit]!
        #

        [move_unit_fake]
            x=$elyssa_store.x,16,17
            y=$elyssa_store.y,30,30
            side=$elyssa_store.side
            type=$elyssa_store.type
        [/move_unit_fake]

        [unstore_unit]
            variable=elyssa_store
            x,y=17,30
        [/unstore_unit]

        {CLEAR_VARIABLE elyssa_store}

        [message]
            speaker=Elynia
            message= _ "What have you done..."
        [/message]

        [delay]
            time=250
        [/delay]

        [message]
            speaker=Elyssa
            message= _ "I would greatly prefer that you learned some self-constraint and resisted the temptation to blast everything in sight. Trust me, I have been there — I know what it feels like..."
        [/message]

        {FACE_DIRECTION id=Elyssa sw}

        [redraw][/redraw]

        [delay]
            time=250
        [/delay]

        [message]
            speaker=Elyssa
            message= _ "... but I will not tolerate such displays of weakness from the predestined Guardian of Earth, and I will not hesitate to rip your heart out of your chest if you fail to show some respect for yourself."
        [/message]

        [delay]
            time=750
        [/delay]

        [message]
            speaker=Elynia
            message= _ "... Guardian... of Earth..."
        [/message]

        [message]
            speaker=Elyssa
            message= _ "Ah yes, I almost forgot — you are still a stupid and ignorant elf. I still don’t understand how you lived for longer than any of us and yet your awakening has only just taken place. Then again, you were blessed by Iluvia..."
        [/message]

        {FACE_DIRECTION id=Elynia ne}

        [redraw][/redraw]

        [delay]
            time=250
        [/delay]

        [message]
            speaker=Elyssa
            message= _ "Yes, that must be it. The powers conferred by the Union atrophied your heart."
        [/message]

        [delay]
            time=750
        [/delay]

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

        [message]
            speaker=Elyssa
            message= _ "An abomination. A creature that violates the laws of nature for the purpose of protecting it in some way. That’s the farce set up by the First Gods. Your energy heart draws from an unlimited power source and provides you with vast potential according to the aspect that Irdya’s seed itself assigned to you: some degree of control over earth, absolute command of the arcane flame and all the creatures whose life force is based on it, and immortality at an inconvenient cost."
        [/message]

        [delay]
            time=250
        [/delay]

        [message]
            speaker=Elyssa
            message= _ "Didn’t you ever wonder why no other elves had your unprecedented affinity with the faerie realm? Why your abnormally long life has been an endless strife? Why you could never conceive children? Why every single person you ever loved died?"
        [/message]

        [message]
            speaker=Elynia
            message= _ "... The necromancer... The necromancer I vanquished..."
        [/message]

        [message]
            speaker=Elyssa
            message= _ "Argan told me about that. Just another conceited sorcerer with his mouth full of air in the end. People tend to overestimate the dying words of those skilled in the forbidden arts, mostly out of fear. No, my dear, you were always cursed before even meeting that insignificant necromancer. You could even say Irdya herself cursed you, and that would not be entirely inaccurate."
        [/message]

        [message]
            speaker=Elyssa
            message= _ "Every guardian that has existed shares your curse. Even I do, in spite of my condition as an unwilling usurper."
        [/message]

        [message]
            speaker=Elynia
            message= _ "Why did you not kill me?"
        [/message]

        [message]
            speaker=Elyssa
            message= _ "Because that would be a terrible waste of potential. Trust me, I could not wish harder for the day your soul is permanently destroyed, but this is not the most appropriate moment for that."
        [/message]

        [message]
            speaker=Elyssa
            message= _ "Ah yes, I forgot to mention that clause... Naturally-born guardians like you awaken once their soul fully merges with their energy heart, and the only way to kill a guardian is through their heart, so... (smirking)"
        [/message]

        [message]
            speaker=Elynia
            message= _ "I should destroy you right now. You are the abomination, not me."
        [/message]

        [message]
            speaker=Elyssa
            message= _ "And then who would help you fight our common enemy? Do you even know what turned him into the monster you fought in Wesmere?"
        [/message]

        [message]
            speaker=Elynia
            message= _ "Zhangor? Ergea said he is a shapeshifter. Isn’t that the true form of a shapeshifter?"
        [/message]

        [message]
            speaker=Elyssa
            message= _ "Ha, ha, your ignorance is as limitless as the powers you will eventually master and use against me. No, shapeshifters do not have a true form beyond that which they individually choose for themselves; granted, they are nearly indistinguishable from humans or elves during childhood."
        [/message]

        [message]
            speaker=Elyssa
            message= _ "Zhangor chose a form that is as hideous as his soul. He might have taken some inspiration from the Gatekeeper he slew in Urvatha — the Gatekeeper whose heart he consumed and absorbed into his body."
        [/message]

        #
        # BEGIN SUB-CUTSCENE
        #

        [store_unit]
            [filter]
                id=Elyssa
            [/filter]
            variable=elyssa_store
            kill=yes
        [/store_unit]

        [store_unit]
            [filter]
                id=Elynia
            [/filter]
            variable=elynia_store
            kill=yes
        [/store_unit]

        {FADE_TO_BLACK}

        [fade_out_sound_effects]
            duration=500
        [/fade_out_sound_effects]

        {REMOVE_SOUND_SOURCE hive_noise}

        [reset_sound_effects][/reset_sound_effects]

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

        [place_shroud]
            side=1
        [/place_shroud]

        #
        # Temporarily switch side 2 to the player's team so Durvan
        # doesn't look weird.
        #
        [modify_side]
            side=2
            team_name=good
        [/modify_side]

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

        [redraw][/redraw]

        {VARIABLE ax 0}
        {VARIABLE ay 0}

        [foreach]
            array=breakdown_cutscene_units
            variable=bc_unit
            [do]
                [if]
                    {VARIABLE_LEXICAL_EQUALS bc_unit.id Anya}
                    [then]
                        {VARIABLE ax $bc_unit.x}
                        {VARIABLE ay $bc_unit.y}

                        [hidden_unit]
                            side=1
                            # wmllint: recognize Anya
                            id=Anya
                            name=" " # wmllint: ignore
                            type=Anya Cutscene Controller
                            x,y=$ax,$ay
                            facing=se
                            moves=0
                            attacks_left=0
                        [/hidden_unit]
                    [/then]
                    [else]
                        #
                        # HACK: workaround a situation I need to solve in E3S8B causing
                        #       breakdown_cutscene_units to contain the previous scenario's
                        #       recall lists.
                        #
                        [if]
                            {VARIABLE_NUMERICAL_GREATER_THAN bc_unit.x 0}
                            {VARIABLE_NUMERICAL_GREATER_THAN bc_unit.y 0}
                            [then]
                                {VARIABLE bc_unit.moves        0}
                                {VARIABLE bc_unit.attacks_left 0}

                                [unstore_unit]
                                    variable=bc_unit
                                [/unstore_unit]

                                [hide_unit]
                                    x,y=$bc_unit.x,$bc_unit.y
                                [/hide_unit]
                            [/then]
                        [/if]
                    [/else]
                [/if]
            [/do]
        [/foreach]

        {BUG_ON (
            {VARIABLE_NUMERICAL_EQUALS ax 0}
            [or]
                {VARIABLE_NUMERICAL_EQUALS ay 0}
            [/or]
        ) ()}

        {CLEAR_VARIABLE breakdown_cutscene_units}

        [store_map_dimensions][/store_map_dimensions]

        [unstore_unit]
            variable=elynia_store
            x,y=$($map_size.width-2),1
        [/unstore_unit]

        [hide_unit]
            id=Elynia
        [/hide_unit]

        [unstore_unit]
            variable=elyssa_store
            x,y=$($map_size.width-1),1
        [/unstore_unit]

        [hide_unit]
            id=Elyssa
        [/hide_unit]

        {SET_THEME {FULLSCREEN_CUTSCENE_UI}}

        {CLEAR_CAVE_SHROUD (
            x,y=$ax,$ay
            radius=7
        )}

        [redraw]
            side=1
        [/redraw]

        #
        # Try to ensure the viewport is focused on Anya. Of course, this doesn't work well in 1.10
        # if the player moves the viewport.
        #

        [scroll_to]
            x,y=$ax,$ay
            {WARP}
        [/scroll_to]

        {FADE_IN}

#define INT_UNHIDE_CUTSCENE_UNITS
    [unhide_unit]
        [not]
            id=Elyssa
        [/not]
        [not]
            id=Elynia
        [/not]
    [/unhide_unit]
#enddef

        {INT_UNHIDE_CUTSCENE_UNITS}

        [redraw][/redraw]

        [delay]
            time=2500
        [/delay]

        #
        # The marshmallow's animations are part of the unit type's WML. We use
        # the recruit animations for this purpose
        #
#define INT_ANIMATE_ANYA _STEP_NUMBER
    [kill]
        x,y=$ax,$ay
        animate=no
        fire_event=no
    [/kill]

    [unit]
        side=1
        id=Anya
        name=" " # wmllint: ignore
        type=Anya Cutscene Controller
        x,y=$ax,$ay
        facing=se
        animate=yes
        # No wmllint, the next line does not have any translation marks.
        variation="animation_step_"+{_STEP_NUMBER} # wmllint: ignore
        moves=0
        attacks_left=0
    [/unit]
#enddef

#define INT_FLASH_PURPLE
    {COLOR_ADJUST 97 81 110}
    {COLOR_ADJUST 193 162 221}
    {COLOR_ADJUST 48 41 55}
    {COLOR_ADJUST 0 0 0}
#enddef

        [message]
            speaker=Elyssa
            scroll=no
            message= _ "True shapeshifters were never meant to become guardians. Every creature was created in such way they could be eliminated should they represent a peril to the balance of nature, but the oldest shapeshifters defy that rule, as you undoubtedly realized after dealing with Zhangor. Combined with the heart of a guardian, they may also defy the soul clause by turning the entirety of their nigh indestructible bodies into their hearts."
        [/message]

        [delay]
            time=750
        [/delay]

        {INT_FLASH_PURPLE}

        [delay]
            time=750
        [/delay]

        [message]
            speaker=Elyssa
            scroll=no
            message= _ "We should be thankful that the girl you took under your wing does not have the same grandiose aspirations as our delightful Demon Lord."
        [/message]

        {INT_ANIMATE_ANYA 2}

        [delay]
            time=750
        [/delay]

        [message]
            speaker=Elynia
            scroll=no
            message= _ "Wh— Anya... What is she?" # wmllint: no spellcheck
        [/message]

        [delay]
            time=250
        [/delay]

        {INT_ANIMATE_ANYA 3}

        [delay]
            time=750
        [/delay]

        {INT_ANIMATE_ANYA 4}

        [delay]
            time=250
        [/delay]

        [message]
            speaker=Elyssa
            scroll=no
            message= _ "She is a thing we mistakenly assumed would never exist."
        [/message]

        {FACE_DIRECTION id=Durvan sw}

        [redraw][/redraw]

        [delay]
            time=750
        [/delay]

        {FACE_DIRECTION id=Ergea ne}

        [redraw][/redraw]

        {INT_ANIMATE_ANYA 5}

        [delay]
            time=1000
        [/delay]

        [message]
            speaker=Elyssa
            scroll=no
            message= _ "She is the true Guardian of Darkness of the Second Cycle."
        [/message]

        [delay]
            time=1000
        [/delay]

        {COLOR_ADJUST 100 100 100}

        [hide_unit][/hide_unit]

        {WHITE_SCREEN}

        [terrain_mask]
            x,y=1,1
            {MASK 08B_Destiny_part_1_2.mask}
            border=yes
        [/terrain_mask]

        [redraw][/redraw]

        [delay]
            time=500
        [/delay]

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

        [delay]
            time=150
        [/delay]

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

        [kill]
            id=Anya
        [/kill]

        [hidden_unit]
            side=1
            id=Anya
            name=" " # wmllint: ignore
            type=Anya Cutscene Controller
            x,y=$ax,$ay
            facing=se
            # skip the recruit animation for this one
            variation="animation_step_6"
            moves=0
            attacks_left=0
        [/hidden_unit]

        {RESET_SCREEN}

        {INT_UNHIDE_CUTSCENE_UNITS}

        [redraw][/redraw]

        [store_unit]
            [filter]
                type=Shaxthal Deathbringer
            [/filter]
            variable=deathbringers_store
            kill=no
        [/store_unit]

        [foreach]
            array=deathbringers_store
            variable=deathbringer
            [do]
                {VARIABLE_RANDOM damage 22..74}

                [harm_unit]
                    [filter]
                        x,y=$deathbringer.x,$deathbringer.y
                    [/filter]
                    amount=$damage
                    kill=no
                    animate=no
                [/harm_unit]

                [sound]
                    name={SOUND_LIST:BIOMECHANICAL_HIT}
                [/sound]

                [delay]
                    time=25
                [/delay]
            [/do]
        [/foreach]

        {CLEAR_VARIABLE deathbringers_store}

        [scroll_to]
            x,y=$ax,$ay
        [/scroll_to]

        [delay]
            time=750
        [/delay]

        [hide_unit][/hide_unit]

        {WHITE_SCREEN}

        [terrain_mask]
            x,y=1,1
            {MASK 08B_Destiny_part_1_3.mask}
            border=yes
        [/terrain_mask]

        [redraw][/redraw]

        [delay]
            time=250
        [/delay]

        [object]
            silent=yes
            [filter]
                id=Anya
            [/filter]
            [effect]
                apply_to=variation
                name="animation_step_7"
            [/effect]
        [/object]

        [item]
            x,y=$ax,$ay
            halo=halo/lighthouse-aura.png
        [/item]

        {RESET_SCREEN}

        {INT_UNHIDE_CUTSCENE_UNITS}

        {FACE_DIRECTION id=Ergea  sw}
        {FACE_DIRECTION id=Durvan ne}

        [redraw][/redraw]

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

        [kill]
            type=Shaxthal Deathbringer
            [filter_location]
                terrain=Q*,Q*^*
            [/filter_location]
            animate=yes
            fire_event=no
        [/kill]

        [scroll_to_unit]
            id=Anya
        [/scroll_to_unit]

        [delay]
            time=1500
        [/delay]

        [message]
            speaker=Elyssa
            scroll=no
            message= _ "I do not know how she came into existence, seeing as how the seed on Yrathid was said to have been absorbed by Merthiaal. Then again, it is just as troubling that the Uria we all know exists, as well as your counterpart on Silida. Who really knows what was going through the heads of the three goddesses who ended and restarted it all."
        [/message]

        [remove_item]
            x,y=$ax,$ay
        [/remove_item]

        {CLEAR_VARIABLE ax,ay}

        [redraw][/redraw]

        [kill][/kill]

        {FADE_TO_BLACK}

        #
        # Revert side 2 to the bad guys' team.
        #
        [modify_side]
            side=2
            team_name=evil
        [/modify_side]

        [place_shroud]
            side=1
        [/place_shroud]

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

        {INT_TERRAIN_MOD_1}
        {INT_TERRAIN_MOD_2}

        [redraw][/redraw]

        {RESET_THEME}

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

        {CLEAR_VARIABLE shroud_store}

        [redraw]
            side=1
        [/redraw]

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

        [mute_sound_effects][/mute_sound_effects]

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

        [fade_in_sound_effects]
            duration=500
        [/fade_in_sound_effects]

        {FADE_IN}

        #
        # Recreate ELynia using her regular variation so
        # her unit type name is the correct one on the sidebar.
        # This also restores her guardian ability set.
        #

        [unit]
            {CHARACTER_STATS_ELYNIA}
            type=Guardian of Earth Elynia
            canrecruit=yes
            side=1
            x,y=$elynia_store.x,$elynia_store.y
            facing=$elynia_store.facing
        [/unit]

        [unstore_unit]
            variable=elyssa_store
        [/unstore_unit]

        {CLEAR_VARIABLE elynia_store,elyssa_store}

        [redraw]
            side=1
        [/redraw]

        [delay]
            time=750
        [/delay]

        #
        # END SUB-CUTSCENE
        #

        [message]
            speaker=Elynia
            message= _ "There is another Guardian of Earth like me?"
        [/message]

        [message]
            speaker=Elyssa
            # NOTE: we use 'on' here because the 'land' is actually the entire world
            #       of Silida.
            message= _ "I would hardly call her such. Her pact with Uria requires her to sit idle in her stupid faerie land being generally useless. Granted, she did secretly guide Argan so we would find you, and so I would ‘kill’ you."
        [/message]

        [message]
            speaker=Elyssa
            message= _ "It is rather disappointing, really. I am fairly certain she would be a more competent aid than you."
        [/message]

        [message]
            speaker=Elynia
            message= _ "What do you want me to do?"
        [/message]

        [message]
            speaker=Elyssa
            message= _ "First, we must destroy Zhangor, together. Then, we can decide who gets to inherit Irdya through an old-fashioned duel between just the two of us."
        [/message]

        [message]
            speaker=Elynia
            message= _ "What... do you intend to do with Anya?"
        [/message]

        [message]
            speaker=Elyssa
            message= _ "She can be my apprentice if she wishes. Otherwise, she can live as long as she doesn’t try to interfere with my own plans. "
        [/message]

        [message]
            speaker=Elynia
            message= _ "It is said that Uria wants to invade that world, Ethea; that she might find a way to harness the Union, and you intend to sit here and do nothing other than solving your irrelevant quarrel with Zhangor?"
        [/message]

        [message]
            speaker=Elyssa
            message= _ "It is not as irrelevant as you think. Anyway, Uria has various options to choose from on Ethea, and I suspect she will opt for all of them: the body of the Union, for starters; then there is the Seed of Life, and whoever the goddesses designated as the rightful heiress of the Aspect of Life, if anyone at all. But Uria will not be alone in her quest, for the new Guardian of Water on Norsula also plans business with Ethea. In fact, he is already there."
        [/message]

        [message]
            speaker=Elyssa
            message= _ "In the worst case, one will win and reshape our reality at their whim. In the best case, they will only manage to destroy themselves along with Ethea. It is pretty pointless to intervene either way. Uria promised to me I would inherit this world before she decided to exhume the present you left for her, and now that she will be too busy confronting the Norsulan and his forces..."
        [/message]

        [message]
            speaker=Elynia
            message= _ "You may call me ignorant and stupid, but I don’t fail to notice you refer to Uria with disdain. What is stopping you from taking her on directly? Have you been on her side all this time merely because you fear her?"
        [/message]

        [delay]
            time=750
        [/delay]

        {INT_ELYNIA_THOUGHTS ( _ "She stood still for a moment, pondering my words. Her reaction was delayed and mechanical; she pushed me with her strange weapon, and both my chest and the weapon’s core glowed with the color of blood. A familiar feeling of void followed. While the pain in my body diminished, I felt weaker and barely able to stand. Still, I could recognize the energy expelled by the artifact.")}

        [message]
            speaker=Elyssa
            message= _ "Do not forget who is in charge, my dear. I can end your life in an instant if you decide to be uncooperative. We are doing this on my terms."
        [/message]

        [message]
            speaker=Elynia
            message= _ "(gasping for air) ... I..."
        [/message]

        [message]
            speaker=Elyssa
            message= _ "And from now on, you shall remain completely silent unless I require you to speak. Do you understand?"
        [/message]

        [delay]
            time=750
        [/delay]

        [message]
            speaker=Elyssa
            message= _ "Of course you do."
        [/message]

        {MODIFY_UNIT id=Elyssa side 1}

        {FACE_DIRECTION id=Elyssa ne}

        [fire_event]
            name=finalize scenario setup
        [/fire_event]

        {UNLOCK_VIEW}
    [/event]

    #
    # Hook into the bind spell moveto handler for some dialogue.
    #
    [event]
        name=immobilize bound unit

        # This handler always affects Elynia, and she's always immobilized
        # after its counterpart in BIND_UNIT_TO_UNIT_MOVEMENT_RANGE runs.
        # We don't need further conditions here.

        [scroll_to_unit]
            id=Elyssa
        [/scroll_to_unit]

        {UNIT_SPELL_POPUP id=Elyssa _"bind"}

        [delay]
            time=750
        [/delay]

        [message]
            speaker=Elynia
            scroll=no
            message= _ "Ugh—"
        [/message]

        [delay]
            time=250
        [/delay]

        [message]
            speaker=Elyssa
            message= _ "I forgot to mention that you are also bound to follow me wherever I go, all thanks to a very simple spell. If you attempt to escape you’ll just feel even more pain. And you surely do not want that, do you?"
        [/message]
    [/event]

    #
    # Potion of yuck.
    #

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

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

        [transient_message]
            caption= _ "Potion of Dreadful Taste"
            image=icons/potion_green_medium.png
            sound=potion.ogg
            message= _ "Yuck!"
        [/transient_message]
    [/event]

    #
    # Message glyphs
    #

    [event]
        name=moveto
        first_time_only=no
        [filter]
            side=1
            x,y=30,23
        [/filter]

        [allow_undo][/allow_undo]

        {MSG_GLYPH ( _ "The Aspects of Darkness and Light are both interwoven in the very fabric of our reality. Although the powers they confer are often underestimated on their own, the combination of either aspect with any other can have formidable effects. It is generally agreed that the combination of Darkness and Light in particular serves as a connection to the power of the Union — a power most intimately related to Creation itself.")}
    [/event]

    [event]
        name=moveto
        first_time_only=no
        [filter]
            side=1
            x,y=34,21
        [/filter]

        [allow_undo][/allow_undo]

        {MSG_GLYPH ( _ "Life draws from Light and Darknesss, Existence draws from Darkness and Light. Fire and Water oppose each other just as Creation and Destruction do. Thunder and Ice are opposites in the same sense as Earth and Air complement each other.")}

        {MSG_GLYPH ( _ "All the aspects that govern our universe are closely related and equally important to the continuance of reality. Their roles are as flexible as necessary to accomplish the ultimate goal of preserving the First Gods’ legacy, no matter the cost.")}
    [/event]

    [event]
        name=moveto
        first_time_only=no
        [filter]
            side=1
            x,y=34,25
        [/filter]

        [allow_undo][/allow_undo]

        # po: “To brook” below is used in an obsolete sense; namely
        # po: “to use/enjoy/have the full employment of” (from wiktionary).
        # po: It also serves as a pun.
        {MSG_GLYPH ( _ "Fire forges knowledge.

Light wards knowledge.

Darkness craves knowledge.

Water brooks knowledge.")}
    [/event]

    [event]
        name=moveto
        first_time_only=no
        [filter]
            side=1
            x,y=39,24
        [/filter]

        [allow_undo][/allow_undo]

        {MSG_GLYPH ( _ "Guardian-class beings are distinguished by the existence of a special organ in their bodies called the Energy Heart. The organ acts as a virtuallly unlimited source of energy and sustenance for the creature, able to keep it alive under circumstances that would otherwise result in permanent damage or even death. In fact, the host body can suffer any kind of injuries and they will be gradually healed by the Energy Heart, the healing rate depending on the severity of the damage as well as the host’s contamination level.

The organ goes through its own growth and maturation process independent from the host body. Norsulan studies conducted on the Seed of Fire during the Second Cycle have shown that it is possible to artificially grow the organ in the bodies of non-Guardians, albeit with disastrous effects. An alternative approach was used to build the first prototype of an artificial Guardian, keeping the Energy Heart in a separate insulated container with a direct pathway to the host’s nervous system, and an electronic control unit.")}

        {MSG_GLYPH ( _ "The research subjects were all deceased Norsulans, and none of them managed to establish a stable connection with their Energy Hearts. It is suspected that there is a less evident connection between the body, Energy Heart, and spirit of a real Guardian that allows them to fully control their three constituent parts — a connection to the seed that gave them birth, and the Greater Design laid out first by Yarae, and then by Delethia.")}
    [/event]

    [event]
        name=moveto
        first_time_only=no
        [filter]
            side=1
            x,y=14,49
        [/filter]

        [allow_undo][/allow_undo]

        {MSG_GLYPH ( _ "The Orbs of Light and Darkness do not just allow those blessed by Iluvia to summon the Union itself. Given every aspect’s individual affiliation with either path, it may be possible to use the Orbs as instruments to tap into the powers of the other aspects.

As the first Avatar of the Union herself, Iluvia made use of this mechanism to aid Uria and Xia’el in destroying every other corrupted guardian before banishing Yarae from our universe.")}
    [/event]

    [event]
        name=attack
        [filter]
            race=shaxthal
        [/filter]
        [filter_second]
            id=Elyssa
        [/filter_second]

        [message]
            speaker=Elyssa
            message= _ "Why are you attacking me?"
        [/message]
    [/event]

    [event]
        name=attack end
        [filter]
            race=shaxthal
        [/filter]
        [filter_second]
            id=Elyssa
        [/filter_second]

        [message]
            speaker=Elyssa
            message= _ "Yet another of Zhangor’s tricks. He really pays attention to detail, but turning every single one of my allies against me will not suffice to stop me."
        [/message]
    [/event]

    [event]
        name=turn 3

        [message]
            speaker=Elynia
            message= _ "The Union was not enough to destroy that demon."
        [/message]

        [message]
            speaker=Elyssa
            message= _ "I thought I commanded you to remain silent."
        [/message]

        [delay]
            time=750
        [/delay]

        [message]
            speaker=Elynia
            message= _ "If you truly wanted to kill me you would have done so already. You want my help against Zhangor, but there is nothing I can offer that you do not already have. You even have the Ruby of Fire!"
        [/message]

        [message]
            speaker=Elyssa
            message= _ "A weapon. A catalyst of destruction that is much safer to use for our kind than our own inner power. I intend to tear Zhangor apart with it, but the fact that he is a creature of both light and darkness puts me at a disadvantage. To counteract his power I need the assistance of someone well versed in the path of Light, and he knows that; hence he secured the support of Demon Lord Hemérilyel and her subordinates and brought them with him."
        [/message]

        [message]
            speaker=Elyssa
            message= _ "As the Lady of Light you used to be, you understand the powers of light better than I do, and you control an aspect that is also affiliated with it."
        [/message]
    [/event]

    [event]
        name=turn 3 end

        [message]
            speaker=Elynia
            message= _ "Ergea said I would find a power beneath Kalari that would allow us to turn the tide of war in our favor and purge Uria’s influence from Irdya. Was she... lying?"
        [/message]

        [message]
            speaker=Elyssa
            message= _ "That demoness asked our Seer many things and failed to understand nearly all of them. About the particular thing you ask, she was... right, in a way."
        [/message]

        [message]
            speaker=Elyssa
            message= _ "The power to end this was always within you, dear. Who knows how things would have turned out if you had healed Argan instead of killing him! The Lady of Light and the Master of Darkness, wielding the Union and the Aspect of Earth against Uria! But since you did not follow that road, you might as well say I am the power you sought."
        [/message]
    [/event]

    [event]
        name=turn 4

        [message]
            speaker=Elynia
            message= _ "You sound decidedly bitter whenever you mention Argan. What is..."
        [/message]

        [message]
            speaker=Elyssa
            message= _ "None of your business. Keep your mouth shut."
        [/message]
    [/event]

    [event]
        name=turn 5 end

        [message]
            speaker=Elynia
            message= _ "Why do you want Irdya so much?"
        [/message]

        [message]
            speaker=Elyssa
            message= _ "Will you ever stop asking questions?"
        [/message]
    [/event]

    #
    # Fire in the hole etc.
    #

    [event]
        name=blast event wall
        first_time_only=no

        [filter_condition]
            {VARIABLE_NUMERICAL_EQUALS blast_source.x 0}
            [or]
                {VARIABLE_NUMERICAL_EQUALS blast_source.y 0}
            [/or]
        [/filter_condition]

        {BUG ("Blast location undefined!")}
    [/event]

    [event]
        name=blast event wall
        first_time_only=no
        [filter_condition]
            {VARIABLE_NUMERICAL_NOT_EQUALS blast_source.x 0}
            {VARIABLE_NUMERICAL_NOT_EQUALS blast_source.y 0}
        [/filter_condition]

        [hide_unit][/hide_unit]

        {RED_SCREEN}

        [store_locations]
            x,y=$blast_source.x,$blast_source.y
            radius=1
            variable=blast_targets
        [/store_locations]

        [foreach]
            array=blast_targets
            variable=blast_target
            [do]
                [if]
                    {VARIABLE_LEXICAL_CONTAINS blast_target.terrain Xos}
                    [or]
                        {VARIABLE_LEXICAL_CONTAINS blast_target.terrain Xos^Efs}
                    [/or]
                    [or]
                        {VARIABLE_LEXICAL_CONTAINS blast_target.terrain Xu}
                    [/or]
                    [then]
                        {VARIABLE_RANDOM blast_terrain Uh,Uu,Uu^Es,Rb^Es,Rb}
                    [/then]
                    [else]
                        {VARIABLE_RANDOM blast_terrain Rb^Es,Rb}
                    [/else]
                [/if]

                [terrain]
                    x,y=$blast_target.x,$blast_target.y
                    terrain=$blast_terrain
                [/terrain]
            [/do]
        [/foreach]

        {CLEAR_VARIABLE blast_terrain}

        {CLEAR_CAVE_SHROUD (find_in="blast_targets")}

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

        [redraw]
            side=1
        [/redraw]

        {RESET_SCREEN}

        [unhide_unit][/unhide_unit]

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

        [harm_unit]
            [filter]
                [filter_location]
                    find_in=blast_targets
                [/filter_location]
                [not]
                    side=1
                [/not]
            [/filter]
            {QUANTITY amount 10 8 6}
            damage_type=impact
            kill=yes
            animate=yes
            fire_event=yes
        [/harm_unit]

        [delay]
            time=750
        [/delay]

        {CLEAR_VARIABLE blast_targets}

        [scroll_to]
            x,y=$x1,$y1
        [/scroll_to]
    [/event]

#define INT_BLAST_EVENT_WALL _X _Y

    {VARIABLE blast_event_prefix $unit.id}

    #
    # Set blast_event_prefix to 'elynia' or 'elyssa' accordingly.
    #
    [lua]
        code= << wml.variables.blast_event_prefix = string.lower(wml.variables.blast_event_prefix) >>
    [/lua]

    [fire_event]
        name="$blast_event_prefix blast event wall dialog 1"
    [/fire_event]

    {VARIABLE blast_source.x {_X} }
    {VARIABLE blast_source.y {_Y} }

    [fire_event]
        name=blast event wall
        [primary_unit]
            x,y=$x1,$y1
        [/primary_unit]
    [/fire_event]

    {CLEAR_VARIABLE blast_source}

    [fire_event]
        name="$blast_event_prefix blast event wall dialog 2"
    [/fire_event]

    {CLEAR_VARIABLE blast_event_prefix}
#enddef

    [event]
        name=elynia blast event wall dialog 1,elyssa blast event wall dialog 1
        first_time_only=yes

        # wmllint: local spelling teleporting

        [message]
            speaker=Elyssa
            message= _ "The underground portion of this citadel is larger than you may have suspected, and it can take a whole day to cover it entirely. Teleporting around here is an impossibility since your last intrusion, so we’ll need to create some shortcuts ourselves."
        [/message]
    [/event]

    [event]
        name=elyssa blast event wall dialog 1
        first_time_only=yes

        [message]
            speaker=Elyssa
            message= _ "I haven’t done this in a while."
        [/message]
    [/event]

    [event]
        name=elyssa blast event wall dialog 2
        first_time_only=yes

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

        {INT_ELYNIA_THOUGHTS ( _ "If the demoness’ unsettling grin is any indication, destroying things is as stimulating for her as it is for me. I suppose that is the curse of our kind. What were the First Gods’ intentions when entrusting their precious creation to such flawed stewards?")}
    [/event]

    [event]
        name=elynia blast event wall dialog 1
        first_time_only=yes

        [message]
            speaker=Elyssa
            message= _ "Destroy that wall."
        [/message]
    [/event]

    [event]
        name=elynia blast event wall dialog 2
        first_time_only=yes

        [message]
            speaker=Elyssa
            message= _ "Excellent. You will eventually learn to focus your energy for more productive purposes."
        [/message]

        [message]
            speaker=narrator
            image=wesnoth-icon.png
            message= _ "That is a vain hope, of course. You really do not believe the elf will ever attain a greater degree of control over her aspect; she is just too incompetent for the burden. You can only wonder why events conspired to make her the heiress of Irdya instead of someone more mentally and emotionally fit."
        [/message]
    [/event]

    [event]
        name=moveto
        [filter]
            side=1
            x=22-28,23-28
            y= 9-12,13-14
        [/filter]

        {INT_BLAST_EVENT_WALL 30 10}
    [/event]

    [event]
        name=moveto
        [filter]
            side=1
            x=49-58
            y=19-25
        [/filter]

        {CLEAR_CAVE_SHROUD (
            x,y=53,22
            radius=2
        )}

        [redraw]
            side=1
        [/redraw]

        [scroll_to]
            x,y=55,23
        [/scroll_to]

        [delay]
            time=750
        [/delay]

        [message]
            speaker=Elyssa
            message= _ "That crack was not there before. But it matters little — we can continue descending by our own means. There is another corridor right below this area if I’m not mistaken..."
        [/message]

        {INT_BLAST_EVENT_WALL 48 21}

        [scroll_to]
            x,y=47,22
        [/scroll_to]

        [delay]
            time=750
        [/delay]

        [message]
            speaker=Elyssa
            message= _ "That should do just fine. There is an underground river just adjacent to the corridor that we can follow."
        [/message]
    [/event]

    [event]
        name=moveto
        [filter]
            side=1
            x=44-46
            y=23-28
        [/filter]

        {INT_BLAST_EVENT_WALL 47 26}
    [/event]

    #
    # Enable recruitment of Fire Wraiths when entering
    # the underground river passage.
    #

    [event]
        name=moveto
        [filter]
            id=Elyssa
            x=49-57
            y=26-35
        [/filter]

        [message]
            speaker=Elyssa
            message= _ "This passage leads to another corridor where we will surely find more opposition. It might be a good idea to summon some help to clear the path ahead."
        [/message]

        {ENABLE_FIRE_GUARDIAN_SUMMONING}

        [event]
            name=victory

            {DISABLE_FIRE_GUARDIAN_SUMMONING}
        [/event]

        [transient_message]
            image=units/monsters/firewraith/firewraith.png
            message= _ "Elyssa can now summon Fire Wraiths."
        [/transient_message]

        {OBJECTIVES (
            victory_string= _ "Current Objective:"
            {OBJECTIVE_VICTORY ( _ "Locate the entrance to the lowest level")}

            {OBJECTIVE_DEFEAT  ( _ "Death of Elyssa")}
            {OBJECTIVE_DEFEAT  ( _ "Death of Elynia")}

            {TURNS_RUN_OUT}

            {OBJECTIVE_NO_CARRYOVER}

            {LIMITED_CHARACTER_MOVES_NOTE}
            {FIRE_GUARDIAN_SUMMONING_NOTE}
        )}
    [/event]

    #
    # Activate side 2 recruitment when approaching the last corridor.
    #

    [event]
        name=moveto
        [filter]
            side=1
            x=59-70
            y=39-45
        [/filter]

        [allow_undo][/allow_undo]

        [modify_side]
            side=2
            hidden=no
            {GOLD 100 115 130}
            recruit=Demon,Imp,Chaos Invoker,Chaos Headhunter
        [/modify_side]

        {GENERIC_UNIT 2 (Demon Grunt) 46 44}  {NO_UPKEEP_NO_OVERLAY}
        {GENERIC_UNIT 2 (Demon Zephyr) 47 46} {NO_UPKEEP_NO_OVERLAY}
        {GENERIC_UNIT 2 (Demon Grunt) 45 46}  {NO_UPKEEP_NO_OVERLAY}

        [message]
            speaker="Jeru'unog"
            message= _ "Cowards! The Fire must be extinguished for her betrayal! Go, find her!"
        [/message]

        [message]
            speaker=Elyssa
            message= _ "That must be yet another of those minor Demon Lords. I wonder what kind of story Zhangor made up for them."
        [/message]

        [message]
            speaker=Elynia
            message= _ "You are betraying Uria by plotting against Zhangor."
        [/message]

        [message]
            speaker=Elyssa
            message= _ "Only if she wants to put it in that light. Ergea explained to you how the succession system works on Urvatha; did you forget?"
        [/message]

        [message]
            speaker=Elynia
            message= _ "Not really. But I would appreciate it if you stopped reading my thoughts and memories at every opportunity."
        [/message]

        {OBJECTIVES (
            victory_string= _ "Current Objective:"
            {OBJECTIVE_VICTORY ( _ "Vanquish Demon Lord Jeru’unog")}

            {OBJECTIVE_DEFEAT  ( _ "Death of Elyssa")}
            {OBJECTIVE_DEFEAT  ( _ "Death of Elynia")}

            {TURNS_RUN_OUT}

            {OBJECTIVE_NO_CARRYOVER}

            {LIMITED_CHARACTER_MOVES_NOTE}
            {FIRE_GUARDIAN_SUMMONING_NOTE}
        )}
    [/event]

    [event]
        name=last breath
        [filter]
            id="Jeru'unog"
        [/filter]

        [message]
            speaker="Jeru'unog"
            message= _ "Defeated by a faerie and a human! How can this be?"
        [/message]
    [/event]

    [event]
        name=die
        [filter]
            id="Jeru'unog"
        [/filter]

        [message]
            speaker=Elyssa
            message= _ "I am not human."
        [/message]

        #
        # For simplicity, INT_BLAST_EVENT_WALL does not support swapping the
        # primary unit, so we must do so through a separate event.
        #

        [fire_event]
            name=blast final wall
            [primary_unit]
                x,y=$x2,$y2
            [/primary_unit]
        [/fire_event]

        {OBJECTIVES (
            victory_string= _ "Current Objective:"
            {OBJECTIVE_VICTORY ( _ "Locate the entrance to the lowest level")}

            {OBJECTIVE_DEFEAT  ( _ "Death of Elyssa")}
            {OBJECTIVE_DEFEAT  ( _ "Death of Elynia")}

            {TURNS_RUN_OUT}

            {OBJECTIVE_NO_CARRYOVER}

            {LIMITED_CHARACTER_MOVES_NOTE}
            {FIRE_GUARDIAN_SUMMONING_NOTE}
        )}
    [/event]

    [event]
        name=blast final wall

        {INT_BLAST_EVENT_WALL 39 44}
    [/event]

    [event]
        name=moveto
        [filter]
            side=1
            x=14
            y=37-41
        [/filter]

        [hide_unit][/hide_unit]

        {FADE_TO_BLACK}

        [fade_out_music]
            duration=500
        [/fade_out_music]

        [fade_out_sound_effects]
            duration=500
        [/fade_out_sound_effects]

        {REMOVE_SOUND_SOURCE hive_noise}

        [reset_sound_effects][/reset_sound_effects]

        {ENDLEVEL_QUIET}
    [/event]

    [event]
        name=time over
        [message]
            speaker=Elyssa
            message= _ "... So, you obtain the power of a god and still manage to drag your feet all over the place for an eternity? Seriously? You don’t even walk!"
        [/message]
    [/event]
[/scenario]

#undef INT_TERRAIN_MOD_1
#undef INT_TERRAIN_MOD_2
#undef INT_RED_AURA
#undef INT_REMOVE_RED_AURA
#undef INT_FLASH_RED
#undef INT_FLASH_PURPLE
#undef INT_ANIMATE_ANYA
#undef INT_BLAST_EVENT_WALL
#undef INT_ELYNIA_THOUGHTS
#undef INT_UNHIDE_CUTSCENE_UNITS

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