#textdomain wesnoth-thot

[scenario]
    id=12_The_Underlevels
    name= _ "The Underlevels"
    map_data="{campaigns/The_Hammer_of_Thursagan/maps/12_The_Underlevels.map}"
    turns=65
    next_scenario=13_Epilogue
    victory_when_enemies_defeated=yes

    {UNDERGROUND}

    {SCENARIO_MUSIC silence.ogg}

    # wmllint: validate-off
    [side]
        side=1
        controller=human
        recruit="Dwarvish Fighter,Dwarvish Thunderer,Dwarvish Guardsman, Dwarvish Scout"
        {GOLD 350 300 250}
        team_name=good
        user_team_name= _ "Alliance"
        {FLAG_VARIANT knalgan}
        village_support=2

        # wmllint: recognize Aiglondur
        {CHARACTER_STATS_AIGLONDUR}

        shroud=yes
        facing=se
    [/side]

#define RECRUITS_MASKED_DWARVES
    recruit="Dwarvish Masked Fighter, Dwarvish Masked Steelclad, Dwarvish Masked Thunderer, Dwarvish Masked Thunderguard, Dwarvish Ulfserker, Dwarvish Berserker, Dwarvish Masked Guardsman, Dwarvish Masked Stalwart"
#enddef

#define MASKED_DWARF TYPE X Y
    [unit]
        type={TYPE}
        x={X}
        y={Y}
        [modifications]
            {TRAIT_LOYAL}
        [/modifications]
        ai_special=guardian
        random_traits=yes
        name= _ "Masked Dwarf"
    [/unit]
#enddef

    [side]
        side=2
        controller=ai
        recruit="Necrophage,Draug,Deathblade,Banebow"
        gold=0 # Will change when the side is activated
        income=-2
        team_name=evil
        user_team_name= _ "Masked Dwarves"
        {FLAG_VARIANT knalgan}

        # wmllint: recognize Karrag
        {CHARACTER_STATS_KARRAG}

        color=black
        facing=nw

        {MASKED_DWARF (Dwarvish Masked Sentinel)    48 20}
        {MASKED_DWARF (Dwarvish Masked Sentinel)    48 24}
        {MASKED_DWARF (Dwarvish Masked Steelclad)    51 19}
        {MASKED_DWARF (Dwarvish Masked Steelclad)    51 26}
        {MASKED_DWARF (Dwarvish Masked Steelclad)    52 18}
        {MASKED_DWARF (Dwarvish Masked Steelclad)    52 26}
        {MASKED_DWARF (Dwarvish Masked Stalwart)    53 20}
        {MASKED_DWARF (Dwarvish Masked Stalwart)    53 25}
        {MASKED_DWARF (Dwarvish Masked Dragonguard)    54 21}
        {MASKED_DWARF (Dwarvish Masked Dragonguard)    54 23}

        {NOTRAIT_UNIT () "Draug" 56 18} {GUARDIAN} {NO_UPKEEP}
        {NOTRAIT_UNIT () "Banebow" 56 19} {GUARDIAN} {NO_UPKEEP}
        {NOTRAIT_UNIT () "Draug" 57 20} {GUARDIAN} {NO_UPKEEP}
        {NOTRAIT_UNIT () "Draug" 57 25} {GUARDIAN} {NO_UPKEEP}
        {NOTRAIT_UNIT () "Banebow" 56 25} {GUARDIAN} {NO_UPKEEP}
        {NOTRAIT_UNIT () "Draug" 56 26} {GUARDIAN} {NO_UPKEEP}

        [ai]
            passive_leader=yes
            grouping=defensive
            {ATTACK_DEPTH 4 5 5}
        [/ai]
    [/side]
    # wmllint: validate-on

    [side]
        side=3
        controller=ai

        {RECRUITS_MASKED_DWARVES}

        gold=0 # Will change when the side is activated
        {INCOME 5 9 13}
        team_name=evil
        user_team_name= _ "Masked Dwarves"
        {FLAG_VARIANT knalgan}

        type=Dwarvish Masked Lord
        id=Dufon
        name= _ "Masked Dwarf"
        profile=portraits/maskeddwarf4.png~RIGHT()
        canrecruit=yes

        facing=nw

        {MASKED_DWARF (Dwarvish Masked Steelclad)    23 20}
        {MASKED_DWARF (Dwarvish Masked Steelclad)    28 26}
        {MASKED_DWARF (Dwarvish Masked Thunderer) 24 19}
        {MASKED_DWARF (Dwarvish Masked Thunderer) 24 20}
        {MASKED_DWARF (Dwarvish Masked Thunderer) 27 26}
        {MASKED_DWARF (Dwarvish Masked Thunderer) 28 25}

        [ai]
            {NO_SCOUTS}
            recruitment_pattern=fighter,fighter,mixed fighter
        [/ai]
    [/side]

    [side]
        side=4
        controller=ai

        {RECRUITS_MASKED_DWARVES}

        gold=0 # Will change when the side is activated
        {INCOME 8 12 16}
        team_name=evil
        user_team_name= _ "Masked Dwarves"
        {FLAG_VARIANT knalgan}

        type=Dwarvish Masked Lord
        id=Aragoth
        name= _ "Masked Dwarf"
        profile=portraits/maskeddwarf2.png~RIGHT()
        canrecruit=yes

        facing=sw

        {MASKED_DWARF (Dwarvish Masked Sentinel)     30 11}
        {MASKED_DWARF (Dwarvish Masked Sentinel)     33 12}

        [ai]
            {NO_SCOUTS}
            recruitment_pattern=fighter,fighter,mixed fighter
        [/ai]
    [/side]

    [side]
        side=5
        controller=ai

        {RECRUITS_MASKED_DWARVES}

        gold=0 # Will change when the side is activated
        {INCOME 8 12 16}
        team_name=evil
        user_team_name= _ "Masked Dwarves"
        {FLAG_VARIANT knalgan}

        type=Dwarvish Masked Lord
        id=Dranath
        name= _ "Masked Dwarf"
        profile=portraits/maskeddwarf3.png~RIGHT()
        canrecruit=yes

        facing=nw

        {MASKED_DWARF (Dwarvish Masked Sentinel)     25 32}
        {MASKED_DWARF (Dwarvish Masked Sentinel)     29 31}

        [ai]
            {NO_SCOUTS}
            recruitment_pattern=fighter,fighter,mixed fighter
        [/ai]
    [/side]

    # Scenery
    {PLACE_IMAGE "scenery/rune2.png" 38 21}
    {PLACE_IMAGE "scenery/rune4.png" 38 23}
    {PLACE_IMAGE "scenery/rune2.png" 46 6}
    {PLACE_IMAGE "scenery/rune4.png" 44 36}

    {PLACE_IMAGE "items/bones.png" 19 5}
    {PLACE_IMAGE "items/bones.png" 25 5}

    {PLACE_IMAGE "items/chest.png" 48 13}
    {PLACE_IMAGE "items/chest.png" 14 29}

    # Starting villages
    {STARTING_VILLAGES 1 4}
    {STARTING_VILLAGES 2 9}
    {STARTING_VILLAGES 3 5}
    {STARTING_VILLAGES_AREA 3 23 27 4}
    {STARTING_VILLAGES_AREA 3 35 28 1}
    {STARTING_VILLAGES_AREA 3 23 13 4}
    {STARTING_VILLAGES 4 6}
    {STARTING_VILLAGES 5 6}

    [event]
        name=prestart

        [objectives]
            side=1
            [objective]
                description= _ "Find and 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]

            {TURNS_RUN_OUT}
            {IS_LAST_SCENARIO}
        [/objectives]

        [recall]
            id=Angarthing
        [/recall]

        [recall]
            id=Dulcatulos
        [/recall]

        [recall]
            id=Ratheln
        [/recall]

        {MODIFY_UNIT (side=1) facing se}

        {VARIABLE runes_activated 0}
        {VARIABLE rune_one 0}
        {VARIABLE rune_two 0}
    [/event]

    [event]
        name=unit placed
        first_time_only=no
        [filter]
            side=1
        [/filter]

        [object]
            silent=yes
            [filter]
                x,y=$x1,$y1
            [/filter]
            [effect]
                apply_to=vision_costs
                replace=yes
                [vision_costs]
                    impassable=3
                [/vision_costs]
            [/effect]
        [/object]
    [/event]

    {CONDITIONAL_MAGE_RECRUITING}

    [event]
        name=start

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

        [message]
            speaker=Dulcatulos
            message= _ "It has been... so many years since I’ve been down here. Only Karrag and his personal followers used this level. I can't believe I never wondered about that before."
        [/message]

        [message]
            speaker=Angarthing
            # wmllint: local spelling glamours
            message= _ "It is Karrag's doing—his 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 <i>is</i> Karrag? We can’t have been more than seconds behind him."
        [/message]

        [message]
            speaker=Angarthing
            message= _ "Most 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]

        {REPLACE_SCENARIO_MUSIC knalgan_theme.ogg}
        {APPEND_MUSIC           siege_of_laurelmor.ogg}
        {APPEND_MUSIC           underground.ogg}
        {APPEND_MUSIC           the_dangerous_symphony.ogg}
        {APPEND_MUSIC           the_deep_path.ogg}
    [/event]

    ##################################### Hidden events #####################################

    # Small unit hitpoint bonuses
    [event]
        name=moveto
        first_time_only=yes
        [filter]
            side=1
            x,y=19,5
        [/filter]

        [message]
            speaker=unit
            message= _ "Someone died here."
        [/message]

        # Secret easter egg bonus
        # Give a unit 3 extra hp

        [object]
            [filter]
                x,y=$x1,$y1
            [/filter]
            duration=forever
            silent=yes
            [effect]
                apply_to=hitpoints
                increase_total=3
                increase=3
            [/effect]
        [/object]
    [/event]
    [event]
        name=moveto
        first_time_only=yes
        [filter]
            side=1
            x,y=25,5
        [/filter]

        [message]
            speaker=unit
            message= _ "Poor guy didn't make it."
        [/message]

        # Secret easter egg bonus
        # Give a unit 3 extra hp

        [object]
            [filter]
                x,y=$x1,$y1
            [/filter]
            duration=forever
            silent=yes
            [effect]
                apply_to=hitpoints
                increase_total=3
                increase=3
            [/effect]
        [/object]
    [/event]

    # Gold
    [event]
        name=moveto
        first_time_only=yes
        [filter]
            side=1
            x,y=48,13
        [/filter]

        [message]
            speaker=unit
            message= _ "There's some gold in here!"
        [/message]

        [gold]
            side=1
            amount={ON_DIFFICULTY 50 40 30}
        [/gold]
        {PLACE_IMAGE "items/chest-open.png" 48 13}
    [/event]

    [event]
        name=moveto
        first_time_only=yes
        [filter]
            side=1
            x,y=14,29
        [/filter]

        [message]
            speaker=unit
            message= _ "I found some gold!"
        [/message]

        [gold]
            side=1
            amount={ON_DIFFICULTY 50 40 30}
        [/gold]
        {PLACE_IMAGE "items/chest-open.png" 14 29}
    [/event]
    #########################################################################################
    ################################## Gate opening events ##################################
    [event]
        name=moveto
        first_time_only=yes
        [filter]
            side=1
            x=16,17
            y=18,18
        [/filter]

        [if]
            [variable]
                name=unit.id
                equals=Aiglondur
            [/variable]
            [or]
                [variable]
                    name=unit.id
                    equals=Angarthing
                [/variable]
            [/or]
            [then]
                [message]
                    speaker=unit
                    message= _ "The gates are locked. I will have to break them open by force!"
                [/message]
            [/then]
            [else]
                [message]
                    speaker=unit
                    message= _ "The gates are locked!"
                [/message]

                [message]
                    speaker=Aiglondur
                    message= _ "Force them open!"
                [/message]

                [message]
                    speaker=unit
                    message= _ "Yes, sir!"
                [/message]
            [/else]
        [/if]

        [delay]
            time=1000
        [/delay]

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

        [delay]
            time=100
        [/delay]

        [terrain]
            x=18,17
            y=18,19
            terrain=Ur^Pr/o
        [/terrain]
        [redraw]
            clear_shroud=yes
            side=1
        [/redraw]

        [delay]
            time=1000
        [/delay]

        [message]
            speaker=Angarthing
            message= _ "Let us proceed onward."
        [/message]
    [/event]

    [event]
        name=moveto
        first_time_only=yes
        [filter]
            side=1
            x,y=42,5
        [/filter]

        [if]
            [variable]
                name=unit.id
                equals=Aiglondur
            [/variable]
            [or]
                [variable]
                    name=unit.id
                    equals=Angarthing
                [/variable]
            [/or]
            [then]
                [message]
                    speaker=unit
                    message= _ "There's something behind this door. I shall break it down!"
                [/message]
            [/then]
            [else]
                [message]
                    speaker=unit
                    message= _ "There's something behind this door."
                [/message]

                [message]
                    speaker=Aiglondur
                    message= _ "Break it down!"
                [/message]
            [/else]
        [/if]

        [delay]
            time=1000
        [/delay]

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

        [delay]
            time=100
        [/delay]

        [terrain]
            x,y=43,6
            terrain=Ur^Pr/o
        [/terrain]
        [redraw]
            clear_shroud=yes
            side=1
        [/redraw]
    [/event]

    [event]
        name=moveto
        first_time_only=yes
        [filter]
            side=1
            x,y=40,37
        [/filter]

        [message]
            speaker=unit
            message= _ "It looks like there is a rune behind this gate!"
        [/message]

        [delay]
            time=1000
        [/delay]

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

        [delay]
            time=100
        [/delay]

        [terrain]
            x,y=41,37
            terrain=Ur^Pr\o
        [/terrain]
        [redraw]
            clear_shroud=yes
            side=1
        [/redraw]
    [/event]

    #########################################################################################
    ########################## Catching sight of enemy leaders ##############################
    [event]
        name=sighted
        [filter]
            side=3
        [/filter]
        [filter_second]
            side=1
        [/filter_second]

        [message]
            speaker=unit
            message= _ "The dirtgrubber-friends have come! Slay them all!"
        [/message]

        [message]
            speaker=second_unit
            message= _ "You could not stop us before and you won't be stopping us now!"
        [/message]

        # Activate side 3
        [gold]
            side=3
            amount={ON_DIFFICULTY 30 50 70}
        [/gold]
    [/event]

    [event]
        name=sighted
        [filter]
            id=Dufon
        [/filter]
        [filter_second]
            side=1
        [/filter_second]

        [message]
            speaker=Dufon
            message= _ "You shall never pass through here! The doors I guard are sealed by the power of the Hammer itself."
        [/message]

        [message]
            speaker=second_unit
            message= _ "You won't stop us!"
        [/message]

        [message]
            speaker=Dufon
            message= _ "Fools! Even should you defeat me, the master's ritual will soon be complete and you shall all become his slaves!"
        [/message]

        [gold]
            side=3
            amount={ON_DIFFICULTY 40 60 80}
        [/gold]
    [/event]

    [event]
        name=sighted
        [filter]
            id=Aragoth
        [/filter]
        [filter_second]
            side=1
        [/filter_second]

        [message]
            speaker=Aragoth
            message= _ "Your path forward ends here! Once the lord's spell is complete, your souls will soon be chained to his will!"
        [/message]

        # Give side 4 some gold
        [gold]
            side=4
            amount={ON_DIFFICULTY 75 100 125}
        [/gold]
    [/event]

    [event]
        name=sighted
        [filter]
            id=Dranath
        [/filter]
        [filter_second]
            side=1
        [/filter_second]

        [message]
            speaker=Dranath
            message= _ "The dirtgrubbers have come! Stop their advance!"
        [/message]

        # Give side 5 some gold
        [gold]
            side=5
            amount={ON_DIFFICULTY 75 100 125}
        [/gold]
    [/event]
    #########################################################################################
    #################################### Rune events ########################################
    [event]
        name=moveto
        first_time_only=yes
        [filter]
            side=1
            x,y=46,6
        [/filter]
        [filter_condition]
            [variable]
                name=rune_one
                numerical_equals=0
            [/variable]
        [/filter_condition]

        [message]
            speaker=unit
            message= _ "This must be one of the runic keys!"
        [/message]

        [delay]
            time=1000
        [/delay]

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

        [delay]
            time=100
        [/delay]

        {PLACE_IMAGE "scenery/rune2-glow.png" 38 21}
        {PLACE_IMAGE "scenery/rune2-glow.png" 46 6}

        [delay]
            time=1000
        [/delay]

        # Activate the rune
        {VARIABLE_OP runes_activated add 1}
        {VARIABLE_OP rune_one add 1}

        # Check if both runes are activated or not
        [if]
            [variable]
                name=runes_activated
                equals=2
            [/variable]
            [then]
                [fire_event]
                    name=runes_found
                [/fire_event]
            [/then]
            [else]
                [message]
                    speaker=Aiglondur
                    message= _ "We still need to find the other one!"
                [/message]

                [objectives]
                    side=1
                    [objective]
                        description= _ "Find and activate the runic keys (one remaining)"
                        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]
                    [note]
                        description= _ "You may teleport units between matching runes (the destination must be clear)"
                    [/note]
                    {TURNS_RUN_OUT}
                    {IS_LAST_SCENARIO}
                [/objectives]
            [/else]
        [/if]
    [/event]

    # Rune 1 teleportation
    [event]
        name=moveto
        first_time_only=no
        [filter]
            side=1
            x,y=46,6
        [/filter]
        [filter_condition]
            [variable]
                name=rune_one
                numerical_equals=1
            [/variable]
            [and]
                [not]
                    [have_unit]
                        x,y=38,21
                    [/have_unit]
                [/not]
            [/and]
        [/filter_condition]

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

        [unstore_unit]
            variable=unit
            x,y=38,21
            find_vacant=yes
        [/unstore_unit]

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

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

    [event]
        name=moveto
        first_time_only=no
        [filter]
            side=1
            x,y=38,21
        [/filter]
        [filter_condition]
            [variable]
                name=rune_one
                numerical_equals=1
            [/variable]
            [and]
                [not]
                    [have_unit]
                        x,y=46,6
                    [/have_unit]
                [/not]
            [/and]
        [/filter_condition]

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

        [unstore_unit]
            variable=unit
            x,y=46,6
            find_vacant=yes
        [/unstore_unit]

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

    # Rune 2 activation
    [event]
        name=moveto
        first_time_only=yes
        [filter]
            side=1
            x,y=44,36
        [/filter]
        [filter_condition]
            [variable]
                name=rune_two
                numerical_equals=0
            [/variable]
        [/filter_condition]

        [message]
            speaker=unit
            message= _ "We've found a runic key!"
        [/message]

        [delay]
            time=1000
        [/delay]

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

        [delay]
            time=100
        [/delay]

        {PLACE_IMAGE "scenery/rune4-glow.png" 38 23}
        {PLACE_IMAGE "scenery/rune4-glow.png" 44 36}

        [delay]
            time=1000
        [/delay]

        # Activate the second rune
        {VARIABLE_OP runes_activated add 1}
        {VARIABLE_OP rune_two add 1}

        # Check if both runes are activated
        [if]
            [variable]
                name=runes_activated
                equals=2
            [/variable]
            [then]
                [fire_event]
                    name=runes_found
                [/fire_event]
            [/then]
            [else]
                [message]
                    speaker=Aiglondur
                    message= _ "We still need to find the other one!"
                [/message]

                [objectives]
                    side=1
                    [objective]
                        description= _ "Find and activate the runic keys (one remaining)"
                        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]
                    [note]
                        description= _ "You may teleport units between matching runes (the destination must be clear)"
                    [/note]
                    {TURNS_RUN_OUT}
                    {IS_LAST_SCENARIO}
                [/objectives]
            [/else]
        [/if]
    [/event]

    # Rune 2 teleportation
    [event]
        name=moveto
        first_time_only=no
        [filter]
            side=1
            x,y=44,36
        [/filter]
        [filter_condition]
            [variable]
                name=rune_two
                numerical_equals=1
            [/variable]
            [and]
                [not]
                    [have_unit]
                        x,y=38,23
                    [/have_unit]
                [/not]
            [/and]
        [/filter_condition]

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

        [unstore_unit]
            variable=unit
            x,y=38,23
            find_vacant=yes
        [/unstore_unit]

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

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

    [event]
        name=moveto
        first_time_only=no
        [filter]
            side=1
            x,y=38,23
        [/filter]
        [filter_condition]
            [variable]
                name=rune_two
                numerical_equals=1
            [/variable]
            [and]
                [not]
                    [have_unit]
                        x,y=44,36
                    [/have_unit]
                [/not]
            [/and]
        [/filter_condition]

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

        [unstore_unit]
            variable=unit
            x,y=44,36
            find_vacant=yes
        [/unstore_unit]

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

    # When both runes are activated, open the area to the final chamber
    [event]
        name=runes_found
        first_time_only=yes

        [message]
            speaker=Angarthing
            message= _ "The keys have been found. The door should open..."
        [/message]

        {SCROLL_TO 38 22}

        [delay]
            time=1000
        [/delay]

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

        [delay]
            time=500
        [/delay]

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

        [delay]
            time=500
        [/delay]

        [terrain]
            x=39,40
            y=23,23
            terrain=Uu
        [/terrain]
        [terrain]
            x=40,41
            y=22,23
            terrain=Ur
        [/terrain]
        [terrain]
            x=39,40
            y=22,21
            terrain=Ur^Es
        [/terrain]
        [terrain]
            x,y=41,22
            terrain=Uu^Emf
        [/terrain]
        [redraw][/redraw]

        [delay]
            time=500
        [/delay]

        [message]
            speaker=Aiglondur
            message= _ "The lich surely awaits us within. We must be on guard."
        [/message]

        [objectives]
            side=1
            [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]
            [note]
                description= _ "You may teleport units between matching runes (the destination must be clear)"
            [/note]
            {TURNS_RUN_OUT}
            {IS_LAST_SCENARIO}
        [/objectives]
    [/event]

    # If you get close to the final area, it tells you you need to activate the runes
    [event]
        name=moveto
        first_time_only=yes
        [filter]
            side=1
            x=36-38
            y=21-23
        [/filter]

        [filter_condition]
            [variable]
                name=key_read
                boolean_equals=no
            [/variable]
        [/filter_condition]

        [message]
            speaker=unit
            message= _ "It seems that the guard spoke the truth. These doors will not open to us!"
        [/message]

        [message]
            speaker=Angarthing
            message= _ "They are sealed by the ancient runelore of the Hammer. No amount of force can open these doors - we will need to find the keys to the seals here."
        [/message]

        [objectives]
            side=1
            [objective]
                description= _ "Find and activate the runic keys to the sealed door"
                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]
            {TURNS_RUN_OUT}
            {IS_LAST_SCENARIO}
        [/objectives]
    [/event]
    #########################################################################################
    ################################ Karrag's speeches ######################################
    [event]
        name=sighted
        [filter]
            side=2
        [/filter]
        [filter_second]
            side=1
        [/filter_second]

        [message]
            speaker=unit
            message= _ "My lord, the dirtgrubbers have entered our sanctuary!"
        [/message]

        [message]
            speaker=Karrag
            message= _ "Excellent! Their blood will provide plenty of fuel for my ritual!"
        [/message]

        # Karrag's initial wave
        [gold]
            side=2
            amount={ON_DIFFICULTY 130 150 170}
        [/gold]
    [/event]

    [event]
        name=sighted
        [filter]
            id=Karrag
        [/filter]
        [filter_second]
            side=1
        [/filter_second]

        [message]
            speaker=Karrag
            message= _ "So, the usurpers have arrived at last."
        [/message]

        [message]
            speaker=Aiglondur
            message= _ "We are not the usurpers but the liberators of Kal Kartha! We are here to free our kin from your dark sorcery!"
        [/message]

        [message]
            speaker=Karrag
            message= _ "You insolent fool! It is I who have led Kal Kartha to glory and I who have cleansed the lands of the true people from all unworthy scum! Kal Kartha owes me everything!"
        [/message]

        [message]
            speaker=Angarthing
            message= _ "No! You are the one who owes our brethren their freedom! You have ensnared their minds with your foul magic and now we are here to put an end to your tyrannical rule!"
        [/message]

        [message]
            speaker=Karrag
            message= _ "Any enemy of my rule is no better than the filthiest of dirtgrubbers. You no longer belong to the true people. You will become my slaves!"
        [/message]

        [message]
            speaker=Aiglondur
            message= _ "Not if we stop you here. AXES UP!"
        [/message]

        # Give Karrag more gold
        [gold]
            side=2
            amount={ON_DIFFICULTY 120 160 200}
        [/gold]
    [/event]

    [event]
        name=last breath
        [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]

        [message]
            speaker=Karrag
            message= _ "Nooo! My power... it wanes..."
        [/message]

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

        [message]
            speaker=Dulcatulos
            message= _ "And your rule is at an end, Karrag, once the brave lord of Kal Kartha."
        [/message]

        [message]
            speaker=Aiglondur
            message= _ "Do not mourn his passing, Dulcatulos. The Karrag you knew died many years ago when his lust for power consumed him. It is now time to put the past behind and right the wrongs that have been wrought here."
        [/message]

        [message]
            speaker=Angarthing
            message= _ "Aiglondur speaks the truth. The deed is done. Though the heart of the darkness is gone, there is still much to do. Much will have to be done to amend the desecration of the Hammer and the evil that has been done here."
        [/message]

        [message]
            speaker=Aiglondur
            message= _ "But first, we must bring this news to the rest of Kal Kartha. A new Lord must be chosen."
        [/message]

        [message]
            speaker=Angarthing
            message= _ "Aye, let us go."
        [/message]

        {CLEAR_VARIABLE runes_activated}
        {CLEAR_VARIABLE rune_one}
        {CLEAR_VARIABLE rune_two}

        [endlevel]
            result=victory
            carryover_report=no
        [/endlevel]
    [/event]
    #########################################################################################
    ######################################## Deaths #########################################
    [event]
        name=last breath
        [filter]
            id=Dufon
        [/filter]

        [message]
            speaker=Dufon
            message= _ "The master's ritual... must not be... interrupted..."
        [/message]
    [/event]

    [event]
        name=last breath
        [filter]
            id=Dranath
        [/filter]

        [message]
            speaker=Dranath
            message= _ "Imbeciles! Once the master's dark rite is complete, I will return to slay you myself!"
        [/message]
    [/event]

    [event]
        name=last breath
        [filter]
            id=Aragoth
        [/filter]

        [message]
            speaker=Aragoth
            message= _ "The heathens... have slain me-"
        [/message]
    [/event]
    #########################################################################################
    ################################## Running out of time ##################################

    [event]
        name=turn 57

        [message]
            speaker=Aiglondur
            message= _ "The air is cold with the stench of death."
        [/message]

        [message]
            speaker=Angarthing
            message= _ "No doubt it is this ritual that the masked ones spoke of. We must hurry and stop Karrag!"
        [/message]
    [/event]

    [event]
        name=turn 61

        [harm_unit]
            [filter]
                id=Aiglondur
            [/filter]
            animate=yes
            amount=3
            kill=no
            slowed=yes
        [/harm_unit]

        [message]
            speaker=Aiglondur
            message= _ "I feel as if the life is being sapped out of my body!"
        [/message]

        [message]
            speaker=Angarthing
            message= _ "Karrag's spell grows more powerful with every passing moment. If we do not defeat him now, we will all turn into his thralls!"
        [/message]
    [/event]

    [event]
        name=time over

        [message]
            speaker=Karrag
            message= _ "HAHAHAHA! Yes, yes, YES! The rite of death is complete at last! Die, you filthy dirtgrubbers, die so that I may raise you again as my mindless slaves!"
        [/message]

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

    {RENAME_MASKED_DWARVES 3,4,5}

    {HERODEATH_AIGLONDUR}
    {HERODEATH_ANGARTHING}
    {HERODEATH_RATHELN}
    {HERODEATH_DULCATULOS}
[/scenario]

#undef RECRUITS_MASKED_DWARVES
#undef MASKED_DWARF
