#textdomain wesnoth-sotbe
[scenario]
    id=02_The_Human_Army
    name= _ "The Human Army"
    map_data="{campaigns/Son_Of_The_Black_Eye/maps/01_End_of_Peace.map}"

    turns=18

    {DEFAULT_SCHEDULE}

    next_scenario=03_Toward_Mountains_of_Haag

    {SCENARIO_MUSIC "loyalists.ogg"}
    {EXTRA_SCENARIO_MUSIC "battle.ogg"}
    {EXTRA_SCENARIO_MUSIC "heroes_rite.ogg"}

    [event]
        name=prestart
        [objectives]
            side=1
            [objective]
                description= _ "Defeat Lanbec’h"
                condition=win
                [show_if]
                    {VARIABLE_CONDITIONAL prepare_retreat boolean_equals no}
                    {VARIABLE_CONDITIONAL retreat boolean_equals no}
                [/show_if]
            [/objective]
            [objective]
#ifdef EASY
                description= _ "Resist until your people are ready to go (turn 12)"
#endif
#ifdef NORMAL
                description= _ "Resist until your people are ready to go (turn 13)"
#endif
#ifdef HARD
                description= _ "Resist until your people are ready to go (turn 14)"
#endif
                condition=win
                [show_if]
                    {VARIABLE_CONDITIONAL prepare_retreat boolean_equals yes}
                [/show_if]
            [/objective]
            [objective]
                description= _ "Then move Kapou’e to the signpost in the northeast"
                condition=win
                [show_if]
                    {VARIABLE_CONDITIONAL prepare_retreat boolean_equals yes}
                [/show_if]
            [/objective]
            [objective]
                description= _ "Move Kapou’e to the signpost in the northeast"
                condition=win
                [show_if]
                    {VARIABLE_CONDITIONAL retreat boolean_equals yes}
                [/show_if]
            [/objective]
            [objective]
                description= _ "Death of Kapou’e"
                condition=lose
            [/objective]

            [gold_carryover]
                bonus=no
                carryover_percentage=40
            [/gold_carryover]
        [/objectives]
    [/event]

    [side]
        side=1
        id="Kapou'e"
        type=Orcish Leader
        controller=human
        team_name=Kapoue
        user_team_name=_ "Kapou’e"
        gold=100
        {BLACK_FLAG}
    [/side]

    # Give Kapou'e the northern tier of villages near his keep.
    {STARTING_VILLAGES 1 18}

    [side]
        type=General
        id="Lanbec'h"
        name= _ "Lanbec’h"
        profile=portraits/lanbech.png
        side=2
        canrecruit=yes
        facing=sw
        recruit=Dragoon, Swordsman, Pikeman, Longbowman
        team_name=Humans
        user_team_name=_ "Humans"
        gold=10000
        {FLAG_VARIANT loyalist}
    [/side]

    [story]
        [part]
            story= _ "Refusing to yield to fear, Kapou’e rallied his warriors in preparation for the upcoming battle."
            {SOTBE_BIGMAP}
            {JOURNEY_01_OLD}
        [/part]

        [part]
            story= _ "He was not disappointed. A few days later the main body of the human army arrived. Driven to a desperate rage by the death of his son-in-law, Earl Lanbec’h led the army himself."
            {SOTBE_BIGMAP}
            {JOURNEY_01_OLD}
        [/part]
    [/story]

    {SOTBE_TRACK {JOURNEY_02_NEW} }

    [event]
        name=start

        [recall]
            id=Vrag
        [/recall]

        [message]
            speaker="Lanbec'h"
            message= _ "So this is the bold orc who has dared kill my son-in-law."
        [/message]
        [message]
            speaker="Kapou'e"
            message= _ "And this is that stupid human who dares march against Kapou’e — Son of the Black-Eye!"
        [/message]
    [/event]

    [event]
        name=turn 6

        [message]
            speaker=narrator
            message= _ "As Kapou’e saw the hardened troops pour out of the human encampment, he began to have second thoughts."
            image=wesnoth-icon.png
        [/message]

        [message]
            speaker="Kapou'e"
            message= _ "They are too many and too tough. The few here don’t stand a chance."
        [/message]

        # List types so that lowest-level unit gets picked first
        [role]
            role=Helper
            type=Wolf Rider, Orcish Archer, Orcish Grunt, Orcish Warrior, Orcish Crossbowman, Goblin Knight, Goblin Pillager, Orcish Warlord, Orcish Slurbow, Direwolf Rider
            side=1
            search_recall_list=no
            [not]
                id="Kapou'e,Vrag"
            [/not]
            [else]
                {UNIT 1 (Orcish Grunt) 16 3 (role=Helper)}
            [/else]
        [/role]

        [if]
            [have_unit]
                id=Vrag
            [/have_unit]
            [then]
                [message]
                    speaker=Vrag
                    message= _ "I told you so!"
                [/message]

                [message]
                    speaker="Kapou'e"
                    message= _ "Insolence! But you make a good point all the same. I should have paid attention to my supporters before. But what should we do now?"
                [/message]

                [message]
                    speaker=Vrag
                    message= _ "We must flee! There is no way we can stand up against such a force."
                [/message]
            [/then]
            [else]
                [message]
                    role=Helper
                    message= _ "We must flee! There is no way we can stand up against such a force."
                [/message]
            [/else]
        [/if]

        [message]
            speaker="Kapou'e"
            message= _ "The Son of the Black-Eye will never ‘flee’. But making a ‘strategic withdrawal’ is another matter."
        [/message]

        [message]
            speaker="Kapou'e"
            message= _ "My father often spoke of the shamans of the Great Council who live in Barag Gór in the lands of the free tribes. We shall ask them for support. With their help, perhaps we can unite the orcish tribes and crush these humans."
        [/message]

        [store_unit]
            [filter]
                role=Helper
            [/filter]
            kill=no
            variable=stored_helper
        [/store_unit]

        [message]
            speaker="Kapou'e"
            message= _ "$stored_helper.name|!"
        [/message]

        [message]
            role=Helper
            message= _ "Yeah, Chief?"
        [/message]

        [message]
            speaker="Kapou'e"
            message= _ "You, gather up our people and assemble them on the road some distance north of here. We will hold back the humans here until you are finished."
        [/message]

        [message]
            role=Helper
            message= _ "Done."
        [/message]

        [kill]
            role=Helper
            animate=no
        [/kill]

        {PLACE_IMAGE scenery/signpost.png 28 1}

        {VARIABLE prepare_retreat yes}

        [show_objectives]
        [/show_objectives]
    [/event]

    [event]
#ifdef EASY
        name=turn 12
#endif
#ifdef NORMAL
        name=turn 13
#endif
#ifdef HARD
        name=turn 14
#endif

        {VARIABLE stored_helper.x 27}
        {VARIABLE stored_helper.y 1}

        [unstore_unit]
            variable=stored_helper
            find_vacant=yes
        [/unstore_unit]

        {CLEAR_VARIABLE stored_helper}

        {MOVE_UNIT role=Helper 26 2}

        [message]
            role=Helper
            message= _ "Chief, we have all our people ready to go. Come on, this way. We managed to gather the last of the gold from the treasury as well."
        [/message]

        [gold]
            side=1
            amount=100
        [/gold]

        [message]
            speaker="Kapou'e"
            message= _ "Took you long enough. Let’s go!"
        [/message]

        {CLEAR_VARIABLE prepare_retreat}
        {VARIABLE retreat yes}

        [if]
            [have_unit]
                x=28
                y=1
                id="Kapou'e"
            [/have_unit]

            [then]
                [fire_event]
                    name=Kapoue_leaves
                [/fire_event]
            [/then]
            [else]
                [show_objectives]
                [/show_objectives]
            [/else]
        [/if]

        [event]
            name=moveto

            [filter]
                x=28
                y=1
                id="Kapou'e"
            [/filter]

            [fire_event]
                name=Kapoue_leaves
            [/fire_event]
        [/event]
    [/event]

    [event]
        name=Kapoue_leaves

        [message]
            speaker="Kapou'e"
            message= _ "We’ll be back, you foul mud-sucking humans!"
        [/message]

        [message]
            speaker="Lanbec'h"
            message= _ "That’s right, flee, you cowardly orcs! This land is mine!"
        [/message]

        [message]
            speaker="Kapou'e"
            message= _ "In your dreams, worm. When the time comes you will pay for all this with your life!"
            image=portraits/kapoue-angry.png
        [/message]

        {CLEAR_VARIABLE retreat}

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

    {KAPOUE_DEATH}
[/scenario]
