#textdomain wesnoth-did
[scenario]
    id=Orc_war
    next_scenario=Return_to_Parthyn

    name=_ "Orc War"
    map_data="{campaigns/Descent_Into_Darkness/maps/Orc_war.map}"
    victory_when_enemies_defeated=yes
    turns=30
    {MORNING}
    {AFTERNOON}
    {DUSK}
    {FIRST_WATCH}
    {SECOND_WATCH}
    {DAWN}

    {INTRO_AND_SCENARIO_MUSIC northerners.ogg battle.ogg}
    {EXTRA_SCENARIO_MUSIC the_city_falls.ogg}
    {EXTRA_SCENARIO_MUSIC the_dangerous_symphony.ogg}

    [story]
        [part]
            story=_ "All through the summer and fall, the necromancer and his apprentice travel through orc-held lands. At night, they cause skeletons and ghosts to emerge from the forests to terrorize and kill entire camps of orcs and their goblin minions. Word spreads among the orcish towns, which begin to post guards and leave torches burning all night. These measures do little to help them."
            background=story/travel.jpg
            scale_background=no
        [/part]
        [part]
            story=_ "Word spreads to the south as well, of the many battles won against the orc tribes, as Darken Volk tells Malin. As spring rolls around, a number of dark adepts, eager to aid in the fight, travel northwards and join the pair. 'They are quite useful in battle,' the necromancer says to Malin, 'but none of them have even a tenth of your potential power.'"
            background=story/travel.jpg
            scale_background=no
        [/part]
        [part]
            story=_ "The damage inflicted by Malin and Darken Volk over the past year forces the usually fractious local chieftains to unite in opposition. Eventually, at a narrow place in the river men call the Longlier and Elves call the Arkan-thoria, they manage to surround the humans and force a fight."
            background=story/travel.jpg
            scale_background=no
        [/part]
        [part]
            show_title=yes
            {TO_ORC_WAR}
        [/part]
    [/story]

    {SET_LABEL 8 12 (_"River Longlier")}

    [side]
        side=1
        controller=human
        type=Apprentice Mage
        id=Malin Keshar
        name=_ "Malin Keshar"
        unrenamable=yes
        canrecruit=yes
        recruit=Walking Corpse,Vampire Bat,Ghost,Ghoul,Skeleton Archer,Skeleton,Dark Adept DiD
        fog=no
        shroud=no
        gold=200
        {FLAG_VARIANT undead}
    [/side]

    {STARTING_VILLAGES 1 6}

    [side]
        side=2
        controller=ai
        team_name=orcs
        user_team_name=_"Orcs"
        type=Orcish Warlord
        id=Borth
        name=_ "Borth"
        profile=portraits/orcs/transparent/warlord.png
        canrecruit=yes
        recruit=Goblin Spearman,Orcish Archer,Orcish Crossbowman,Wolf Rider,Orcish Grunt,Goblin Knight,Orcish Warrior,Troll Whelp
        {GOLD 110 130 150}
        fog=no
        shroud=no
        [ai]
            villages_per_scout=8
            village_value=0.5
            [target]
                id=Malin Keshar
                value=1
            [/target]
            [target]
                id=Darken Volk
                value=1
            [/target]
        [/ai]
    [/side]

    {STARTING_VILLAGES 2 10}

    [side]
        side=3
        controller=ai
        team_name=orcs
        user_team_name=_"Orcs"
        type=Orcish Slurbow
        id="P'Gareth"
        name=_ "P'Gareth"
        profile=portraits/orcs/transparent/grunt-3.png
        canrecruit=yes
        recruit=Orcish Archer,Orcish Crossbowman,Goblin Pillager,Orcish Grunt,Orcish Assassin
        {GOLD 110 130 150}
        fog=no
        shroud=no
        [ai]
            scout_village_targeting=2
            village_value=0.5
            [target]
                id=Malin Keshar
                value=1
            [/target]
            [target]
                id=Darken Volk
                value=1
            [/target]
        [/ai]
    [/side]

    {STARTING_VILLAGES 3 7}

    [side]
        side=4
        controller=ai
        team_name=orcs
        user_team_name=_"Orcs"
        type=Orcish Warlord
        id="K'Vark"
        name=_ "K'Vark"
        profile=portraits/orcs/transparent/warlord.png
        canrecruit=yes
        recruit=Orcish Archer,Orcish Crossbowman,Troll Whelp,Wolf Rider,Orcish Grunt
        {GOLD 110 130 150}
        fog=no
        shroud=no
        [ai]
            villages_per_scout=6
            village_value=0.5
            [target]
                id=Malin Keshar
                value=1
            [/target]
            [target]
                id=Darken Volk
                value=1
            [/target]
        [/ai]
    [/side]

    {STARTING_VILLAGES 4 8}

    [event]
        name=prestart

        # {SCATTER_IMAGE (terrain=Gg) 3 scenery/oak-leaning.png}
        # {SCATTER_IMAGE (terrain=Gs^Fp) 6 scenery/pine2.png}

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

            note={EARLY_FINISH_BONUS_NOTE}+{NEW_GOLD_CARRYOVER_NOTE_40}
        [/objectives]

        [recall]
            id=Darken Volk
        [/recall]

        {VARIABLE orc_leaders_killed 0}
    [/event]

    [event]
        name=start

        [message]
            speaker=Malin Keshar
            message=_ "Since the very founding of Wesnoth you have hounded humans at every turn. You have raided my home at every opportunity. You have trampled our fields, slaughtered our livestock. You have brought war to a place of peace, and death to a place of life. You have killed without remorse, and despoiled that which was once beautiful. You have murdered my father and caused endless trouble to me. Now I shall have my revenge on you. Expect no mercy from me, because you have long since lost the right to it. I will crush you into the dust. The attacks on Parthyn will stop here and now. When I bring word of your demise the town will cheer my triumphant return."
        [/message]
        [message]
            speaker=Borth
            message=_ "Stop your silly talk, foul necromancer. You have caused 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]

    # In-scenario events

    # Defeat Conditions
    {MALIN_DEATH}
    {VOLK_DEATH}
    {TIME_OUT_LOSE}

    # Victory Condition
    [event]
        name=die
        first_time_only=no

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

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

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

                count=1
            [/have_unit]

            [then]
                [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 13}
                        {VARIABLE escape_to_y 1}
                    [/case]

                    [case]
                        value=3

                        {VARIABLE escape_to_x 1}
                        {VARIABLE escape_to_y 31}
                    [/case]

                    [case]
                        value=4

                        {VARIABLE escape_to_x 40}
                        {VARIABLE escape_to_y 34}
                    [/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]

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

                    kill=yes
                    variable=orc_leader_store
                [/store_unit]

                [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]

                [message]
                    speaker=Malin Keshar
                    message=_ "The last chieftain... he's escaping! The coward!"
                [/message]
                [message]
                    speaker=Darken Volk
                    message=_ "Coward, yes. You must hunt him down before he can take word to the orcish council. A single chieftain, even after he gathers the survivors from this battle, should pose no problem for you, even on your own."
                [/message]
                [message]
                    speaker=Malin Keshar
                    message=_ "On my own? Is my apprenticeship over?"
                [/message]
                [message]
                    speaker=Darken Volk
                    message=_ "... Almost. The growth of your power has been truly impressive to watch. There is, however, a small favor I will ask of you. That will constitute the last part of your training. Now there are merely some... tasks... to which I must attend. They need not concern you. I will meet up with you to the west in a few weeks. In the meantime, do not let the last chieftain escape justice."
                [/message]

                # Heal Darken Volk and store him for his return in A Small Favor
                [object]
                    silent=yes
                    [filter]
                        id=Darken Volk
                    [/filter]
                    [effect]
                        apply_to=hitpoints
                        heal_full=yes
                    [/effect]
                [/object]
                [store_unit]
                    [filter]
                        id=Darken Volk
                    [/filter]
                    variable=darken_volk_store
                    kill=yes
                [/store_unit]

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