#textdomain wesnoth-After_the_Storm

[scenario]
    id=08B_Destiny_part_1
    name= _ "Destiny — Part 1"
    {MAP 08B_Destiny_part_1.map}
    {TURNS 42 40 38}
    next_scenario=08C_Breakdown
    victory_when_enemies_defeated=no
    {DO_NOT_REMOVE_FROM_CARRYOVER_ON_DEFEAT}

    {H_DEATHS}

    {SCENARIO_MUSIC       "siege_of_laurelmor.ogg"} {CONTINUE_PLAYING_STORY_MUSIC_FIRST}
    {EXTRA_SCENARIO_MUSIC "the_city_falls.ogg"}

    {STORYTXT_DESTINY_PART_1}

    {SPAWN_CONTROLLER}

    #
    # Use the Endless Night ToD stats everywhere, but use different
    # local lighting depending on whether an area is outdoors or not.
    # Outdoors uses the default Endless Night lighting, which is
    # darker than the custom Indoors lighting so far used in all
    # Kalari interior scenarios.
    #

    {ENDLESS_NIGHT} {SCHEDULE_LIGHTING -10 -20 0}

    [event]
        name=prestart

        [time_area]
            id=outdoors
            # Durvan starting area
            x= 0-8, 1, 3, 5, 7,0-2,0
            y=4-14,15,15,15,15,  3,2
            [or]
                # Anya starting area
                x=27-39,29-36,31,35
                y=  0-4,    5, 6, 6
            [/or]
            [or]
                # High gardens
                x= 0-9 ,10-20,17-19,21-22,   23,   23, 0-10,14-18
                y=23-32,30-40,   41,31-40,32-33,36-39,36-51,   29
                [not]
                    terrain=X*,X*^*
                [/not]
            [/or]
            {ENDLESS_NIGHT}
        [/time_area]
    [/event]

    {SET_LABEL 17 34 _"Feerelim’s Garden"}

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

        shroud=yes

        {GOLD 240 230 220}

        # wmllint: recognize Anya
        {CHARACTER_STATS_ANYA}
        canrecruit=yes
        # Start with an L3 because of our effectively nil art budget.
        type=Nightshade Fire
        # 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"
        {ALLIANCE_FLAG}

        shroud=yes

        {GOLD 250 240 230}

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

    [side]
        side=3
        team_name=evil
        # Bosses
        user_team_name= _ "team_name^Zhangor"
        {CHAOS_FLAG}
        color=gold

        #controller=null

        hidden=yes
        no_leader=yes

        {NO_ECONOMY}

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

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

        {GOLD 75 80 85} # Village income should do the magic
        recruit=Chaos Gunner,Chaos Invader,Chaos Headhunter,Chaos Invoker

        canrecruit=yes
        type=Chaos Sharpshooter
        id=General Ramzal
        name= _ "General Ramzal"
        facing=nw
        [modifications]
            {TRAIT_INTELLIGENT}
            {TRAIT_RESILIENT}
        [/modifications]

        {GENERIC_UNIT () (Chaos Magus) 22 32} {NO_UPKEEP_NO_OVERLAY} {FACING nw}
    [/side]

    [side]
        side=5
        team_name=evil
        user_team_name= _ "team_name^Uria"
        {CHAOS_FLAG}

        {GOLD 140 160 175}
        recruit=Skeleton,Demon,Ghost,Chaos Bowman

        canrecruit=yes
        type=Chaos Lorekeeper
        id=Mal Therygos
        name= _ "Mal Therygos"
        facing=sw
        [modifications]
            {TRAIT_STRONG}
            {TRAIT_QUICK}
        [/modifications]

        {GENERIC_UNIT () (Death Knight) 36 16} {NO_UPKEEP_NO_OVERLAY} {FACING sw}

        {GENERIC_UNIT () (Draug) 33 17} {NO_UPKEEP_NO_OVERLAY} {GUARDIAN} {FACING sw}
        {GENERIC_UNIT () (Spectre) 34 15} {NO_UPKEEP_NO_OVERLAY} {GUARDIAN} {FACING sw}

        {GENERIC_UNIT () (Ghast) 20 21} {NO_UPKEEP_NO_OVERLAY} {GUARDIAN} {FACING ne}
        {GENERIC_UNIT () (Ghast) 22 23} {NO_UPKEEP_NO_OVERLAY} {GUARDIAN} {FACING se}

        {GENERIC_UNIT () (Wraith) 19 23} {NO_UPKEEP_NO_OVERLAY} {GUARDIAN} {FACING ne}
    [/side]

    [side]
        side=6
        team_name=evil
        # Guards
        user_team_name= _ "team_name^Uria"
        {CHAOS_FLAG}

        no_leader=yes

        {NO_ECONOMY}

        {ai/aliases/stable_singleplayer.cfg}
        [ai]
            {AI_SIMPLE_ALWAYS_ASPECT aggression        1.00}
            {AI_SIMPLE_ALWAYS_ASPECT leader_aggression 1.00}
            {AI_SIMPLE_ALWAYS_ASPECT caution           0.00}
            {AI_SIMPLE_ALWAYS_ASPECT leader_ignores_keep yes}
        [/ai]

        {GENERIC_UNIT () (Serpent Messenger) 17 34} {NO_UPKEEP_NO_OVERLAY} {FACING ne} {GUARDIAN}

        {GENERIC_UNIT () (Ixthala Fire Dancer) 26 26} {NO_UPKEEP_NO_OVERLAY} {FACING ne} {GUARDIAN}
        {GENERIC_UNIT () (Ixthala Fire Dancer) 33 44} {NO_UPKEEP_NO_OVERLAY} {FACING nw} {GUARDIAN}
        {GENERIC_UNIT () (Ixthala Fire Dancer) 19 38} {NO_UPKEEP_NO_OVERLAY} {FACING ne} {GUARDIAN}

        {GENERIC_UNIT () (Demon Stormtide) 14 34} {NO_UPKEEP_NO_OVERLAY} {FACING sw} {GUARDIAN}
        {GENERIC_UNIT () (Demon Stormtide) 20 34} {NO_UPKEEP_NO_OVERLAY} {FACING ne} {GUARDIAN}
    [/side]

    [side]
        side=7
        team_name=evil
        # Shaxthals
        user_team_name= _ "team_name^Uria"
        {CHAOS_FLAG}

        no_leader=yes

        {NO_ECONOMY}

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

        {GENERIC_UNIT () (Shaxthal Turret) 23 16} {NO_UPKEEP_NO_OVERLAY}

        {GENERIC_UNIT () (Shaxthal Turret) 37 44} {NO_UPKEEP_NO_OVERLAY}

        {GENERIC_UNIT () (Shaxthal Worm) 50 21} {NO_UPKEEP_NO_OVERLAY} {GUARDIAN} {FACING sw}
        {GENERIC_UNIT () (Shaxthal Worm) 47 20} {NO_UPKEEP_NO_OVERLAY} {GUARDIAN} {FACING se}

#ifndef EASY
        {GENERIC_UNIT () (Shaxthal Enforcer Drone) 36 45} {NO_UPKEEP_NO_OVERLAY} {GUARDIAN} {FACING nw} {VARIATION surface}
        {GENERIC_UNIT () (Shaxthal Sentry Drone)   37 48} {NO_UPKEEP_NO_OVERLAY} {GUARDIAN} {FACING ne} {VARIATION surface}
#else
        {GENERIC_UNIT () (Shaxthal Sentry Drone)   36 45} {NO_UPKEEP_NO_OVERLAY} {GUARDIAN} {FACING nw} {VARIATION surface}
#endif

        {GENERIC_UNIT () (Shaxthal Rayblade) 32 43} {NO_UPKEEP_NO_OVERLAY} {GUARDIAN} {FACING nw}
        {GENERIC_UNIT () (Shaxthal Rayblade) 27 40} {NO_UPKEEP_NO_OVERLAY} {GUARDIAN} {FACING nw}
        {GENERIC_UNIT () (Shaxthal Rayblade) 25 41} {NO_UPKEEP_NO_OVERLAY} {GUARDIAN} {FACING nw}

        {GENERIC_UNIT () (Shaxthal Drone) 28 43} {NO_UPKEEP_NO_OVERLAY} {GUARDIAN} {FACING nw} {VARIATION surface}
        {GENERIC_UNIT () (Shaxthal Drone) 32 41} {NO_UPKEEP_NO_OVERLAY} {GUARDIAN} {FACING sw} {VARIATION surface}

        {GENERIC_UNIT () (Shaxthal Protector Drone) 11 38} {NO_UPKEEP_NO_OVERLAY} {GUARDIAN} {FACING ne}
        {GENERIC_UNIT () (Shaxthal Protector Drone) 22 38} {NO_UPKEEP_NO_OVERLAY} {GUARDIAN} {FACING nw}

        {GENERIC_UNIT () (Verlissh Matrix Flow System) 23 34} {NO_UPKEEP_NO_OVERLAY}
        {GENERIC_UNIT () (Verlissh Matrix Flow System) 24 35} {NO_UPKEEP_NO_OVERLAY}
        {GENERIC_UNIT () (Verlissh Matrix Flow System) 25 34} {NO_UPKEEP_NO_OVERLAY}

        {GENERIC_UNIT () (Shaxthal Assault Drone) 19 30} {NO_UPKEEP_NO_OVERLAY} {GUARDIAN} {FACING ne}

        {GENERIC_UNIT () (Shaxthal Sentry Drone) 28 21} {NO_UPKEEP_NO_OVERLAY} {GUARDIAN} {FACING nw} {VARIATION surface}
    [/side]

    {STARTING_VILLAGES_ALL 4}

    {STARTING_VILLAGES 1 6}
    {STARTING_VILLAGES 2 6}
    {STARTING_VILLAGES 5 3}

    {TIMED_DRONE_SPAWNER ({DIFF 3 2 2}) (type,facing,variation="Shaxthal Enforcer Drone",se,surface) 7 41 38}

    {TIMED_DRONE_SPAWNER ({DIFF 3 2 2}) (type,facing,variation="Shaxthal Enforcer Drone",se,surface) 7 46 34}

    {TIMED_DRONE_SPAWNER ({DIFF 3 2 2}) (type,facing,variation="Shaxthal Enforcer Drone",nw,surface) 7 55 39}

    {TIMED_DRONE_SPAWNER ({DIFF 3 2 2}) (type,facing,variation="Shaxthal Enforcer Drone",nw,surface) 7 48 41}

    # This must correspond to the above spawner locations.
#define INT_HIVE_ENTRANCE_LOCS
    x=41,46,55,48
    y=38,34,39,41
#enddef

    [event]
        name=prestart

        [store_unit]
            [filter]
                {INT_HIVE_ENTRANCE_LOCS}
            [/filter]
            variable=delayed_hive_spawns
            kill=yes
        [/store_unit]

        {VARIABLE ramzal_taunted no}

        {OBJECTIVES (
            side=1,2
            victory_string= _ "Current Objective:"
            {OBJECTIVE_VICTORY ( _ "Defeat all enemy leaders to seize the keep")}

            {OBJECTIVE_DEFEAT  ( _ "Death of Anya")}
            {OBJECTIVE_DEFEAT  ( _ "Death of Durvan")}
            {OBJECTIVE_DEFEAT  ( _ "Death of Irylean")}
            {OBJECTIVE_DEFEAT  ( _ "Death of Ergea")}
            {OBJECTIVE_DEFEAT  ( _ "Death of Cron")}

            {TURNS_RUN_OUT}

            {OBJECTIVE_FULL_CARRYOVER}
        )}

        {CLEAR_CAVE_SHROUD (
            x,y=33,5
            radius=6
        )}

        {FACE_DIRECTION id=Durvan ne}

        {RECALL_SIDE_LOYALS 2 ()}
    [/event]

    [event]
        name=start

        {ITEM_CRYSTAL_GLYPH_MESSAGE 49 15}

        {MOVE_UNIT id=Anya 33  5}

        {FACE_DIRECTION id=Anya s}

        [redraw]
            side=1
        [/redraw]

        # wmllint: recognize Irylean
        {RECALL_IRYLEAN_AT_LOCATION 34  5}
        # wmllint: recognize Ergea
        {RECALL_ERGEA_AT_LOCATION   32  5}
        # wmllint: recognize Cron
        {RECALL_CRON_AT_LOCATION    32  4}
        # wmllint: recognize Daeira
        {RECALL_DAEIRA_AT_LOCATION  34  4}
        # wmllint: recognize Igor
        {RECALL_IGOR_AT_LOCATION    33  3}

        {FACE_DIRECTION side=1 s}

        [redraw][/redraw]

        [delay]
            time=500
        [/delay]

        [message]
            speaker=Irylean
            message= _ "I’m not sure this is a good idea."
        [/message]

        [message]
            speaker=Ergea
            message= _ "This fortress is key to the defense of the Kalari region and guards an entrance to the underground complex. If we intend to assist Elynia..."
        [/message]

        [message]
            speaker=Irylean
            message= _ "I know, I know. It just seems such a contrived plan. Do we have any idea who controls it at this particular time?"
        [/message]

        [message]
            speaker=Ergea
            message= _ "No."
        [/message]

        [message]
            speaker=Anya
            message= _ "Durvan is meeting with us again soon. Let us not waste any more of his time."
        [/message]

        [message]
            speaker=Irylean
            message= _ "Fair enough."
        [/message]
    [/event]

    [event]
        name=turn 3

        [message]
            speaker=Ergea
            message= _ "I am concerned that sooner or later we are going to have to face against the Storm Sisters. We are rather ill-prepared for such a confrontation, but there is no helping it."
        [/message]

        [message]
            speaker=Durvan
            message= _ "Who are they?"
        [/message]

        [message]
            speaker=Ergea
            message= _ "Zhangor’s loyal enforcers. Regrettably, they are from my own clan. We had... different ideas as to how to handle Zhangor’s rise to power. They opted to side with him, pledging their assassin skills to his service in order to ensure that my fellow stormkind and others do not step out of line. Shortly before battle I received reports indicating that they are roaming the skies of Kalari Central hunting down anyone suspected of rebellious conduct."
        [/message]

        [message]
            speaker=Durvan
            message= _ "I imagine your head is quite highly priced right now."
        [/message]

        [message]
            speaker=Ergea
            message= _ "Yes, it is. I am expecting them to be awaiting us in the fortress keep."
        [/message]

        [message]
            speaker=Irylean
            message= _ "Bah, we will make short work of them, for sure!"
        [/message]
    [/event]

    [event]
        name=moveto,attack
        [filter]
            side=1,2
        [/filter]
        [filter_condition]
            [have_unit]
                type=Shaxthal Turret
                x,y=23,16
                [and]
                    {UNIT_VISIBLE_FOR_SIDE 1}
                    [or]
                        {UNIT_VISIBLE_FOR_SIDE 2}
                    [/or]
                [/and]
            [/have_unit]
        [/filter_condition]

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

        [delay]
            time=750
        [/delay]

        [message]
            speaker=Anya
            message= _ "That thing... are those... human... bodies... protruding from it?"
        [/message]

        [message]
            speaker=Ergea
            # po: Fist: male (Zhangor)
            message= _ "Uria is feared for the habit of decorating her various temples and fortresses on Inferno with those who have foolishly dared to stand up against her. Long ago, she realized that torturing and killing rebels was not enough to make an example, so she began to use her Life powers in more... creative ways. She revels in inflicting unending pain to others, and so does her Fist."
        [/message]

        [message]
            speaker=Ergea
            # po: Voice: male (Argan), Fire: female (Elyssa)
            message= _ "The Voice used his words to control the forces of Chaos, and the Fire used subtlety. While torture and bloodshed have been a common instrument for all three emissaries, Zhangor has opted for the unrestrained brutality that had previously marked his reign over the declining shapeshifters on Urvatha... and the children of Xia’el on Irdya."
        [/message]

        [message]
            speaker=Ergea
            message= _ "Since he lacks the special connection with the Tree that Uria does have, he is limited to the possibilities offered by the technology Chaos had already appropriated for imitating her perverse creations. Unfortunately for his innocent victims, their fate is not any less horrifying or irreversible."
        [/message]

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

        [event]
            name=last breath
            [filter]
                type=Shaxthal Turret
            [/filter]

            [message]
                speaker=Ergea
                scroll=no
                message= _ "The most we can do is to put them out of their misery."
            [/message]
        [/event]
    [/event]

    [event]
        name=turn 8
        [filter_condition]
            [have_unit]
                id=Igor
            [/have_unit]
        [/filter_condition]

        [message]
            speaker=Durvan
            message= _ "You know, Anya... I think I’m finally getting used to the wolves. Granted, I’m still not keen on their awful breath."
        [/message]

        [message]
            speaker=Anya
            message= _ "See? It’s not all that bad once you get to know them."
        [/message]

        [message]
            speaker=Durvan
            message= _ "Yes, sure. I still wish Willow would stop stalking me, especially since half of the time that goblin follows. He’s in desperate need of a bath, that guy."
        [/message]

        [message]
            speaker=Anya
            message= _ "To be fair, I haven’t bathed in a while either and you don’t seem to mind."
        [/message]

        [message]
            speaker=Durvan
            message= _ "I— That’s... I mean, that’s not the same! Be— besides, you are surely going to do it as soon as you get the chance. Unlike <i>him</i>."
        [/message]

        [message]
            speaker=Anya
            message= _ "You are saying that only because he’s a goblin, aren’t you?"
        [/message]
    [/event]

    [event]
        name=moveto
        [filter]
            side=1,2
            x=1-74
            y=18-50
        [/filter]

        {CLEAR_CAVE_SHROUD (
            x,y=24,34
            radius=2
        )}

        [redraw]
            side=1,2
        [/redraw]

        [message]
            speaker=General Ramzal
            # po: 'Wose-born wench' referring to Elynia.
            message= _ "Ha ha ha, it is the Lady of Light’s apprentice, and the stormkind renegade! Oh well, seeing as how the Fist has his own plans for the wose-born wench, I may as well content myself with the corpses of these two as my trophies."
        [/message]

        [place_shroud]
            side=1,2
            x,y=24,34
            radius=2
        [/place_shroud]

        [redraw]
            side=1,2
        [/redraw]

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

    [event]
        name=moveto
        [filter]
            id=Ergea
            [filter_location]
                radius=8
                [filter]
                    id=General Ramzal
                [/filter]
            [/filter_location]
        [/filter]

        [message]
            speaker=General Ramzal
            message= _ "Come and face me, wind witch! I’ve always been curious to see whether your kind has the guts to rise against their more powerful masters."
        [/message]

        {VARIABLE ramzal_taunted yes}

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

    [event]
        name=moveto
        [filter]
            id=Anya
            [filter_location]
                radius=8
                [filter]
                    id=General Ramzal
                [/filter]
            [/filter_location]
        [/filter]

        [message]
            speaker=General Ramzal
            message= _ "You are messing with the wrong crowd, little faerie. You should consider returning to whatever putrid bog you came from, before you get hurt!"
        [/message]

        {VARIABLE ramzal_taunted yes}

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

    [event]
        name=last breath
        [filter]
            id=General Ramzal
        [/filter]
        [filter_second]
            id=Ergea
        [/filter_second]

        [message]
            speaker=General Ramzal
            message= _ "Disgusting double-crossing hag—"
        [/message]
    [/event]

    [event]
        name=last breath
        [filter]
            id=General Ramzal
        [/filter]
        [filter_second]
            id=Anya
        [/filter_second]

        [message]
            speaker=Anya
            message= _ "You should have returned to whatever filthy cavern you crawled out from!"
        [/message]

        [message]
            speaker=General Ramzal
            message= _ "Damn you, miserable faerie-born creature—"
        [/message]
    [/event]

    [event]
        name=attack
        [filter]
            id=Cron
        [/filter]
        [filter_second]
            id=General Ramzal
        [/filter_second]
        [filter_condition]
            {VARIABLE_BOOLEAN_EQUALS ramzal_taunted yes}
        [/filter_condition]

        [message]
            speaker=Cron
            message= _ "Cron doesn’t like the foul-mouthed human and his annoying blast stick."
        [/message]

        [message]
            speaker=General Ramzal
            message= _ "Just what do you think you are doing with that ridiculous hammer?"
        [/message]
    [/event]

    #
    # Once Ramzal et al are dead, the gate to the last segment is opened.
    #

    [event]
        name=enemies defeated

        {REMOVE_EVENT_BARRIER ("*^Zz\,*^Zz/,*^Zz|,*^P*/,*^P*\,*^P*|") 24 39}

        [message]
            speaker=Ergea
            message= _ "That disgusting human filth could not possibly be in command of this fortress alone. We ought to enter the keep and locate their true leader."
        [/message]

        [message]
            speaker=Anya
            message= _ "As you say, then, but we should make this quick. I’ll lead the way."
        [/message]

        {OBJECTIVES (
            side=1,2
            victory_string= _ "Current Objective:"
            {OBJECTIVE_VICTORY ( _ "Find the castellan")}

            {OBJECTIVE_DEFEAT  ( _ "Death of Anya")}
            {OBJECTIVE_DEFEAT  ( _ "Death of Durvan")}
            {OBJECTIVE_DEFEAT  ( _ "Death of Irylean")}
            {OBJECTIVE_DEFEAT  ( _ "Death of Ergea")}
            {OBJECTIVE_DEFEAT  ( _ "Death of Cron")}

            {TURNS_RUN_OUT}

            {OBJECTIVE_CARRYOVER}
        )}

        [event]
            name=moveto,attack
            [filter]
                side=1,2
            [/filter]
            [filter_condition]
                [have_unit]
                    type=Shaxthal Turret
                    x,y=37,44
                    [and]
                        {UNIT_VISIBLE_FOR_SIDE 1}
                        [or]
                            {UNIT_VISIBLE_FOR_SIDE 2}
                        [/or]
                    [/and]
                [/have_unit]
            [/filter_condition]

            {CLEAR_CAVE_SHROUD (
                x,y=37,44
                radius=4
            )}

            [redraw]
                side=1,2
            [/redraw]

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

            {HIGHLIGHT_GOAL x,y=45,29}

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

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

        [allow_undo][/allow_undo]

        # po: The ‘Four’ are individuals of indeterminate genders.
        {MSG_GLYPH ( _ "The Infertile Mother shall give birth to Four.")}

        # po: Except for the ‘Four’, these names refer to inanimate objects.
        {MSG_GLYPH ( _ "These Four shall seek shelter in the Second. The First shall be consumed, the Tree shall be infected.")}

        # po: These names also refer to inanimate objects.
        {MSG_GLYPH ( _ "The missing Fifth shall provide knowledge. The Eleventh and the Twelfth shall provide hope.")}
    [/event]

#define INT_SET_POS_ON_ID _CONTAINER _ID _X _Y _FACING
    [if]
        {VARIABLE_LEXICAL_EQUALS {_CONTAINER}+".id" {_ID} }
        [then]
            [set_variables]
                name={_CONTAINER}
                mode=merge
                [value]
                    facing={_FACING}
                    x={_X}
                    y={_Y}
                [/value]
            [/set_variables]
        [/then]
    [/if]
#enddef

    [event]
        name=die
        [filter]
            type=Shaxthal Turret
            x,y=37,44
        [/filter]

        # Avoid defeat on last turn.
        [modify_turns]
            value=-1
        [/modify_turns]

        [if]
            {VARIABLE_NUMERICAL_NOT_EQUALS side_number 1}
            [then]
                [event]
                    name="turn $($turn_number + 1) refresh"
                    delayed_variable_substitution=no

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

                [end_turn][/end_turn]
            [/then]
            [else]
                [fire_event]
                    name=boss stage 1
                [/fire_event]
            [/else]
        [/if]
    [/event]

    [event]
        name=boss stage 1

        {LOCK_VIEW}

        [delay]
            time=750
        [/delay]

        #
        # Switch Durvan to side 1 for the duration of the boss fight.
        # Force him to wear blue TC for consistency.
        #

        [object]
            silent=yes
            [filter]
                id=Durvan
            [/filter]
            [effect]
                apply_to=image_mod
                add="RC(magenta>blue)"
            [/effect]
        [/object]

        {MODIFY_UNIT id=Durvan side 1}

        #
        # Deactivate side 2.
        #

        [modify_side]
            side=2
            controller=null
        [/modify_side]

        [hide_unit][/hide_unit]

        {FADE_TO_BLACK}

        [place_shroud]
            side=1,2
            # everywhere
        [/place_shroud]

        [fade_out_music][/fade_out_music]

        [scroll_to]
            x,y=48,39
            {WARP}
        [/scroll_to]

        [kill]
            [not]
                side=1
            [/not]
            [not]
                side=2
            [/not]
        [/kill]

        # Send everyone back to the recall list.

        {RESET_AND_SEND_TO_RECALL_LIST (
            side=1,2
            [not]
                id=Anya,Durvan,Ergea,Cron,Irylean,Igor
            [/not]
        )}

        # Take Daeira away from the recall list. She is NOT participating in
        # this boss fight.
        [if]
            [have_unit]
                side=1
                id=Daeira
                search_recall_list=yes
            [/have_unit]
            [then]
                [store_unit]
                    [filter]
                        id=Daeira
                    [/filter]
                    variable=daeira_store
                    kill=yes
                [/store_unit]
            [/then]
        [/if]

        [store_unit]
            [filter]
                [not]
                    x,y=recall,recall
                [/not]
                [and]
                    side=1
                    [or]
                        side=2
                    [/or]
                [/and]
            [/filter]
            variable=heroes_store
            kill=yes
        [/store_unit]

        [kill]
            [not]
                side=1
            [/not]
            [not]
                side=2
            [/not]
        [/kill]

        [delay]
            time=750
        [/delay]

        {CLEAR_CAVE_SHROUD (
            x,y=49,37
            radius=12
            [filter_radius]
                [not]
                    terrain=Q*,Q*^*,G*,G*^*,Rp,Rp^*
                [/not]
                [not]
                    x=0-83
                    y=0-29
                [/not]
            [/filter_radius]
            [or]
                # East corner walls, not reached with r = 12.
                # We can't use r = 13 because that uncovers too
                # much to the south-west.
                x,y=62,35-36
            [/or]
        )}

        # Ensure side 1 has at least 100 gold for recalls in the event that
        # the player's economy crashed at some point.

        [lua]
            code=<<
                if wesnoth.sides[1].gold < 100 then
                    wesnoth.sides[1].gold = 100
                end
            >>
        [/lua]

        {FADE_IN}

        [foreach]
            array=heroes_store
            variable=hero
            [do]
                {INT_SET_POS_ON_ID hero Anya    46 39 ne}

                {INT_SET_POS_ON_ID hero Irylean 45 39 ne}

                {INT_SET_POS_ON_ID hero Durvan  45 38 ne}

                {INT_SET_POS_ON_ID hero Ergea   48 39 ne}

                {INT_SET_POS_ON_ID hero Cron    46 40 ne}

                {INT_SET_POS_ON_ID hero Igor    43 39 ne}

                [set_variables]
                    name=hero
                    mode=merge
                    [value]
                        hitpoints=$hero.max_hitpoints
                        moves=$hero.max_moves
                        attacks_left=$hero.max_attacks
                    [/value]
                [/set_variables]

                {CLEAR_VARIABLE hero.status.uncovered}
                {CLEAR_VARIABLE hero.status.poisoned}
                {CLEAR_VARIABLE hero.status.slowed}
                {CLEAR_VARIABLE hero.status.petrified}

                [unstore_unit]
                    variable="hero"
                [/unstore_unit]
            [/do]
        [/foreach]

        {CLEAR_VARIABLE heroes_store}

        [unhide_unit][/unhide_unit]

        [delay]
            time=750
        [/delay]

        [message]
            speaker=Anya
            message= _ "This place is so unbearably bright even though the longest night isn’t over yet. Where does all this light come from?"
        [/message]

        [delay]
            time=250
        [/delay]

        {FACE_DIRECTION id=Ergea sw}

        [redraw][/redraw]

        [delay]
            time=250
        [/delay]

        [message]
            speaker=Ergea
            message= _ "Hm."
        [/message]

        [message]
            speaker=Irylean
            message= _ "Perhaps it’s some kind of beacon built into the ceiling structure whose light is directed at us using mirrors. I have heard of some temples in the North using that kind of trick, expensive as it may be."
        [/message]

        [message]
            speaker=Durvan
            message= _ "Don’t all these creatures worship darkness, though?"
        [/message]

        {FACE_DIRECTION id=Ergea ne}

        [redraw][/redraw]

        [message]
            speaker=Ergea
            message= _ "That is incorrect. While Uria’s minions on Irdya were mostly Merthiaal worshipers for historical reasons, recently she has—"
        [/message]

        {QUAKE "cave-in.ogg"}

        [scroll_to]
            x,y=40,42
        [/scroll_to]

        [terrain]
            terrain=Xos
            x=38-39,40,39-41
            y=   42,42,   43
        [/terrain]

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

        [place_shroud]
            side=1,2
            x=37-38,39-40
            y=42-43,43-44
        [/place_shroud]

        [redraw]
            side=1,2
        [/redraw]

        {QUAKE "cave-in.ogg"}

        [scroll_to]
            x,y=54,34
        [/scroll_to]

        {QUAKE "cave-in.ogg"}

        {BOSS_AMBIENTANCE_LOOPING}

        [unit]
            canrecruit=yes
            side=6
            type=Lumeril Glyph Mistress
            id=Hemérilyel
            name= _ "Hemérilyel"
            {IS_BOSS}
            max_moves,moves=0,0
            facing=sw
            x,y=54,34
            animate=yes
        [/unit]

        [delay]
            time=250
        [/delay]

        [store_locations]
            [and]
                x,y=54,34
                radius=1
            [/and]
            [not]
                x,y=54,34
            [/not]
            variable=glyph_locs
        [/store_locations]

        [foreach]
            array=glyph_locs
            variable=glyph
            [do]
                {RANDOM 1..4}

                [unit]
                    side=6
                    type=Lumeril Glyph
                    x,y=$glyph.x,$glyph.y
                    animate=no
                    variation="anim$random"
                    [variables]
                        previous_hitpoints=0
                    [/variables]
                [/unit]
            [/do]
        [/foreach]

        {CLEAR_VARIABLE glyph_locs,random}

        {FLASH_WHITE (
            [sound]
                name=dragonstick.ogg
            [/sound]
        )}

        {QUAKE "rumble.ogg"}

        [store_locations]
            {INT_HIVE_ENTRANCE_LOCS}
            variable=hive_entrance_locs
        [/store_locations]

        [foreach]
            array=hive_entrance_locs
            variable=loc
            [do]
                [terrain]
                    x,y=$loc.x,$loc.y
                    terrain=Yhs^Xp
                [/terrain]

                [remove_shroud]
                    side=1,2
                    x,y=$loc.x,$loc.y
                    radius=1
                [/remove_shroud]
            [/do]
        [/foreach]

        {CLEAR_VARIABLE hive_entrance_locs}

        [sound]
            name=gate-fall.ogg
        [/sound]

        [redraw]
            side=1,2
        [/redraw]

        [delay]
            time=500
        [/delay]

        [message]
            speaker=Ergea
            message= _ "Uria be damned... Why did it have to be you?"
        [/message]

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

        {BUG_ON ({VARIABLE_NUMERICAL_NOT_EQUALS delayed_hive_spawns.length 4}) ("wrong number of stored spawns ($delayed_hive_spawns.length|)")}

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

        {CLEAR_VARIABLE delayed_hive_spawns}

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

        [delay]
            time=500
        [/delay]

        [scroll_to_unit]
            id=Anya
        [/scroll_to_unit]

        {OBJECTIVES (
            side=1,2
            victory_string= _ "Current Objective:"
            {OBJECTIVE_VICTORY ( _ "Vanquish Demon Lord Hemérilyel")}

            {OBJECTIVE_DEFEAT  ( _ "Death of Anya")}
            {OBJECTIVE_DEFEAT  ( _ "Death of Durvan")}
            {OBJECTIVE_DEFEAT  ( _ "Death of Irylean")}
            {OBJECTIVE_DEFEAT  ( _ "Death of Ergea")}
            {OBJECTIVE_DEFEAT  ( _ "Death of Cron")}

            {TURNS_RUN_OUT}

            {OBJECTIVE_CARRYOVER}
        )}

        {UNLOCK_VIEW}

        #
        # Someone will ask me about this otherwise so have Anya ask first.
        #

        [event]
            name=side 1 turn end
            [filter_condition]
                {VARIABLE_NUMERICAL_NOT_EQUALS daeira_store.length 0}
            [/filter_condition]

            [message]
                speaker=Anya
                message= _ "Wait... Where did Daeira go?"
            [/message]

            [message]
                speaker=Durvan
                message= _ "Who?"
            [/message]

            [message]
                speaker=Anya
                message= _ "The water faerie! She was with us just a few moments ago!"
            [/message]

            [message]
                speaker=Igor
                message= _ "Water faerie?"
            [/message]

            [message]
                speaker=Durvan
                message= _ "Uh... Did I miss something? I don’t know who you’re talking about."
            [/message]

            [message]
                speaker=Anya
                message= _ "Argh, never mind! I’ll explain later."
            [/message]
        [/event]
    [/event]

    #
    # The glyphs are indestructible by units other than Anya.
    # Hemera remains invincible as long as the glyphs are intact.
    #

    [event]
        name=attack
        first_time_only=no
        [filter]
            [not]
                id=Anya
            [/not]
        [/filter]
        [filter_second]
            type=Lumeril Glyph
        [/filter_second]

        [fire_event]
            name="lumeril glyph standard preattack"
            [primary_unit]
                x,y=$x2,$y2
            [/primary_unit]
            [secondary_unit]
                x,y=$x1,$y1
            [/secondary_unit]
        [/fire_event]
    [/event]

    [event]
        name=attack
        first_time_only=no
        [filter]
            type=Lumeril Glyph
        [/filter]
        [filter_second]
            [not]
                id=Anya
            [/not]
        [/filter_second]

        [fire_event]
            name="lumeril glyph standard preattack"
            [primary_unit]
                x,y=$x1,$y1
            [/primary_unit]
            [secondary_unit]
                x,y=$x2,$y2
            [/secondary_unit]
        [/fire_event]
    [/event]

    [event]
        name=attack end,last breath
        first_time_only=no
        [filter]
            [not]
                id=Anya
            [/not]
        [/filter]
        [filter_second]
            type=Lumeril Glyph
        [/filter_second]

        [fire_event]
            name="lumeril glyph standard postattack"
            [primary_unit]
                x,y=$x2,$y2
            [/primary_unit]
            [secondary_unit]
                x,y=$x1,$y1
            [/secondary_unit]
        [/fire_event]
    [/event]

    [event]
        name=attack end,last breath
        first_time_only=no
        [filter]
            type=Lumeril Glyph
        [/filter]
        [filter_second]
            [not]
                id=Anya
            [/not]
        [/filter_second]

        [fire_event]
            name="lumeril glyph standard postattack"
            [primary_unit]
                x,y=$x1,$y1
            [/primary_unit]
            [secondary_unit]
                x,y=$x2,$y2
            [/secondary_unit]
        [/fire_event]
    [/event]

    [event]
        name="lumeril glyph standard preattack"
        first_time_only=no

        # PRECONDITIONS:
        # * The primary unit is the Lumeril Glyph unit.
        # * The secondary unit belongs to side 1.

        {VARIABLE unit.variables.previous_hitpoints $unit.hitpoints}

        [unstore_unit]
            variable=unit
            find_vacant=no
        [/unstore_unit]
    [/event]

    [event]
        name="lumeril glyph standard postattack"
        first_time_only=no

        # PRECONDITIONS:
        # * The primary unit is the Lumeril Glyph unit.
        # * The secondary unit belongs to side 1.

        [if]
            {VARIABLE_NUMERICAL_GREATER_THAN unit.variables.previous_hitpoints 0}
            [then]
                {VARIABLE unit.hitpoints $unit.variables.previous_hitpoints}

                {VARIABLE unit.variables.previous_hitpoints 0}

                [unstore_unit]
                    variable=unit
                    find_vacant=no
                    {COLOR_HEAL}
                    text= _ "absorbed damage"
                [/unstore_unit]
            [/then]
        [/if]
    [/event]

    [event]
        name="lumeril glyph standard postattack"
        first_time_only=yes
        id=lumeril_glyph_strategy_exposition # wmllint: ignore

        [message]
            speaker=Ergea
            message= _ "Hemérilyel is physically frail, but her magic is too strong. We must destroy her protection glyphs, but that may prove impossible without the assistance of someone who is as versed in the ways of Darkness as she is in the path of Light."
        [/message]

        [delay]
            time=750
        [/delay]

        # wmllint: local spelling Er

        [message]
            speaker=Irylean
            message= _ "Er, why are you looking at me? Perhaps Anya should try instead?"
        [/message]

        [scroll_to]
            x,y=$x2,$y2
        [/scroll_to]
    [/event]

    #
    # Damage inflicted on the crystals by Anya affects all of them.
    #

    [event]
        name=attack end
        first_time_only=no
        [filter]
            id=Anya
        [/filter]
        [filter_second]
            type=Lumeril Glyph
        [/filter_second]

        [fire_event]
            name="lumeril glyph anya postattack"
            [primary_unit]
                x,y=$x2,$y2
            [/primary_unit]
            [secondary_unit]
                x,y=$x1,$y1
            [/secondary_unit]
        [/fire_event]
    [/event]

    [event]
        name=attack end
        first_time_only=no
        [filter]
            type=Lumeril Glyph
        [/filter]
        [filter_second]
            id=Anya
        [/filter_second]

        [fire_event]
            name="lumeril glyph anya postattack"
            [primary_unit]
                x,y=$x1,$y1
            [/primary_unit]
            [secondary_unit]
                x,y=$x2,$y2
            [/secondary_unit]
        [/fire_event]
    [/event]

    [event]
        name="lumeril glyph anya postattack"
        first_time_only=no

        # PRECONDITIONS:
        # * The primary unit is the Lumeril Glyph unit.
        # * The secondary unit is Anya.

        [if]
            {VARIABLE_NUMERICAL_GREATER_THAN unit.hitpoints 0}
            [then]
                [store_unit]
                    [filter]
                        type=Lumeril Glyph
                        [not]
                            x,y=$x2,$y2
                        [/not]
                    [/filter]
                    variable=glyphs_store
                [/store_unit]

                [foreach]
                    array=glyphs_store
                    variable=glyph
                    [do]
                        {VARIABLE glyph.hitpoints $unit.hitpoints}
                        [unstore_unit]
                            variable=glyph
                            find_vacant=no
                        [/unstore_unit]
                    [/do]
                [/foreach]

                {CLEAR_VARIABLE glyphs_store}
            [/then]
        [/if]
    [/event]

    [event]
        name="lumeril glyph anya postattack"
        first_time_only=yes

        [remove_event]
            id=lumeril_glyph_strategy_exposition # wmllint: ignore
        [/remove_event]

        [message]
            speaker=Durvan
            message= _ "It’s working! Anya!"
        [/message]

        [message]
            speaker=Ergea
            message= _ "Excellent."
        [/message]

        [scroll_to]
            x,y=$x2,$y2
        [/scroll_to]
    [/event]

    [event]
        name=die
        [filter]
            type=Lumeril Glyph
        [/filter]

        {LOCK_VIEW}

        [scroll_to_unit]
            id=Hemérilyel
        [/scroll_to_unit]

        [kill]
            type=Lumeril Glyph
            animate=no
            fire_event=no
        [/kill]

        [redraw][/redraw]

        [store_unit]
            [filter]
                id=Hemérilyel
            [/filter]
            variable=hemera_store
        [/store_unit]

        {VARIABLE hemera_store.max_moves 6}
        {VARIABLE hemera_store.moves     $hemera_store.max_moves}

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

        {CLEAR_VARIABLE hemera_store}

        [sound]
            name=lich-die.ogg
        [/sound]

        {QUAKE ("thunderstick.ogg")}

        [delay]
            time=250
        [/delay]

        # No, wmllint. Hemérilyel is a "Lumeril Glyph Mistress", not a "Lumeril Glyph".
        # She's not speaking in her own death event!

        # wmllint: deathcheck off
        [message]
            speaker=Hemérilyel
            message= _ "Is this the game you are playing now, Ergea? Allying yourself with this Irdyan scum so they can die for you?"
        [/message]
        # wmllint: deathcheck on

        {UNLOCK_VIEW}
    [/event]

    [event]
        name=last breath
        [filter]
            id=Hemérilyel
        [/filter]

        [message]
            speaker=Hemérilyel
            message= _ "No... not the darkness... no... please!"
        [/message]
    [/event]

    [event]
        name=die
        [filter]
            id=Hemérilyel
        [/filter]

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

    #
    # The Deathbringers.
    #

    [event]
        name=boss stage 2

        {LOCK_VIEW}

        {CLEAR_LABELS}

        {RESET_UNIT_STATUSES (
            id=Anya
            [or]
                id=Durvan
            [/or]
            [or]
                id=Ergea
            [/or]
        )}

        #
        # Drop Daeira back where she belongs.
        #
        [if]
            {VARIABLE_NUMERICAL_NOT_EQUALS daeira_store.length 0}
            [then]
                [unstore_unit]
                    variable=daeira_store
                    x,y=recall,recall
                [/unstore_unit]

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

        #
        # Switch Durvan back to side 2.
        #

        {MODIFY_UNIT id=Durvan side 2}

        #
        # Reactivate side 2.
        #

        [modify_side]
            side=2
            controller=human
        [/modify_side]

        [fade_out_music]
            duration=1000
        [/fade_out_music]

        [delay]
            time=750
        [/delay]

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

        #
        # Deactivate hive spawns and kill them.
        #

        {VARIABLE spawner_controller_enabled no}

        [kill]
            side=7
        [/kill]

        [store_locations]
            {INT_HIVE_ENTRANCE_LOCS}
            variable=hive_entrance_locs
        [/store_locations]

        [foreach]
            array=hive_entrance_locs
            variable=loc
            [do]
                [terrain]
                    x,y=$loc.x,$loc.y
                    terrain=Xos
                [/terrain]

                [place_shroud]
                    side=1,2
                    x,y=$loc.x,$loc.y
                    radius=1
                [/place_shroud]
            [/do]
        [/foreach]

        {CLEAR_VARIABLE hive_entrance_locs}

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

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

        {CLEAR_CAVE_SHROUD (
            x,y=66,28
            radius=9
            [or]
                x,y=59,32
                radius=5
            [/or]
        )}

        [redraw]
            side=1,2
        [/redraw]

        [scroll_to]
            x,y=68,27
        [/scroll_to]

        [delay]
            time=750
        [/delay]

        [message]
            speaker=Durvan
            message= _ "Look, it’s another garden!"
        [/message]

        {MOVE_UNIT id=Anya 60 32}

        [message]
            speaker=Irylean
            message= _ "There must be a way to open these walls again— Anya, where are you going?"
        [/message]

        [scroll_to]
            x,y=69,28
        [/scroll_to]

        [terrain]
            terrain=^Ii
            x,y=69,28
            layer=overlay
        [/terrain]

        {ITEM_CRYSTAL_GLYPH_MESSAGE 69 28} # triggers a redraw on 1.10

        [delay]
            time=750
        [/delay]

        {MOVE_UNIT id=Anya 64 30}

        [delay]
            time=750
        [/delay]

        {MOVE_UNIT id=Ergea 63 30}

        [message]
            speaker=Irylean
            message= _ "I— All right. Durvan, can you help—"
        [/message]

        {MOVE_UNIT id=Durvan 63 31}

        [if]
            [have_unit]
                id=Igor
            [/have_unit]
            [then]
                [message]
                    speaker=Irylean
                    message= _ "Oh, very well, then. I suppose Cron and Igor can help me—"
                [/message]
            [/then]
            [else]
                [message]
                    speaker=Irylean
                    message= _ "Oh, very well, then. I suppose Cron can help me—"
                [/message]
            [/else]
        [/if]

        [terrain]
            x=58-60,57-59
            y=32   ,33
            terrain=Xos
        [/terrain]

        {RESET_AND_SEND_TO_RECALL_LIST (
            [not]
                x,y=recall,recall
            [/not]
            [not]
                id=Anya
            [/not]
            [not]
                id=Durvan
            [/not]
            [not]
                id=Ergea
            [/not]
        )}

        [place_shroud]
            side=1,2
            x=36-54,55-56,57-58,59-60,61-62,63-64
            y=30-45,31-45,32-45,33-45,34-45,35-45
        [/place_shroud]

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

        [redraw]
            side=1
        [/redraw]

        {FACE_DIRECTION side=1 sw}

        [redraw][/redraw]

        {QUAKE ("rumble.ogg")}

        [delay]
            time=1500
        [/delay]

        [message]
            speaker=Durvan
            message= _ "What now?"
        [/message]

        [message]
            speaker=Ergea
            message= _ "This garden cannot physically be here — I fear that it might be an illusion cast by Zhangor."
        [/message]

        [message]
            speaker=Anya
            # po: Again, the Fire of Uria is Elyssa.
            message= _ "Didn’t you say he would be in the citadel fighting the Fire of Uria?"
        [/message]

        [message]
            speaker=Ergea
            message= _ "More specifically, our Seer said—"
        [/message]

        [delay]
            time=750
        [/delay]

        [message]
            speaker=Ergea
            message= _ "No... That cannot be right."
        [/message]

        [delay]
            time=750
        [/delay]

#define MSG_ZHANGOR_1 _MSG
    [message]
        speaker=narrator
        image=misc/blank-hex.png
        message="<i>"+{_MSG}+"</i>" # wmllint: ignore
    [/message]
#enddef

#define MSG_ZHANGOR_2 _MSG
    [scroll_to]
        x,y=69,28
    [/scroll_to]

    [message]
        speaker=narrator
        caption= _ "Zhangor"
        image=items/crystal-glyph-message.png
        message={_MSG}  # wmllint: ignore
    [/message]
#enddef

        {MSG_ZHANGOR_1 (_"Ha, ha, ha, ha, ha, ha...")}
        [+message]
            sound=laugh.ogg
        [/message]

        [message]
            speaker=Ergea
            message= _ "No..."
        [/message]

        [message]
            speaker=Anya
            message= _ "Who is there?!"
        [/message]

        [delay]
            time=750
        [/delay]

        {MSG_ZHANGOR_1 (_"Did you truly think I would not find out about your plans, Ergea?")}

        {FACE_DIRECTION (side=1) ne}

        [redraw][/redraw]

        [message]
            speaker=Ergea
            message= _ "Zhangor."
        [/message]

        {MSG_ZHANGOR_1 (_"Did you not know that I have my own informants everywhere throughout Urvatha? Of course I would make sure to subvert the Seer’s prophecy in advance.")}

        [delay]
            time=250
        [/delay]

        [scroll_to]
            x,y=69,28
        [/scroll_to]

        {REPLACE_SCENARIO_MUSIC ("overlive.ogg")}

        [delay]
            time=500
        [/delay]

        [message]
            speaker=Ergea
            message= _ "Anya, teleport us away from this place at once."
        [/message]

        [message]
            speaker=Anya
            # po: "... something blocking my [teleport] power."
            message= _ "I can’t! I am trying but there seems to be something—"
        [/message]

        {MSG_ZHANGOR_2 ( _ "Is it not appalling that the Lady of Light left a poor mixed-blood girl in charge of assisting a fallen Demon Lord with a death wish? You would expect more common sense from a creature who has lived for so long and seen so much. Then again, she came here seeking her own death.")}

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

        {MSG_ZHANGOR_2 ( _ "You want her, don’t you? But her time has already expired, and the dark fire that took her will be extinguished next. I will deal with you all later... assuming anything remains by then.")}

        [fade_out_music]
            duration=500
        [/fade_out_music]

        [remove_item]
            x,y=69,28
        [/remove_item]

        [redraw][/redraw]

        [scroll_to]
            x,y=72,25
        [/scroll_to]

        [unit]
            side=7
            type=Shaxthal Deathbringer
            facing=sw
            x,y=72,25
            animate=yes
            variation=cyclops
        [/unit]

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

        [unit]
            side=7
            type=Shaxthal Deathbringer
            facing=ne
            x,y=59,30
            animate=yes
        [/unit]

        {FACE_DIRECTION (id=Durvan) nw}
        [redraw][/redraw]

        [scroll_to]
            x,y=64,32
        [/scroll_to]

        [unit]
            side=7
            type=Shaxthal Deathbringer
            facing=nw
            x,y=64,32
            animate=yes
        [/unit]

        [delay]
            time=250
        [/delay]

        [message]
            speaker=Anya
            message= _ "Are those...?"
        [/message]

        [message]
            speaker=Ergea
            message= _ "The same abominations he sent after Elorran. We could not be more unprepared for this encounter."
        [/message]

        [message]
            speaker=Anya
            message= _ "(<i>muttering to herself</i>) Elynia, why couldn’t you be here, now..."
        [/message]

        [delay]
            time=750
        [/delay]

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

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

        [kill]
            id=Anya
            [or]
                type=Shaxthal Deathbringer
            [/or]
        [/kill]

        {FADE_TO_BLACK}

        {BLACK_SCREEN}

        [delay]
            time=1000
        [/delay]

        [message]
            speaker=narrator
            image=misc/blank-hex.png
            message= _ "<i>... I never thought it would come to this...</i>"
        [/message]

        [delay]
            time=1500
        [/delay]

        [scroll_to]
            x,y=66,28
        [/scroll_to]

        {FADE_IN}

        [set_variables]
            name=durvan_store
            mode=merge
            [value]
                hitpoints=$($durvan_store.max_hitpoints * 0.25)
                facing=ne
                x,y=67,28
            [/value]
        [/set_variables]

        [unstore_unit]
            variable=durvan_store
        [/unstore_unit]

        [set_variables]
            name=ergea_store
            mode=merge
            [value]
                hitpoints=$($ergea_store.max_hitpoints * 0.40)
                facing=sw
                x,y=65,29
            [/value]
        [/set_variables]

        [unstore_unit]
            variable=ergea_store
        [/unstore_unit]

        {CLEAR_VARIABLE durvan_store,ergea_store}

        [unit]
            side=7
            type=Shaxthal Deathbringer
            facing=se
            x,y=66,26
        [/unit]

        [unit]
            side=7
            type=Shaxthal Deathbringer
            facing=sw
            x,y=68,27
            hitpoints=63
            variation=cyclops
        [/unit]

        [unit]
            side=7
            type=Shaxthal Deathbringer
            facing=nw
            x,y=69,30
            hitpoints=14
            variation=beast
        [/unit]

        [unit]
            side=7
            type=Shaxthal Deathbringer
            facing=ne
            x,y=64,29
            hitpoints=22
        [/unit]

        [unit]
            side=7
            type=Shaxthal Deathbringer
            facing=ne
            x,y=65,32
            variation=beast
        [/unit]

        [unit]
            side=7
            type=Shaxthal Deathbringer
            facing=ne
            x,y=62,28
            hitpoints=74
        [/unit]

        [unit]
            side=7
            type=Shaxthal Deathbringer
            facing=ne
            x,y=61,31
            variation=cyclops
        [/unit]

        [unit]
            {CHARACTER_STATS_ANYA}
            # clobber IS_HERO from the stats macro
            {NO_OVERLAYS_NO_ELLIPSE}
            {INJURED_VARIATION_STATS}
            canrecruit=yes
            side=1
            type=Nightshade Fire
            variation=injured
            x,y=66,28
            facing=se
        [/unit]

        [scroll_to_unit]
            id=Anya
        [/scroll_to_unit]

        [delay]
            time=1500
        [/delay]

        [message]
            speaker=narrator
            image=misc/blank-hex.png
            message= _ "<i>... Why couldn’t we be together to face the end?</i>"
        [/message]

        [delay]
            time=2000
        [/delay]

        [store_unit]
            [filter]
                [not]
                    x,y=recall,recall
                [/not]
            [/filter]
            variable=breakdown_cutscene_units
            # E3S8C destroys this container, so we want Ergea and Durvan to get
            # automatically stored in the recall list at the end.
            kill=no
        [/store_unit]

        [hide_unit][/hide_unit]

        {FADE_TO_BLACK}

        {BUG_ON ({VARIABLE_NUMERICAL_EQUALS breakdown_cutscene_units.length 0}) ("No cutscene units stored!")}

        {UNLOCK_VIEW}

        {ENDLEVEL_QUIET}
    [/event]

    [event]
        name=victory

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

#undef INT_SET_POS_ON_ID
#undef INT_HIVE_ENTRANCE_LOCS
#undef MSG_ZHANGOR_1
#undef MSG_ZHANGOR_2

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