#textdomain wesnoth-trow
[scenario]
    id=16_The_Kalian
    name= _ "The Ka’lian"
    map_data="{campaigns/The_Rise_Of_Wesnoth/maps/16_The_Kalian.map}"
    next_scenario=18_A_Spy_in_the_Woods
    theme=Cutscene_Minimal

    turns=30
    {AFTERNOON}

    {SCENARIO_MUSIC traveling_minstrels.ogg}

    # No story
    {TROW_GC_TRACK {JOURNEY_16_NEW} }

    [side]
        side=1
        type=Noble Commander
        id=Prince Haldric
        name= _ "Prince Haldric"
        unrenamable=yes
        canrecruit=yes
        gold=0
        controller=human
        team_name=Haldric
        user_team_name=_"Refugees"
        {FLAG_VARIANT loyalist}
    [/side]

    [side]
        side=2
        type=Autumn Shyde
        id=Lady Dionli
        name= _ "Lady Dionli"
        # profile="portraits/dionli.png"
        facing=se
        team_name=Elves
        user_team_name=_"Elves"
        {FLAG_VARIANT long}
    [/side]

    [side]
        side=3
        type=Elvish Champion
        id=Lord Logalmier
        name= _ "Lord Logalmier"
        profile="portraits/logalmier.png"
        image="units/kalian-elvish-champion.png"
        team_name=Elves
        user_team_name=_"Elves"
        {FLAG_VARIANT long}
        [modifications]
            [object]
                [effect]
                    apply_to=image_mod
                    replace=O(0)~BLIT(units/kalian-elvish-champion.png)
                [/effect]
            [/object]
        [/modifications]
    [/side]

    [side]
        side=4
        type=Elvish Sharpshooter
        id=Lord Aryad
        name= _ "Lord Aryad"
        profile="portraits/aryad.png"
        facing=sw
        team_name=Elves
        user_team_name=_"Elves"
        {FLAG_VARIANT long}
    [/side]

    [event]
        name=prestart

        [recall]
            id=Lady Jessene
        [/recall]

        [recall]
            id=Burin the Lost
        [/recall]

        [recall]
            id=Sir Ruddry
        [/recall]

        [recall]
            id=Sir Ladoc
        [/recall]

        [recall]
            id=Minister Edren
        [/recall]

        [teleport]
            [filter]
                id=Prince Haldric
            [/filter]
            x=13
            y=21
        [/teleport]

        [teleport]
            [filter]
                id=Lady Jessene
            [/filter]
            x=15
            y=20
        [/teleport]

        [teleport]
            [filter]
                id=Burin the Lost
            [/filter]
            x=11
            y=21
        [/teleport]

        [teleport]
            [filter]
                id=Sir Ruddry
            [/filter]
            x=12
            y=21
        [/teleport]

        [teleport]
            [filter]
                id=Sir Ladoc
            [/filter]
            x=12
            y=21
        [/teleport]

        [teleport]
            [filter]
                id=Minister Edren
            [/filter]
            x=15
            y=22
        [/teleport]

        {HERO (Elvish Marshal) ("Lord El'Isomithir") ( _ "Lord El’Isomithir") 4 13 14 ("portraits/isomithir.png")}
    [/event]

    # wmllint: local spelling Dionli

#define DRAGON
    [option]
        label= _ "I think I’ll fight the dragon!"

        [show_if]
            [variable]
                name=the_dragon
                numerical_equals=0
            [/variable]
        [/show_if]

        [command]
            [message]
                speaker=Prince Haldric
                message= _ "Lord Logalmier, I shall defeat your dragon."
                image=portraits/haldric-annoyed.png
            [/message]
            [endlevel]
                result=victory
                bonus=no
                {NEW_GOLD_CARRYOVER 100}
                carryover_report=no
                linger_mode=no
                next_scenario=17a_The_Dragon
            [/endlevel]
        [/command]
    [/option]
#enddef

#define BEACH
    [option]
        label= _ "Let’s get those saurians and nagas on that beach!"

        [show_if]
            [variable]
                name=a_beach
                numerical_equals=0
            [/variable]
        [/show_if]

        [command]
            [message]
                speaker=Prince Haldric
                message= _ "Those cold blooded monsters will feel my wrath!"
                image=portraits/haldric-mad.png
            [/message]
            [endlevel]
                result=victory
                bonus=no
                {NEW_GOLD_CARRYOVER 100}
                carryover_report=no
                linger_mode=no
                next_scenario=17b_Lizard_Beach
            [/endlevel]
        [/command]
    [/option]
#enddef

#define HOLE
    [option]
        label= _ "Let’s clear out that troll hole!"

        [show_if]
            [variable]
                name=troll_hole
                numerical_equals=0
            [/variable]
        [/show_if]

        [command]
            [message]
                speaker=Prince Haldric
                message= _ "So what exactly is a troll?"
            [/message]
            [endlevel]
                result=victory
                bonus=no
                {NEW_GOLD_CARRYOVER 100}
                carryover_report=no
                linger_mode=no
                next_scenario=17c_Troll_Hole
            [/endlevel]
        [/command]
    [/option]
#enddef

#define ISLE
    [option]
        label= _ "Let’s put those souls to rest on the cursed isle!"

        [show_if]
            [variable]
                name=cursed_isle
                numerical_equals=0
            [/variable]
        [/show_if]

        [command]
            [message]
                speaker=Prince Haldric
                message= _ "Undead. Bah! We’re pros at fighting them."
                image=portraits/haldric-annoyed.png
            [/message]
            [endlevel]
                result=victory
                bonus=no
                {NEW_GOLD_CARRYOVER 100}
                carryover_report=no
                linger_mode=no
                next_scenario=17d_Cursed_Isle
            [/endlevel]
        [/command]
    [/option]
#enddef

#define QUEST_CHOICES
    [message]
        speaker=Prince Haldric
        message= _ "In the name of peace between our peoples:"
        {DRAGON}
        {BEACH}
        {HOLE}
        {ISLE}
    [/message]
#enddef

#define QUESTS
    [if]
        [variable]
            name=the_dragon
            numerical_equals=0
        [/variable]
        [then]
            [message]
                speaker=Lord Logalmier
                message= _ "I fear my kin are too easy on you. I decree that you should be made to fight the Dragon of the Green Swamp and its saurian minions. If you can defeat him, you will have truly earned your place in this land."
            [/message]
        [/then]
    [/if]

    [if]
        [variable]
            name=a_beach
            numerical_equals=0
        [/variable]
        [then]
            [message]
                speaker=Lady Dionli
                message= _ "There is a group of saurians, friends of the dragon I’m sure, who are trading metal with the nagas of the sea. We should put a stop to this. They are located on a beach near here."
            [/message]
        [/then]
    [/if]

    [if]
        [variable]
            name=troll_hole
            numerical_equals=0
        [/variable]
        [then]
            [message]
                speaker=Lord Aryad
                message= _ "We are having a problem with a troll-hole in the Brown Hills. While I find the thought of those dwarves stumbling on the trolls vaguely amusing, this should make an adequate quest for you."
            [/message]
        [/then]
    [/if]

    [if]
        [variable]
            name=cursed_isle
            numerical_equals=0
        [/variable]
        [then]
            [message]
                speaker="Lord El'Isomithir"
                message= _ "Long ago a clan of elves on the Isle of Tears fell under the sway of a dark curse. Their souls still haunt that place and no elf will go there. You should clear this isle, and put their souls to rest."
            [/message]
        [/then]
    [/if]

#enddef

#define GREET
    [switch]
        variable=last_done
        [case]
            value="Dragon"
            [message]
                speaker=Lord Logalmier
                message= _ "Ahh, you have defeated the dragon, man of the west-north, you are truly impressive for a human."
            [/message]
        [/case]
        [case]
            value="Hole"
            [message]
                speaker=Lord Aryad
                message= _ "So, you have defeated the trolls. Welcome back, Haldric."
            [/message]
        [/case]
        [case]
            value="Isle"
            [message]
                speaker="Lord El'Isomithir"
                message= _ "Finally the souls of our poor kin may rest. Thank you."
            [/message]
        [/case]
        [case]
            value="Beach"
            [message]
                speaker=Lady Dionli
                message= _ "Our beaches are free again. I knew I could trust you, Haldric."
            [/message]
        [/case]
    [/switch]
#enddef

    [event]
        name=start
        [message]
            speaker=narrator
            message= _ "Haldric and his companions find themselves before the Ka’lian, or the Council of Elven Lords."
            image=wesnoth-icon.png
        [/message]

        [switch]
            variable=num_done
            [case]
                value=0
                [message]
                    speaker=Lord Logalmier
                    message= _ "Dionli, why have you brought these humans before us?"
                [/message]
                [message]
                    speaker=Lady Dionli
                    message= _ "They are of the same people as the Prince of Southbay. They come as refugees. I can see a use for them."
                [/message]
                [message]
                    speaker=Lord Aryad
                    # wmllint: local spelling shortliveds
                    message= _ "What use would that be? What need could we have for the shortliveds here?"
                [/message]
                [message]
                    speaker=Lady Dionli
                    message= _ "The dwarves have come to the Brown Hills. While they live long, even they grow like weeds when in an empty field. There is trouble brewing."
                [/message]
                [message]
                    speaker=Lady Dionli
                    message= _ "It is better to be the greater of three than the lesser of two. The Prince of Southbay was good, he was a credit to his people. Maybe these ones are made of the same stuff."
                [/message]
                [message]
                    speaker="Lord El'Isomithir"
                    message= _ "But why then do they come as refugees? Speak, human."
                [/message]
                [message]
                    speaker=Prince Haldric
                    message= _ "Our people come in peace. There was a war in our homeland. We are refugees. We come seeking a new home, since our island to the west and north is now forfeit."
                [/message]
                [message]
                    speaker="Lord El'Isomithir"
                    message= _ "So you come to steal our land? We know your kind, humans of the west-north."
                [/message]
                [message]
                    speaker=Prince Haldric
                    message= _ "We only wish to live in peace. The dwarves are peoples of mountain and hill, the elves are people of the forests, we only seek some of the space in between."
                [/message]
                [message]
                    speaker=Lady Dionli
                    message= _ "I suggest that we grant these humans the plains to the north and south of the Great River."
                [/message]
                [message]
                    speaker=Lord Aryad
                    message= _ "They should be put to the test before such a grant is made."
                [/message]
                [message]
                    speaker="Lord El'Isomithir"
                    message= _ "A quest for each of us then?"
                [/message]
                [message]
                    speaker=Lady Dionli
                    message= _ "Agreed."
                [/message]
                [message]
                    speaker=Lord Aryad
                    message= _ "Agreed."
                [/message]
                [message]
                    speaker=Lord Logalmier
                    message= _ "Agreed. (<i>Sigh</i>)"
                [/message]
                [message]
                    speaker=Prince Haldric
                    message= _ "Umm, agreed."
                [/message]
                [message]
                    speaker=Lord Aryad
                    message= _ "Well then, human. Each of us lords has a specific quest for you. If you complete them all you will be granted all of the plains in our domain and the hills south of the Great River, if not you will be forced to depart. So which quest do you wish to undertake first?"
                [/message]
                {QUESTS}

                {QUEST_CHOICES}
            [/case]
            [case]
                value=1
                {GREET}

                [message]
                    speaker=Lord Logalmier
                    message= _ "Very good, but this is just the start, human. There is still much more for you to do."
                [/message]

                {QUESTS}

                {QUEST_CHOICES}
            [/case]
            [case]
                value=2
                {GREET}

                [message]
                    speaker=Lord Logalmier
                    message= _ "You are victorious again. You may yet earn your place in this land."
                [/message]

                {QUESTS}

                {QUEST_CHOICES}
            [/case]
            [case]
                value=3
                {GREET}

                [message]
                    speaker=Lord Logalmier
                    message= _ "Ahh, my young prince, you’re not as soft as I thought."
                [/message]

                {QUESTS}

                {QUEST_CHOICES}
            [/case]
            [case]
                value=4

                [message]
                    speaker=Lady Dionli
                    message= _ "You were successful, Prince Haldric. I knew you could do it."
                [/message]

                [message]
                    speaker=Lord Logalmier
                    message= _ "Man of the west-north, you have earned your place on this great continent."
                [/message]

                [message]
                    speaker=Lord Aryad
                    message= _ "As per our agreement, you and your people—"
                [/message]

                [message]
                    speaker="Lord El'Isomithir"
                    message= _ "—may stay."
                [/message]

                [message]
                    speaker=Lord Logalmier
                    message= _ "We hereby grant you the plains to the north of the Great River, and the plains and hills to the south of the Great River. Be kind to the land. In a time of need we may call upon you, remember our generosity."
                [/message]

                [message]
                    speaker=Prince Haldric
                    message= _ "Fair enough. I decree a ‘Pact of Mutual Aid’ between our peoples. But— aren’t you setting us in conflict with the Dwarves?"
                [/message]

                [message]
                    speaker=Lord Logalmier
                    message= _ "No. The Dwarves have returned to the north. But humans mine as well, no? They are your resources to guard now. In the future we would be willing to trade with you."
                [/message]

                [move_unit_fake]
                    type=Lieutenant
                    side=1
                    x=20,20,19
                    y=25,24,24
                [/move_unit_fake]

                {HERO (Lieutenant) (Commander Aethyr) ( _ "Commander Aethyr") 1 19 24 ("portraits/aethyr-second.png")}

                [delay]
                    time=500
                [/delay]

                [message]
                    speaker=Lord Logalmier
                    message= _ "Who is this?"
                [/message]

                [message]
                    speaker=Prince Haldric
                    message= _ "It’s Commander Aethyr, of Clearwater Port. I was sure you perished in the fighting there."
                [/message]

                [message]
                    speaker=Commander Aethyr
                    message= _ "No, sir. I was leading the final survivors of Clearwater Port. We were making our last stand at the lighthouse when one of your ships came. One of my men conked me on the head, then I woke up at sea."
                [/message]

                [message]
                    speaker=Commander Aethyr
                    message= _ "I come bearing news. Some ‘old friends’ have decided to make an appearance. You should go ‘greet’ them."
                [/message]

                [message]
                    speaker=Lady Jessene
                    message={WHISPER _"I fear our friend has said too much. You go on ahead, I’ll catch up with you."}
                [/message]

                {CLEAR_VARIABLE num_done}
                {CLEAR_VARIABLE a_beach}
                {CLEAR_VARIABLE cursed_isle}
                {CLEAR_VARIABLE the_dragon}
                {CLEAR_VARIABLE troll_hole}
                {CLEAR_VARIABLE last_done}

                [endlevel]
                    result=victory
                    bonus=no
                    {NEW_GOLD_CARRYOVER 100}
                    carryover_report=no
                    linger_mode=no
                    next_scenario=18_A_Spy_in_the_Woods
                [/endlevel]
            [/case]
        [/switch]
    [/event]
[/scenario]

#undef DRAGON
#undef BEACH
#undef HOLE
#undef ISLE
#undef QUEST_CHOICES
#undef QUESTS
#undef GREET
