#textdomain wesnoth-Invasion_from_the_Unknown

[scenario]
    id=22B_Dark_Hive
    name= _ "The Dark Hive"
    {MAP 22B_Dark_Hive.map}
    {TURNS 82 78 75}
    next_scenario=23A_Into_the_Lair
    victory_when_enemies_defeated=no
    {NO_RECALLS}

    {SCENARIO_MUSIC       "into_the_shadows.ogg"}
    {EXTRA_SCENARIO_MUSIC "suspense.ogg"}

    {INDOORS_HIVE} {SCHEDULE_LIGHTING -50 -70 0}

    {STORYTXT_DARK_HIVE}

    {DEATHS_ACT_4}

    {SPAWN_CONTROLLER}

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

        fog=yes
        shroud=yes

        {NO_ECONOMY}

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

    # Boss supporters
    [side]
        side=2
        team_name=enemies
        user_team_name= _ "team_name^Chaos Warlord"
        {CHAOS_FLAG}
        color=gold
        controller=null # Activated later.

        hidden=yes
        no_leader=yes
        # Recruit list and gold set by events.

        {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 village_value          0.00}
            {AI_SIMPLE_ALWAYS_ASPECT grouping                 no}

            {AI_BOSS_TARGETING_ENGINE <<{"Elynia","Galas","Mal Keshar"}>>}
        [/ai]
    [/side]

    [side]
        side=3
        team_name=enemies
        user_team_name= _ "team_name^Chaos Empire"
        {CHAOS_FLAG}
        color=blue

        hidden=yes
        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]

        # Initial area.

        {SIDE_GENERIC_GUARD (Chaos Razerman) 20 18} {FACING nw}
        {SIDE_GENERIC_GUARD (Chaos Invader)  19 19} {FACING nw}
        {SIDE_GENERIC_GUARD (Chaos Invader)  21 19} {FACING nw}

        {SIDE_GENERIC_GUARD (Chaos Marauder)  5 27} {FACING se}
        {SIDE_GENERIC_GUARD (Demon Grunt)     7 29} {FACING nw}

        {SIDE_GENERIC_GUARD (Chaos Heavy Longbowman) 30 20} {FACING sw}
        {SIDE_GENERIC_GUARD (Demon Zephyr)           26 21} {FACING nw}

        {SIDE_GENERIC_GUARD (Chaos Magus) 37 19} {FACING se}

        {SIDE_GENERIC_GUARD (Chaos Marauder) 44 13} {FACING sw}

        # Boss arena.

        {SIDE_GENERIC_GUARD (Demon Warrior) 18 40} {FACING ne}

        {SIDE_GENERIC_GUARD (Demon Zephyr)  18 43}
        {SIDE_GENERIC_GUARD (Demon Zephyr)  11 47}

        {SIDE_GENERIC_GUARD (Demon Warrior) 14 48}

        {SIDE_GENERIC_GUARD (Demon Zephyr)  24 42}
        {SIDE_GENERIC_GUARD (Demon Zephyr)   7 42}

        {SIDE_GENERIC_GUARD (Demon Zephyr)  26 48}
        {SIDE_GENERIC_GUARD (Demon Zephyr)  36 46}
        {SIDE_GENERIC_GUARD (Demon Zephyr)  29 51}
        {SIDE_GENERIC_GUARD (Demon Zephyr)  43 49}

        {SIDE_GENERIC_GUARD (Hell Guardian)     40 54}
        {SIDE_GENERIC_GUARD (Chaos Arbalestier) 35 56}
    [/side]

    [side]
        side=4
        team_name=enemies
        user_team_name= _ "team_name^Dark Hive"
        {CHAOS_FLAG}

        hidden=yes
        no_leader=yes
        {NO_ECONOMY}

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

        {SIDE_GENERIC_GUARD (Shaxthal Sentry Drone) 27 29} {FACING ne} {PALETTE shaxthal_drone_base shaxthal_drone_cyan}
        {SIDE_GENERIC_GUARD (Shaxthal Sentry Drone) 35 33} {FACING nw} {PALETTE shaxthal_drone_base shaxthal_drone_cyan}

        {SIDE_GENERIC_UNIT (Verlissh Matrix Flow System) 44 28}
        {SIDE_GENERIC_UNIT (Verlissh Matrix Flow System) 51 23}
        {SIDE_GENERIC_UNIT (Verlissh Matrix Flow System) 50 10}
        {SIDE_GENERIC_UNIT (Verlissh Matrix Flow System) 38  5}
        {SIDE_GENERIC_UNIT (Verlissh Matrix Flow System) 23 11}
        {SIDE_GENERIC_UNIT (Verlissh Matrix Flow System)  6 13}
        {SIDE_GENERIC_UNIT (Verlissh Matrix Flow System) 11 28}
        {SIDE_GENERIC_UNIT (Verlissh Matrix Flow System) 10 38}
        {SIDE_GENERIC_UNIT (Verlissh Matrix Flow System) 22 43}
        {SIDE_GENERIC_UNIT (Verlissh Matrix Flow System)  6 47}
        {SIDE_GENERIC_UNIT (Verlissh Matrix Flow System)  9 54}
        {SIDE_GENERIC_UNIT (Verlissh Matrix Flow System) 10 56}
        {SIDE_GENERIC_UNIT (Verlissh Matrix Flow System) 10 60}
        {SIDE_GENERIC_UNIT (Verlissh Matrix Flow System) 35 62}
        {SIDE_GENERIC_UNIT (Verlissh Matrix Flow System) 39 42}
        {SIDE_GENERIC_UNIT (Verlissh Matrix Flow System) 41 45}
    [/side]

    [side]
        side=5
        team_name=enemies
        user_team_name= _ "team_name^Cave Creatures"

        hidden=yes
        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 village_value          0.00}
            {AI_SIMPLE_ALWAYS_ASPECT simple_targeting        yes}
            {AI_SIMPLE_ALWAYS_ASPECT grouping                 no}
        [/ai]

        {SIDE_GENERIC_GUARD (Blood Bat) 22 16}
        {SIDE_GENERIC_GUARD (Blood Bat)  6 20}
        {SIDE_GENERIC_GUARD (Blood Bat) 42 10}

        {SIDE_GENERIC_GUARD (Giant Ant) 44 21}
        {SIDE_GENERIC_GUARD (Giant Ant) 45 23}

        {SIDE_GENERIC_GUARD (Water Serpent) 22 17}

        {SIDE_GENERIC_GUARD (Dread Bat)  4 40}
        {SIDE_GENERIC_GUARD (Dread Bat) 24 58}
        {SIDE_GENERIC_GUARD (Dread Bat) 33 45}
    [/side]

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

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

    {NPC_BIRD_BEHAVIOR_WHOLE_MAP 4}

    {SETUP_SHAXTHAL_ROAMING_SOUND_EFFECTS}

    {HIVE_NOISE_2_SOUND_SOURCE}

    {CAVE_WATER_SOUND_SOURCE 46 22}

#define GA_DRONES_EASY
    "Shaxthal Drone,Shaxthal Drone,Shaxthal Drone,Shaxthal Drone,Shaxthal Runner Drone,Shaxthal Sentry Drone" #enddef
#define GA_DRONES_MEDIUM
    "Shaxthal Drone,Shaxthal Sentry Drone,Shaxthal Sentry Drone,Shaxthal Protector Drone,Shaxthal Protector Drone" #enddef
#define GA_DRONES_HARD
    "Shaxthal Sentry Drone,Shaxthal Assault Drone" #enddef
#define GA_DRONES_ULTRA
    "Shaxthal Sentry Drone,Shaxthal Sentry Drone,Shaxthal Assault Drone,Shaxthal Assault Drone,Shaxthal Assault Drone,Shaxthal Rayblade" #enddef

#define GA_DRONE _TURNS _DIFFICULTY_LEVEL _X _Y
    {TIMED_DRONE_SPAWNER {_TURNS} (type={GA_DRONES_{_DIFFICULTY_LEVEL}}) 4 {_X} {_Y} }
#enddef

    # Initial area -- eastern branch.

    {GA_DRONE {DIFF 7 6 6} HARD   27 10}
    {GA_DRONE {DIFF 6 5 4} MEDIUM 29 11}
    {GA_DRONE {DIFF 4 3 3} EASY   29  4}
    {GA_DRONE {DIFF 4 3 3} HARD   31  5}
    {GA_DRONE {DIFF 4 3 3} EASY   33  6}

    {GA_DRONE {DIFF 7 6 5} ULTRA  33 14}
    {GA_DRONE {DIFF 5 4 4} ULTRA  31 16}
    {GA_DRONE {DIFF 8 7 6} HARD   31 17}

    {GA_DRONE {DIFF 4 3 3} EASY   41 12}
    {GA_DRONE {DIFF 5 4 4} EASY   40 16}
    {GA_DRONE {DIFF 7 6 5} MEDIUM 38 18}

    # Initial area -- water branch.

    {GA_DRONE {DIFF 5 4 3} ULTRA   5 14}
    {GA_DRONE {DIFF 7 6 5} ULTRA   8 12}
    {GA_DRONE {DIFF 5 4 3} ULTRA   5 12}
    {GA_DRONE {DIFF 3 2 2} EASY    8 15}

    # W glyph passage.

    {GA_DRONE {DIFF 9 8 7} ULTRA  12 25}
    {GA_DRONE {DIFF 7 6 5} MEDIUM 11 23}
    {GA_DRONE {DIFF 6 5 4} EASY   13 27}

    # NE glyph passage.

    {GA_DRONE {DIFF 7 6 5} HARD   47 10}
    {GA_DRONE {DIFF 5 3 3} HARD   49  9}

    # Boss arena entrance.

    {GA_DRONE {DIFF 9 8 7} ULTRA  36 22}
    {GA_DRONE {DIFF 8 7 6} MEDIUM 37 23}
    {GA_DRONE {DIFF 7 6 5} EASY   43 27}
    {GA_DRONE {DIFF 7 6 5} EASY   44 29}
    {GA_DRONE {DIFF 7 6 5} EASY   45 28}

    # Boss arena (stage 1).

    {GA_DRONE {DIFF 7 6 5} ULTRA  27 31}
    {GA_DRONE {DIFF 9 8 7} ULTRA  31 34}
    {GA_DRONE {DIFF 7 6 5} HARD   30 27}

    {GA_DRONE {DIFF 5 4 3} EASY   32 27}
    {GA_DRONE {DIFF 5 4 3} EASY   25 31}

    # Boss arena (stages 2+).

    {GA_DRONE {DIFF 7 6 5} MEDIUM 10 39}
    {GA_DRONE {DIFF 7 6 5} MEDIUM 16 35}
    {GA_DRONE {DIFF 7 6 5} MEDIUM 23 39}
    {GA_DRONE {DIFF 9 8 7} ULTRA  25 39}
    {GA_DRONE {DIFF 7 6 5} HARD   21 44}

    {GA_DRONE {DIFF 7 6 5} EASY    7 46}
    {GA_DRONE {DIFF 7 6 5} EASY    8 48}
    {GA_DRONE {DIFF 7 6 5} MEDIUM  4 50}
    {GA_DRONE {DIFF 7 6 5} EASY    6 52}
    {GA_DRONE {DIFF 7 6 5} MEDIUM  9 56}
    {GA_DRONE {DIFF 4 3 3} MEDIUM 11 58}
    {GA_DRONE {DIFF 5 4 3} EASY   13 59}
    {GA_DRONE {DIFF 3 2 2} EASY   14 60}
    {GA_DRONE {DIFF 5 4 3} EASY    7 59}
    {GA_DRONE {DIFF 3 2 2} EASY    5 57}
    {GA_DRONE {DIFF 7 6 5} EASY    5 55}

    {GA_DRONE {DIFF 5 4 3} EASY   39 41}
    {GA_DRONE {DIFF 7 6 5} EASY   41 44}
    {GA_DRONE {DIFF 7 6 5} ULTRA  39 43}

    {GA_DRONE {DIFF 9 9 8} ULTRA  45 56}
    {GA_DRONE {DIFF 9 9 8} ULTRA  37 61}
    {GA_DRONE {DIFF 9 9 8} ULTRA  37 59}

    # wmlindent: start ignoring

#define GA_WORMS_START
    [set_variables]
        mode=replace
        name=temp_worm_locs
#enddef

#define GA_WORM _X _Y
    [literal]
        x,y={_X},{_Y}
    [/literal]
#enddef

#define GA_WORMS_FINISH
    [/set_variables]

    [foreach]
        array=temp_worm_locs
        [do]
            {VARIABLE_RANDOM temp_worm_variation a,b,c}
            {VARIABLE_RANDOM temp_worm_palette   brown,purple,cyan,base}

            [unit]
                side=4
                type=Shaxthal Worm
                upkeep=free
                x=$this_item.x
                y=$this_item.y
                variation=$temp_worm_variation
                random_traits=yes
                random_gender=yes
                generate_name=yes
                [modifications]
                    {UNIT_PALETTE_SWITCH () ("shaxthal_drone_base") ("shaxthal_drone_$temp_worm_palette")}
                [/modifications]
            [/unit]
        [/do]
    [/foreach]

    {CLEAR_VARIABLE temp_worm_palette,temp_worm_variation,temp_worm_locs}
#enddef

    # wmlindent: stop ignoring

    #
    # Set-up healing spots.
    #

    {OBJ_HEALING_GLYPH 11 45}
    {OBJ_HEALING_GLYPH 26 49}
    {OBJ_HEALING_GLYPH 37 55}

    [event]
        name=prestart

        {VARIABLE boss_stage_num  0}
        {VARIABLE void_kills     no}

        #
        # Add worms.
        #

        {GA_WORMS_START}

        # Initial area.

        {GA_WORM 10 10}
        {GA_WORM 15 12}
        {GA_WORM 25  9}
        {GA_WORM 26  3}
        {GA_WORM 15 18}
        {GA_WORM 28 28}
        {GA_WORM 17 23}
        {GA_WORM  6 23}
        {GA_WORM 10 31}
        {GA_WORM 33 21}
        {GA_WORM 32 22}
        {GA_WORM 48 24}
        {GA_WORM 46 18}
        {GA_WORM 41 14}
        {GA_WORM 44  8}
        {GA_WORM 48 13}
        {GA_WORM 50  7}
        {GA_WORM 52  8}
        {GA_WORM 35  5}
        {GA_WORM 34 10}
        {GA_WORM 27 12}
        {GA_WORM 31 12}
        {GA_WORM 44  2}
        {GA_WORM 25 18}
        {GA_WORM 48 32}
        {GA_WORM 44 38}
        {GA_WORM 31 41}

        # Boss arena, initial segment.

        {GA_WORM 38 29}
        {GA_WORM 34 35}
        {GA_WORM 27 34}
        {GA_WORM 22 28}
        {GA_WORM 26 26}
        {GA_WORM 35 26}

        # Boss arena, abyss segment.

        {GA_WORM 16 38}
        {GA_WORM 24 44}
        {GA_WORM 44 45}
        {GA_WORM 50 52}
        {GA_WORM 31 61}
        {GA_WORM 41 64}
        {GA_WORM 15 63}
        {GA_WORM  5 59}
        {GA_WORM 17 54}
        {GA_WORM  3 46}
        {GA_WORM 18 47}
        {GA_WORM 43 54}
        {GA_WORM 37 52}
        {GA_WORM 32 51}
        {GA_WORM 30 53}
        {GA_WORM 18 60}
        {GA_WORM  6 64}
        {GA_WORM 28 68}

        {GA_WORMS_FINISH}

        # wmlindent: start ignoring

        # Proximity spawns code set-up.
        [set_variables]
            name=pspawn_diff_choices
            [literal]
                easy={GA_DRONES_EASY}
                medium={GA_DRONES_MEDIUM}
                hard={GA_DRONES_HARD}
                ultra={GA_DRONES_ULTRA}

                random={DIFF
                    easy,easy,easy,medium,hard,ultra
                    easy,easy,easy,medium,medium,medium,hard,ultra
                    easy,easy,medium,medium,medium,hard,hard,ultra
                }
            [/literal]
        [/set_variables]

        # wmlindent: stop ignoring

        [setup_doors]
            side=6
        [/setup_doors]

        # Recall heroes

        # wmllint: recognize Elynia
        {RECALL_ELYNIA}
        # wmllint: recognize Mal Keshar
        {RECALL_MAL_KESHAR}
        # wmllint: recognize Lédinor
        {RECALL_LEDINOR}
        # wmllint: recognize Erathan
        {RECALL_ERATHAN2}
        # wmllint: recognize Igor
        {RECALL_IGOR}

        {FACE_DIRECTION side=1 se}

        {OBJECTIVES (
            {OBJECTIVE_VICTORY ( _ "Proceed deeper underground with Galas, Elynia, or Mal Keshar")}

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

            {TURNS_RUN_OUT}

            {OBJECTIVE_FULL_CARRYOVER}
        )}
    [/event]

    {FINAL_SCENARIO_PLAYER_RECRUITMENT_WITH_AUTORECALL}

    [event]
        name=start
        [message]
            speaker=Mal Keshar
            message= _ "Elynia, what you are saying is simply preposterous! How could I possibly serve as a substitute for Argan’s powers! Unless..."
        [/message]

        [message]
            speaker=Elynia
            message= _ "As we descend deeper into this fortress, we get ever closer to Inferno, and to the source of their power. You are one of the most powerful dark sorcerers ever born from Irdya. My hope is that together we might be able to tap into the darkness of the demons’ homeland... possibly at the risk of our own lives. It’s either that or allow the demoness to erase you and me from existence."
        [/message]

        [message]
            speaker=Mal Keshar
            message= _ "I am not sure... if I even want to do this anymore. I am no hero! I should kill you and take the prize to hell with me! Actually, I guess that’s exactly where we are headed, so..."
        [/message]

        [message]
            speaker=Elynia
            message= _ "You did many things in the past, most of them crimes against people and life. But now, at the end of all things, you guided Galas and his loyal followers to the depths of Irdya, awoke me from my long slumber, and fought the hordes of Chaos alongside us all the while. Redeeming yourself will take much more than this, but I can assure you that turning your back on us now will only result in your destruction at the hands of Uria’s servants."
        [/message]

        [message]
            speaker=Galas
            message= _ "Would you prefer that fate over fighting a just cause one final time?"
        [/message]
    [/event]

    [event]
        name=DEBUG1

        [while]
            [have_unit]
                side=1
                x=1-15
                y=1-9
            [/have_unit]
            [do]
                [teleport]
                    [filter]
                        side=1
                        x=1-15
                        y=1-9
                    [/filter]
                    x,y=39,27
                [/teleport]
            [/do]
        [/while]

        [redraw]
            side=1
        [/redraw]

        [scroll_to_unit]
            id=Galas
        [/scroll_to_unit]
    [/event]

    [event]
        name=side 1 turn 1 end

        [message]
            speaker=Mal Keshar
            message= _ "Pah! To the Dark Gods with you and your stupid and pretentious motivations! I will help, but only because I am curious to see if I can really harness this legendary power! I can’t possibly refuse the offer of unlimited power after all these eons..."
        [/message]

        [message]
            speaker=Elynia
            message= _ "(smiles) I knew you would listen to reason, Malin."
        [/message]

        {IF_HAVE_ERATHAN (
            [message]
                speaker=Erathan
                message= _ "How can you people hand your lives to this lich on a silver platter like that! It defies all logic!"
            [/message]

            [message]
                speaker=Galas
                message= _ "Just like this mission, then?"
            [/message]
        )}
    [/event]

    #
    # Give the player some incentive to advance fast and quickly.
    #

    #
    # TODO: continuous spawns from starting area
    #

    #
    # TODO: OPTIMIZE WML FOOTPRINT
    #
#define GA_PROXIMITY_SPAWN _CENTER_X_Y _CREVICE_X_Y _TRIGGER_X_Y_RANGE
    [event]
        name=moveto
        [filter]
            side=1
            x,y={_TRIGGER_X_Y_RANGE}
        [/filter]

        {QUAKE cave-in.ogg}

        [store_locations]
            x,y={_CENTER_X_Y}
            variable=pspawn_center_loc
        [/store_locations]

        [store_locations]
            terrain="*^Xp"
            [and]
                x,y={_CENTER_X_Y}
                radius=3
            [/and]
            variable=pspawn_locs
        [/store_locations]

        {LOG_IFTU_DBG "gauntlet pspawn: $pspawn_locs.length locations around ($pspawn_center_loc.x,$pspawn_center_loc.y) ~ 3"}

        [foreach]
            array=pspawn_locs
            [do]
                {VARIABLE_RANDOM pspawn_respawn_timer {DIFF 4..8 3..6 2..4} }
                {VARIABLE_RANDOM pspawn_difficulty $pspawn_diff_choices.random}

                {LOG_IFTU_DBG "gauntlet pspawn: spawn @ ($this_item.x,$this_item.y) timer = $pspawn_respawn_timer difficulty = $pspawn_difficulty"}

                {TIMED_DRONE_SPAWNER $pspawn_respawn_timer type=$pspawn_diff_choices.$pspawn_difficulty 4 $this_item.x| $this_item.y|}
                # HACK
                {TRY_RESPAWN_NOW 4 $this_item.x| $this_item.y|}
            [/do]
        [/foreach]

        [terrain]
            x,y={_CREVICE_X_Y}
            terrain=$pspawn_center_loc.terrain
            layer=base
        [/terrain]

        [item]
            image=scenery/rubble.png
            x,y={_CREVICE_X_Y}
        [/item]

        [sound]
            name=explosion-big.ogg,explosion.ogg,bot-huge-explosion.ogg
        [/sound]

        {CLEAR_CAVE_SHROUD x,y,radius=$pspawn_center_loc.x,$pspawn_center_loc.y,5}

        {CLEAR_FOG 1 $pspawn_center_loc.x $pspawn_center_loc.y 5}

        [redraw]
            side=1
        [/redraw]

        [scroll_to]
            x,y={_CENTER_X_Y}
        [/scroll_to]

        [delay]
            time=500
        [/delay]

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

        {CLEAR_VARIABLE pspawn_center_loc,pspawn_locs,pspawn_difficulty,pspawn_respawn_timer}

        {UNCLEAR_FOG}
    [/event]
#enddef

    {GA_PROXIMITY_SPAWN    38,5     37,7     34-41,9-16 }
    {GA_PROXIMITY_SPAWN    23,12    20,13    16-24,17-23}
    {GA_PROXIMITY_SPAWN    51,24    48,22    38-45,23-31}

    #
    # Warn about windy passages
    #
    [event]
        name=moveto
        [filter]
            side=1
            [filter_location]
                [filter_adjacent_location]
                    count=4
                    terrain=X*
                [/filter_adjacent_location]
            [/filter_location]
        [/filter]

        {CONDITIONAL_ERATHAN (
            {VARIABLE tmp_speaker Erathan}
        ) (
            {VARIABLE tmp_speaker (Mal Keshar)}
        )}

        [message]
            # $tmp_speaker = (Erathan) or (Mal Keshar)
            speaker=$tmp_speaker
            message= _ "We should avoid those dark and windy passages. With such evil creatures lurking around, we could get cornered and trapped."
        [/message]

        {CLEAR_VARIABLE tmp_speaker}
    [/event]

    {PICK_UP items/coffin-closed.png 6 28
    (
        [not]
            race=undead
        [/not]
    )
    ( _ "This dusty coffin contains the barely recognizable remains of what appears to be a human noble of some sort. “Vikren the First of Wesnoth.” It says he was some kind of important figure back in the old empire? Who knows what he would be doing down here in this infernal complex... Wait a moment. His body was placed here wearing some kind of magic ring. I sense a powerful magic stirring within somehow, even an eternity after his death. Do you think we should take it?")
    ( _ "I have this distinct feeling that the magic in this ring would interact with the undead in ways we cannot possibly predict. Let us not attempt anything stupid while we are still on the run from that murderous woman, shall we?")
    (
        [remove_item]
            x,y=$x1,$y1
        [/remove_item]

        [item]
            x,y=$x1,$y1
            image=items/coffin-open.png
        [/item]

        [object]
            id=revenant_ring
            name= _ "Ring of the Revenant"
            image=icons/skull_ring.png
            description= _ "Any living creature wearing this ring is granted the power to cheat death once, after which the ring shall become inert for a thousand years."
            duration=forever
            [filter]
                x,y=$x1,$y1
            [/filter]
            [effect]
                apply_to=new_ability
                [abilities]
                    [dummy]
                        id=revenant_ring
                        name= _ "ring of the revenant"
                        description= _ "Any living creature wearing this ring is granted the power to cheat death once, after which the ring shall become inert for a thousand years."
                    [/dummy]
                [/abilities]
            [/effect]
        [/object]

        [if]
            [have_unit]
                type=Faerie Spirit
                x,y=$x1,$y1
            [/have_unit]

            [then]
                [message]
                    speaker=Galas
                    message= _ "Wait... does a forest spirit count as a dead or a living creature?"
                [/message]

                [message]
                    speaker=Mal Keshar
                    message= _ "Why not both? I reckon this could be be a worthwhile experiment, he he."
                [/message]

                [message]
                    speaker=unit
                    message= _ "I know not how this is possible, but the ring appears to have become firmly intertwined with my existence in a way I cannot begin to comprehend. I cannot remove it."
                [/message]

                [message]
                    speaker=Elynia
                    message= _ "I hope this doesn’t turn out to be a grave mistake later..."
                [/message]

                [message]
                    speaker=Mal Keshar
                    message= _ "You did not just say “grave mistake” while stealing an object from a grave, did you, Elynia?"
                [/message]
            [/then]
        [/if]

        # Yes, the player is allowed to pull this insanity on themselves.

        [if]
            [have_unit]
                race=bats
                x,y=$x1,$y1
            [/have_unit]
            [then]
                [message]
                    speaker=Elynia
                    message= _ "Did we just give the ring to one of Mal Keshar’s pets? Seriously? Do you have any idea of the historical importance of this ring?"
                [/message]

                [message]
                    speaker=Mal Keshar
                    message= _ "Pah, it’s not like anyone else has a need for it right now. Why is it such a big deal?"
                [/message]
            [/then]
        [/if]

        [message]
            speaker=Elynia
            message= _ "Vikren of Wesnoth... I cannot seem to remember the details anymore, but I was once sent by... somebody... to find this man in Parthyn, a border stronghold. I was to convince him to start a revolt among the countryside’s populace and put an end to the anarchy that fractured the kingdom of Wesnoth. In time and with Argan’s help, we would take Weldyn back and found the Second Wesnothian Empire."
        [/message]

        [message]
            speaker=Mal Keshar
            message= _ "Hold on a moment, are you saying that this guy was from my hometown all along? What?? And he was responsible for that superfluous ball of fire circling Irdya alongside our original sun?"
        [/message]

        [message]
            speaker=Elynia
            message= _ "Naia was actually the creation of one of his descendants centuries later, not Vikren himself. Although he did once tell his people that he envisioned a monument to Wesnoth’s glory emblazoned on the vast night sky forever, so the inspiration certainly did come from him."
        [/message]

        [message]
            speaker=Mal Keshar
            message= _ "And you were responsible for his rise to a position that enabled him to inspire his progeny, huh?"
        [/message]

        [message]
            speaker=Elynia
            message= _ "As you can probably imagine, I am not too proud of that accomplishment these days. But we have tarried here for long enough — let us move on."
        [/message]
    )
    REMOVE_MAP_ITEM=no}

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

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

        [allow_undo][/allow_undo]

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

    {GA_GLYPH  6 27 ( _ "The earliest modern attempts at recreating the biomechanical Shaxthals required us to imbue the experiment subjects with Uria’s life magic to support their mutilated bodies. A device was embedded in their brains to control them through a neural interface. However, this process had notably high maintenance and development costs.

Once we recovered the original samples from the Argazar civilization, we were able to engineer a superior template for creating new Shaxthal lifeforms — ones with the ability to self-reproduce in adequately built hives. Their nerve system has been modified to enable us to control them remotely when necessary, but their hard-coded behavioral patterns should take care of most tasks without our intervention.

Because of their symbiotic relationship with the Verlissh and the fact that the latter only thrive in dark places, Shaxthal hives must be built underground. Only fully matured Shaxthals can properly survive the desert heat. The final phase of their maturation process requires their exoskeleton to be gradually exposed to sunlight for small periods of time. It is because of this that all Shaxthal hives are required to have unobstructed surface exits.")}

    {GA_GLYPH 48  9 ( _ "Only the elite order of Chaos Dreadcrafters led by Mal Hekuba knows the secrets of the manipulation and transformation of living creatures. It is rumored that the Voice of Uria himself passed this sacred knowledge onto them at the behest of the goddess herself. While for the moment the creation of new life remains a mystery beyond even her reach, one day perhaps, she will learn the Song of Life and teach us to paint the vast canvas laid by Yarae.")}

    # wmlindent: start ignoring

#define GA_SETUP_ELYSSA _GOLD _INCOME _RECRUIT_LIST
    [modify_side]
        side=2
        controller=ai
        hidden=no
        gold={_GOLD}
        income={_INCOME}
        recruit={_RECRUIT_LIST}
    [/modify_side]
#enddef

#define GA_SPAWN_ELYSSA _STAGE_NUM
    {VARIABLE boss_stage_num {_STAGE_NUM} }

    [store_starting_location]
        side="$(1 + $boss_stage_num)"
        variable=boss_location
    [/store_starting_location]

    [store_direction]
        from_x,from_y=$boss_location.x,$boss_location.y
        [to]
            [filter]
                id=Galas
            [/filter]
        [/to]
        variable=boss_facing
    [/store_direction]

    [unit]
        side=2
        # wmllint: recognize Elyssa
        {CHARACTER_STATS_ELYSSA}
        canrecruit=yes
        {IS_BOSS}
        x,y=$boss_location.x,$boss_location.y
        facing=$boss_facing
        [+modifications]
            # Boost her stats. Gets 1 additional melee attack strike on last
            # boss stage, 0.5/1 additional melee/ranged damage per stage. This
            # is intended to offset the Union's OPness by some degree.
            {BOSS_BOOST
                ("$(10*$boss_stage_num)%")
                ("$(0.5*$boss_stage_num)") ("$(if($boss_stage_num > 2, 1, 0))")
                ("$(1.0*$boss_stage_num)") (0)
            }
        [/modifications]
    [/unit]

    {CLEAR_VARIABLE boss_facing}

    [capture_village]
        side=2
        x,y=$boss_location.x,$boss_location.y
        radius=5
    [/capture_village]
#enddef

#define GA_BOSS_RECRUIT_CASTLEFUL
    # We don't use placement=leader here because it won't make sure the unit is
    # spawned on castle or keep tiles specifically.
    # TODO: should we skip tiles that have a player unit on them too?

    [store_locations]
        # Consider adding *^C* and *^K* if you want to use this on your own
        # scenario. (But why would you read IftU or AtS's code in the first
        # place? It's horrible!)
        terrain=C*,K*,C*^*,K*^*
        [and]
            x,y=$boss_location.x,$boss_location.y
            radius=2
            [not]
                [filter]
                    side=2
                [/filter]
            [/not]
        [/and]
        variable=boss_recruit_locs
    [/store_locations]

    [foreach]
        array=boss_recruit_locs
        variable=loc
        [do]
            [lua]
                code=<<
                    local recruit_list = wesnoth.sides[2].recruit
                    local n = ("1..%d"):format(#rlist)
                    wml.variables["boss_recruit"] = recruit_list[n]
                >> # wmlxgettext: [/n]
            [/lua]

            {FAKE_RECRUIT 2 $boss_recruit $loc.x $loc.y}
        [/do]
    [/foreach]

    {CLEAR_VARIABLE boss_recruit}
#enddef

#define GA_CLEANUP_VARS
    {CLEAR_VARIABLE boss_location}
#enddef

    # wmlindent: stop ignoring

    ############################################################################
    #                                                                          #
    #                               BOSS STAGE 1                               #
    #                                                                          #
    ############################################################################

    [event]
        name=die
        [filter]
            type=Door
            x=36,37
            y=27,28
        [/filter]

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

    [event]
        name=boss stage 1

        {REPLACE_SCENARIO_MUSIC "siege_of_laurelmor.ogg"}

        {GA_SETUP_ELYSSA {DIFF 100 120 130} {DIFF 5 8 10} (Shaxthal Assault Drone,Shaxthal Runner Drone,Shaxthal Rayblade)}

        {GA_SPAWN_ELYSSA 1}

        {CLEAR_CAVE_SHROUD x,y,radius=$boss_location.x,$boss_location.y,5}

        [redraw]
            side=1
        [/redraw]

        {CLEAR_FOG 1 $boss_location.x $boss_location.y 5}

        {BOSS_POPUP}

        [scroll_to_unit]
            id=Elyssa
        [/scroll_to_unit]

        [delay]
            time=750
        [/delay]

        [message]
            speaker=Elyssa
            message= _ "Despite every obstacle placed just for you, you still believe you can continue and kill the Chaos Emperor in his own lair. I sorely underestimated your foolishness."
        [/message]

        {GA_BOSS_RECRUIT_CASTLEFUL}

        [message]
            speaker=Galas
            message= _ "Elynia, are we close enough to Inferno already? There is absolutely no way we will be able to advance with her in our way!"
        [/message]

        [message]
            speaker=Elynia
            message= _ "We can try... but while we focus, you will need to protect us from the Warlord’s forces."
        [/message]

        [message]
            speaker=Galas
            message= _ "You heard her — protect them at all costs!"
        [/message]

        {GA_CLEANUP_VARS}

        {UNCLEAR_FOG}

        [fire_event]
            name=union trance prepare
        [/fire_event]
    [/event]

    [event]
        name=union trance prepare

        {OBJECTIVES (
            {OBJECTIVE_VICTORY ( _ "Move Elynia and Mal Keshar so they are on adjacent hexes")}

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

            {TURNS_RUN_OUT}

            {OBJECTIVE_FULL_CARRYOVER}
        )}

        [event]
            id=union_trance_start_check_on_moveto
            name=moveto
            first_time_only=no
            [filter]
                id=Elynia,Mal Keshar
            [/filter]

            [fire_event]
                name=union trance begin
            [/fire_event]
        [/event]

        #
        # Try to fire the trance sequence immediately to see if they are
        # already adjacent to each other.
        #

        [fire_event]
            name=union trance begin
        [/fire_event]
    [/event]

    [event]
        name=union trance begin
        [filter_condition]
            [have_unit]
                id=Elynia
                [filter_adjacent]
                    id=Mal Keshar
                [/filter_adjacent]
            [/have_unit]
        [/filter_condition]

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

        [modify_unit]
            [filter]
                id=Elynia,Mal Keshar
            [/filter]
            moves=0
            max_moves=0
            attacks_left=0
            max_attacks=0
            [variables]
                normal_max_moves=$this_unit.max_moves
                normal_max_attacks=$this_unit.max_attacks
            [/variables]
        [/modify_unit]

        [message]
            speaker=Mal Keshar
            message= _ "Very well, Elynia... let us hope that your theory is correct and will not result in our destruction."
        [/message]

        [message]
            speaker=Elynia
            message= _ "... I hope so as well."
        [/message]

        {VARIABLE trance_turns {DIFF 2 3 4}}

        {OBJECTIVES (
            {OBJECTIVE_VICTORY ( _ "Protect Elynia and Mal Keshar from harm for $trance_turns turns")}
            {OBJECTIVE_SHOW_IF ({VARIABLE_NUMERICAL_NOT_EQUALS trance_turns 1})}
            {OBJECTIVE_VICTORY ( _ "Protect Elynia and Mal Keshar from harm for one more turn")}
            {OBJECTIVE_SHOW_IF ({VARIABLE_NUMERICAL_EQUALS trance_turns 1})}

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

            {TURNS_RUN_OUT}

            {OBJECTIVE_FULL_CARRYOVER}
        )}

        [event]
            id=union_trance_timer
            name=side 1 turn refresh
            first_time_only=no

            {VARIABLE_DEC trance_turns}

            [fire_event]
                name=union trance end
            [/fire_event]
        [/event]
    [/event]

    #
    # Time to make OP shit happen. It's all downhill from here.
    #

    {UNION_CAST_EVENTS}

    [event]
        name=union trance end
        [filter_condition]
            {VARIABLE_NUMERICAL_LESS_THAN trance_turns 1}
        [/filter_condition]

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

        [modify_unit]
            [filter]
                id=Elynia,Mal Keshar
            [/filter]
            moves=$this_unit.variables.normal_max_moves
            max_moves=$this_unit.variables.normal_max_moves
            attacks_left=$this_unit.variables.normal_max_attacks
            max_attacks=$this_unit.variables.normal_max_attacks
        [/modify_unit]

        {CLEAR_VARIABLE trance_turns}

        # The rest is part of a separate handler for debug purpsoes.
        [fire_event]
            name=union summoned
        [/fire_event]
    [/event]

    [event]
        name=union summoned

        #
        # The beginning of the end.
        #

        {REPLACE_SCENARIO_MUSIC "silence.ogg"}

        {THUNDER ()}
        {QUAKE rumble.ogg}
        [delay]
            time=500
        [/delay]

        {THUNDER ()}
        [delay]
            time=250
        [/delay]

        {THUNDER ()}
        [delay]
            time=250
        [/delay]

        {THUNDER ()}
        [delay]
            time=250
        [/delay]

        {THUNDER ()}
        [delay]
            time=250
        [/delay]

        [hide_unit][/hide_unit]

        {WHITE_SCREEN}

        [delay]
            time=750
        [/delay]

        [object]
            silent=yes
            duration=forever
            [filter]
                id=Elynia
            [/filter]

            {UNION_EFFECTS}
        [/object]

        [object]
            silent=yes
            duration=forever
            [filter]
                id=Mal Keshar
            [/filter]

            {UNION_EFFECTS}

            [effect]
                apply_to=new_animation
                {UNION_ANIM_MAL_KESHAR}
            [/effect]
        [/object]

        {RESET_SCREEN}

        [unhide_unit][/unhide_unit]

        [floating_text]
            [filter]
                id=Elynia,Mal Keshar
            [/filter]
            text=""+_"union"+"" # wmllint: ignore
        [/floating_text]

        {QUAKE explosion.ogg}

        # SMITE EVIL
        [kill]
            [filter_side]
                [enemy_of]
                    side=1
                [/enemy_of]
            [/filter_side]
            [filter_adjacent]
                id=Elynia,Mal Keshar
            [/filter_adjacent]
            [not]
                id=Elyssa
            [/not]

            fire_event=yes
            animate=yes
        [/kill]

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

        {INCIDENTAL_MUSIC       "ambuscade.ogg"}

        [scroll_to_unit]
            id=Elynia
        [/scroll_to_unit]

        [delay]
            time=750
        [/delay]

        [message]
            speaker=Elyssa
            scroll=no
            message= _ "How... can this be? That power... the Union!"
        [/message]

        [message]
            speaker=Elynia
            message= _ "It worked! Malin, it worked!"
        [/message]

        [message]
            speaker=Mal Keshar
            message= _ "Yes... YES! Tremble before us, pathetic worms, and prepare to meet your gods!"
        [/message]

        {OBJECTIVES (
            {OBJECTIVE_VICTORY ( _ "Use the Union to take down the Chaos Warlord")}

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

            {TURNS_RUN_OUT}

            {OBJECTIVE_FULL_CARRYOVER}
        )}
    [/event]

    ############################################################################
    #                                                                          #
    #                           BOSS HP CONTROL EVENTS                         #
    #                                                                          #
    ############################################################################

    # Elyssa is vulnerable to regular attacks only on stage 3, which cannot
    # actually kill her but will instead cause her to regenerate a new HP bar.
    # Only the Union can end the fight permanently on stage 3. On earlier
    # stages she must be brought down to n% HP by union attacks -- other
    # attacks will not have an effect and may even heal her by degrees on
    # higher difficulty levels.

    # TODO: test whether this causes balance issues, since Elynia and
    #       Mal Keshar need to bring her down to n% HP in a single attack and
    #       that might prove too frustrating due to RNG interference.

    # wmlindent: start ignoring

    {BOSS_ABSORB_DAMAGE_EX Elyssa
        ({VARIABLE_NUMERICAL_NOT_EQUALS boss_stage_num 3})
        ({BOSS_REGEN_ATTACK_DAMAGE {DIFF 1.00 1.10 1.20}})
        (
            [filter_second_attack]
                [not]
                    special=union
                [/not]
            [/filter_second_attack]
        )
    }

    {BOSS_IMMORTALITY Elyssa
        {VARIABLE_NUMERICAL_GREATER_THAN_OR_EQUAL boss_stage_num 3}
        100
    }

    # wmlindent: stop ignoring

    # Her dying to the Union in stage 3 triggers victory.

    [event]
        name=last breath
        [filter]
            id=Elyssa
        [/filter]
        [filter_second_attack]
            special=union
        [/filter_second_attack]
        [filter_condition]
            {VARIABLE_NUMERICAL_GREATER_THAN_OR_EQUAL boss_stage_num 3}
        [/filter_condition]

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

    # Hook into this from above, which won't have an effect.
    [event]
        name=boss absorb damage
        [filter_second_attack]
            special=union
        [/filter_second_attack]

        [message]
            speaker=Mal Keshar
            message= _ "Hah! Our attacks actually have an effect on her now!"
        [/message]
    [/event]

    [event]
        name=boss absorb damage
        [filter_condition]
            [have_unit]
                ability=union
            [/have_unit]
        [/filter_condition]
        [filter_second]
            [not]
                id=Elynia,Mal Keshar
            [/not]
        [/filter_second]

        [message]
            speaker=Galas
            message= _ "We should not be attacking her directly, it is pointless! Let Elynia and Mal Keshar deal with her instead!"
        [/message]
    [/event]

    #
    # HACK:
    #
    # The stage transition events are defined in reverse order since otherwise
    # they chain into each other all at once the first time (!) due to their
    # conditions being mutually inclusive.
    #
    # This is a really ugly approach but the alternative is making everything
    # more complicated with deeply nested events and crap.
    #

    [event]
        name=boss absorb damage
        [filter_second_attack]
            special=union
        [/filter_second_attack]
        [filter_condition]
            {VARIABLE_NUMERICAL_EQUALS             boss_stage_num 2}
            {VARIABLE_NUMERICAL_LESS_THAN_OR_EQUAL unit.hitpoints "$(0.40 * $unit.max_hitpoints)"}
        [/filter_condition]

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

    [event]
        name=boss absorb damage
        [filter_second_attack]
            special=union
        [/filter_second_attack]
        [filter_condition]
            {VARIABLE_NUMERICAL_EQUALS             boss_stage_num 1}
            {VARIABLE_NUMERICAL_LESS_THAN_OR_EQUAL unit.hitpoints "$(0.60 * $unit.max_hitpoints)"}
        [/filter_condition]

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

    ############################################################################
    #                                                                          #
    #                               BOSS STAGE 2                               #
    #                                                                          #
    ############################################################################

    [event]
        name=end boss stage 1

        [message]
            speaker=Elyssa
            message= _ "This is not over yet!"
        [/message]

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

        [move_unit_fake]
            type=$elyssa_store.type
            side=$elyssa_store.side
            gender=$elyssa_store.gender
            variation=$elyssa_store.variation
            x=$elyssa_store.x,26,24,20
            y=$elyssa_store.y,32,33,35
        [/move_unit_fake]

        {CLEAR_VARIABLE elyssa_store}

        [message]
            speaker=Galas
            message= _ "The coward is fleeing! We must not allow her to escape!"
        [/message]

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

    [event]
        name=boss stage 2

        {GA_SETUP_ELYSSA {DIFF 130 140 150} {DIFF 3 4 5} (Demon Zephyr,Shaxthal Sentry Drone,Shaxthal Rayblade)}

        {GA_SPAWN_ELYSSA 2}

        {GA_CLEANUP_VARS}

        # Make it possible to open the gates leading to the portal area.

        [terrain]
            x=29,25
            y=35,33
            terrain=^Pr\
            layer=overlay
        [/terrain]

        [setup_doors]
            side=6
            x=29,25
            y=35,33
        [/setup_doors]

        {OBJECTIVES (
            {OBJECTIVE_VICTORY ( _ "Track down and vanquish the Chaos Warlord")}

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

            {TURNS_RUN_OUT}

            {OBJECTIVE_FULL_CARRYOVER}
        )}
    [/event]

    #
    # Moving into the void may sometimes kill player units.
    #

    [event]
        name=moveto
        first_time_only=no
        [filter]
            side=1
            x=1-100
            y=35-100
            [filter_location]
                terrain=Qxua
            [/filter_location]
        [/filter]
        [filter_condition]
            {VARIABLE_BOOLEAN_EQUALS void_kills yes}
        [/filter_condition]

        {RANDOM       0..100000}
        {VARIABLE_MOD random 101}

        [if]
            {VARIABLE_NUMERICAL_EQUALS random 0}
            [then]
                [kill]
                    x,y=$x1,$y1
                    fire_event=yes
                    animate=yes
                [/kill]
            [/then]
        [/if]
    [/event]

    [event]
        name=moveto
        [filter]
            side=1
            x=1-100
            y=1-34
            [filter_location]
                [filter_adjacent_location]
                    terrain=Qxua
                [/filter_adjacent_location]
            [/filter_location]
        [/filter]

        [allow_undo][/allow_undo]

        [message]
            speaker=unit
            {UNIT_SPEAKS_FOR_UNDEAD_MINION (id=Mal Keshar)}
            message= _ "Uhhh... What is this?" # wmllint: no spellcheck
        [/message]
    [/event]

    [event]
        name=moveto
        [filter]
            side=1
            x=1-100
            y=35-100
            [filter_location]
                terrain=Qxua
                [or]
                    [filter_adjacent_location]
                        terrain=Qxua
                    [/filter_adjacent_location]
                [/or]
            [/filter_location]
        [/filter]

        [allow_undo][/allow_undo]

        [message]
            speaker=Mal Keshar
            message= _ "What the...?! Look, this place is floating over an infinite void!"
        [/message]

        [message]
            speaker=Erathan
            message= _ "Dear Lords of Light!"
        [/message]

        [message]
            speaker=Igor
            message= _ "Wait, I can see stars in it! So... the sky is below us? Are we walking upside-down then, or... Aaaargh, I’m so confused!!!"
        [/message]

        [message]
            speaker=Elynia
            message= _ "So this is what the bridge between our worlds looks like. Mal Keshar, we probably should avoid sending spirits across the void, lest they become trapped in it."
        [/message]

        [message]
            speaker=Mal Keshar
            message= _ "Hm, indeed, that is a risk we cannot afford right now."
        [/message]

        {VARIABLE void_kills yes}
    [/event]

    ############################################################################
    #                                                                          #
    #                               BOSS STAGE 3                               #
    #                                                                          #
    ############################################################################

    [event]
        name=end boss stage 2

        [message]
            speaker=Elyssa
            message= _ "Darkness unto the enemies of Uria!"
        [/message]

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

        [hide_unit][/hide_unit]

        {BLACK_SCREEN}

        [kill]
            id=Elyssa
        [/kill]

        [delay]
            time=1000
        [/delay]

        {FADE_IN}

        [unhide_unit][/unhide_unit]

        [delay]
            time=750
        [/delay]

        [message]
            speaker=Elynia
            message= _ "I doubt she will be able to keep this up for much longer."
        [/message]

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

    [event]
        name=boss stage 3

        {GA_SETUP_ELYSSA {DIFF 190 210 220} {DIFF 5 6 7} (Demon Zephyr,Shaxthal Sentry Drone,Shaxthal Drone,Shaxthal Rayblade,Demon)}

        {GA_SPAWN_ELYSSA 3}

        {GA_CLEANUP_VARS}

        # Allow access to the final area.

        [remove_terrain_overlays]
            x=31-32,40,41
            y=   56,52,53
        [/remove_terrain_overlays]

        {FIRE_EVENT_ON_STUMBLE_UPON "boss spotted on stage 3" id=Elyssa}
    [/event]

    [event]
        name=boss spotted on stage 3

        [message]
            speaker=Elyssa
            message= _ "You just don’t know when to give up."
        [/message]

        [message]
            speaker=Galas
            message= _ "Neither do you. By now you have surely seen that the power of the Union can destroy you easily. Accept your fate and fight us instead of fleeing like a lowly rat!"
        [/message]

#ifndef EASY
        [count_units]
            side=1
            race=undead
            [and]
                level=0
                [or]
                    level=1
                [/or]
#ifdef HARD
                [or]
                    level=2
                [/or]
#endif
            [/and]
        [/count_units]

        [if]
            {VARIABLE_NUMERICAL_GREATER_THAN unit_count 0}
            [then]
                [message]
                    speaker=Elyssa
                    message= _ "By... (clutching her face) By the power you have bestowed upon me, Uria, may... the spells conferring life to the dead... be canceled now!"
                [/message]

                [kill]
                    side=1
                    race=undead
                    [and]
                        level=0
                        [or]
                            level=1
                        [/or]
#ifdef HARD
                        [or]
                            level=2
                        [/or]
#endif
                    [/and]
                    fire_event=yes
                    animate=yes
                [/kill]

                [if]
                    {VARIABLE_NUMERICAL_EQUALS unit_count 1}
                    [then]
                        [message]
                            speaker=Mal Keshar
                            message= _ "My minion! You will pay for that, repulsive wench!"
                        [/message]
                    [/then]
                    [else]
                        [message]
                            speaker=Mal Keshar
                            message= _ "My minions! You will pay for that, repulsive wench!"
                        [/message]
                    [/else]
                [/if]
            [/then]
        [/if]

        {CLEAR_VARIABLE unit_count}
#endif

        #
        # HACK FIXME too lazy to rewrite the macro
        #

        [store_locations]
            [filter]
                id=Elyssa
            [/filter]
            variable=boss_location
        [/store_locations]

        {GA_BOSS_RECRUIT_CASTLEFUL}
    [/event]

    [event]
        name=boss end

        {REPLACE_SCENARIO_MUSIC into_the_shadows.ogg}

        [kill]
            id=Elyssa
            animate=yes
            fire_event=no
        [/kill]

        [message]
            speaker=narrator
            image=wesnoth-icon.png
            message= _ "The combined power of Elynia and Mal Keshar hit the demoness one last time, shattering into her magic defense shield and sending her flying across the bridge. Unable to regain her footing, she desperately grabbed her sword and prepared for the killing blow."
        [/message]

        [remove_terrain_overlays]
            x,y,radius=43,62,1
        [/remove_terrain_overlays]

        {CLEAR_CAVE_SHROUD x,y,radius=44,62,6}

        [redraw]
            side=1
        [/redraw]

        [delay]
            time=750
        [/delay]

        {MOVE_UNIT id=Elynia 43 62}

        {FACE_DIRECTION id=Elynia se}

        # TODO: preserve XP (but not max HP)

        [unit]
            {CHARACTER_STATS_ELYSSA}
            animate=yes
            canrecruit=yes
            side=2
            x,y=44,62
            facing=nw
            hitpoints=1
            {IS_BOSS}
        [/unit]

        [delay]
            time=750
        [/delay]

        [message]
            speaker=Elyssa
            message= _ "Go on, Elynia. Do what you must do. Now that I have failed, there’s no purpose left for me..."
        [/message]

        [message]
            speaker=Elynia
            message= _ "Who are you?"
        [/message]

        [message]
            speaker=Elyssa
            message= _ "Why would I tell you?"
        [/message]

        [message]
            speaker=Elynia
            message= _ "I would feel much better about ending your miserable life if you did."
        [/message]

        [delay]
            time=1500
        [/delay]

        [message]
            speaker=Elyssa
            # po: Intentionally not mentioning the Chaos Emperor's name here.
            # po: Note that she's referring to him back when the empire did not
            # po: even exist!
            message= _ "I am Elyssa. I dedicated my life to studying the ancient Empire’s history from whatever remnants I could find amidst the sands. That is... before I found him... and Uria.... Their great power and knowledge truly changed me, and in time, they will change this world too."
        [/message]

        [delay]
            time=750
        [/delay]

        [message]
            speaker=Elynia
            message= _ "Where is your master hiding?"
        [/message]

        [delay]
            time=750
        [/delay]

        [message]
            speaker=Mal Keshar
            message= _ "She’s not going to answer. Off with her head!"
        [/message]

        [message]
            speaker=Elyssa
            message= _ "You are not going to do it, are you? I can give you an answer... but only if you swear you will spare my life."
        [/message]

        [message]
            speaker=Galas
            message= _ "Don’t listen to her lies, Elynia! You know these creatures cannot be trusted!"
        [/message]

        [message]
            speaker=narrator
            image=wesnoth-icon.png
            # FIXME: cancan relative to S21 boss intro seq
            message= _ "Elynia stared directly into the demoness’ eyes, with a frightening expression of suppressed rage. Time seemed to stop for the watchers, but not a single one dared to break the uneasy silence."
        [/message]

        [delay]
            time=2000
        [/delay]

        [message]
            speaker=narrator
            image=wesnoth-icon.png
            message= _ "Then, she spoke."
        [/message]

        [message]
            speaker=Elynia
            message= _ "Tell me what you know and you can keep what little life you have left, as long as you get out of my sight as quickly as you can. Now out with it."
        [/message]

        [message]
            speaker=Galas
            message= _ "But she..."
        [/message]

        [delay]
            time=750
        [/delay]

        [message]
            speaker=Elyssa
            # po: If your language has singular/plural 'you' ambiguity like
            # po: English, try to use that for the "greatest fears" part of
            # po: this line; otherwise make it plural.
            message= _ "Do you see the passage ahead? Go through it, and you will be in Inferno. The entrance to his icy fortress is just across the snow following the tip of the road. There, you will find the heart of the hive, and his lair. But be warned — once you enter, there will be no going back, and you should be prepared to face your greatest fears."
        [/message]

        [message]
            speaker=Elynia
            message= _ "Very well, then. Now, go."
        [/message]

        [kill]
            id=Elyssa
            fire_event,animate=no,no
        [/kill]

        [redraw][/redraw]

        [delay]
            time=1000
        [/delay]

        [message]
            speaker=Galas
            message= _ "Why would you do this, Elynia? That woman is Anlindë’s murderer!"
        [/message]

        [message]
            speaker=Elynia
            message= _ "I cannot bring myself to kill someone so much weaker than I. It would be unfair... and cruel. You remember how the lich Mal Keshar came to be, do you not? Let yourself succumb to wrath and you become as bad as the foul-minded creatures you fight."
        [/message]

        [delay]
            time=750
        [/delay]

        [message]
            speaker=Elynia
            message= _ "Now, it’s time to go find the answers we seek. Let us see... if the Chaos Emperor can be stopped before the madness of this place consumes us as well."
        [/message]

        {ENDLEVEL_CONTINUE}
    [/event]

    [event]
        name=victory

        {CLEAR_VARIABLE void_kills,pspawn_diff_choices,boss_stage_num,boss_location}
    [/event]
[/scenario]

#undef GA_DRONES_EASY
#undef GA_DRONES_MEDIUM
#undef GA_DRONES_HARD
#undef GA_DRONES_ULTRA
#undef GA_DRONE
#undef GA_GLYPH
#undef GA_WORM
#undef GA_WORMS_START
#undef GA_WORMS_FINISH
#undef GA_PROXIMITY_SPAWN
#undef GA_SETUP_ELYSSA
#undef GA_SPAWN_ELYSSA
#undef GA_BOSS_RECRUIT_CASTLEFUL
#undef GA_CLEANUP_VARS

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


#textdomain wesnoth-Invasion_from_the_Unknown

[scenario]
    id=23A_Into_the_Lair
    name= _ "Into the Lair"
    {MAP 23A_Into_the_Lair.map}
    {TURNS 110 98 92}
    next_scenario=23B_Until_Death
    victory_when_enemies_defeated=no
    {NO_RECALLS}

    {SCENARIO_MUSIC "revelation.ogg"} {CONTINUE_PLAYING_STORY_MUSIC_FIRST}

    {DEEP_UNDERGROUND}

    {STORYTXT_INTO_THE_LAIR}

    {DEATHS_ACT_4}

    {SPAWN_CONTROLLER}

    {UNION_CAST_EVENTS}

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

        shroud=yes

        {NO_ECONOMY}

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

#define L_AI_GUARDS_BEHIND_GATES
    [avoid]
        area=outdoors
    [/avoid]
#enddef

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

        hidden=yes
        no_leader=yes

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

        {SIDE_GENERIC_GUARD (Goliath) 44 51} {FACING nw}
        {SIDE_GENERIC_GUARD (Goliath) 47 49} {FACING nw}

        {SIDE_GENERIC_GUARD (Shaxthal Rayblade) 46 40} {FACING nw}

        {SIDE_GENERIC_GUARD (Abomination) 51 48}
        {SIDE_GENERIC_GUARD (Abomination) 54 49}
        {SIDE_GENERIC_GUARD (Abomination) 43 54}
        {SIDE_GENERIC_GUARD (Abomination) 40 49}
        {SIDE_GENERIC_GUARD (Abomination) 45 57}
        {SIDE_GENERIC_GUARD (Abomination) 55 52}

        {SIDE_GENERIC_GUARD (Hellhound) 58 56} {FACING sw}

        {SIDE_GENERIC_GUARD (Chaos Razerman) 60 50} {FACING sw}
        {SIDE_GENERIC_GUARD (Chaos Razerman) 50 60} {FACING n }

        {SIDE_GENERIC_GUARD (Demon Zephyr) 54 56}
        {SIDE_GENERIC_GUARD (Demon Zephyr) 58 53}

        {SIDE_GENERIC_GUARD (Hell Guardian) 52 26} {FACING se}
        {SIDE_GENERIC_GUARD (Hell Guardian) 56 28} {FACING nw}

        {SIDE_GENERIC_GUARD (Demon Warrior) 53 28} {FACING ne}

        {SIDE_GENERIC_GUARD (Shaxthal Protector Drone) 46 30}
        {SIDE_GENERIC_GUARD (Shaxthal Protector Drone) 48 31}

        {SIDE_GENERIC_GUARD (Blood Imp) 48 30}

        {SIDE_GENERIC_GUARD (Demon Zephyr) 53 20}
        {SIDE_GENERIC_GUARD (Demon Zephyr) 55 22}
        {SIDE_GENERIC_GUARD (Demon Zephyr) 66 26}
        {SIDE_GENERIC_GUARD (Demon Zephyr) 69 25}

        {SIDE_GENERIC_GUARD (Wraith) 41 12}

        {SIDE_GENERIC_GUARD (Necrophage) 48 55}
        {SIDE_GENERIC_GUARD (Necrophage) 51 54}
        {SIDE_GENERIC_GUARD (Necrophage) 59 52}
        {SIDE_GENERIC_GUARD (Necrophage) 50 64}

        {SIDE_GENERIC_GUARD (Draug) 68 61} {FACING nw}
    [/side]

    [side]
        side=3
        team_name=enemies
        user_team_name= _ "team_name^Lair Guards"
        {CHAOS_FLAG}

        {GOLD 100 120 130}
        {INCOME 5 6 7}
        recruit=Demon,Demon Zephyr,Imp,Blood Imp,Chaos Bowman,Chaos Headhunter

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

            {L_AI_GUARDS_BEHIND_GATES}
        [/ai]

        canrecruit=yes
        type=Chaos Lorekeeper
        id=Mal Murwiel
        name= _ "Mal Murwiel"
        [modifications]
            {TRAIT_BIOMECHANICAL}
            {TRAIT_DEXTROUS}
            {BOSS_BOOST 40% 1 1 0 1}
        [/modifications]

        {SIDE_GENERIC_GUARD (Demon Grunt) 40 33} {FACING ne}
    [/side]

    [side]
        side=4
        team_name=enemies
        user_team_name= _ "team_name^Lair Guards"
        {CHAOS_FLAG}

        {GOLD 100 120 130}
        {INCOME 5 6 7}
        recruit=Shaxthal Runner Drone,Chaos Invader,Chaos Invoker,Chaos Hound

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

            {L_AI_GUARDS_BEHIND_GATES}
        [/ai]

        canrecruit=yes
        type=Chaos Lorekeeper
        id=Mal Aravir
        name= _ "Mal Aravir"
        [modifications]
            {TRAIT_BIOMECHANICAL}
            {TRAIT_RESILIENT}
            {BOSS_BOOST 20% 3 0 0 2}
        [/modifications]

        {SIDE_GENERIC_GUARD (Demon Grunt) 44 35} {FACING nw}
    [/side]

    # Cockatrices
    [side]
        side=5
        team_name=enemies
        user_team_name= _ "team_name^Chaos Emperor"
        {CHAOS_FLAG}

        no_leader=yes

        {ai/aliases/stable_singleplayer.cfg}
        [ai]
            # Their stats aren't great, force them to attack anyway.
            {AI_SIMPLE_ALWAYS_ASPECT aggression             9.00}
            {AI_SIMPLE_ALWAYS_ASPECT caution                0.00}
            {AI_SIMPLE_ALWAYS_ASPECT village_value          0.00}
        [/ai]
    [/side]

    [side]
        side=6 # Disabled on prestart until an event during gameplay.
        team_name=enemies
        user_team_name= _ "team_name^Lair Hive"
        {CHAOS_FLAG}

        recruit=Shaxthal Drone,Shaxthal Rayblade,Shaxthal Sentry Drone

        {ai/aliases/stable_singleplayer.cfg}
        [ai]
            # Happens to be the drone controller for this scenario too. This
            # means drones will be more cautious around the player than in most
            # other situations.
            {AI_SIMPLE_ALWAYS_ASPECT aggression             1.00}
            {AI_SIMPLE_ALWAYS_ASPECT caution                0.00}
            {AI_SIMPLE_ALWAYS_ASPECT village_value          0.00}

            {L_AI_GUARDS_BEHIND_GATES}
        [/ai]

        canrecruit=yes
        type=Demon Warrior
        id="Ka'alarilyn"
        name= _ "Ka’alarilyn"
        [modifications]
            {TRAIT_RESILIENT}
            {TRAIT_INTELLIGENT}
        [/modifications]

        {SIDE_GENERIC_GUARD (Demon Warrior) 17 29} {FACING se}
        {SIDE_GENERIC_GUARD (Demon Warrior) 16 30} {FACING ne}

        {SIDE_GENERIC_GUARD (Demon Zephyr) 30 29} {FACING se}
        {SIDE_GENERIC_GUARD (Demon Zephyr) 26 34} {FACING ne}
    [/side]

    [side]
        side=7 # Disabled on prestart until an event during gameplay.
        team_name=enemies
        user_team_name= _ "team_name^Lair Hive"
        {CHAOS_FLAG}

        recruit=Shaxthal Drone,Shaxthal Rayblade,Shaxthal Sentry Drone

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

            {L_AI_GUARDS_BEHIND_GATES}
        [/ai]

        canrecruit=yes
        type=Demon Warrior
        gender=female
        id=Vyta
        name= _ "Vyta"
        [modifications]
            {TRAIT_STRONG}
            {TRAIT_DEXTROUS}
        [/modifications]

        {SIDE_GENERIC_GUARD (Psy Mindraider) 18 40} {FACING se}
        {SIDE_GENERIC_GUARD (Psy Mindraider) 28 22} {FACING sw}
        {SIDE_GENERIC_GUARD (Psy Mindraider) 25 54} {FACING nw}

        {SIDE_GENERIC_GUARD (Psy Crawler) 25 41} {FACING ne}
        {SIDE_GENERIC_GUARD (Psy Crawler) 24 42} {FACING nw}
        {SIDE_GENERIC_GUARD (Psy Crawler) 24 54}
        {SIDE_GENERIC_GUARD (Psy Crawler) 26 54}
        {SIDE_GENERIC_GUARD (Psy Crawler) 25 53}

        {SIDE_GENERIC_UNIT (Verlissh Matrix Flow System) 21 49}
        {SIDE_GENERIC_UNIT (Verlissh Matrix Flow System) 20 53}
        {SIDE_GENERIC_UNIT (Verlissh Matrix Flow System) 24 51}
        {SIDE_GENERIC_UNIT (Verlissh Matrix Flow System) 24 55}
        {SIDE_GENERIC_UNIT (Verlissh Matrix Flow System) 27 57}
        {SIDE_GENERIC_UNIT (Verlissh Matrix Flow System) 28 52}
        {SIDE_GENERIC_UNIT (Verlissh Matrix Flow System) 20 57}
        {SIDE_GENERIC_UNIT (Verlissh Matrix Flow System) 23 66}
        {SIDE_GENERIC_UNIT (Verlissh Matrix Flow System) 27 60}
        {SIDE_GENERIC_UNIT (Verlissh Matrix Flow System) 29 61}
        {SIDE_GENERIC_UNIT (Verlissh Matrix Flow System) 33 61}

        {SIDE_GENERIC_UNIT (Verlissh Matrix Flow System) 16 39}
        {SIDE_GENERIC_UNIT (Verlissh Matrix Flow System) 18 38}
        {SIDE_GENERIC_UNIT (Verlissh Matrix Flow System) 10 39}

        {SIDE_GENERIC_UNIT (Verlissh Matrix Flow System)  5 35}
        {SIDE_GENERIC_UNIT (Verlissh Matrix Flow System)  5 31}
        {SIDE_GENERIC_UNIT (Verlissh Matrix Flow System)  9 31}
        {SIDE_GENERIC_UNIT (Verlissh Matrix Flow System) 12 30}
        {SIDE_GENERIC_UNIT (Verlissh Matrix Flow System) 15 32}
        {SIDE_GENERIC_UNIT (Verlissh Matrix Flow System) 11 25}
        {SIDE_GENERIC_UNIT (Verlissh Matrix Flow System) 20 24}
        {SIDE_GENERIC_UNIT (Verlissh Matrix Flow System) 13 17}
        {SIDE_GENERIC_UNIT (Verlissh Matrix Flow System) 17 18}
        {SIDE_GENERIC_UNIT (Verlissh Matrix Flow System) 23 22}
        {SIDE_GENERIC_UNIT (Verlissh Matrix Flow System) 23 21}
        {SIDE_GENERIC_UNIT (Verlissh Matrix Flow System) 24 24}
    [/side]

    # Doors
    [side]
        side=8
        team_name=enemies
        user_team_name= _ "team_name^Chaos Emperor"
        {CHAOS_FLAG}

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

    {STARTING_VILLAGES 3 6}
    {STARTING_VILLAGES 4 6}
    {STARTING_VILLAGES 7 4}

    {SETUP_SHAXTHAL_ROAMING_SOUND_EFFECTS}

    # No cave noise sound source because it's too inconvenient to deal with
    # the outdoors region like in AtS E1S11.2.

    {CAVE_WATER_SOUND_SOURCE 49 66}
    {CAVE_WATER_SOUND_SOURCE 27 52}
    {CAVE_WATER_SOUND_SOURCE  9 50}
    {CAVE_WATER_SOUND_SOURCE  9 39}
    {CAVE_WATER_SOUND_SOURCE  7 17}
    {CAVE_WATER_SOUND_SOURCE 19 17}

#define F_DRONES_EASY
    "Shaxthal Drone,Shaxthal Drone,Shaxthal Drone,Shaxthal Drone,Shaxthal Drone,Shaxthal Sentry Drone" #enddef
#define F_DRONES_MEDIUM
    "Shaxthal Drone,Shaxthal Drone,Shaxthal Drone,Shaxthal Drone,Shaxthal Sentry Drone,Shaxthal Sentry Drone" #enddef
#define F_DRONES_HARD
    "Shaxthal Drone,Shaxthal Sentry Drone,Shaxthal Sentry Drone" #enddef

#define F_DRONE _TURNS _DIFFICULTY_LEVEL _X _Y
    {TIMED_DRONE_SPAWNER {_TURNS} (type={F_DRONES_{_DIFFICULTY_LEVEL}}) 6 {_X} {_Y} }
#enddef

    {F_DRONE {DIFF 8 7 6}    HARD   24 57}
    {F_DRONE {DIFF 9 8 7}    HARD   32 57}
    {F_DRONE {DIFF 9 9 8}    MEDIUM 30 52}
    {F_DRONE {DIFF 9 8 7}    MEDIUM 34 55}
    {F_DRONE {DIFF 9 9 8}    EASY   32 60}
    {F_DRONE {DIFF 9 9 8}    EASY   28 62}
    {F_DRONE {DIFF 9 8 7}    EASY   26 62}
    {F_DRONE {DIFF 9 9 8}    MEDIUM 22 64}
    {F_DRONE {DIFF 9 8 7}    EASY   22 63}
    {F_DRONE {DIFF 9 8 7}    EASY   25 67}
    {F_DRONE {DIFF 8 8 7}    MEDIUM 24 66}
    {F_DRONE {DIFF 9 8 7}    EASY   21 60}
    {F_DRONE {DIFF 8 7 6}    EASY   15 57}
    {F_DRONE {DIFF 9 8 7}    EASY   13 61}
    {F_DRONE {DIFF 9 8 7}    EASY   18 55}
    {F_DRONE {DIFF 9 8 7}    EASY   25 49}
    {F_DRONE {DIFF 12 11 10} HARD   29 43}

    {F_DRONE {DIFF 9 8 7}    HARD    9 36}
    {F_DRONE {DIFF 9 8 7}    HARD    5 33}

    {F_DRONE {DIFF 9 8 7}    MEDIUM 19 32}
    {F_DRONE {DIFF 9 8 7}    EASY   21 30}
    {F_DRONE {DIFF 9 8 7}    HARD   27 28}
    {F_DRONE {DIFF 9 8 7}    EASY   25 29}

    {F_DRONE {DIFF 12 11 10} EASY   37 39}
    {F_DRONE {DIFF 12 11 10} EASY   30 35}
    {F_DRONE {DIFF 12 11 10} EASY   48 37}

    {F_DRONE {DIFF 9 8 7}    MEDIUM 13 26}
    {F_DRONE {DIFF 7 7 6}    MEDIUM 14 23}
    {F_DRONE {DIFF 9 8 7}    MEDIUM  6 27}
    {F_DRONE {DIFF 9 9 8}    HARD    7 24}
    {F_DRONE {DIFF 9 8 7}    MEDIUM 14 20}
    {F_DRONE {DIFF 9 8 7}    MEDIUM 10 17}
    {F_DRONE {DIFF 9 8 7}    EASY   17 17}
    {F_DRONE {DIFF 9 8 7}    EASY   16 14}
    {F_DRONE {DIFF 9 8 7}    EASY   18 15}
    {F_DRONE {DIFF 9 8 7}    EASY    6 15}
    {F_DRONE {DIFF 9 8 7}    EASY    5 17}
    {F_DRONE {DIFF 8 7 6}    HARD   24 21}
    {F_DRONE {DIFF 7 6 6}    EASY   24 23}
    {F_DRONE {DIFF 9 8 7}    MEDIUM 27 29}
    {F_DRONE {DIFF 9 8 7}    EASY   26 14}
    {F_DRONE {DIFF 9 8 7}    EASY   24 15}
    {F_DRONE {DIFF 9 8 7}    EASY   27 19}

#ifndef EASY
    {F_DRONE {DIFF 9 8 7}    EASY   59 59}
    {F_DRONE {DIFF 9 8 7}    EASY   66 58}
    {F_DRONE {DIFF 9 8 7}    EASY   65 62}

#ifdef HARD
    {F_DRONE {DIFF 9 8 7}    EASY   63 57}
    {F_DRONE {DIFF 9 8 7}    EASY   62 60}
    {F_DRONE {DIFF 9 8 7}    EASY   69 60}
#endif

#endif

    {SNOW_ON_TOD inferno_night}

    [event]
        name=prestart

        [item]
            x=68-69,70
            y=   62,61
            image=items/gohere.png
        [/item]

        [time_area]
            id=outdoors
            {INFERNO_NIGHT}
            # Map terrain-dependent heuristic, because coordinate regions are
            # a PITA to track down.
            terrain=A*,A*^*,M*,M*^*,H*,H*^*,Qxua,Cha,*^Bsb*,Rr,Rr^*
            [or]
                # Match patches of broken ice in the river outside.
                terrain=W*
                [filter_adjacent_location]
                    terrain=A*
                [/filter_adjacent_location]
            [/or]
            [or]
                # Starting area edifice thingy.
                x,y,radius=71,4,6
            [/or]
            [or]
                # Pillars near the entrance, past the bridge.
                x=55,61
                y=23,26
            [/or]
        [/time_area]

        [mute_sound_effects][/mute_sound_effects]

        #
        # Configure interior and exterior sound sources in such a way they
        # cover the two different map areas radially.
        #

        [lua]
            code= <<
                local function distance2(a, b)
                    return ((b.x - a.x)^2 + (b.y - a.y)^2)^0.5
                end

                local function deserialize2(stem, p)
                    wml.variables[stem .. ".x"] = p.x
                    wml.variables[stem .. ".y"] = p.y
                end

                -- Snow area boundaries don't cover the impassable mountains
                -- range north from the secret glyph passage, which is okay
                -- because no-one can walk through them.

                --  ^ Top right
                local snow_a = { x = 80, y = 1  }
                local snow_b = { x = 38, y = 29 }

                local hive_a = snow_b
                local hive_b = { x = 1 , y = 72 }
                --  v Bottom left

                deserialize2("snow_corner", snow_a)
                deserialize2("hive_corner", hive_b)

                wml.variables["snow_radius"] = distance2(snow_a, snow_b)
                wml.variables["hive_radius"] = distance2(hive_a, hive_b)
            >>
        [/lua]

        {WIND_NOISE_SOUND_SOURCE}
        [+sound_source]
            x,y=$snow_corner.x,$snow_corner.y
            full_range=$($snow_radius/2)
            fade_range=$($snow_radius/2)
        [/sound_source]

        # Done in an event later.
        [event]
            name=enable hive ambience
            delayed_variable_substitution=no

            {CAVE_NOISE_SOUND_SOURCE}
            [+sound_source]
                x,y=$hive_corner.x,$hive_corner.y
                full_range=$hive_radius
                fade_range=$($snow_radius/3)
            [/sound_source]
        [/event]

        {CLEAR_VARIABLE snow_corner,snow_radius,hive_corner,hive_radius}

        #
        # Randomize barrier glyph location.
        #
        # ^Kov is used to mark candidates vn the north, ^Vov is for candidates
        # in the south.
        #

        {VARIABLE_RANDOM selector 0..1000}
        {VARIABLE_MOD    selector 2}

        [if]
            {VARIABLE_NUMERICAL_EQUALS selector 0}
            [then]
                {VARIABLE selector *^Kov}
            [/then]
            [else]
                {VARIABLE selector *^Vov}
            [/else]
        [/if]

        [store_locations]
            terrain=$selector
            variable=glyph_candidates
        [/store_locations]

        {BUG_ON ({VARIABLE_NUMERICAL_EQUALS glyph_candidates.length 0}) ()}

        {VARIABLE_RANDOM selector "0..$($glyph_candidates.length - 1)"}

        [terrain]
            terrain=^Ii
            layer=overlay
            x=$glyph_candidates[$selector].x
            y=$glyph_candidates[$selector].y
        [/terrain]

        {ITEM_CRYSTAL_GLYPH_GATE $glyph_candidates[$selector].x $glyph_candidates[$selector].y}

        [event]
            delayed_variable_substitution=no
            name=moveto
            first_time_only=no
            [filter]
                side=1
                x=$glyph_candidates[$selector].x
                y=$glyph_candidates[$selector].y
            [/filter]

            [fire_event]
                name=barrier glyph triggered
                [primary_unit]
                    x,y=$|x1,$|y1
                [/primary_unit]
            [/fire_event]
        [/event]

        [remove_terrain_overlays]
            terrain=*^Kov,*^Vov
        [/remove_terrain_overlays]

        # Debugging aid.
        #[terrain]
        #    [and]
        #        terrain=*^Kov,*^Vov
        #    [/and]
        #    terrain=Aa
        #[/terrain]

        {CLEAR_VARIABLE glyph_candidates,selector}

        #
        # Hive sentry sides are enabled and given gold later.
        #

        [modify_side]
            side=6,7
            controller=null
        [/modify_side]

        #
        # Finish setup.
        #

        [setup_doors]
            side=8
            [not]
                x,y,radius=55,67,1
            [/not]
            [not]
                x,y,radius=74,52,1
            [/not]
        [/setup_doors]

        # wmllint: recognize Elynia
        {RECALL_ELYNIA}
        # wmllint: recognize Mal Keshar
        {RECALL_MAL_KESHAR}
        # wmllint: recognize Lédinor
        {RECALL_LEDINOR}
        # wmllint: recognize Erathan
        {RECALL_ERATHAN2}
        # wmllint: recognize Igor
        {RECALL_IGOR}

        {FACE_DIRECTION side=1 sw}

        {OBJECTIVES (
            {OBJECTIVE_VICTORY ( _ "Find the entrance to the lair of the Chaos Emperor")}

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

            {TURNS_RUN_OUT}

            {OBJECTIVE_FULL_CARRYOVER}
        )}
    [/event]

    {FINAL_SCENARIO_PLAYER_RECRUITMENT_WITH_AUTORECALL}

    [event]
        name=prestart

        [hide_unit][/hide_unit]

        {BLACK_SCREEN}

        {LOCK_VIEW}
    [/event]

    [event]
        name=start

        [fade_out_music][/fade_out_music]

        [fade_in_sound_effects]
            duration=500
        [/fade_in_sound_effects]

        {FADE_IN}

        [unhide_unit][/unhide_unit]

        {CONDITIONAL_IGOR (
            [message]
                speaker=Igor
                message= _ "I didn’t think the demons’ homeland would be such a... cold... place— <b>ATCHOO!!!</b>"
            [/message]
        ) (
            [message]
                speaker=Galas
                message= _ "I have to say, I never expected Inferno to be such a cold place."
            [/message]
        )}

        [message]
            speaker=Mal Keshar
            message= _ "Yes, there does not appear to be anything but more snow in the distance. Who knew!"
        [/message]

        [message]
            speaker=Elynia
            message= _ "I assume this is but a small land in a much larger realm. The stories speak of far more varied locations, much like Irdya itself."
        [/message]

        [message]
            speaker=Galas
            message= _ "Surely the Emperor chose this location in order to have a nigh-on unlimited water supply for his ostentatious capital, then."
        [/message]

        {UNLOCK_VIEW}
    [/event]

    [event]
        id=its_quiet_too_quiet_talk
        name=side 1 turn 1 end

        [message]
            speaker=Lédinor
            message= _ "Come to think of it, there <b>is</b> nothing but snow in sight, indeed. Does anyone else find this troubling?"
        [/message]

        [message]
            speaker=Elynia
            message= _ "You are right, the solitude of this place doesn’t bode well."
        [/message]
    [/event]

    [event]
        name=turn 2

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

    #
    # Just in case something goes wrong with the unit vision expectations on turn 1.
    #

    {FIRE_EVENT_ON_STUMBLE_UPON "found first enemy" (
        [filter_side]
            [enemy_of]
                side=1
            [/enemy_of]
        [/filter_side]
    )}

    [event]
        name=found first enemy

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

        {CONDITIONAL_ERATHAN (
            [message]
                speaker=Erathan
                message= _ "I spot a few foes over there."
            [/message]
        ) (
            [message]
                speaker=Galas
                message= _ "I spot a few foes over there."
            [/message]
        )}

        [scroll_to_unit]
            x,y=$x2,$y2
        [/scroll_to_unit]

        [delay]
            time=750
        [/delay]

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

    # Entering the lair, roughly past the entrance gates.
    [event]
        name=moveto
        [filter]
            side=1
            [filter_location]
                x,y,radius=37,37,7
            [/filter_location]
        [/filter]

        [fire_event]
            name=enable hive ambience
        [/fire_event]

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

        [delay]
            time=250
        [/delay]

        {MYSTERIOUS_VOICE ( _ "Welcome! Welcome all to my lair, foolish creatures!")}
        [+message]
            sound=dwarf-laugh.wav
        [/message]

        [message]
            speaker=Mal Keshar
            message= _ "It’s that infuriating laugh again! Oh, I swear, the moment I get my hands on that pretentious bastard..."
        [/message]

        # Reveal goal gate.

        {CLEAR_CAVE_SHROUD (
            x,y,radius=37,37,5
            [or]
                x,y,radius=38,37,4
            [/or]
            [or]
                x,y,radius=37,44,3
            [/or]
        )}

        [redraw]
            side=1
        [/redraw]

        [scroll_to]
            x,y=38,46
        [/scroll_to]

        {HIGHLIGHT_GOAL (
            x=37,38-39
            y=47,46
        )}

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

        #
        # Release the cockatrices.
        #

        {GENERIC_UNIT 5 Cockatrice 13 45} {NO_UPKEEP_NO_OVERLAY}
        {GENERIC_UNIT 5 Cockatrice  8 47} {NO_UPKEEP_NO_OVERLAY}
        {GENERIC_UNIT 5 Cockatrice 15 49} {NO_UPKEEP_NO_OVERLAY} {GUARDIAN}
        {GENERIC_UNIT 5 Cockatrice 23 52} {NO_UPKEEP_NO_OVERLAY} {GUARDIAN}
        {GENERIC_UNIT 5 Cockatrice 14 57} {NO_UPKEEP_NO_OVERLAY} {GUARDIAN}
        {GENERIC_UNIT 5 Cockatrice 30 58} {NO_UPKEEP_NO_OVERLAY} {GUARDIAN}
        {GENERIC_UNIT 5 Cockatrice 23 58} {NO_UPKEEP_NO_OVERLAY}

        {GENERIC_UNIT 5 Cockatrice  8 38} {NO_UPKEEP_NO_OVERLAY} {GUARDIAN}
        {GENERIC_UNIT 5 Cockatrice  8 28} {NO_UPKEEP_NO_OVERLAY} {GUARDIAN}
        {GENERIC_UNIT 5 Cockatrice 15 31} {NO_UPKEEP_NO_OVERLAY} {GUARDIAN}
        {GENERIC_UNIT 5 Cockatrice  6 24} {NO_UPKEEP_NO_OVERLAY} {GUARDIAN}
        {GENERIC_UNIT 5 Cockatrice 18 21} {NO_UPKEEP_NO_OVERLAY}
        {GENERIC_UNIT 5 Cockatrice 15 16} {NO_UPKEEP_NO_OVERLAY}
        {GENERIC_UNIT 5 Cockatrice  8 18} {NO_UPKEEP_NO_OVERLAY} {GUARDIAN}
        {GENERIC_UNIT 5 Cockatrice 25 23} {NO_UPKEEP_NO_OVERLAY} {GUARDIAN}

        #
        # Enable hive sentry sides.
        #
        [modify_side]
            side=5,6,7
            controller=ai
            {GOLD 130 150 175}
        [/modify_side]

        #
        # Add more tracks to the playlist instead of replacing it entirely.
        #
        {APPEND_MUSIC "knalgan_theme.ogg"}
        {APPEND_MUSIC "into_the_shadows.ogg"}
    [/event]

    [event]
        name=moveto
        [filter]
            side=1
            [filter_location]
                [filter_adjacent_location]
                    terrain=*^Zz*
                [/filter_adjacent_location]
            [/filter_location]
        [/filter]

        [message]
            speaker=Elynia
            message= _ "The protection enchantment shielding this gate is far too strong. May I suggest searching for another way to open it?"
        [/message]

        [message]
            speaker=Mal Keshar
            message= _ "Union?"
        [/message]

        [message]
            speaker=Elynia
            message= _ "I would rather avoid unnecessary use of it while we are in this place... I hope you can understand why."
        [/message]

        # He already knows things Galas doesn't.

        [message]
            speaker=Mal Keshar
            message= _ "... Yes... I <i>think</i> I see where this is going. Very well, then. Let us do things your way."
        [/message]
    [/event]

    ############################################################################
    #                                                                          #
    #                      CHIMERA/COCKATRICE CONTROL EVENTS                   #
    #                                                                          #
    ############################################################################

    {FIRE_EVENT_ON_STUMBLE_UPON "found cockatrice" type=Cockatrice}

    [event]
        name=found cockatrice

        [scroll_to_unit]
            x,y=$x2,$y2
        [/scroll_to_unit]

        [delay]
            time=750
        [/delay]

        [message]
            speaker=Mal Keshar
            message= _ "Hey, what do we have here... Cockatrices! There are cockatrices roaming about this place!"
        [/message]

        [message]
            speaker=Galas
            message= _ "Huh?"
        [/message]

        [message]
            speaker=Elynia
            message= _ "Bird-like creatures which are said to have the ability to turn any living thing to stone with a single glance. They are not natural denizens of our world, being instead the product of forbidden sorcery."
        [/message]

        [message]
            speaker=Mal Keshar
            message= _ "Yes, yes — all right, attention everyone! Avoid direct eye contact with these pests or you <i>will</i> regret it!"
        [/message]

        [message]
            speaker=Elynia
            message= _ "I believe I can remove the effects of their magic with a spell. However, should any victim come to harm while petrified..."
        [/message]

        {OBJECTIVES (
            {OBJECTIVE_VICTORY ( _ "Find the entrance to the lair of the Chaos Emperor")}

            {OBJECTIVE_DEFEAT ( _ "Elynia is petrified by an enemy unit")}
            {OBJECTIVE_DEFEAT ( _ "Death of Galas")}
            {OBJECTIVE_DEFEAT ( _ "Death of Elynia")}
            {OBJECTIVE_DEFEAT ( _ "Death of Mal Keshar")}
            {OBJECTIVE_DEFEAT ( _ "Death of Lédinor")}

            {TURNS_RUN_OUT}

            {OBJECTIVE_FULL_CARRYOVER}

            {OBJECTIVE_NOTE ( _ "Elynia can revert the effects of petrification on adjacent player units at the start of each turn")}
        )}
    [/event]

    #
    # TODO: figure out how to implement the statue effect so that units can be
    #       harmed while petrified. One notable caveat is that standing
    #       animations need to be stopped, which is currently a hardcoded
    #       case in the engine.
    #

    [event]
        name=petrified
        [filter]
            id=Elynia
        [/filter]

        [message]
            speaker=Elynia
            message= _ "I can’t... help you... now..."
        [/message]

        {HERO_DEFEAT_ENDLEVEL}
    [/event]

    {UNPETRIFY_UNITS_AT_TURN_START 1 id=Elynia}

    ############################################################################
    #                                                                          #
    #                           SCENARIO PROGRESSION                           #
    #                                                                          #
    ############################################################################

    [event]
        name=barrier glyph triggered
        first_time_only=no
        [filter]
            [not]
                id=Elynia,Mal Keshar
            [/not]
        [/filter]

        [allow_undo][/allow_undo]

        [message]
            speaker=narrator
            image=wesnoth-icon.png
            message= _ "You are not able to activate this sealed glyph. Perhaps you should send Elynia or Mal Keshar to investigate instead."
        [/message]
    [/event]

    [event]
        name=barrier glyph triggered
        [filter]
            id=Elynia,Mal Keshar
        [/filter]

        {GATE_GLYPH_ACTIONS 38 46}

        # Open shortcut passages leading back to the hall chamber, but don't
        # specifically bring attention to them.

        [terrain]
            x=28,29,  32,33,  28,29
            y=49,50,  28,29,  23,23
            terrain=Yhl
        [/terrain]

        [terrain]
            x=32,33
            y=41,42
            terrain=Yhr
        [/terrain]

        [redraw]
            side=1
        [/redraw]

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

    [event]
        name=boss entrance setup

        {GENERIC_UNIT 5 Cockatrice 44 49} {NO_UPKEEP_NO_OVERLAY} {GUARDIAN} {FACING nw}
        {GENERIC_UNIT 5 Cockatrice 46 53} {NO_UPKEEP_NO_OVERLAY} {GUARDIAN} {FACING nw}
        {GENERIC_UNIT 5 Cockatrice 51 50} {NO_UPKEEP_NO_OVERLAY} {GUARDIAN} {FACING nw}

        [unit]
            side=5
            canrecruit=yes
            type=Chimera
            id=Knidaril
            name= _ "Knidaril"
            placement=leader
            facing=nw
            [modifications]
                {TRAIT_STRONG}
                {TRAIT_RESILIENT}
            [/modifications]
        [/unit]

        [modify_side]
            side=5
            recruit=Cockatrice
            {GOLD 100 110 120}
        [/modify_side]

        [capture_village]
            side=5
            [filter]
                id=Knidaril
            [/filter]
            radius=8
        [/capture_village]
    [/event]

    [event]
        name=die
        [filter]
            id=Knidaril
        [/filter]

        [sound]
            name=gate.ogg # Yes, it's the hit sound, not the death sound.
        [/sound]

        {CLEAR_CAVE_SHROUD (
            x,y,radius=59,57,4
            [or]
                x,y,radius=57,55,4
            [/or]
            [or]
                x,y,radius=52,53,6
            [/or]
        )}

        [redraw]
            side=1
        [/redraw]

        {GATE_GLYPH_ACTIONS 59 57}

        [message]
            speaker=Galas
            message= _ "This is quite obviously an invitation into a trap. Shall we heed it?"
        [/message]

        [message]
            speaker=Lédinor
            message= _ "This whole place feels like a trap to me. On the other hand, if we don’t come to him..."
        [/message]

        [message]
            speaker=Galas
            message= _ "... he will come to us. Even then, I think we should first look around for anything that could help us — weapons, information, anything."
        [/message]
    [/event]

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

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

        [allow_undo][/allow_undo]

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

    # Secret glyph.

    {L_GLYPH 34 16 ( _ "Uria insists on the necessity of handing control of Irdya over to someone more experienced if everything goes according to plan. She says she will need me on Ethea, and that Nar-hamoth is of no use whatsoever beyond monitoring the Iron Council. “So who will it be?”, I inquired. “Somebody who can govern Irdya with an iron fist in your absence. Someone whose very name shall instill fear and obedience in all our subjects.”

This is not how I hoped things would turn out, and Elyssa will surely not be pleased with this turn of events. The best I can do now is stall the mission for a while and hope she does not find out.")}

    # Final antechamber glyphs.

    {L_GLYPH 59 45 ( _ "The Light of the soul, the Darkness of the mind. Two opposing aspects that govern our existence and give way to life. Never fully overlapping, but also always intertwined.

The Union of Light and Darkness. A paradoxical power beyond measure that permeates our reality like the sap that flows through the branches of a tree. Why would the First Gods bequeath such a dangerous tool to flawed beings like us? What is it that they saw approaching at the end of time?")}

    {L_GLYPH 63 42 ( _ "The glyph’s contents seem to be in a language you have never read nor heard before.")}

    {L_GLYPH 68 44 ( _ "Unlike the Seer, Uria believes that our fate can be changed by our actions, that there is no single path to the same destination, and that, like the fish that swim upstream from the ocean, the course of reality can be altered by a sufficiently strong will.")}

    {L_GLYPH 69 49 ( _ "The glyph’s contents seem to be in a language you have never read nor heard before.")}

    [event]
        name=moveto
        [filter]
            id=Elynia,Galas,Mal Keshar
            x=68-80,70
            y=62-70,61
        [/filter]

        [hide_unit][/hide_unit]

        {FADE_TO_BLACK}

        {ENDLEVEL_QUIET}
    [/event]

    #[event]
    #    name=victory
    #[/event]
[/scenario]

#undef L_AI_GUARDS_BEHIND_GATES
#undef L_GLYPH
#undef F_DRONE
#undef F_DRONES_EASY
#undef F_DRONES_MEDIUM
#undef F_DRONES_HARD

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