#textdomain wesnoth-thot

[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}
    {SCENARIO_MUSIC "vengeful.ogg"}
    {VICTORY_AND_DEFEAT_MUSIC}

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

    turns=-1

    {INITIALIZE_LICHES}

    [side]
        type="Dwarvish Fighter"
        description="Aiglondur"
        user_description=_"Aiglondur"
        canrecruit="1"
        side="1"
        controller="human"
        team_name="good"
        fog="no"
        shroud="yes"
        recruit="Dwarvish Fighter,Dwarvish Thunderer,Dwarvish Guardsman,Mage"
        {GOLD 220 200 180}	# BALANCE
    [/side]

    [side]
        type="Dwarvish Rune Lord"
        description="Karrag"
        user_description=_"Karrag"
        profile=portraits/karrag.png
        canrecruit="1"
        side="2"
        colour=black
        controller="ai"
        team_name="evil"
        fog="no"
        shroud="no"
        [ai]
            passive_leader=yes
            grouping=defensive
            {ATTACK_DEPTH 4 5 5}
        [/ai]
        {GOLD 200 250 300}
    [/side]

    [side]
        type="Dwarvish Masked Steelclad"
        description="Dufon"
        user_description=_"Masked Dwarf"
        profile=portraits/maskeddwarf2.png
        canrecruit="1"
        side="3"
        controller="ai"
        team_name="evil"
        fog="no"
        shroud="no"
        recruit="Dwarvish Masked Fighter, Dwarvish Masked Thunderer, Dwarvish Ulfserker"
        [ai]
            {NO_SCOUTS}
            recruitment_ignore_bad_movement=yes
            recruitment_pattern=fighter,fighter,mixed fighter
        [/ai]
        gold=0	# BALANCE
    [/side]

    [side]
        type="Dwarvish Masked Lord"
        description="Aragoth"
        user_description=_"Masked Dwarf"
        profile=portraits/maskeddwarf3.png
        canrecruit="1"
        side="4"
        controller="ai"
        team_name="evil"
        fog="no"
        shroud="no"
        recruit="Dwarvish Masked Fighter, Dwarvish Masked Steelclad, Dwarvish Masked Thunderer, Dwarvish Masked Thunderguard, Dwarvish Ulfserker, Dwarvish Berserker"
        [ai]
            {NO_SCOUTS}
            recruitment_ignore_bad_movement=yes
            recruitment_pattern=fighter,fighter,mixed fighter
        [/ai]
        gold=0	# BALANCE
    [/side]

    [side]
        type="Dwarvish Masked Lord"
        description="Dranath"
        user_description=_"Masked Dwarf"
        profile=portraits/maskeddwarf4.png
        canrecruit="1"
        side="5"
        controller="ai"
        team_name="evil"
        fog="no"
        shroud="no"
        recruit="Dwarvish Masked Fighter, Dwarvish Masked Steelclad, Dwarvish Masked Thunderer, Dwarvish Masked Thunderguard, Dwarvish Ulfserker, Dwarvish Berserker"
        [ai]
            {NO_SCOUTS}
            recruitment_ignore_bad_movement=yes
            recruitment_pattern=fighter,fighter,mixed fighter
        [/ai]
        gold=0	# BALANCE
    [/side]

    [side]
        type="Lich"
        description="Fleleen"
        user_description=_"Fleleen"
        canrecruit="1"
        side="6"
        controller="ai"
        team_name="evil"
        fog="no"
        shroud="no"
        {GOLD 200 250 300}
    [/side]

    [side]
        type="Lich"
        description="Lannex"
        user_description=_"Lannex"
        canrecruit="1"
        side="7"
        controller="ai"
        team_name="evil"
        fog="no"
        shroud="no"
        [ai]
            {NO_SCOUTS}
        [/ai]
        {GOLD 200 250 300}
    [/side]

    [side]
        type="Dwarvish Masked Steelclad"
        description="Sashaon"
        user_description=_"Masked Dwarf"
        profile=portraits/maskeddwarf.png
        canrecruit="1"
        side="8"
        controller="ai"
        team_name="evil"
        fog="no"
        shroud="no"
        recruit="Dwarvish Masked Fighter, Dwarvish Masked Thunderer, Dwarvish Ulfserker"
        {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}
    {@campaigns/The_Hammer_of_Thursagan/utils/macros.cfg}

    {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 10 25}
        {MASKED_GUARD 14 25}
        {MASKED_GUARD 18 25}
        {MASKED_SNIPER 12 25}
        {MASKED_SNIPER 16 25}
        {MASKED_SNIPER 20 25}

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

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

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

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

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

        {DRAUG_GUARD 20 43}
        {DRAUG_GUARD 20 44}
        {DRAUG_GUARD 20 45}
        {DRAUG_GUARD 28 43}
        {DRAUG_GUARD 28 44}
        {DRAUG_GUARD 28 45}
        {DRAUG_GUARD 22 42}
        {DRAUG_GUARD 24 41}
        {DRAUG_GUARD 26 42}
        {DRAUG_GUARD 26 46}
        {DRAUG_GUARD 24 47}
        {DRAUG_GUARD 22 46}

        {GIANT_SPIDER 45 3}
        {GIANT_SPIDER 39 12}
        {GIANT_SPIDER 44 7}
        {GIANT_SPIDER 39 7}
        {GIANT_SPIDER 49 5}
        {GIANT_SPIDER 38 2}

        [recall]
            description="Angarthing"
        [/recall]

        [recall]
            description="Dulcatulos"
        [/recall]

        [recall]
            description="Ratheln"
        [/recall]

        {CONDITIONAL_MAGE_RECRUITING}

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

        [message]
            description="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]
            description="Angarthing"
            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]
            description="Aiglondur"
            message=_"Where *is* Karrag?  We can't have been more than seconds behind him."
        [/message]

        [message]
            description="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]
            description="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]
            description="Dulcatulos"
            message=_"Those are war-drums!"
        [/message]

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

        [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]

    [event]
        name=sighted

        [filter]
            description="Dranath"
        [/filter]

        [message]
            description="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]

    [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 sees that guard spoke truth.  These doors cannot be forced open by any means we have!"
                [/message]

                [message]
                    description="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	# wmllint: ignore
                [/terrain]

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

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

                {ACTIVATE_LICHES}
            [/then]
        [/if]
    [/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	# wmllint: ignore
        [/terrain]
    [/event]

    [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]
            description="Angarthing"
            message= _ "I believe that will be the key-spell for that sealed door."
        [/message]

        [message]
            description="Angarthing"
            message= _ "(reads) Kannin a'kana du'masi a'forigln de'amp."
        [/message]

        [message]
            description="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	# wmllint: ignore
        [/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	# wmllint: ignore
        [/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	# wmllint: ignore
        [/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	# wmllint: ignore
        [/terrain]
    [/event]

    [event]
        name=moveto

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

        [terrain]
            x=10
            y=2
            terrain=Uu	# wmllint: ignore
        [/terrain]

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

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

        [unit]
            side=1
            type=Dwarvish Thunderer
            x=8
            y=1
            random_traits=yes
            generate_description=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	# wmllint: ignore
        [/terrain]

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

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

        [unit]
            side=1
            type=Dwarvish Fighter
            x=15
            y=2
            random_traits=yes
            generate_description=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	# wmllint: ignore
        [/terrain]

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

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

        [unit]
            side=1
            type=Dwarvish Fighter
            x=24
            y=2
            random_traits=yes
            generate_description=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	# wmllint: ignore
        [/terrain]

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

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

        [unit]
            side=1
            type=Dwarvish Thunderguard
            x=24
            y=9
            random_traits=yes
            generate_description=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]
                    description="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]

    # This event is in case the player gets a unit through the sneak tunnel
    # before opening the sealed doors.
    [event]
        name=moveto

        [filter]
            side=1
            x=53
            y=31
        [/filter]

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

        {ACTIVATE_LICHES}
    [/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]
                    description="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]
            description="Aragoth"
        [/filter]

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

        [message]
            description="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]
            description="Aiglondur"
            message= _ "Go thorough 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]
            description="Aiglondur"
            message= _ "OK, the door is about to give. Brace yourselves, everyone."
        [/message]

        [terrain]
            x=21,21
            y=54,55
            terrain=Uu	# wmllint: ignore
        [/terrain]
    [/event]

    [event]
        name=die

        [filter]
            description=Karrag
        [/filter]

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

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

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

    [event]
        name="die"
        [filter]
            description="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]
