#textdomain wesnoth-utbs

[scenario]
    id=04_Descending_into_Darkness
    name= _ "Descending into Darkness"
    next_scenario=05_A_Subterranean_Struggle
    {UTBS_MAP 04_Descending_into_Darkness.map}
    victory_when_enemies_defeated=no

    {TWO_SUNS_DEFAULT_SCHEDULE}
    {TURNS 50 47 44}

    {INTRO_AND_SCENARIO_MUSIC "northerners.ogg" "suspense.ogg"}
    {EXTRA_SCENARIO_MUSIC "vengeful.ogg"}
    {EXTRA_SCENARIO_MUSIC "frantic.ogg"}

    {STORY_DESCENDING_INTO_DARKNESS}

    [side]
        side=1
        id=Kaleh
        type=Quenoth Youth
        canrecruit=yes
        {GOLD 250 200 150}
        {INCOME 5 4 3}
        controller=human
        shroud=yes
        fog=no
        {FLAG_VARIANT long}
        user_team_name= _ "team_name^Quenoth Elves"
    [/side]

    # Orcish leaders

    # The front line leader is a goblin who recruits goblins and orcs,
    # more scouts/weaker units than the other orcs.
    # He is also more aggressive.
    [side]
        side=2
        id=Panok
        name= _ "Panok"
#ifdef HARD
        type=Direwolf Rider
#else
        type=Goblin Knight
#endif
        canrecruit=yes

        {INCOME 8 12 16}
        {GOLD 80 120 160}
        controller=ai
        shroud=no
        fog=no
        team_name=evil
        user_team_name=_"Evil"
#ifdef EASY
        recruit=Orcish Grunt,Wolf Rider,Goblin Spearman,Orcish Archer
#endif
#ifdef NORMAL
        recruit=Orcish Grunt,Wolf Rider,Goblin Impaler,Orcish Archer,Goblin Knight
#endif
#ifdef HARD
        recruit=Orcish Warrior,Wolf Rider,Goblin Impaler,Orcish Crossbowman,Goblin Knight
#endif
        [ai]
            #orc leader guarding front lines is more aggressive
            aggression=0.8
            caution=0.1

#ifdef EASY
            recruitment_pattern=scout,scout,fighter,fighter,archer
#endif
#ifdef NORMAL
            recruitment_pattern=scout,scout,fighter,fighter,fighter,archer
#endif
#ifdef HARD
            recruitment_pattern=scout,scout,fighter,fighter,archer,fighter
#endif
        [/ai]
        {FLAG_VARIANT6 ragged}
    [/side]

    # this orc tribe specialized in ranged combat
    [side]
        side=3
        id=Turg
        name= _ "Turg"
#ifdef EASY
        type=Orcish Warrior
#else
        type=Orcish Warlord
#endif
        canrecruit=yes

        {INCOME 10 15 20}
        {GOLD 100 150 200}
        controller=ai
        shroud=no
        fog=no
        team_name=evil
        user_team_name=_"Evil"
#ifdef EASY
        recruit=Orcish Grunt,Wolf Rider,Orcish Archer,Orcish Assassin,Orcish Crossbowman
#endif
#ifdef NORMAL
        recruit=Orcish Grunt,Wolf Rider,Orcish Archer,Orcish Crossbowman,Orcish Slayer,Orcish Warrior
#endif
#ifdef HARD
        recruit=Orcish Warrior,Wolf Rider,Orcish Crossbowman,Orcish Slayer
#endif

        [ai]
            aggression=0.5
            recruitment_pattern=scout,fighter,archer,fighter,archer,mixed fighter

#ifdef EASY
            recruitment_pattern=scout,fighter,archer,fighter,fighter,mixed fighter
#endif
        [/ai]
        {FLAG_VARIANT6 ragged}
    [/side]

    # this orc tribe specialized in melee combat
    [side]
        side=4
        id="Ug'lok"
        name= _ "Ug’lok"
#ifdef EASY
        type=Orcish Warrior
#else
        type=Orcish Warlord
#endif
        canrecruit=yes
        {INCOME 10 15 20}
        {GOLD 100 150 200}
        controller=ai
        shroud=no
        fog=no
        team_name=evil
        user_team_name=_"Evil"
#ifdef EASY
        recruit=Orcish Grunt,Wolf Rider,Orcish Archer,Orcish Assassin,Orcish Warrior
#endif
#ifdef NORMAL
        recruit=Orcish Warrior,Wolf Rider,Orcish Archer,Orcish Slayer,Orcish Crossbowman
#endif
#ifdef HARD
        recruit=Orcish Warrior,Wolf Rider,Orcish Crossbowman,Orcish Slayer
#endif

        [ai]
            aggression=0.5
            recruitment_pattern=scout,fighter,archer,fighter,archer,mixed fighter
        [/ai]
        {FLAG_VARIANT6 ragged}
    [/side]

    # assassin's side
    [side]
        side=5
        no_leader=yes
        controller=ai
        shroud=no
        fog=no
        team_name=evil
        user_team_name=_"Evil"

        [ai]
            aggression=1.0
            caution=0.0
            [goal]
                name=target
                [criteria]
                    id=Kaleh
                [/criteria]
                value=1000
            [/goal]
        [/ai]
    [/side]

    # Prestart functions:
    # set scenario objectives
    # increase cost of recruiting units
    # recall main heroes
    # initialize starting variables
    # added extra NW bridge in EASY
    # randomly close one of the two exit tunnels at north of map
    # if EASY open up NW cave entrance bottleneck
    # give side 3 (green) control of cave villages
    # place features on map
    # increase speed of goblin knight Panok

    [event]
        name=prestart

        [objectives]
            summary= _ "Objectives:"
            [objective]
                description= _ "Kaleh must reach the exit tunnel at the north edge of the map"
                condition=win
            [/objective]

            [objective]
                description= _ "Death of Kaleh"
                condition=lose
            [/objective]
            [objective]
                description= _ "Death of Nym"
                condition=lose
            [/objective]
            [objective]
                description= _ "Death of Zhul"
                condition=lose
            [/objective]

            {TURNS_RUN_OUT}

            [gold_carryover]
                bonus=yes
                carryover_percentage=40
            [/gold_carryover]
        [/objectives]

        #recall heroes
        [recall]
            id=Nym
        [/recall]

        [recall]
            id=Zhul
        [/recall]

        [recall]
            id=Elyssa
        [/recall]

        #initialize variables
        {VARIABLE naga_ambush no}

        #close one of the two northern tunnels
        {RANDOM 1..10}

        [if]
            [variable]
                name=random
                less_than_equal_to=5
            [/variable]
            [then]
                #Western tunnel
                #to cavewall: 10,4

                [terrain]
                    x=10
                    y=4
                    terrain=Xu
                [/terrain]
            [/then]

            [else]
                #Eastern tunnel
                #to cavewall: 25,4 25,6 26,6 also 26,5 24,4 and 25,3 24,2
                #to shallow water 25,5

                [terrain]
                    x=24,25,25,26,26,25,24
                    y=4,4,6,5,6,3,2
                    terrain=Xu
                [/terrain]

                [terrain]
                    x=25
                    y=5
                    terrain=Wwg
                [/terrain]
            [/else]
        [/if]

        #on EASY difficulty, weaken orcs by deleting 2 towns
#ifdef EASY
        [terrain]
            x= 4,23
            y=19,11
            terrain=Uu
        [/terrain]
#endif

        # green (side 4) should control southern 4 cave villages at start
        # 2,15 4,19 6,17 9,16
        [capture_village]
            side=3
            x= 2, 4, 6, 9
            y=15,19,17,16
        [/capture_village]

        #side 1 (player) controls two villages at start
        [capture_village]
            side=1
            x=33,39
            y=39,38
        [/capture_village]

        {PLACE_IMAGE items/orcish-flag.png 36 33}
        {PLACE_IMAGE items/orcish-flag2.png 30 33}
        {PLACE_IMAGE items/orcish-flag.png 30 37}

        {PLACE_IMAGE items/orcish-flag3.png 31 16}
        {PLACE_IMAGE items/orcish-flag2.png 33 16}
        {PLACE_IMAGE items/orcish-flag.png 10 25}
        {PLACE_IMAGE items/orcish-flag.png 11 24}

        {PLACE_IMAGE scenery/signpost.png 7 1}

        #increase max moves by 1 (game engine will increase current moves to match)
        [object]
            id=FastGoblinKnight
            silent=yes

            [effect]
                apply_to=movement
                increase=1
            [/effect]

            [filter]
                id=Panok
            [/filter]
        [/object]

        # show the area outside the cave if the player found the map last scenario
        [if]
            [variable]
                name=sneak_up
                boolean_equals=yes
            [/variable]
            [then]
                [remove_shroud]
                    [not]
                        time_of_day_id=underground
                    [/not]
                    radius=1
                    side=1
                [/remove_shroud]
            [/then]
        [/if]

        {CLEAR_VARIABLE random,sneak_up}
    [/event]

    # starting dialogue
    [event]
        name=start

        [message]
            speaker=Nym
            message= _ "Those mountains are huge! I never thought they would be so big. And what’s that white stuff on the tops of the peaks?"
        [/message]

        [message]
            speaker=Zhul
            message= _ "I wish Garak were here, he’d know more about these lands than I do. I’ve never been up here, but I heard stories from the few who have made the journey and returned. That white stuff is called snow, Nym, and the mountains are very cold. These smaller hills aren’t as hard to cross, but they are filled with orcs and goblins. It may look peaceful now, but they hide in the many caves and tunnels beneath the surface."
        [/message]

        [message]
            speaker=Kaleh
            message= _ "I had another vision last night, Eloh told me that we had to continue north, but instead of trying to go over the mountains, she said that we had to go underneath them."
        [/message]

        [message]
            speaker=Nym
            message= _ "Underneath them? But how?"
        [/message]

        [message]
            speaker=Zhul
            message= _ "Orcs and goblins have been living here for hundreds of years and their network of tunnels and caves is more extensive than you might think. Who knows how far they go underground? We are ill-prepared for trekking over those frozen peaks. As much as I dislike those pitch-black caves, if we want to cross these mountains we may have no choice."
        [/message]

        [message]
            speaker=Elyssa
            message= _ "Other creatures besides orcs dig tunnels in the earth. Long ago dwarves mined mountains such as these, and huge trolls like to hide in the deep dark places under the earth. If your god is as omniscient as you seem to think, Kaleh, I wouldn’t be surprised if there were a way to cross under these mountains. I fear no darkness, and you won’t be lacking a source of fire or light."
        [/message]

        [message]
            speaker=Nym
            message= _ "Well if we are going to go under these mountains, we’re certainly going to have our hands full fighting all those orcs and goblins."
        [/message]

        [message]
            speaker=Zhul
            message= _ "Indeed. I want to warn you again, Kaleh, this isn’t the desert. The orcs love fighting in hills and caves, and we won’t have the advantages of fighting on the open sands. And with our recent losses we don’t have the numerical advantage we are used to. So we’d best be extra careful. Still if we can clear a path in the hills ahead of us, we should be able to escort our people into the tunnels. And hopefully underground it will be easier to protect them than out in the open."
        [/message]

        [message]
            speaker=Kaleh
            message= _ "Strike hard and fast and also be careful—right, this is going to be fun."
        [/message]
    [/event]

    # underground area should always have "underground" time,
    [time_area]
        x= 0-2,   3,   4,   5,   6,   7,   8,   9,  10,  11,12-13,14-15,16-17,18-21,22-25,26-31,  32,  33,34-38,39-41
        y=0-41,0-37,0-34,0-32,0-31,0-29,0-28,0-26,0-23,0-22, 0-21, 0-20, 0-19, 0-18, 0-17, 0-15,0-14,0-15, 0-14, 0-15
        {UNDERGROUND}
    [/time_area]

    # Event 1: goblins appear in nearby foothills

    # ambushes player at start of player’s turn after player invades hills

    [event]
        name=moveto

        [filter]
            x=30-40,23-31
            y=28-35,30-40
            side=1
        [/filter]

        [event]
            name=side 1 turn

            #If Easy: 5 goblins

            {NAMED_GENERIC_UNIT 2 (Goblin Spearman) 28 37 (Goblin Coward) ( _ "Goblin Coward")}
            [+unit]
                profile="portraits/goblins/spearman-2.png"
                facing=se
            [/unit]
            {NAMED_GENERIC_UNIT 2 (Goblin Spearman) 29 33 (Goblin Scout) ( _ "Goblin Scout")}
            [+unit]
                facing=se
            [/unit]
            {NAMED_GENERIC_UNIT 2 (Goblin Spearman) 38 31 () ( _ "Goblin Scout")}
            [+unit]
                facing=se
            [/unit]
            {NAMED_GENERIC_UNIT 2 (Goblin Spearman) 37 34 () ( _ "Goblin Scout")}
            [+unit]
                facing=se
            [/unit]
            {NAMED_GENERIC_UNIT 2 (Goblin Spearman) 25 39 () ( _ "Goblin Scout")}
            [+unit]
                facing=ne
            [/unit]

#ifndef EASY
            #If Medium: +3 goblins (8)

            {NAMED_GENERIC_UNIT 2 (Goblin Spearman) 26 35 () ( _ "Goblin Scout")}
            [+unit]
                facing=se
            [/unit]
            {NAMED_GENERIC_UNIT 2 (Goblin Spearman) 33 32 () ( _ "Goblin Scout")}
            [+unit]
                facing=se
            [/unit]
            {NAMED_GENERIC_UNIT 2 (Goblin Spearman) 27 32 () ( _ "Goblin Scout")}
            [+unit]
                facing=se
            [/unit]

            #If Hard: +3 goblins (11)
#ifdef HARD
            {NAMED_GENERIC_UNIT 2 (Goblin Spearman) 29 36 () ( _ "Goblin Scout")}
            [+unit]
                facing=se
            [/unit]
            {NAMED_GENERIC_UNIT 2 (Goblin Spearman) 33 34 () ( _ "Goblin Scout")}
            [+unit]
                facing=se
            [/unit]
            {NAMED_GENERIC_UNIT 2 (Goblin Spearman) 31 31 () ( _ "Goblin Scout")}
            [+unit]
                facing=se
            [/unit]

#endif

#endif

            [message]
                speaker=Goblin Scout
                message= _ "Attack!"
            [/message]

            [message]
                speaker=Goblin Coward
                message= _ "Run away!"
            [/message]

            [message]
                speaker=Zhul
                message= _ "Goblins are so predictable."
            [/message]
        [/event]
    [/event]

    # Event 2: naga appear around western guardpost

    # when player approches western guardpost have a few goblins jump out of
    # the eastern hills, and a naga or three appear in the lake

    # Easy:
    # 1 orcish assassin 23,33
    # 3 naga fighters: 20,34 19,33 20,35
    # 2 goblins spearmen: 23,32 24,32 24,33

    # Medium: 1 orcish slayer, 2 goblin impalers, 1 naga warrior, 2 naga fighters
    # Hard: 1 orcish slayer, 2 goblin impalers, 3 naga warriors
    [event]
        name=naga_attack

        #1 orcish assassin/slayer summons/leads any goblins

#ifdef EASY
        {NAMED_GENERIC_UNIT 2 (Orcish Assassin) 20 31 (Orac) ( _ "Orac")}
#else
        {NAMED_GENERIC_UNIT 2 (Orcish Slayer) 20 31 (Orac) ( _ "Orac")}
#endif

        #2 nagas appear at edge of lake

#ifdef EASY
        {NAMED_GENERIC_UNIT 2 (Naga Fighter) 17 34 (Scylla) ( _ "Scylla")}
#else
        {NAMED_GENERIC_UNIT 2 (Naga Warrior) 17 34 (Scylla) ( _ "Scylla")}
#endif
        #hack to make Scylla female
        [+unit]
            gender=female
        [/unit]

#ifdef HARD
        {NAMED_GENERIC_UNIT 2 (Naga Warrior) 16 34 () ( _ "Lake Naga")}
        {NAMED_GENERIC_UNIT 2 (Naga Warrior) 16 35 () ( _ "Lake Naga")}
#else
        {NAMED_GENERIC_UNIT 2 (Naga Fighter) 16 34 () ( _ "Lake Naga")}
        {NAMED_GENERIC_UNIT 2 (Naga Fighter) 16 35 () ( _ "Lake Naga")}
#endif

        {VARIABLE naga_ambush yes}
    [/event]

    [event]
        name=moveto

        [filter]
            x=17-24
            y=29-36
            side=1
        [/filter]

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

        [fire_event]
            name=naga_attack
        [/fire_event]

#ifdef EASY
        {NAMED_GENERIC_UNIT 2 (Goblin Spearman) 21 30 () ( _ "Goblin Scout")}
        {NAMED_GENERIC_UNIT 2 (Goblin Spearman) 17 31 () ( _ "Goblin Scout")}
#else
        {NAMED_GENERIC_UNIT 2 (Goblin Impaler) 21 30 () ( _ "Goblin Scout")}
        {NAMED_GENERIC_UNIT 2 (Goblin Impaler) 17 31 () ( _ "Goblin Scout")}
#endif

        [message]
            speaker=Orac
            message= _ "Come forth, creatures of the lake! Fulfill the oaths you have made and help us drive these hated creatures from our lands."
        [/message]

        [message]
            speaker=Scylla
            message= _ "Yesss, we remember the oath... Sssslay them all!" # wmllint: no spellcheck
            # leaving this here because it might have been a reference to the alien?  It really isn't clear.
            #            message= _ "Sssslay them all! In the name of the Ssscaled One!" # wmllint: no spellcheck
        [/message]
    [/event]

    #Event 3: The Goblin and The Ring (and maybe the Naga)

    # When the elves see Panok moving they notice how fast he is
    [event]
        name=moveto

        [filter]
            id=Panok
            [filter_vision]
                side=1
            [/filter_vision]
        [/filter]

        [message]
            speaker=Panok
            message= _ "These elves are stronger than we thought. Send for more reinforcements!"
        [/message]

        [message]
            speaker=Kaleh
            message= _ "How can he move that fast? He is faster than any goblin rider I have ever seen. It’s almost unnatural."
        [/message]
    [/event]

    # When Panok dies player gets ring and naga ambush is triggered if it
    # hasn't been already
    [event]
        name=last breath

        [filter]
            id=Panok
        [/filter]

        [message]
            speaker=Panok
            message= _ "Gaaghh!!" # wmllint: no spellcheck
        [/message]

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

        {PLACE_IMAGE items/ring-silver.png $x1 $y1}

        {CHECK_SPEAKER}
        [message]
            speaker=$speaking_unit.id
            message= _ "Wait a minute. He was wearing a silver ring on one of his fingers. I think the ring might be magical. Maybe that’s why he was moving so fast."
        [/message]
        {CLEAR_VARIABLE speaking_unit}

        # Commented out, since Kaleh has 6 MP now
#ifdef __UNUSED__
        [message]
            speaker=Nym
            message= _ "I think, Kaleh, that you should take the ring."
        [/message]

        [message]
            speaker=Kaleh
            message= _ "Why me?"
        [/message]

        [message]
            speaker=Nym
            message= _ "Because you tend to move slowly and if we’re going into the caves you’ll need all the speed you can get. And besides, we can’t afford to lose you; you never know when being able to run a bit faster might be the difference between life and death."
        [/message]
#endif

        # Get Ring event
        [event]
            name=moveto
            id=take_ring
            delayed_variable_substitution=no
            first_time_only=no

            [filter]
                x=$x1
                y=$y1
                side=1
                [not]
                    type=Dust Devil
                [/not]
            [/filter]

            [message]
                speaker=unit

                message= _ "Should I take this ring?"
                [option]
                    label= _ "Yes, I’ll take it."

                    [command]
                        [object]
                            id=SpeedyRing
                            name= _ "Ring of Speed"
                            image=items/ring-gold.png
                            description= _ "This ring will increase your maximum speed by 1."
                            [filter]
                                x=$x1
                                y=$y1
                                side=1
                            [/filter]

                            [effect]
                                apply_to=movement
                                increase=1
                            [/effect]
                        [/object]

                        [remove_item]
                            x=$x1
                            y=$y1
                        [/remove_item]

                        [remove_event]
                            id=take_ring
                        [/remove_event]
                    [/command]
                [/option]

                [option]
                    label= _ "No, I think someone else should wear it."

                    [command]
                        [allow_undo]
                        [/allow_undo]
                    [/command]
                [/option]
            [/message]
        [/event]

        #when Panok dies, if player hasn't triggered naga ambush, then units attack

#ifndef EASY
        [if]
            [variable]
                name=naga_ambush
                boolean_equals=no
            [/variable]

            [then]
                [fire_event]
                    name=naga_attack
                [/fire_event]

                [message]
                    speaker=Orac
                    message= _ "The elves have killed Panok the goblin! The other goblins may flee to the caves, but we will not give up these hills without a fight. Come forth, creatures of the lake! Fulfill the oaths you have made and help us drive these hated creatures from our lands."
                [/message]

                [message]
                    speaker=Scylla
                    message= _ "Yesss, we remember the oath... Sssslay them all!" # wmllint: no spellcheck
                [/message]
            [/then]
        [/if]
#endif
    [/event]

    # Event 4: elvish unit afraid when entering underground tunnels
    [event]
        name=moveto

        [filter]
            [filter_location]
                time_of_day_id=underground
            [/filter_location]
            side=1
            race=quenoth,elf
            [not]
                # Exclude Kaleh lest he potentially talks to himself if he is the first to enter the cave
                id=Kaleh
            [/not]
        [/filter]

        [allow_undo]
        [/allow_undo]

        [message]
            speaker=$unit.id
            message= _ "Ugh! These tunnels are pitch black! It’s as bad as fighting in a moonless night, and it stinks of orc filth. I can hardly think of a place I would less like to go into."
        [/message]

        [message]
            speaker=Kaleh
            message= _ "We have no choice. We cannot cross over these mountains, so we must go beneath them. If the orcs skulk in their tunnels and block our way, we must enter their dark places and fight them, no matter what the conditions."
        [/message]

        [message]
            speaker=Zhul
            # TODO: Could give more tips here
            message= _ "Remember, Kaleh, it’s nasty fighting underground. We will be at a disadvantage against orcs and other things that prefer the darkness."
        [/message]

        [message]
            speaker=Elyssa
            message= _ "Also, any time you find a particularly tough orc blocking a passage, my fireballs can blast him quick enough."
        [/message]
    [/event]

    # Event 5: Goblin guards a chest in NE corner of map

    [event]
        name=moveto

        [filter]
            x=31-37
            y=6-9
            side=1
        [/filter]

        {NAMED_NOTRAIT_UNIT 4 (Goblin Impaler) 35 7 (Greebo) ( _ "Greebo")}

        {PLACE_IMAGE items/chest-plain-closed.png 35 6}

        [message]
            speaker=Greebo
            # wmllint: local spelling shinies orcses
            message= _ "Greebo keeps shinies safe from nasty orcses. And ’specially stinking elves."
        [/message]
    [/event]

    # Chest contains gold for player

    [event]
        name=moveto

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

        {PLACE_IMAGE items/chest-plain-open.png 35 6}

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

        {CHECK_EXPLORER}
        [message]
            speaker=$explorer.id
            message= _ "Looks like he’s been squirreling away his stolen loot in this cave. Not that he had much. Must be hard times."
        [/message]
        {CLEAR_VARIABLE explorer}

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

    #Event 6: Cold dagger

    [event]
        name=moveto
        id=find_dagger
        first_time_only=no

        [filter]
            x=12
            y=17
            side=1
            [not]
                type=Dust Devil
            [/not]
        [/filter]

        [message]
            speaker=unit
            message= _ "How odd. Someone has carved a crude fountain out of the stone at the end of the passage. The freezing water pours out into a large pool. At the bottom of the pool I can see a skeleton still gripping a sword. The blade seems to glow faintly blue. The pool isn’t very deep, I could easily wade in and pick it up. But someone else has carved a crude message in the wall. <i>“If you dare to take this blade here, your greatest fear will surely appear.”</i> It looks like a nice sword, but do I dare chance it?"
            [option]
                label= _ "I fear no creature, I will take the blade!"
                [command]
                    [message]
                        speaker=unit
                        message= _ "The blade is chill to the touch and gives off a cold glow. I wonder how it came to be here."
                    [/message]

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

                        id=ColdBlade
                        name= _ "Cold Blade"
                        description= _ "The unit who wields this blade will deal cold damage with its melee attack."

                        [effect]
                            apply_to=attack
                            range=melee
                            set_type=cold
                        [/effect]
                    [/object]

                    {NAMED_NOTRAIT_UNIT 3 (Dawarf) 18 14 (Purple Abomination) ( _ "Purple Abomination")}

                    [message]
                        speaker=Purple Abomination
                        message= _ "I am an abomination, please kill me."
                    [/message]

                    [message]
                        speaker=unit
                        message= _ "I’ve seen some ugly creatures in my day, but that thing is just wrong."
                    [/message]

                    [message]
                        speaker=Purple Abomination
                        message= _ "The voices say I have no choice, I must attack!"
                    [/message]

                    [remove_event]
                        id=find_dagger
                    [/remove_event]
                [/command]
            [/option]

            [option]
                label= _ "I don’t like the sound of this. I’m out of here."
            [/option]
        [/message]
    [/event]

    #Event 7: End of the River

    [event]
        name=moveto

        # Dust devil is supposed to be mute. This isn't like the other cases,
        # where Nym could plausibly speak the line, so we just don't trigger the event.
        [filter]
            x=3
            y=10
            side=1
            [not]
                type=Dust Devil
            [/not]
        [/filter]

        [allow_undo]
        [/allow_undo]

        [message]
            speaker=$unit.id
            message= _ "This is the end of the line. The water is too deep for me to continue any further. I’m freezing cold, wet, and I can’t see a thing. I’m not exactly sure what I’m doing up here. Some strange influence made me want to come up here, but I don’t know what made me think it could be of any good."
        [/message]
    [/event]

    # Event 8: Enter the Assassin/Cloaked Figure (same guy, two names)

    # When Kaleh enters one of the caves, the cloaked figure pops up next turn
    # and attacks in a dramatic manner

    [event]
        name=moveto

        [filter]
            id=Kaleh
            [filter_location]
                time_of_day_id=underground
            [/filter_location]
        [/filter]

        [event]
            # Find the location of Kaleh and then find an adjacent
            # hex the cloaked figure can pop up in. (any hex that is not impassable)
            name=new turn

            [store_locations]
                [filter]
                    id=Kaleh
                [/filter]

                variable=dark_assassin_location
            [/store_locations]

            [unit]
                type=Dark Assassin Cloaked
                id=Cloaked Figure
                name= _ "Cloaked Figure"
                side=5
                x,y=$dark_assassin_location.x,$dark_assassin_location.y
                placement=map
                passable=yes
                [modifications]
                    {TRAIT_INTELLIGENT}
                    {TRAIT_RESILIENT}
                [/modifications]
            [/unit]
            {STORE_UNIT_VAR (id="Cloaked Figure") max_hitpoints temp}
            {VARIABLE_OP temp sub 16}
            {MODIFY_UNIT (id="Cloaked Figure") max_hitpoints $temp}
            {MODIFY_UNIT (id="Cloaked Figure") hitpoints $temp}
            {CLEAR_VARIABLE temp}
            [modify_unit]
                [filter]
                    id=Cloaked Figure
                [/filter]
                [effect]
                    apply_to=attack
                    increase_damage=-1
                [/effect]
            [/modify_unit]
            {CLEAR_VARIABLE dark_assassin_location}

            [delay]
                time=200
            [/delay]

            [message]
                speaker=Cloaked Figure
                image=portraits/cloaked.png
                message= _ "Kaleh, I am death incarnate."
            [/message]

            [message]
                speaker=Cloaked Figure
                image=portraits/cloaked.png
                message= _ "And I shall avenge all those you have killed!"
            [/message]
        [/event]
    [/event]

    # Death event for dark assassin

    [event]
        name=last breath

        [filter]
            id=Cloaked Figure
        [/filter]

        [message]
            speaker=Cloaked Figure
            message= _ "I promise we shall meet again."
        [/message]

        [kill]
            id=Cloaked Figure
            animate=no
            fire_event=no
        [/kill]

        [message]
            speaker=Kaleh
            message= _ "He just disappeared. That’s odd."
        [/message]
    [/event]

    #Event 10: victory if Kaleh moves to north edge of map

    [event]
        name=moveto

        [filter]
            y=1
            side=1
            id=Kaleh
        [/filter]

        [endlevel]
            result=victory
            bonus=yes
            {NEW_GOLD_CARRYOVER 40}
        [/endlevel]
    [/event]

    #victory event
    [event]
        name=victory

        [message]
            speaker=Kaleh
            message= _ "This passage seems different from the other tunnels and caves. It is wide and smooth and leads sharply downwards. I bet this was the way that Eloh was talking about."
        [/message]

        [message]
            speaker=Elyssa
            message= _ "This is no natural passage, and the walls are too well carved and smooth to be made by orcs. I wouldn’t be surprised if this was once carved out by dwarves. I wonder if there are any still left in these mountains..."
        [/message]

        [if]
            [not]
                [have_unit]
                    side=2,3,4
                    canrecruit=yes
                [/have_unit]
            [/not]

            [then]
                [message]
                    speaker=Zhul
                    message= _ "Having killed all the orc and goblin leaders in the immediate vicinity, we can take our time and should have no trouble bringing the rest of our people down this way. It’s odd, I guess we’re trading the dangers we know for the dangers we don’t. We really are putting our lives in Eloh’s palm; may she guide us as well as she has before."
                [/message]
            [/then]

            [else]
                [message]
                    speaker=Zhul
                    message= _ "Now that you’ve found the way we should be able to get the rest of our people past the orcs. It’s odd, I guess we’re trading the dangers we know for the dangers we don’t. We really are putting our lives in Eloh’s palm, may she guide as well as she has before."
                [/message]
            [/else]
        [/if]

        [message]
            speaker=Nym
            message= _ "I’ll just be happy when I can breathe fresh air again and see the suns and stars. Still, who knows what we’ll encounter deep under the earth?"
        [/message]

        [message]
            speaker=Kaleh
            message= _ "Well, there’s only one way to find out."
        [/message]

        {CLEAR_VARIABLE naga_ambush}
    [/event]

    # if player runs out of time, display time over message
    [event]
        name=time over
        [message]
            speaker=Kaleh
            message= _ "We’ve taken too long to get our people into the tunnels! Even more orcs are coming across the foothills from the east and west and flanking us. There’s no way we can kill all these orcs and goblins. We’ll never make it to safety now."
        [/message]
    [/event]

    {UTBS_INCLUDE utils/deaths.cfg}
[/scenario]