#textdomain wesnoth-httt
[scenario]
    id=14_Plunging_into_the_Darkness
    name= _ "Plunging into the Darkness"
    map_data="{campaigns/Heir_To_The_Throne/maps/14_Plunging_Into_the_Darkness.map}"
    victory_when_enemies_defeated=no
    turns=unlimited

    {UNDERGROUND}

    next_scenario=15_The_Lost_General

    {SCENARIO_MUSIC "knalgan_theme.ogg"}
    {EXTRA_SCENARIO_MUSIC "underground.ogg"}
    {EXTRA_SCENARIO_MUSIC "the_deep_path.ogg"}
    {EXTRA_SCENARIO_MUSIC "into_the_shadows.ogg"}

    {HTTT_TRACK {JOURNEY_14_NEW} }

    [event]
        name=prestart
        [objectives]
            side=1
            [objective]
                description= _ "Find the dwarves"
                condition=win
            [/objective]
            [objective]
                description= _ "Death of Konrad"
                condition=lose
            [/objective]
            [objective]
                description= _ "Death of Delfador"
                condition=lose
            [/objective]
            [objective]
                description= _ "Death of Kalenz"
                condition=lose
            [/objective]
            [gold_carryover]
                carryover_percentage=100
            [/gold_carryover]
            {HAS_NO_TURN_LIMIT}
        [/objectives]
    [/event]

    [side]
        type=Commander
        id=Konrad
        name= _ "Konrad"
        unrenamable=yes
        profile=portraits/konrad-human.png
        side=1
        canrecruit=yes
        controller=human
        gold=0
        income=-2
        village_gold=0
        shroud=yes
        user_team_name=_"Rebels"
        team_name=good
        {FLAG_VARIANT long}
    [/side]

    [side]
        side=2
        no_leader=yes
        hidden=yes
        team_name=monsters
        user_team_name=_"Monsters"
        [ai]
            {ATTACK_DEPTH 4 5 5}
            aggression=1.0
        [/ai]

        [unit]
            type=Blood Bat
            x=17
            y=36
            side=2
            ai_special=guardian
        [/unit]
        [unit]
            type=Blood Bat
            x=21
            y=31
            side=2
            ai_special=guardian
        [/unit]
        [unit]
            type=Blood Bat
            x=15
            y=32
            side=2
            ai_special=guardian
        [/unit]
        [unit]
            type=Blood Bat
            x=15
            y=25
            side=2
            ai_special=guardian
        [/unit]

        [unit]
            name= _ "Hywyn"
            type=Giant Spider
            x=16
            y=40
            side=2
        [/unit]
    [/side]

    [side]
        id=Relgorn
        name= _ "Relgorn"
        type=Dwarvish Lord
        side=3
        canrecruit=yes
        recruit=Dwarvish Fighter
        gold=0
        user_team_name=_"Rebels"
        team_name=good

        [unit]
            generate_name=yes
            type=Dwarvish Thunderer
            x=15
            y=22
            side=3
            ai_special=guardian
            [modifications]
                {TRAIT_LOYAL}
            [/modifications]
            {IS_LOYAL}
        [/unit]
        [unit]
            generate_name=yes
            type=Dwarvish Fighter
            x=10
            y=22
            side=3
            ai_special=guardian
            [modifications]
                {TRAIT_LOYAL}
            [/modifications]
            {IS_LOYAL}
        [/unit]
        [unit]
            generate_name=yes
            type=Dwarvish Thunderer
            x=13
            y=20
            side=3
            ai_special=guardian
            [modifications]
                {TRAIT_LOYAL}
            [/modifications]
            {IS_LOYAL}
        [/unit]
        [unit]
            generate_name=yes
            type=Dwarvish Fighter
            x=11
            y=20
            side=3
            ai_special=guardian
            [modifications]
                {TRAIT_LOYAL}
            [/modifications]
            {IS_LOYAL}
        [/unit]
        [unit]
            generate_name=yes
            type=Dwarvish Thunderer
            x=13
            y=19
            side=3
            ai_special=guardian
            [modifications]
                {TRAIT_LOYAL}
            [/modifications]
            {IS_LOYAL}
        [/unit]
        [unit]
            generate_name=yes
            type=Dwarvish Fighter
            x=11
            y=19
            side=3
            ai_special=guardian
            [modifications]
                {TRAIT_LOYAL}
            [/modifications]
            {IS_LOYAL}
        [/unit]
        [unit]
            generate_name=yes
            type=Dwarvish Thunderer
            x=8
            y=20
            side=3
            ai_special=guardian
            [modifications]
                {TRAIT_LOYAL}
            [/modifications]
            {IS_LOYAL}
        [/unit]
        [unit]
            id=rider
            generate_name=yes
            type=Dwarvish Fighter
            x=17
            y=19
            side=3
            ai_special=guardian
            [modifications]
                {TRAIT_LOYAL}
            [/modifications]
            {IS_LOYAL}
        [/unit]
        [unit]
            generate_name=yes
            type=Dwarvish Thunderer
            x=15
            y=16
            side=3
            ai_special=guardian
            [modifications]
                {TRAIT_LOYAL}
            [/modifications]
            {IS_LOYAL}
        [/unit]
        [unit]
            generate_name=yes
            type=Dwarvish Fighter
            x=9
            y=16
            side=3
            ai_special=guardian
            [modifications]
                {TRAIT_LOYAL}
            [/modifications]
            {IS_LOYAL}
        [/unit]
        {FLAG_VARIANT knalgan}
    [/side]

    [event]
        name=prestart
        {NEED_DELFADOR placement=leader}
        {NEED_KALENZ placement=leader}

        [disallow_recruit]
            side=1
            type=Gryphon Rider
        [/disallow_recruit]

        [place_shroud]
            side=1
            x,y=1-20,21-41
        [/place_shroud]

        {PLACE_IMAGE items/bones.png 28 41}
        {PLACE_IMAGE items/bones.png 29 39}
        {PLACE_IMAGE items/bones.png 18 36}
    [/event]

    [event]
        name=start
        [message]
            speaker=Konrad
            {KONRAD_VARIATION concerned}
            message= _ "It’s so dark in here I can hardly see!"
        [/message]
        [message]
            speaker=Delfador
            message= _ "It is dark indeed. We shall have to light torches and tread slowly and carefully. It may be there are still dwarves down here who can aid us!"
        [/message]
        [message]
            speaker=Kalenz
            message= _ "Indeed. We elves do not fare well in these dark pits."
        [/message]
    [/event]

    [event]
        name=sighted

        [filter]
            side=3
        [/filter]

        [filter_second]
            side=1
        [/filter_second]

        [message]
            speaker=Relgorn
            message= _ "Who are these that approach? Surface-dwellers! On your guard, men!"
        [/message]

        [teleport]
            [filter]
                id=Konrad
            [/filter]
            x,y=12,21
        [/teleport]
        [teleport]
            [filter]
                id=Delfador
            [/filter]
            x,y=12,23
        [/teleport]
        [teleport]
            [filter]
                id=Kalenz
            [/filter]
            x,y=14,23
        [/teleport]

        [redraw]
        [/redraw]
        [delay]
            time=1000
        [/delay]

        [message]
            speaker=Delfador
            message= _ "We come in peace, friends. We come in peace!"
        [/message]

        [message]
            speaker=Relgorn
            message= _ "Oh, do you? I see that you are accompanied by elves. Can we dwarves not live in peace without the treacherous elves coming to bother us?"
        [/message]

        [message]
            speaker=Kalenz
            message= _ "Why such harsh words, dwarf? Elves have never done you any harm."
        [/message]

        [message]
            speaker=Relgorn
            message= _ "‘Never done us any harm?’ Why, I was there myself, when the elves refused to honor our alliance. Many dwarves were slaughtered, and you cowardly elves did nothing to help!"
        [/message]

        [message]
            speaker=Kalenz
            message= _ "You go too far! I am Kalenz, a mighty elvish lord! How dare such as you, sniveling in his tunnel, call me a coward?"
        [/message]

        [message]
            speaker=Delfador
            message= _ "Peace, friends! Peace! We must not fight among ourselves, for the evil orcs roam the lands above us."
        [/message]

        [message]
            speaker=Relgorn
            message= _ "Very well! Explain your presence here then, human. Who are you? Why have you risked life and limb to come to Knalga, home of the dwarves?"
        [/message]

        [message]
            speaker=Konrad
            message= _ "Well, we... we..."
        [/message]

        [message]
            speaker=Delfador
            message= _ "We have come so that an heir may claim his inheritance, that a king may claim his throne. We seek the Sceptre of Fire."
        [/message]

        [message]
            speaker=Relgorn
            message= _ "The Sceptre of Fire? Are you out of your minds? Surely you speak in jest!"
        [/message]

        [message]
            speaker=Delfador
            message= _ "We jest not, friend. We seek the Sceptre of Fire. We seek the help of the dwarves in finding it. But know that we will find it, whether you help us or not."
        [/message]

        [message]
            speaker=Relgorn
            message= _ "You speak foolishness. No one even knows if the Sceptre of Fire still exists. And who is this heir, this king that you speak of?"
        [/message]

        [message]
            speaker=Konrad
            message= _ "I am, sir."
        [/message]

        [message]
            speaker=Relgorn
            message= _ "You? Ha ha! This boy that stands before me is the king of Wesnoth? Ha ha! I haven’t had such a laugh in a long time. And who are you, old man?"
        [/message]

        [message]
            speaker=Delfador
            message= _ "I am Delfador, Delfador the Great, Arch Mage to King Garard, and Protector of his heir."
        [/message]

        [message]
            speaker=Relgorn
            message= _ "You... you are Delfador? I saw Delfador when I was but a young dwarf, and I will tell you, old man, you are not Delfador. Men! Take these liars out of my sight. Delfador perished many years ago."
        [/message]

        #the flash of Delfador's lightning bolt
        [scroll_to_unit]
            id=Delfador
        [/scroll_to_unit]

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

        [color_adjust]
            red=100
            green=100
            blue=100
        [/color_adjust]

        [delay]
            time=10
        [/delay]

        [color_adjust]
            red=0
            green=0
            blue=0
        [/color_adjust]

        [message]
            speaker=Delfador
            {DELFADOR_VARIATION mad}
            message= _ "I am Delfador the Great! Tremble before my wrath!"
        [/message]

        [message]
            speaker=Relgorn
            message= _ "You... you really are Delfador! But we had news that you were dead, years ago!"
        [/message]

        [message]
            speaker=Delfador
            message= _ "They thought I was dead. They hoped I was dead. Yet still I live."
        [/message]

        [message]
            speaker=Relgorn
            message= _ "And you really think that you can find the Sceptre of Fire?"
        [/message]

        [message]
            speaker=Delfador
            message= _ "Yes, I do. If you help us, friend, all the treasures of Knalga that we find are yours. We want only the Sceptre. It will be dangerous. Make no mistake about that: dwarves will be killed, perhaps many dwarves. But surely it is better than hiding from the orcs like worms."
        [/message]

        [message]
            speaker=Relgorn
            message= _ "You are right, friend. I will put my best men at your disposal, though we know naught of the Sceptre's location. Legend says it is hidden in the eastern tunnels."
        [/message]

        [message]
            speaker=Delfador
            message= _ "Then to the eastern tunnels we shall go!"
        [/message]

        #
        # Your gryphons are big now!
        #
        [if]
            [variable]
                name=get_gryphons
                numerical_equals=1
            [/variable]
            [then]
                [sound]
                    name=claws.ogg
                [/sound]
                [delay]
                    time=500
                [/delay]
                [sound]
                    name=staff.wav
                [/sound]
                [delay]
                    time=200
                [/delay]
                [sound]
                    name=gryphon-shriek-2.ogg
                [/sound]
                [delay]
                    time=200
                [/delay]
                [sound]
                    name=human-female-hit-3.ogg
                [/sound]

                # A gryphon runs up with an elf behind him

                [move_unit_fake]
                    type=Gryphon
                    side=1
                    x=15,14,14,13,13
                    y=26,25,24,24,23
                [/move_unit_fake]

                [unit]
                    type=Gryphon
                    side=1
                    x,y=13,23
                [/unit]

                [redraw]
                [/redraw]
                [delay]
                    time=500
                [/delay]

                [move_unit_fake]
                    type=Elvish Shaman
                    side=1
                    x=15,14,14,14,14
                    y=26,25,24,23,22
                [/move_unit_fake]

                [unit]
                    type=Elvish Shaman
                    id=Gryphon Tender
                    name= _ "Gryphon Tender"
                    side=1
                    x,y=14,22
                [/unit]

                [redraw]
                [/redraw]
                [delay]
                    time=500
                [/delay]

                [message]
                    speaker=Gryphon Tender
                    message= _ "I am sorry, Prince Konrad. The young gryphons are breaking their ropes. They are simply getting too large and too restless to restrain anymore!"
                [/message]

                # Gryphon runs around some more

                # This kills the gryphon unit so it can travel some more
                [kill]
                    type=Gryphon
                    x,y=13,23
                [/kill]

                [move_unit_fake]
                    type=Gryphon
                    side=1
                    x=13,12,11,10,10,10,10,11,12,13,14,15,15
                    y=23,22,22,21,20,19,18,18,17,18,17,18,19
                [/move_unit_fake]

                [unit]
                    type=Gryphon
                    side=1
                    x,y=15,19
                [/unit]

                [redraw]
                [/redraw]
                [sound]
                    name=gryphon-hit-3.ogg
                [/sound]
                [delay]
                    time=1000
                [/delay]

                [message]
                    speaker=Relgorn
                    message= _ "What’s this? Gryphons in my castle? Remove the beasts!"
                [/message]
                [message]
                    speaker=Konrad
                    message= _ "Beasts? We were planning to use them as mounts."
                [/message]
                [message]
                    speaker=Relgorn
                    message= _ "Ha ha! Gryphons as mounts! Is there no end to your folly?"
                [/message]
                [message]
                    speaker=Konrad
                    message= _ "(looks miffed)"
                [/message]
                [message]
                    speaker=Relgorn
                    message= _ "Well, if you must go on with this mad scheme, I shall supply you with my own troops as riders! A frail human — or worse, an elf — would never be able to handle their violent instincts!"
                [/message]
                [message]
                    speaker=Kalenz
                    message= _ "(looks miffed)"
                [/message]
                [message]
                    speaker=Delfador
                    # po: Relgorn is a Dwarvish Lord
                    message= _ "Temper your anger. Lord Relgorn’s manner may be rough, but surely there is nothing wrong with his suggestion?"
                [/message]
                [message]
                    speaker=Konrad
                    message= _ "Well, I suppose..."
                [/message]

                # A dwarf hops on a gryphon and rides it

                # This gets rid of the dwarvish rider
                [kill]
                    id=rider
                [/kill]

                [move_unit_fake]
                    type=Dwarvish Fighter
                    side=3
                    x=17,16,15
                    y=19,18,19
                [/move_unit_fake]

                # This gets rid of the gryphon
                [kill]
                    type=Gryphon
                    x,y=15,19
                [/kill]

                [unit]
                    type=Gryphon Rider
                    id=Mounted Dwarf
                    name= _ "Mounted Dwarf"
                    side=1
                    x,y=15,19
                [/unit]

                [redraw]
                [/redraw]
                [delay]
                    time=2000
                [/delay]

                [message]
                    speaker=Mounted Dwarf
                    message= _ "Whoa there... No need to be surly, now. Easy...easy... now GO!"
                [/message]

                [sound]
                    name=gryphon-hit-2.ogg
                [/sound]

                # This gets rid of the gryphon rider
                [kill]
                    type=Gryphon Rider
                    x,y=15,19
                [/kill]

                [move_unit_fake]
                    type=Gryphon Rider
                    side=1
                    x=15,15,14,13,12,11,10,10,10,10,11,12,13,13,14,14,15
                    y=19,18,17,18,17,18,18,19,20,21,22,22,23,24,24,25,26
                [/move_unit_fake]

                [message]
                    speaker=narrator
                    image="wesnoth-icon.png"
                    message= _ "You can now recruit fearsome Gryphon Riders!"
                [/message]

                [message]
                    speaker=Relgorn
                    message= _ "Though they stink, gryphons are magnificent animals. They may not be able to navigate our twisted caverns very well, but if you ever see the surface again, they will dominate the skies. Best of luck, Allies-of-Knalga."
                [/message]

                # This gets rid of the gryphon tender unit
                [kill]
                    id=Gryphon Tender
                [/kill]
            [/then]
        [/if]

        [endlevel]
            result=victory
            bonus=no
            {NEW_GOLD_CARRYOVER 100}
        [/endlevel]
    [/event]

    [event]
        name=victory

        [if]
            [variable]
                name=get_gryphons
                numerical_equals=1
            [/variable]
            [then]
                [allow_recruit]
                    side=1
                    type=Gryphon Rider
                [/allow_recruit]
            [/then]
        [/if]
    [/event]

    #a secret passage
    [event]
        name=moveto
        [filter]
            x=17
            y=36
            side=1
        [/filter]
        [message]
            speaker=unit
            message= _ "Hmm... there seems to be a secret passage behind these rocks!"
        [/message]
        [terrain]
            x=16
            y=36
            terrain=Uu
        [/terrain]
    [/event]

    #a chest of treasure behind the secret passage
    {PLACE_IMAGE items/chest.png 9 39}

    [event]
        name=moveto
        [filter]
            x=9
            y=39
            side=1
        [/filter]
        [sound]
            name=gold.ogg
        [/sound]
        [message]
            speaker=unit
            message= _ "There is a great fortune in this chest of treasure! I can count two hundred pieces of gold!"
        [/message]
        [gold]
            side=1
            amount=200
        [/gold]
        [remove_item]
            x,y=$x1,$y1
        [/remove_item]
    [/event]

    {campaigns/Heir_To_The_Throne/utils/deaths.cfg}
[/scenario]
