#textdomain wesnoth-did

[scenario]
    id=01_Saving_Parthyn
    name= _ "Saving Parthyn"
    map_data="{campaigns/Descent_Into_Darkness/maps/01_Saving_Parthyn.map}"
    turns=13
    next_scenario=02_Peaceful_Valley
    victory_when_enemies_defeated=no

    {DEFAULT_SCHEDULE}

    {SCENARIO_MUSIC       northerners.ogg}
    {EXTRA_SCENARIO_MUSIC loyalists.ogg}
    {EXTRA_SCENARIO_MUSIC battle.ogg}

    [story]
        [part]
            music=elvish-theme.ogg

            # po: comments about dialogue style and characterization **THIS TEXT CONTAINS SPOILERS**:
            # po:
            # po: Drogan: although he is the captain of Parthyn's guard, he shows signs of recklessness and inflexibility; he's stiff and stubborn, which causes him to butt heads with Malin
            # po:           often, we see that Drogan says something to Malin (e.g. banishing him) without a clearly good reason why, and that's because of his ego and confidence in his own righteousness
            # po: Darken Volk: he talks a little more formally than Malin, and has quite a few ellipses in his speech. These are at points where he's not speaking exactly what he's thinking in his head because in reality,
            # po:           he's trying to manipulate Malin for his own gain. His mode of speech is a little more formal.
            # po: Dela: little more of a minor character, she's what you might expect from a sister. She isn't wholly against Malin until he kills Drogan, but she also doesn't really want to do much with a necromancer either.
            # po: Malin: rash and impulsive, he cares a lot about his home, but doesn't see that power itself can be a corrupting force (though he does not seek power just for the sake of it, it is for another purpose which is
            # po:           to drive off the orcs). He's a little more informal in his speech, meaning more contractions and colloquialisms, and this is intentional.
            # po: Things to be careful about while editing: there are some poems in S8 and S11, please be mindful when making wording changes there. Some commas are added for readability even though they may not be grammatically correct.
            # po:
            # po: If the target language has a specialized term for a fortified town, like Latin "oppidum", use it for Parthyn.
            story= _ "Malin Keshar was born ten years after the death of Haldric IV. He grew up in the northern border town of Parthyn, the second child and eldest son of the city’s baron. Every summer, by the time the mountainous paths and high passes shed their wintry gowns of snow, orcs descended from the northern hills to ravage the settlements at the frontier. Every year, Malin’s father led the townsfolk to repel the raids and force the orcs to retreat back to the north."
            {STORYTXT_BACKGROUND_BIGMAP_DID}
        [/part]
        [part]
            story= _ "When Malin was ten, a passing mage sensed strong magical abilities in the boy and suggested he be sent to the Isle of Alduin for training in the magical arts. Malin studied there for eight years, learning all manner of magic from basic control over the elements, to the mystic arts and scrying, to alchemy and simple medicine."
            {STORYTXT_BACKGROUND_BIGMAP_DID}
        [/part]
        [part]
            story= _ "Although his life on Alduin was luxurious and peaceful, Malin found the teachings of the scholarly mages to be too philosophical for his tastes. His thoughts turned back to Parthyn, where brute force, not theoretical reasoning, was necessary to drive off the orcs. In time, Malin began to research new magics on his own, but his lack of experience led to a series of failed experiments, one of which took the life of a fellow student. For his transgressions, he was expelled."
            {STORYTXT_BACKGROUND_BIGMAP_DID}
        [/part]
        [part]
            story= _ "When Malin returned to Parthyn, orcs had already begun to attack the city. Although he tried his best to fight them off, the raids were far more relentless and the town guard was far weaker than he had remembered. One night, a particularly powerful strike stormed the city and Malin could only watch as his father was cut down by one of the savage orcish warriors."
            {STORYTXT_BACKGROUND_BIGMAP_DID}
        [/part]
        [part]
            story= _ "Shaken by the loss of their commander, the human defense began to falter. The orcs roared in anticipation of victory, but before they could overrun the city, skeleton warriors poured out of the woods to their rear. The undead cut down orc after orc, swords and axes hacking through flesh and bone with ruthless efficiency. The soldiers watched in half amazement, half fear as the orcs dropped and the skeletons turned toward them, empty eyes bleeding with fetid magic. All was dreadfully still as the blood and carnage settled in the rank darkness."
            {STORYTXT_BACKGROUND_BIGMAP_DID}
        [/part]
        [part]
            story= _ "The silence was broken by the irregular shuffle of a man emerging from the trees. He stood before them, a hunched figure with a rasping voice reminiscent of crackling bones. <i>“I am Darken Volk. While I know you do not love my kind, I think it is vital that we put aside our differences for the moment. The orcish menace grows in the north and they will soon return in even greater force. You cannot hope to defend against them without my... help. For now, however, I ask only to refresh myself in your town.”</i>"
            {STORYTXT_BACKGROUND_BIGMAP_DID}
        [/part]
        [part]
            story= _ "Drogan, the captain of the guard, replied, <i>“Nay, you surely know that the penalty for necromancy is death. Seeing that you have saved our village, however, we will allow you to rest here for a few days. Nevertheless, upon your departure, you are banished from Parthyn. Should you return, we will attack you on sight.”</i>"
            {STORYTXT_BACKGROUND_BIGMAP_DID}
        [/part]
        [part]
            story= _ "Malin, troubled by his father’s death and the strength of the orcish assault, argued to no avail that Darken Volk be allowed to stay. After a couple days, the necromancer left Parthyn without incident."
            {STORYTXT_BACKGROUND_BIGMAP_DID}
        [/part]
    [/story]

    {DID_TRACK {JOURNEY_01_NEW}}

    # wmllint: validate-off
    [side]
        side=1
        controller=human
        recruit=Walking Corpse
        {GOLD 90 70 50}
        team_name=town guard
        user_team_name= _ "Defenders"
        {FLAG_VARIANT undead}

        # wmllint: recognize Malin Keshar
        {CHARACTER_STATS_MALIN_KESHAR}

        facing=nw

        # Starting units for Malin
        {LOYAL_UNIT 1 (Spearman) 28 11}
        {LOYAL_UNIT 1 (Bowman)   26 15}
        {LOYAL_UNIT 1 (Spearman) 23 12}
    [/side]
    # wmllint: validate-on

    [side]
        side=2
        controller=ai
        recruit=Orcish Grunt,Orcish Archer,Wolf Rider,Orcish Crossbowman
        {GOLD 80 110 140}
        {INCOME 2 4 6}
        team_name=orcs
        user_team_name= _ "Orcs"
        {FLAG_VARIANT6 ragged}

        type=Orcish Warrior
        id=Kreg'a'shar Trr
        name= _ "Kreg’a’shar Trr"
        canrecruit=yes

        facing=se

        [ai]
            aggression=0.8
            leader_value=3
            grouping=offensive
            caution=0.1
            recruitment_pattern=fighter,archer,scout
        [/ai]
    [/side]

    [side]
        side=3
        controller=ai
        recruit=Peasant,Woodsman,Spearman
        {GOLD 40 30 20}
        team_name=town guard
        user_team_name= _ "Defenders"
        {FLAG_VARIANT loyalist}

        type=Sergeant
        id=Drogan
        name= _ "Drogan"
        experience=17
        profile=portraits/drogan.png
        canrecruit=yes
        unrenamable=yes

        facing=ne

        # Starting units for Drogan
        {LOYAL_UNIT 3 (Swordsman) 15 17} {GUARDIAN}
        {UNIT 3 (Spearman) 9 16 ()}
        {UNIT 3 (Spearman) 7 13 ()}

        [unit]
            {CHARACTER_STATS_DELA_KESHAR}
            ai_special=guardian
            x,y=4,17
        [/unit]

        [ai]
            village_value=0
            caution=0.5
            [goal]
                name=protect_unit
                [criteria]
                    id=Malin Keshar
                [/criteria]
                value=4
            [/goal]

            # Don't block Malins keep
            [avoid]
                x=21
                y=14
            [/avoid]
        [/ai]
    [/side]

    {STARTING_VILLAGES 3 15}
    {STARTING_VILLAGES 2 5}
    {STARTING_VILLAGES 1 5}

    # Signpost to mark area defended
    {PLACE_IMAGE scenery/signpost.png 17 16}
    {PLACE_IMAGE items/book2.png 28 19}

    [event]
        name=prestart

        [objectives]
            side=1
            [objective]
                condition=win
                description= _ "Defend the river fort for two nights"
            [/objective]
            [objective]
                {ALTERNATIVE_OBJECTIVE_CAPTION}
                condition=win
                description= _ "Kill the orcish leader"
            [/objective]
            [objective]
                condition=lose
                description= _ "Orcs reach the outskirts of Parthyn"
            [/objective]
            [objective]
                condition=lose
                description= _ "Death of Malin Keshar"
            [/objective]
            [objective]
                condition=lose
                description= _ "Death of Dela Keshar"
            [/objective]
            [objective]
                condition=lose
                description= _ "Death of Drogan"
            [/objective]

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

        {VARIABLE malin_used_necromancy no}
    [/event]

    [event]
        name=start

        [message]
            speaker=Dela Keshar
            message= _ "Was it really a good idea to send out a raiding party so soon after the orcs just attacked us? Even Father is no longer here..."
        [/message]

        [message]
            speaker=Malin Keshar
            message= _ "Nor is Darken Volk. We are truly defenseless."
        [/message]

        [message]
            speaker=Dela Keshar
            message= _ "Not like we needed him. I cannot believe that you would even consider trusting a necromancer!"
        [/message]

        [message]
            speaker=Drogan
            message= _ "Quit bickering, you two. With the bulk of their forces massacred in that assault, the orcish encampments will be greatly weakened. The raiding party should be able to clear them out and leave us a relatively quiet summer."
        [/message]

        [message]
            speaker=Malin Keshar
            message= _ "So much for quiet, Drogan. Orcs amass north of the river!"
        [/message]

        [message]
            speaker=Drogan
            message= _ "What? Curses! How can there still be so many of them?"
        [/message]

        [message]
            speaker=Dela Keshar
            message= _ "You sent most of our soldiers away to attack the orcs, and we haven’t even begun to rebuild the city walls..."
        [/message]

        [message]
            speaker=Drogan
            message= _ "Quiet, you. Malin, you must hold the river fort, or they shall surely overrun the town. If you can defend for two days, the raiding party should return by then and we will be able to fight the orcs off. For now, I will bring what soldiers remain to your aid."
        [/message]
    [/event]

    # In-scenario events
    [event]
        name=recruit
        first_time_only=yes
        [filter]
            type=Walking Corpse
        [/filter]

        [message]
            speaker=Drogan
            message= _ "What in blazes is that thing? Has the necromancer returned? His timing could not be worse..."
        [/message]

        [message]
            speaker=Malin Keshar
            message= _ "No, Drogan. I raised this corpse with the skills Darken Volk taught me before he left. While I have no love for it, we cannot hope to repel the orcs without the help of the dead!"
        [/message]

        [message]
            speaker=Drogan
            message= _ "You say it will ensure our survival, but at what price? Defiling the bodies of our dead? Your soul, sold to black magic?"
        [/message]

        [message]
            speaker=Malin Keshar
            message= _ "What? I am hardly evil, Drogan!"
        [/message]

        [message]
            speaker=Dela Keshar
            message= _ "You say that, Brother, but you have been very close-mouthed about why the mages sent you home from Alduin. I am beginning to think that you were already dabbling in this witchcraft even before you met that necromancer!"
        [/message]

        [message]
            speaker=Malin Keshar
            message= _ "No! No... it was something stupid, something silly... it does not matter now! I will not stand by and allow the orcs to destroy my home while I have the skills to prevent it!"
        [/message]

        {VARIABLE malin_used_necromancy yes}
    [/event]

    [event]
        name=moveto
        [filter]
            side=1
            x,y=17,16
        [/filter]

        [message]
            speaker=narrator
            message= _ "Welcome to Parthyn"
            image=scenery/signpost.png
        [/message]

        [allow_undo][/allow_undo]
    [/event]

    [event]
        name=moveto
        [filter]
            x,y=28,19
            id=Malin Keshar
        [/filter]
        [message]
            speaker=narrator
            message= _ "Fear is the path to the dark side. Fear leads to anger. Anger leads to hate. Hate leads to suffering."
            image=wesnoth-icon.png
        [/message]
        [allow_undo][/allow_undo]
    [/event]

    # Defeat Conditions
    [event]
        name=moveto
        [filter]
            side=2
            x=0-17
            y=13-20
        [/filter]

        [message]
            speaker=Drogan
            message= _ "The orcs have broken through. Parthyn is open to attack!"
        [/message]

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

    # This shouldn't happen, but just in case
    [event]
        name=die
        [filter]
            id=Drogan
        [/filter]

        [message]
            speaker=unit
            message= _ "Who will be left to defend Parthyn?"
        [/message]

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

    [event]
        name=die
        [filter]
            id=Dela Keshar
        [/filter]

        [message]
            speaker=unit
            message= _ "I’m... dying..."
        [/message]

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

    # Victory Conditions
    [event]
        name=time over

        [unit]
            type=Swordsman
            x,y=5,17
            side=3
            id=Soldier
        [/unit]
        [unit]
            type=Longbowman
            x,y=6,17
            side=3
        [/unit]
        [unit]
            type=Javelineer
            x,y=6,18
            side=3
        [/unit]

        [message]
            speaker=Soldier
            message= _ "We’ve returned from ransacking the orcish camps, Drogan. It seems like we’re just in time!"
        [/message]
        [message]
            speaker=Kreg'a'shar Trr
            message= _ "More humans! We will need the Chief if we are to fight them now. Grunts, retreat!"
        [/message]

        [kill]
            side=2
        [/kill]

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

    # This is very unlikely, but just in case...
    [event]
        name=enemies defeated

        [message]
            speaker=Malin Keshar
            message= _ "The orcs are dead!"
        [/message]

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

    [event]
        name=victory

        [kill]
            side=2
            animate=no
            fire_event=no
        [/kill]

        [if]
            [variable]
                name=malin_used_necromancy
                boolean_equals=yes
            [/variable]
            [then]
                [message]
                    speaker=Drogan
                    message= _ "By all rights, I should have you executed on the spot, Malin. I cannot believe you let that necromancer corrupt you. I suppose part of this is my fault since I was the one who allowed him into Parthyn; nevertheless... Since I showed him mercy, I will show the same to you. You are hereby banished from Parthyn."
                [/message]

                [message]
                    speaker=Malin Keshar
                    message= _ "Fine words, Drogan. Would you rather have let the orcs overrun the town?"
                [/message]

                [message]
                    speaker=Drogan
                    message= _ "Aye, better that than to even dabble in dark magic. People would have rebuilt the town, just as they always have before. Even had I died, it would at least have been with dignity. Would the mages had taught you more sense."
                [/message]

                [message]
                    speaker=Malin Keshar
                    message= _ "I only did it to protect those whom I care about. Is this really what I deserve for saving your hides?"
                [/message]

                [message]
                    speaker=Drogan
                    message= _ "Yes, yes it is. Nobody will support you on your path to depravity."
                [/message]

                # Hint that the loyal units stay behind
                [message]
                    side=1
                    race=human
                    [not]
                        id=Malin Keshar
                    [/not]
                    message= _ "We should all be glad to see you gone, necromancer. I detest having fought by your side."
                [/message]

                [message]
                    speaker=Malin Keshar
                    message= _ "Dela? Sister?"
                [/message]

                [message]
                    speaker=Dela Keshar
                    message= _ "It sickens me to be of the same blood as a necromancer. Father would turn in his grave if he could see what you’ve become. Just leave."
                [/message]

                [message]
                    speaker=Drogan
                    message= _ "Begone, Malin. I’ve no wish to see your face around here ever again."
                [/message]
            [/then]
            [else]
                [message]
                    speaker=Drogan
                    message= _ "That was bravely done, lad, holding the orcs off by yourself. But I fear the raiding party brings grave news from the north. More warlords have begun to amass armies in the hills, no more than a few days north of the Great River. I do not know if we possess the strength to fight them off."
                [/message]

                [message]
                    speaker=Malin Keshar
                    message= _ "Then we must seek help. It has not been long since Darken Volk’s departure. Perhaps I can find him and ask him to aid us."
                [/message]

                [message]
                    speaker=Drogan
                    message= _ "I will pretend I did not hear that."
                [/message]

                [message]
                    speaker=Malin Keshar
                    message= _ "Then what would you have us do, Drogan? Let the orcs overrun Parthyn? Abandon our families to those savages?"
                [/message]

                [message]
                    speaker=Drogan
                    message= _ "If it comes to it, yes. Abandon the town and rebuild later, as we have always done."
                [/message]

                [message]
                    speaker=Malin Keshar
                    message= _ "Or we can drive off the orcs altogether and make sure they never attack us again. Surely I cannot be the only one who sees that what Drogan says is madness!"
                [/message]

                [message]
                    speaker=Drogan
                    message= _ "Should you embark on a quest to seek out depravity, none of us will support you."
                [/message]

                # Hint that the loyal units stay behind
                [message]
                    side=1
                    race=human
                    [not]
                        id=Malin Keshar
                    [/not]
                    message= _ "Better to die than to ally ourselves with a necromancer."
                [/message]

                [message]
                    speaker=Malin Keshar
                    message= _ "Dela? Sister?"
                [/message]

                [message]
                    speaker=Dela Keshar
                    message= _ "I hope that you will stay with us, Malin. Be reasonable."
                [/message]

                [message]
                    speaker=Malin Keshar
                    message= _ "Be reasonable? I am the only one who sees reason here. If no one will help me, I will go by myself."
                [/message]

                [message]
                    speaker=Dela Keshar
                    message= _ "Malin, seeking out the help of a necromancer is just... just foolhardy! We need you here to help protect the town!"
                [/message]

                [message]
                    speaker=Malin Keshar
                    message= _ "You will eventually see that I am right, Dela. I am resolved."
                [/message]
            [/else]
        [/if]

        [modify_unit]
            [filter]
                side=1
                race=human
                [not]
                    id=Malin Keshar
                [/not]
            [/filter]
            side=2
        [/modify_unit]
    [/event]

    {HERODEATH_MALIN}
[/scenario]
