#textdomain wesnoth-thot

# This is the part of THoT that was designed by Taurus.  ESR did some
# tuning and debugging afterwards, redid the flavor dialogue, and
# added the war drums, but it's still basically Taurus's architecture.

[scenario]
    name=_"The Underlevels"
    id="12_The_Underlevels"
    next_scenario="13_Epilogue"
    victory_when_enemies_defeated=yes

    map_data="{@campaigns/The_Hammer_of_Thursagan/maps/underlevels.map}"

    {UNDERGROUND}
    # No scenario music; we don't want it drowning out the wardrums.

    {SCENARIO_MUSIC "silence.ogg"}

    {STARTING_VILLAGES 8 4}
    {STARTING_VILLAGES 5 6}
    {STARTING_VILLAGES 3 3}
    {STARTING_VILLAGES 4 9}

    [set_variable]
        name=liches_active
        value=no
    [/set_variable]

    turns=-1

    [side]
        type="Dwarvish Fighter"
        id="Aiglondur"
        name=_"Aiglondur"
        canrecruit="1"
        side="1"
        controller="human"
        team_name="good"
        user_team_name=_"Alliance"
        {FLAG_VARIANT knalgan}
        fog="no"
        shroud="yes"
        recruit="Dwarvish Fighter,Dwarvish Thunderer,Dwarvish Guardsman"
        {GOLD 220 200 180}	# BALANCE
    [/side]

    [side]
        type="Dwarvish Rune Lord"
        id="Karrag"
        name=_"Karrag"
        profile=portraits/karrag.png
        canrecruit="1"
        side="2"
        colour=black
        controller="ai"
        team_name="evil"
        user_team_name=_"Evil"
        fog="no"
        shroud="no"
        recruit="Blood Bat,Ghost,Wraith,Shadow,Skeleton,Skeleton Archer,Ghoul,Necrophage,Revenant,Deathblade,Bone Shooter"
        [ai]
            passive_leader=yes
            grouping=defensive
            {ATTACK_DEPTH 4 5 5}
        [/ai]
        gold=0	# Will change when the side is acxtivated
    [/side]

    [side]
        type="Dwarvish Masked Steelclad"
        id="Dufon"
        name=_"Masked Dwarf"
        profile=portraits/maskeddwarf2.png
        canrecruit="1"
        side="3"
        controller="ai"
        team_name="evil"
        user_team_name=_"Evil"
        fog="no"
        shroud="no"
        recruit="Dwarvish Masked Fighter, Dwarvish Masked Thunderer, Dwarvish Ulfserker, Dwarvish Masked Guardsman"
        [ai]
            {NO_SCOUTS}
            recruitment_ignore_bad_movement=yes
            recruitment_pattern=fighter,fighter,mixed fighter
        [/ai]
        gold=0	# Will change when the side is acxtivated
    [/side]

    [side]
        type="Dwarvish Masked Lord"
        id="Aragoth"
        name=_"Masked Dwarf"
        profile=portraits/maskeddwarf3.png
        canrecruit="1"
        side="4"
        controller="ai"
        team_name="evil"
        user_team_name=_"Evil"
        fog="no"
        shroud="no"
        recruit="Dwarvish Masked Fighter, Dwarvish Masked Steelclad, Dwarvish Masked Thunderer, Dwarvish Masked Thunderguard, Dwarvish Ulfserker, Dwarvish Berserker, Dwarvish Masked Guardsman, Dwarvish Masked Stalwart"
        [ai]
            {NO_SCOUTS}
            recruitment_ignore_bad_movement=yes
            recruitment_pattern=fighter,fighter,mixed fighter
        [/ai]
        gold=0	# Will change when the side is activated
    [/side]

    [side]
        type="Dwarvish Masked Lord"
        id="Dranath"
        name=_"Masked Dwarf"
        profile=portraits/maskeddwarf4.png
        canrecruit="1"
        side="5"
        controller="ai"
        team_name="evil"
        user_team_name=_"Evil"
        fog="no"
        shroud="no"
        recruit="Dwarvish Masked Fighter, Dwarvish Masked Steelclad, Dwarvish Masked Thunderer, Dwarvish Masked Thunderguard, Dwarvish Ulfserker, Dwarvish Berserker, Dwarvish Masked Guardsman, Dwarvish Masked Stalwart"
        [ai]
            {NO_SCOUTS}
            recruitment_ignore_bad_movement=yes
            recruitment_pattern=fighter,fighter,mixed fighter
        [/ai]
        gold=0	# Will change when the side is acxtivated
    [/side]

    [side]
        type="Lich"
        id="Fleleen"
        name=_"Fleleen"
        canrecruit="1"
        side="6"	# ACTIVATE_LICHES macro depends on this value
        controller="ai"
        team_name="evil"
        user_team_name=_"Evil"
        fog="no"
        shroud="no"
        {GOLD 200 250 300}
    [/side]

    [side]
        type="Lich"
        id="Lannex"
        name=_"Lannex"
        canrecruit="1"
        side="7"	# ACTIVATE_LICHES macro depends on this value
        controller="ai"
        team_name="evil"
        user_team_name=_"Evil"
        fog="no"
        shroud="no"
        [ai]
            {NO_SCOUTS}
        [/ai]
        {GOLD 200 250 300}
    [/side]

    [side]
        type="Dwarvish Masked Steelclad"
        id="Sashaon"
        name=_"Masked Dwarf"
        profile=portraits/maskeddwarf.png
        canrecruit="1"
        side="8"
        controller="ai"
        team_name="evil"
        user_team_name=_"Evil"
        fog="no"
        shroud="no"
        recruit="Dwarvish Masked Fighter, Dwarvish Masked Thunderer, Dwarvish Ulfserker, Dwarvish Masked Guardsman"
        {GOLD 150 175 200}
        [ai]
            {NO_SCOUTS}
            recruitment_ignore_bad_movement=yes
            recruitment_pattern=fighter,fighter,mixed fighter
        [/ai]
    [/side]

    {@campaigns/The_Hammer_of_Thursagan/utils/herodeaths.cfg}

#define MASKED_GUARD SIDE X Y
    [unit]
        type=Dwarvish Masked Steelclad
        x={X}
        y={Y}
        side={SIDE}
        ai_special=guardian
        random_traits=yes
        name= _ "Masked Dwarf"
    [/unit]
#enddef

#define MASKED_SNIPER SIDE X Y
    [unit]
        type=Dwarvish Masked Thunderguard
        x={X}
        y={Y}
        side={SIDE}
        ai_special=guardian
        random_traits=yes
        generate_name=yes
        name= _ "Masked Dwarf"
    [/unit]
#enddef

#define MASKED_STALWART SIDE X Y
    [unit]
        type=Dwarvish Masked Stalwart
        x={X}
        y={Y}
        side={SIDE}
        ai_special=guardian
        random_traits=yes
        generate_name=yes
        name= _ "Masked Dwarf"
    [/unit]
#enddef

#define JAIL_SAGA ID_STRING
    [set_variable]
        name=saga_told
        value=1
    [/set_variable]

    [message]
        speaker={ID_STRING}
        message= _ "Finally! I see someone managed to see through the web of deception thrown up by that vile Karrag!"
    [/message]

    [message]
        speaker=Aiglondur
        message= _ "I thought Karrag's fight was against the so called 'dirtgrubbers'. Why would he keep you, a dwarf captive?"
    [/message]

    [message]
        speaker={ID_STRING}
        message= _ "I guess Karrag thought I knew too much. When his masked henchmen started raiding, plundering and taking all sorts of prisoners - which were sent to these underlevels and never seen again - I began to inquire. I discovered many unsettling things indeed, but before I could act on them I was arrested and thrown down here."
    [/message]

    [message]
        speaker={ID_STRING}
        message= _ "I gather that he is involved in some sick ritual which requires the blood of living creatures. These cells seem to be the holding place where he keeps his victims. The 'dirtgrubbers' he seems to prefer sacrificing have long since been taken away. Now it is just us few dwarves that remain..."
    [/message]

    [message]
        speaker="Angarthing"
        message= _ "Freeing these prisoners is more of a blow to Karrag then we thought, for now he is unable to continue his foul sorcery."
    [/message]
#enddef

#define ACTIVATE_LICHES
    [if]
        [variable]
            name=liches_active
            value=no
        [/variable]
        [then]
            [message]
                speaker="Angarthing"
                message=_"I sense wrongness. Some greater evil awakens before us."
            [/message]

            [allow_recruit]
                side=6
                type="Blood Bat,Ghost,Wraith,Shadow,Skeleton,Skeleton Archer,Ghoul,Necrophage,Revenant,Deathblade,Bone Shooter"
            [/allow_recruit]

            [allow_recruit]
                side=7
                type="Blood Bat,Ghost,Wraith,Shadow,Skeleton,Skeleton Archer,Ghoul,Necrophage,Revenant,Deathblade,Bone Shooter"
            [/allow_recruit]

            [set_variable]
                name=liches_active
                value=yes
            [/set_variable]
        [/then]
    [/if]
#enddef

    {SET_RIGHTEOUS_FLAME_EVENT}

    [event]
        name="start"

        {PLACE_IMAGE "scenery/dwarven-doors-closed.png" 38 42}
        {PLACE_IMAGE "scenery/dwarven-doors-closed.png" 39 42}
        {PLACE_IMAGE "scenery/dwarven-doors-closed.png" 40 42}
        {PLACE_IMAGE "scenery/dwarven-doors-closed.png" 21 55}
        {PLACE_IMAGE "scenery/dwarven-doors-closed.png" 21 54}
        {PLACE_IMAGE "scenery/dwarven-doors-closed.png" 53 33}
        {PLACE_IMAGE "scenery/dwarven-doors-closed.png" 23 4}
        {PLACE_IMAGE "scenery/dwarven-doors-closed.png" 39 13}
        {PLACE_IMAGE "scenery/dwarven-doors-closed.png" 26 5}
        {PLACE_IMAGE "scenery/dwarven-doors-closed.png" 25 8}
        {PLACE_IMAGE "scenery/dwarven-doors-closed.png" 18 1}
        {PLACE_IMAGE "scenery/dwarven-doors-closed.png" 10 2}
        {PLACE_IMAGE "scenery/dwarven-doors-closed.png" 15 24}
        {PLACE_IMAGE "scenery/dwarven-doors-closed.png" 15 36}
        {PLACE_IMAGE "items/book2.png" 41 6}
        {PLACE_IMAGE "items/chest.png" 15 22}
        {PLACE_IMAGE "items/chest.png" 15 38}
        {PLACE_IMAGE "scenery/rune4.png" 12 1}
        {PLACE_IMAGE "scenery/rune4.png" 20 1}
        {PLACE_IMAGE "scenery/rune4.png" 41 43}
        {PLACE_IMAGE "scenery/rune4.png" 37 43}

        {MASKED_GUARD  2 10 25}
        {MASKED_GUARD  2 14 25}
        {MASKED_GUARD  2 18 25}
        {MASKED_SNIPER 2 12 25}
        {MASKED_SNIPER 2 16 25}
        {MASKED_SNIPER 2 20 25}

        {MASKED_GUARD  2 10 34}
        {MASKED_GUARD  2 14 34}
        {MASKED_GUARD  2 18 34}
        {MASKED_SNIPER 2 12 34}
        {MASKED_SNIPER 2 16 34}
        {MASKED_SNIPER 2 20 34}

        {MASKED_STALWART 2 26 27}
        {MASKED_STALWART 2 26 30}
        {MASKED_STALWART 2 30 26}
        {MASKED_STALWART 2 32 27}
        {MASKED_STALWART 2 32 30}
        {MASKED_STALWART 2 30 31}

        {MASKED_STALWART 2 38 24}
        {MASKED_STALWART 2 36 23}
        {MASKED_STALWART 2 38 19}
        {MASKED_STALWART 2 36 19}
        {MASKED_STALWART 2 33 16}
        {MASKED_STALWART 2 33 18}
        {MASKED_STALWART 2 23 16}
        {MASKED_STALWART 2 23 18}

        {MASKED_GUARD    2 24 14}
        {MASKED_SNIPER   2 22 14}
        {MASKED_GUARD    2 24 19}
        {MASKED_SNIPER   2 22 19}
        {MASKED_STALWART 2 18 15}
        {MASKED_STALWART 2 18 17}
        {MASKED_STALWART 2 12 16}
        {MASKED_STALWART 2 15 12}
        {MASKED_STALWART 2 11 12}
        {MASKED_GUARD    2 10 11}
        {MASKED_SNIPER   2 9 11}
        {MASKED_GUARD    2 16 11}
        {MASKED_SNIPER   2 17 11}

        {MASKED_STALWART 2 37 33}
        {MASKED_STALWART 2 35 34}
        {MASKED_GUARD    2 35 37}
        {MASKED_SNIPER   2 35 38}
        {MASKED_GUARD    2 35 39}
        {MASKED_SNIPER   2 35 40}
        {MASKED_GUARD    2 43 37}
        {MASKED_SNIPER   2 43 38}
        {MASKED_GUARD    2 43 39}
        {MASKED_SNIPER   2 43 40}

        {NOTRAIT_UNIT 2 "Draug" 20 43} {GUARDIAN}
        {NOTRAIT_UNIT 2 "Draug" 20 44} {GUARDIAN}
        {NOTRAIT_UNIT 2 "Draug" 20 45} {GUARDIAN}
        {NOTRAIT_UNIT 2 "Draug" 28 43} {GUARDIAN}
        {NOTRAIT_UNIT 2 "Draug" 28 44} {GUARDIAN}
        {NOTRAIT_UNIT 2 "Draug" 28 45} {GUARDIAN}
        {NOTRAIT_UNIT 2 "Draug" 22 42} {GUARDIAN}
        {NOTRAIT_UNIT 2 "Draug" 24 41} {GUARDIAN}
        {NOTRAIT_UNIT 2 "Draug" 26 42} {GUARDIAN}
        {NOTRAIT_UNIT 2 "Draug" 26 46} {GUARDIAN}
        {NOTRAIT_UNIT 2 "Draug" 24 47} {GUARDIAN}
        {NOTRAIT_UNIT 2 "Draug" 22 46} {GUARDIAN}

        {NOTRAIT_UNIT 2 "Giant Spider" 45  3} {GUARDIAN}
        {NOTRAIT_UNIT 2 "Giant Spider" 39 12} {GUARDIAN}
        {NOTRAIT_UNIT 2 "Giant Spider" 44  7} {GUARDIAN}
        {NOTRAIT_UNIT 2 "Giant Spider" 39  7} {GUARDIAN}
        {NOTRAIT_UNIT 2 "Giant Spider" 49  5} {GUARDIAN}
        {NOTRAIT_UNIT 2 "Giant Spider" 38  2} {GUARDIAN}

        [recall]
            id="Angarthing"
        [/recall]

        [recall]
            id="Dulcatulos"
        [/recall]

        [recall]
            id="Ratheln"
        [/recall]

        {CONDITIONAL_MAGE_RECRUITING}

        [message]
            speaker="Angarthing"
            message=_"This place smells of death."
        [/message]

        [message]
            speaker="Dulcatulos"
            message=_"It's been...it's been years since I've been down here. Only Karrag and his personal followers used this level. Why did I never wonder about that before?"
        [/message]

        [message]
            speaker="Angarthing"
            # wmllint: local spelling glamours
            message=_"Karrag's will, and his dark magic. I think he has been casting glamours on all of you ever since he passed over."
        [/message]

        [message]
            speaker="Aiglondur"
            message=_"Where *is* Karrag? We can't have been more than seconds behind him."
        [/message]

        [message]
            speaker="Dulcatulos"
            message=_"This is the Grand Gallery. There are rows of small chambers along its sides; he could have slipped into any of them."
        [/message]

        [message]
            speaker="Aiglondur"
            message=_"More likely he has cloaked himself, thinking to run ahead to gather his followers. He could be within a spear-cast of us now and we wouldn't know it in this gloom."
        [/message]

        [sound]
            name=ambient/wardrums.ogg
        [/sound]

        [message]
            speaker="Dulcatulos"
            message=_"Those are war-drums!"
        [/message]

        [message]
            speaker="Aiglondur"
            message=_"Aye. Karrag, calling his troops to battle. Only the Dark Gods know what hellspawn the lich will summon. AXES UP!"
        [/message]

        # Now pile on the music
        {REPLACE_SCENARIO_MUSIC "vengeful.ogg"}
        {APPEND_MUSIC "underground.ogg"}
        {APPEND_MUSIC "breaking_the_chains.ogg"}
        {APPEND_MUSIC "the_city_falls.ogg"}
        {APPEND_MUSIC "battle.ogg"}
        {APPEND_MUSIC "vengeful.ogg"}
        {APPEND_MUSIC "the_deep_path.ogg"}
        {APPEND_MUSIC "the_dangerous_symphony.ogg"}
        {APPEND_MUSIC "knalgan_theme.ogg"}
        {APPEND_MUSIC "legends_of_the_north.ogg"}
        {APPEND_MUSIC "suspense.ogg"}
        {APPEND_MUSIC "revelation.ogg"}

        [objectives]
            side="1"
            silent="no"
            [objective]
                description=_"Defeat Karrag"
                condition="win"
            [/objective]
            [objective]
                description=_"Death of Aiglondur"
                condition="lose"
            [/objective]
            [objective]
                description=_"Death of Angarthing"
                condition="lose"
            [/objective]
            [objective]
                description=_"Death of Dulcatulos"
                condition="lose"
            [/objective]
        [/objectives]

        [set_variable]
            name=key_read
            value=no
        [/set_variable]
        [set_variable]
            name=door_open
            value=no
        [/set_variable]
    [/event]

    # We've arrived at the door to the sealed cave section,
    # The door guardian gets more gold to recruit another troop wave.
    [event]
        name=sighted

        [filter]
            id="Dranath"
        [/filter]

        [message]
            speaker="Dranath"
            message= _ "You cannot pass, fools. The doors I guard are sealed by the power of the Hammer itself."
        [/message]

        [message]
            speaker=second_unit
            message= _ "We'll see about that!"
        [/message]

        [gold]
            side=5
            amount=300
        [/gold]
    [/event]

    # We're at the door to the sealed cave section.
    [event]
        name=moveto
        first_time_only=no

        [filter]
            side=1
            x=38,39,40
            y=41,41,41
        [/filter]

        [if]
            [variable]
                name=key_read
                equals=no
            [/variable]

            [then]
                [message]
                    speaker=unit
                    message= _ "It seems that guard spoke truth. These doors cannot be forced open by any means we have!"
                [/message]

                [message]
                    speaker="Angarthing"
                    message= _ "I sense these bindings to be the work of common sorcery, not the power of the Hammer. Usually to each such locking spell there is some sort of key. If we can but find the key, we will able to open these doors."
                [/message]
            [/then]
        [/if]

        [if]
            [and]
                [variable]
                    name=key_read
                    equals=yes
                [/variable]
                [variable]
                    name=door_open
                    equals=no
                [/variable]
            [/and]

            [then]
                [message]
                    speaker=unit
                    message= _ "The key has been uttered, these doors should open..."
                [/message]

                [terrain]
                    x=38,39,40
                    y=42,42,42
                    terrain=Uu
                [/terrain]

                [message]
                    speaker=unit
                    message= _ "There we go... faugh, what is that smell!"
                [/message]

                [set_variable]
                    name=door_open
                    value=yes
                [/set_variable]

                # We defer activating the two subordinate liches in
                # the sealed cave section until this point because we
                # don't want the whole cave section to be already
                # flooded with monsters when the player's troops enter
                # it.  Ideally, we'd like the player to collide with
                # an expanding wave of monsters from the lich to the
                # west, and then possibly get hit from behind by
                # monsters percolating through the narrow passage from the
                # lich to the east.  The tunnel lengths have been tuned
                # for this result.
                {ACTIVATE_LICHES}
            [/then]
        [/if]
    [/event]

    # This event is in case the player gets a unit through the sneak tunnel
    # between the spider room and the eastern lich chamber before opening
    # the sealed doors.
    [event]
        name=moveto

        [filter]
            side=1
            x=51-54
            y=20-33
        [/filter]

        [message]
            speaker=unit
            message= _ "I think I hear noises, ahead of us..."
        [/message]

        {ACTIVATE_LICHES}
    [/event]

    # Don't active Karrag too early or all his units will run to
    # the adjacent chamber and the final fight will just be bashing
    # on the guardian Draugs.
    [event]
        name=sighted

        [filter]
            id=Karrag
        [/filter]

        [message]
            speaker=Karrag
            message= _ "Fresh blood! Exactly what I need to complete the rite."
        [/message]

        [gold]
            side=2
            amount=300	# Perhaps drop this to 200/250 on lower difficulties?
        [/gold]
    [/event]

    [event]
        name=moveto

        [filter]
            side=1
            x=25,25
            y=5,6
        [/filter]

        [message]
            speaker=unit
            message= _ "It's locked, but nothing that our hammers can't manage."
        [/message]

        [terrain]
            x=26
            y=5
            terrain=Uu
        [/terrain]
    [/event]

    # The book is in the room of spiders
    [event]
        name=moveto

        [filter]
            side=1
            x=41
            y=6
        [/filter]

        [message]
            speaker=unit
            message= _ "A scroll with some strange writing on it..."
        [/message]

        [message]
            speaker="Angarthing"
            message= _ "I believe that will be the key-spell for that sealed door."
        [/message]

        [message]
            speaker="Angarthing"
            message= _ "(reads) Kannin a'kana du'masi a'forigln de'amp."	# wmllint: no spellcheck
        [/message]

        [message]
            speaker="Angarthing"
            message= _ "Now try the door again, it should open."
        [/message]

        [set_variable]
            name=key_read
            value=yes
        [/set_variable]
    [/event]

    [event]
        name=moveto

        [filter]
            side=1
            x=15
            y=25
        [/filter]

        [message]
            speaker=unit
            message= _ "A door. Perhaps Karrag is hiding in here..."
        [/message]

        [terrain]
            x=15
            y=24
            terrain=Uu
        [/terrain]
    [/event]

    [event]
        name=moveto

        [filter]
            side=1
            x=15
            y=35
        [/filter]

        [message]
            speaker=unit
            message= _ "A door. Perhaps Karrag is hiding in here..."
        [/message]

        [terrain]
            x=15
            y=36
            terrain=Uu
        [/terrain]
    [/event]

    [event]
        name=moveto
        [filter]
            x=15
            y=22
            side=1
        [/filter]
        [message]
            speaker=unit
            message= _ "150 gold pieces. This should help."
        [/message]
        [gold]
            side=1
            amount=150
        [/gold]
        [removeitem]
            x=15
            y=22
        [/removeitem]
    [/event]

    [event]
        name=moveto
        [filter]
            x=15
            y=38
            side=1
        [/filter]
        [message]
            speaker=unit
            message= _ "150 gold pieces. I wonder why Karrag would choose to store his gold here."
        [/message]
        [gold]
            side=1
            amount=150
        [/gold]
        [removeitem]
            x=15
            y=38
        [/removeitem]
    [/event]

    [event]
        name=moveto

        [filter]
            side=1
            x=39
            y=12
        [/filter]

        [message]
            speaker=unit
            message= _ "An old caved in passage way. Perhaps if we clear away some of this rubble we may be able to get through..."
        [/message]

        [terrain]
            x=39,39
            y=13,14
            terrain=Uu
        [/terrain]
    [/event]

    [event]
        name=moveto

        [filter]
            side=1
            x=55
            y=33
        [/filter]

        [message]
            speaker=unit
            message= _ "Another old caved-in passage way..."
        [/message]

        [terrain]
            x=55,55
            y=34,35
            terrain=Uu
        [/terrain]
    [/event]

    [event]
        name=moveto

        [filter]
            side=1
            x=11
            y=2
        [/filter]

        [terrain]
            x=10
            y=2
            terrain=Uu
        [/terrain]

        [remove_shroud]
            x=7-10
            y=1-3
        [/remove_shroud]

        [unit]
            side=1
            type=Dwarvish Steelclad
            x=8
            y=2
            random_traits=yes
            name= _ "Trisi"
            id=Trisi
        [/unit]

        [unit]
            side=1
            type=Dwarvish Thunderer
            x=8
            y=1
            random_traits=yes
            generate_name=yes
        [/unit]

        [if]
            [variable]
                name=saga_told
                numerical_equals=0
            [/variable]

            [then]
                {JAIL_SAGA (Trisi)}
            [/then]
        [/if]
    [/event]

    [event]
        name=moveto

        [filter]
            side=1
            x=19
            y=2
        [/filter]

        [terrain]
            x=18
            y=1
            terrain=Uu
        [/terrain]

        [remove_shroud]
            x=15-18
            y=1-3
        [/remove_shroud]

        [unit]
            side=1
            type=Dwarvish Steelclad
            x=16
            y=1
            random_traits=yes
            name= _ "Malifen"
            id=Malifen
        [/unit]

        [unit]
            side=1
            type=Dwarvish Fighter
            x=15
            y=2
            random_traits=yes
            generate_name=yes
        [/unit]

        [if]
            [variable]
                name=saga_told
                numerical_equals=0
            [/variable]

            [then]
                {JAIL_SAGA (Malifen)}
            [/then]
        [/if]
    [/event]

    [event]
        name=moveto

        [filter]
            side=1
            x=23
            y=5
        [/filter]

        [terrain]
            x=23
            y=4
            terrain=Uu
        [/terrain]

        [remove_shroud]
            x=22-25
            y=1-3
        [/remove_shroud]

        [unit]
            side=1
            type=Dwarvish Thunderguard
            x=23
            y=3
            random_traits=yes
            name= _ "Borras"
            id=Borras
        [/unit]

        [unit]
            side=1
            type=Dwarvish Fighter
            x=24
            y=2
            random_traits=yes
            generate_name=yes
        [/unit]

        [if]
            [variable]
                name=saga_told
                numerical_equals=0
            [/variable]

            [then]
                {JAIL_SAGA (Borras)}
            [/then]
        [/if]
    [/event]

    [event]
        name=moveto

        [filter]
            side=1
            x=25
            y=7
        [/filter]

        [terrain]
            x=25
            y=8
            terrain=Uu
        [/terrain]

        [remove_shroud]
            x=22-25
            y=8-10
        [/remove_shroud]

        [unit]
            side=1
            type=Dwarvish Steelclad
            x=24
            y=8
            random_traits=yes
            name= _ "Zamak"
            id=Zamak
        [/unit]

        [unit]
            side=1
            type=Dwarvish Thunderguard
            x=24
            y=9
            random_traits=yes
            generate_name=yes
        [/unit]

        [if]
            [variable]
                name=saga_told
                numerical_equals=0
            [/variable]

            [then]
                {JAIL_SAGA (Zamak)}
            [/then]
        [/if]
    [/event]

    [event]
        name=moveto
        first_time_only=no

        [filter]
            side=1
            x=12
            y=1
        [/filter]

        [if]
            [variable]
                name=key_read
                equals=no
            [/variable]

            [then]
                [message]
                    speaker=unit
                    message= _ "When I step on this rune, I feel strange indeed. I feel like I am being pulled somewhere else, but at the same time being held back by an equally powerful force."
                [/message]

                [message]
                    speaker="Angarthing"
                    message= _ "It seems to be some sort of a teleportation device. What's more, the bindings that are preventing it from working seem to be the same ones that bar those sealed gates."
                [/message]
            [/then]
        [/if]

        [if]
            [variable]
                name=key_read
                equals=yes
            [/variable]

            [then]
                [teleport]
                    [filter]
                        x,y=$x1,$y1
                    [/filter]
                    x,y=37,43
                [/teleport]

                # In case user never puts anyone through the sealed door
                {ACTIVATE_LICHES}
            [/then]
        [/if]
    [/event]

    [event]
        name=moveto
        first_time_only=no

        [filter]
            side=1
            x=20
            y=1
        [/filter]

        [if]
            [variable]
                name=key_read
                equals=no
            [/variable]

            [then]
                [message]
                    speaker=unit
                    message= _ "When I step on this rune, I feel strange indeed. I feel like I am being pulled somewhere else, but at the same time being held back by an equally powerful force."
                [/message]

                [message]
                    speaker="Angarthing"
                    message= _ "It seems to be some sort of a teleportation device. What's more, the bindings that are preventing it from working seem to be the same ones that bar those sealed gates."
                [/message]
            [/then]
        [/if]

        [if]
            [variable]
                name=key_read
                equals=yes
            [/variable]

            [then]
                [teleport]
                    [filter]
                        x,y=$x1,$y1
                    [/filter]
                    x,y=41,43
                [/teleport]
            [/then]
        [/if]
    [/event]

    [event]
        name=sighted

        [filter]
            id="Aragoth"
        [/filter]

        [gold]
            side=4
            amount=300
        [/gold]

        [message]
            speaker="Aragoth"
            message= _ "Our master's ritual must not be interrupted. Stop them!"
        [/message]
    [/event]

    [event]
        name=moveto

        [filter]
            side=1
            x=22,22
            y=54,55
        [/filter]

        [message]
            speaker=unit
            message= _ "Yon doors are big, tightly locked - and, I would imagine, well barricaded. This may take a while."
        [/message]

        [message]
            speaker="Aiglondur"
            message= _ "Go through that rubble yonder; see if you can dig up some sort of battering ram."
        [/message]

        [message]
            speaker=narrator
            image=misc/empty.png
            message= _ "One hour later"
        [/message]

        [message]
            speaker="Aiglondur"
            message= _ "The door is about to give. Brace yourselves, everyone."
        [/message]

        [terrain]
            x=21,21
            y=54,55
            terrain=Uu
        [/terrain]
    [/event]

    [event]
        name=die

        [filter]
            id=Karrag
        [/filter]

        [message]
            speaker=Karrag
            message=_ "No! No! No! Dirtgrubbers must die! The true people must rule all!"
        [/message]

        [message]
            speaker=Aiglondur
            message=_ "The 'true people' speak through our axes. Die, foul lich."
        [/message]

        [endlevel]
            result=victory
        [/endlevel]
    [/event]

    [event]
        name="die"
        [filter]
            id="Dulcatulos"
        [/filter]

        [message]
            speaker=Aiglondur
            message=_"Without Dulcatulos to explain our actions to the Kal Karthans we'll have to fight them, too. Our mission has failed."
        [/message]

        [endlevel]
            result=defeat
        [/endlevel]
    [/event]
[/scenario]

#undef MASKED_GUARD
#undef MASKED_SNIPER
#undef MASKED_STALWART
#undef JAIL_SAGA
#undef ACTIVATE_LICHES
