#textdomain wesnoth-did

[scenario]
    id=05_Orc_War
    name= _ "Orc War"
    map_data="{campaigns/Descent_Into_Darkness/maps/05_Orc_War.map}"
    victory_when_enemies_defeated=yes
    turns=37
    next_scenario=06_Return_to_Parthyn

    {DEFAULT_SCHEDULE_MORNING}

    {INTRO_AND_SCENARIO_MUSIC battle.ogg northerners.ogg}
    {EXTRA_SCENARIO_MUSIC northern_mountains.ogg}
    {EXTRA_SCENARIO_MUSIC siege_of_laurelmor.ogg}

    [story]
        [part]
            story=_ "The cycle of the seasons churns and summer and fall roll around once more. Malin’s thoughts turn back to Parthyn frequently, where a year prior, he had still been among family and friends in the rustic little town that he still thinks of as his home. He has since become a forsaken wanderer, he thinks, but the still burning image of his father being cut down amidst the ruins of his home is imprinted at the forefront of his mind."
            {STORYTXT_BACKGROUND travel.jpg}
        [/part]
        [part]
            story=_ "Companionship and peace... perhaps they are but a farce and certainly an impossibility with the threat of the orcish clans still looming. Perhaps there is no point in reminiscing on his once peaceful, pastoral life. He has never been one for regrets."
            {STORYTXT_BACKGROUND travel.jpg}
        [/part]
        [part]
            story=_ "Malin turns his attention to the task at hand. Darken Volk leads him through the heart of the Whitefang territory, where they terrorize and murder entire camps of orcs with their undead minions. Word spreads among the orcish towns, which begin to post more guards and dispatch frequent patrols to exterminate the two necromancers. All of their attempts fail."
            {STORYTXT_BACKGROUND travel.jpg}
        [/part]
        [part]
            story=_ "Word spreads to the south as well when the ever present raids are suddenly absent this year. The people at the frontier towns go about their days, gossiping about rumors of the undead, some with disgust, some with intrigue. When winter passes and spring comes again, a number of dark adepts travel northward and join the pair of necromancers. <i>“They can be quite useful,”</i> Darken Volk says to Malin, <i>“but none of them have even a tenth of your potential power.”</i>"
            {STORYTXT_BACKGROUND travel.jpg}
        [/part]
        [part]
            story=_ "Malin and Darken Volk continue their raids on the orcs and eventually force the usually fractious Whitefang chieftains to unite in opposition. The orcs pursue the two necromancers east toward the mouth of the river Men call the Longlier and Elves call the Arkan-thoria, where they manage to surround the humans and force a fight."
            {STORYTXT_BACKGROUND travel.jpg}
        [/part]
    [/story]

    {DID_TRACK {JOURNEY_05_NEW}}

    # wmllint: validate-off
    [side]
        side=1
        controller=human
        recruit=Walking Corpse,Vampire Bat,Ghost,Ghoul,Skeleton Archer,Skeleton,Dark Adept DiD
        {GOLD 190 170 150}
        team_name=good
        user_team_name= _ "Malin Keshar"
        {FLAG_VARIANT undead}

        # wmllint: recognize Malin Keshar
        {CHARACTER_STATS_MALIN_KESHAR}

        facing=sw
    [/side]
    # wmllint: validate-on

    [side]
        side=2
        controller=ai
        recruit=Goblin Spearman,Orcish Archer,Orcish Crossbowman,Wolf Rider,Orcish Grunt,Goblin Knight,Orcish Warrior,Troll Whelp
        {GOLD 50 70 90}
        {INCOME 4 6 8}
        team_name=orcs
        user_team_name=_"Orcs"
        {FLAG_VARIANT6 ragged}

        type=Orcish Warlord
        id=Borth
        name= _ "Borth"
        profile=portraits/orcs/warlord.png
        canrecruit=yes

        facing=se

        [ai]
            villages_per_scout=8
            village_value=0.5
            [goal]
                name=target
                [criteria]
                    id=Malin Keshar
                [/criteria]
                value=1
            [/goal]
            [goal]
                name=target
                [criteria]
                    id=Darken Volk
                [/criteria]
                value=1
            [/goal]
        [/ai]
    [/side]

    [side]
        side=3
        controller=ai
        recruit=Orcish Archer,Orcish Crossbowman,Goblin Pillager,Orcish Grunt,Orcish Assassin
        {GOLD 50 70 90}
        {INCOME 5 7 9}
        team_name=orcs
        user_team_name= _ "Orcs"
        {FLAG_VARIANT6 ragged}

        type=Orcish Warlord
        id="P'Gareth"
        name= _ "P’Gareth"
        profile=portraits/orcs/grunt-3.png
        canrecruit=yes

        facing=ne

        [ai]
            scout_village_targeting=2
            village_value=0.5
            [goal]
                name=target
                [criteria]
                    id=Malin Keshar
                [/criteria]
                value=1
            [/goal]
            [goal]
                name=target
                [criteria]
                    id=Darken Volk
                [/criteria]
                value=1
            [/goal]
        [/ai]
    [/side]

    [side]
        side=4
        controller=ai
        recruit=Orcish Archer,Orcish Crossbowman,Troll Whelp,Wolf Rider,Orcish Grunt
        {GOLD 50 70 90}
        {INCOME 4 6 8}
        team_name=orcs
        user_team_name= _ "Orcs"
        {FLAG_VARIANT6 ragged}

        type=Orcish Warlord
        id="K'Vark"
        name= _ "K’Vark"
        profile=portraits/orcs/grunt-5.png
        canrecruit=yes

        facing=nw

        [ai]
            villages_per_scout=6
            village_value=0.5
            [goal]
                name=target
                [criteria]
                    id=Malin Keshar
                [/criteria]
                value=1
            [/goal]
            [goal]
                name=target
                [criteria]
                    id=Darken Volk
                [/criteria]
                value=1
            [/goal]
        [/ai]
    [/side]

    [label]
        x,y=16,14
        text= _ "River Longlier"
    [/label]

    {STARTING_VILLAGES 1 6}
    {STARTING_VILLAGES 2 5}
    {STARTING_VILLAGES 3 6}
    {STARTING_VILLAGES 4 5}

    [event]
        name=prestart

        {CLEAR_CORPSE_HORDE}

        [objectives]
            side=1
            [objective]
                condition=win
                description= _ "Kill the orcish leaders"
            [/objective]
            [objective]
                condition=lose
                description= _ "Death of Malin Keshar"
            [/objective]
            [objective]
                condition=lose
                description= _ "Death of Darken Volk"
            [/objective]

            {TURNS_RUN_OUT}

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

        [recall]
            id=Darken Volk
        [/recall]

        {MODIFY_UNIT (side=1) facing sw}
    [/event]

    [event]
        name=start

        [message]
            speaker=Malin Keshar
            message= _ "Even before the very founding of Wesnoth, you have hounded my people at every turn. You have trampled our fields, slaughtered our livestock, and burned our houses. You have brought war to a place of peace and death to a place of life. You are nothing but remorseless killers and savage beasts. Your kind deserves no mercy and shall receive none. I will crush you into the dust and make you into my slaves for all eternity."
        [/message]

        [message]
            speaker=Borth
            message= _ "The silly necromancer is trying to talk us to death! Puny human, you have caused us enough trouble. It is time for you to die."
        [/message]

        [message]
            speaker="P'Gareth"
            message= _ "Ummm... unless... you are already dead, like the skeletons?"
        [/message]

        [message]
            speaker="K'Vark"
            message= _ "Then, it will be time for you to die again!"
        [/message]
    [/event]

    [event]
        name=die
        first_time_only=no
        [filter]
            side=2,3,4
            canrecruit=yes
        [/filter]
        [filter_condition]
            [have_unit]
                side=2,3,4
                canrecruit=yes

                [not]
                    side=$unit.side
                [/not]

                count=2
            [/have_unit]
        [/filter_condition]

        [message]
            speaker=Malin Keshar
            message= _ "How puny and weak you look in death, orc."
        [/message]
    [/event]

    # Victory Condition
    [event]
        name=die
        first_time_only=no
        [filter]
            side=2,3,4
            canrecruit=yes
        [/filter]
        [filter_condition]
            [have_unit]
                side=2,3,4
                canrecruit=yes

                [not]
                    side=$unit.side
                [/not]

                count=1
            [/have_unit]
        [/filter_condition]

        [message]
            speaker=Malin Keshar
            message= _ "Death is only the beginning for you. After this battle, you can be sure that I will make you into my thrall. And now for the last one—"
        [/message]

        [store_unit]
            [filter]
                side=2,3,4
                canrecruit=yes

                [not]
                    side=$unit.side
                [/not]
            [/filter]

            kill=no
            variable=remaining_orc_leader
        [/store_unit]

        [switch]
            variable=remaining_orc_leader.side
            [case]
                value=2
                {VARIABLE escape_to_x 11}
                {VARIABLE escape_to_y 1}
            [/case]

            [case]
                value=3
                {VARIABLE escape_to_x 8}
                {VARIABLE escape_to_y 26}
            [/case]

            [case]
                value=4
                {VARIABLE escape_to_x 40}
                {VARIABLE escape_to_y 7}
            [/case]
        [/switch]

        [object]
            silent=yes

            [filter]
                x,y=$remaining_orc_leader.x,$remaining_orc_leader.y
            [/filter]

            [effect]
                apply_to=hitpoints
                heal_full=yes
            [/effect]
        [/object]

        [message]
            speaker=$remaining_orc_leader.id
            message= _ "Retreat!"
        [/message]

        [store_unit]
            [filter]
                x,y=$remaining_orc_leader.x,$remaining_orc_leader.y
            [/filter]

            kill=yes
            variable=orc_leader_store
        [/store_unit]

        {CLEAR_VARIABLE orc_leader_store.status.poisoned}

        [move_unit_fake]
            type=$remaining_orc_leader.type
            side=$remaining_orc_leader.side
            x=$remaining_orc_leader.x,$escape_to_x
            y=$remaining_orc_leader.y,$escape_to_y
        [/move_unit_fake]

        {CLEAR_VARIABLE remaining_orc_leader,escape_to_x,escape_to_y}

        [message]
            speaker=Malin Keshar
            message= _ "The last chieftain flees! The coward!"
        [/message]

        [message]
            speaker=Darken Volk
            message= _ "Orcs are no more than beasts. They bellow out against a weaker foe as if that makes them mighty, but will always flee in the face of an overwhelming force. Nevertheless, the Whitefangs still number many and have some ties to the other orcish clans as well. You must hunt this chieftain down before he can alert the others, else we may soon have dozens more on our tail."
        [/message]

        [message]
            speaker=Malin Keshar
            message= _ "By ‘you’, you mean... on my own?"
        [/message]

        [message]
            speaker=Darken Volk
            message= _ "Your apprenticeship is nearly over; you are more than capable of handling a single, half-dead orc on your own. After, I do have a small favor I will ask of you. It will constitute the last part of your... training. I have some other things that I must attend to in preparation. In a few weeks, meet with me to the west, near the town of Tath. For now, hunt down the last chieftain."
        [/message]

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

    [event]
        name=victory

        # Heal Darken Volk and store him for his return in A Small Favor
        [heal_unit]
            [filter]
                id=Darken Volk
            [/filter]

            animate=no
            amount=full
            restore_statuses=yes
        [/heal_unit]

        [store_unit]
            [filter]
                id=Darken Volk
            [/filter]
            variable=darken_volk_store
            kill=yes
        [/store_unit]
    [/event]

    {HERODEATH_MALIN}
    {HERODEATH_VOLK}

    {TIME_OVER_DEFEAT}
[/scenario]
