#textdomain wesnoth-sotbe
[scenario]
    id=04_The_Siege_of_Barag_Gor
    name= _ "The Siege of Barag Gór"
    map_data="{campaigns/Son_Of_The_Black_Eye/maps/04_The_Siege_of_Barag_Gor.map}"
    turns=24
    victory_when_enemies_defeated=yes

    {DEFAULT_SCHEDULE}

    next_scenario=05_To_the_Harbor_of_Tirigaz

    {SCENARIO_MUSIC "vengeful.ogg"}
    {EXTRA_SCENARIO_MUSIC "the_city_falls.ogg"}
    {EXTRA_SCENARIO_MUSIC "battle.ogg"}

    [event]
        name=prestart
        [objectives]
            side=1,3
            [objective]
                condition=win
                description=_ "Defeat all enemy leaders"
            [/objective]
            [objective]
                condition=lose
                description=_ "Death of Kapou’e"
            [/objective]
            [objective]
                condition=lose
                description=_ "Death of Grüü"
            [/objective]
            [objective]
                condition=lose
                description=_ "Death of a Shaman"
            [/objective]

            {TURNS_RUN_OUT}

            [gold_carryover]
                bonus=yes
                carryover_percentage=40
            [/gold_carryover]
            [note]
                description= _ "Except for the shamans, the Barag Gór defenders will not follow you into the next scenario"
            [/note]
        [/objectives]
    [/event]

    [side]
        side=1
        id="Kapou'e"
        type=Orcish Leader
        controller=human
        recruit=Troll Whelp
        team_name=Kapoue
        user_team_name=_ "Kapou’e"
        {GOLD 200 150 120}
        {BLACK_FLAG}
    [/side]

    [side]
        type=Elvish Marshal
        id=Etheliel
        name= _ "Etheliel"
        side=2
        team_name=Elves
        user_team_name=_"Elves"
        canrecruit=yes
        recruit=Elvish Archer, Elvish Fighter
        profile="portraits/elves/captain.png~FL()~RIGHT()"
        {GOLD 100 125 150}
        {INCOME 8 12 20}
        {FLAG_VARIANT wood-elvish}
    [/side]

    {STARTING_VILLAGES 2 10}
    {AI_FORCE_ATTACK_HIGH_XP_UNITS_SETUP}
    {AI_FORCE_ATTACK_HIGH_XP_UNITS 2}

    [side]
        type=Orcish Slayer
        id=Rugh
        name= _ "Rugh"
        side=3
        controller=human
        team_name=Kapoue
        user_team_name=_ "Kapou’e"
        canrecruit=yes
        recruit= Wolf Rider, Orcish Grunt, Orcish Archer
        {GOLD 250 200 150}
    [/side]

    {STARTING_VILLAGES 3 5}

    [side]
        type=Elvish Marshal
        id="Hida'tul"
        name= _ "Hida’tul"
        side=4
        team_name=Elves
        user_team_name=_"Elves"
        canrecruit=yes
        recruit=Elvish Archer, Elvish Fighter
        {GOLD 100 125 150}
        {FLAG_VARIANT wood-elvish}
    [/side]

    {STARTING_VILLAGES 4 10}
    {AI_FORCE_ATTACK_HIGH_XP_UNITS 4}

    [side]
        type=Elvish Marshal
        id=Ammon
        name= _ "Ammon"
        side=5
        team_name=Elves
        user_team_name=_"Elves"
        canrecruit=yes
        recruit=Elvish Archer, Elvish Fighter
        {GOLD 100 125 150}
        {FLAG_VARIANT wood-elvish}

        [ai]
            passive_leader=yes
            [goal]
                name=target
                [criteria]
                    side=1
                [/criteria]
                value=50
            [/goal]
        [/ai]
    [/side]

    {STARTING_VILLAGES 5 6}
    {AI_FORCE_ATTACK_HIGH_XP_UNITS 5}

    [side]
        type=Elvish Marshal
        id=Sammual
        name= _ "Sammual"
        side=6
        team_name=Elves
        user_team_name=_"Elves"
        canrecruit=yes
        recruit=Elvish Archer, Elvish Fighter
        {GOLD 100 125 150}
        {INCOME 6 9 12}
        {FLAG_VARIANT wood-elvish}
    [/side]

    {STARTING_VILLAGES 6 8}
    {AI_FORCE_ATTACK_HIGH_XP_UNITS 6}

    {BIGMAP_04}

    [event]
        name=prestart

        {GENERIC_UNIT 2 "Elvish Fighter" 18 14}
        {GENERIC_UNIT 2 "Elvish Fighter" 21 12}
        {GENERIC_UNIT 2 "Elvish Fighter" 22 11}
        {GENERIC_UNIT 2 "Elvish Fighter" 18 16}

        {GENERIC_UNIT 2 "Elvish Fighter" 26 15}
        {GENERIC_UNIT 2 "Elvish Fighter" 22 17}

        {GENERIC_UNIT 2 "Elvish Archer" 23 12}
        {GENERIC_UNIT 2 "Elvish Archer" 26 13}
        {GENERIC_UNIT 2 "Elvish Archer" 25 17}

        {GENERIC_UNIT 2 "Elvish Archer" 20 17}
        {GENERIC_UNIT 2 "Elvish Archer" 20 12}

        {GENERIC_UNIT 3 "Orcish Archer" 19 14} {GUARDIAN}
        {GENERIC_UNIT 3 "Orcish Archer" 22 13} {GUARDIAN}
        {GENERIC_UNIT 3 "Orcish Archer" 20 16} {GUARDIAN}

        {GENERIC_UNIT 3 "Orcish Archer" 23 17} {GUARDIAN}
        {GENERIC_UNIT 3 "Orcish Archer" 24 14} {GUARDIAN}

        {GENERIC_UNIT 3 "Orcish Grunt" 24 16} {GUARDIAN}
        {GENERIC_UNIT 3 "Orcish Grunt" 22 12} {GUARDIAN}
        {GENERIC_UNIT 3 "Orcish Grunt" 20 13} {GUARDIAN}
        {GENERIC_UNIT 3 "Orcish Grunt" 19 16} {GUARDIAN}

        {GENERIC_UNIT 3 "Orcish Grunt" 25 15} {GUARDIAN}
        {GENERIC_UNIT 3 "Orcish Grunt" 22 16} {GUARDIAN}
        # wmllint: whofield ORCISH_SHAMAN 4
        {ORCISH_SHAMAN 3 22 14 Pirk _"Pirk"}
        # wmllint: whofield OLD_ORCISH_SHAMAN 4
        {OLD_ORCISH_SHAMAN 3 22 15 Gork _"Gork"}
        # wmllint: whofield NOVICE_ORCISH_SHAMAN 4
        {NOVICE_ORCISH_SHAMAN 3 21 15 Vraurk _"Vraurk"}

        [item]
            x=7
            y=30
            image=units/orcs/assassin.png~RC(magenta>red)
        [/item]

        [item]
            x=7
            y=30
            image=items/cage.png
        [/item]

        {GENERIC_UNIT 2 "Elvish Fighter" 5 30} {GUARDIAN}
        {GENERIC_UNIT 2 "Elvish Captain" 7 29} {GUARDIAN}
        {GENERIC_UNIT 2 "Elvish Fighter" 9 30} {GUARDIAN}
    [/event]

    [event]
        name=start

        [recall]
            id=Grüü
        [/recall]

        [role]
            type=Direwolf Rider,Goblin Knight,Goblin Pillager,Wolf Rider
            role=Scout
        [/role]

        [store_unit]
            [filter]
                role=Scout
            [/filter]
            variable=scout
        [/store_unit]

        [if]
            [variable]
                name=scout.length
                greater_than=0
            [/variable]

            [then]
                [recall]
                    role=Scout
                    x,y=36,3
                [/recall]
            [/then]

            [else]
                {GENERIC_UNIT 1 "Wolf Rider" 36 3}
                [+unit]
                    role=Scout
                    to_variable=scout
                [/unit]
            [/else]
        [/if]

        [message]
            speaker=narrator
            message= _ "When the party finally reached Barag Gór, they were met with a most startling sight."
            image=wesnoth-icon.png
        [/message]

        [scroll_to]
            x,y=23,14
        [/scroll_to]

        [message]
            speaker="Kapou'e"
            message= _ "What the—! Barag Gór is besieged by elves! The wose-born weaklings have always been jealous of our power, but what reason do they have to attack the city?"
            scroll=no
        [/message]

        [message]
            speaker=Grüü
            message= _ "What can you expect, Chief? They’re elves after all."
        [/message]

        [message]
            speaker="Kapou'e"
            message= _ "Hmmm. $scout.name, go find out what they are up to."
        [/message]

        [message]
            role=Scout
            message= _ "Sure."
        [/message]

        [set_variable]
            name=scout.x
            value=32
        [/set_variable]

        [set_variable]
            name=scout.y
            value=6
        [/set_variable]

        [kill]
            role=Scout
        [/kill]

        [move_unit_fake]
            type=$scout.type
            side=1
            x=36,32,32
            y=3,5,6
        [/move_unit_fake]

        [unstore_unit]
            variable=scout
        [/unstore_unit]

        [message]
            speaker=Ammon
            message= _ "One more step and you are dead, flea-bag. Better run if you value your life."
        [/message]

        [message]
            role=Scout
            message= _ "Quit your boasting, mule-ears. The chief wants to know why you’re here, instead of cowering in your dung-spattered forests."
        [/message]

        [message]
            speaker=Ammon
            message= _ "Watch your mouth around your betters, goblin! And you can tell your chief to hand the shamans over to us if he wants to be alive by sundown."
        [/message]

        [message]
            role=Scout
            message= _ "What business do you high-and-mighty elves have with our shamans?"
        [/message]

        [message]
            speaker=Ammon
            message= _ "Our business with them is none of your concern."
        [/message]

        [message]
            role=Scout
            message= _ "Oh, yes, it is. The shamans keep our ancient knowledge and our sacred things; they are not for the likes of you. Why do you want them anyway?"
        [/message]

        [message]
            speaker=Ammon
            message= _ "Well... the humans want to... meet with them."
        [/message]

        [message]
            role=Scout
            message= _ "Oh, so they paid you to come and get them, have they?"
        [/message]

        [message]
            speaker=Ammon
            message= _ "Well..."
        [/message]

        [message]
            role=Scout
            message= _ "So the ‘great and mighty’ elves are now nothing but a bunch of mercenaries."
        [/message]

        [message]
            speaker=Ammon
            message= _ "KILL HIM!!"
        [/message]

        [unit]
            type=Elvish Fighter
            side=5
            x=29
            y=6
            generate_name=yes
            random_traits=yes
        [/unit]

        [unit]
            type=Elvish Fighter
            side=5
            x=29
            y=8
            generate_name=yes
            random_traits=yes
        [/unit]

        [message]
            role=Scout
            message= _ "Hahaha! If you can!"
        [/message]

        [set_variable]
            name=scout.x
            value=36
        [/set_variable]

        [set_variable]
            name=scout.y
            value=3
        [/set_variable]

        [kill]
            role=Scout
        [/kill]

        [move_unit_fake]
            type=$scout.type
            side=1
            x=32,36
            y=6,3
        [/move_unit_fake]

        [unstore_unit]
            variable=scout
        [/unstore_unit]

        [message]
            speaker=Ammon
            message= _ "Blast it, he got away."
        [/message]

        [message]
            speaker="Kapou'e"
            message= _ "So, what news do you bring, $scout.name?"
        [/message]

        [message]
            role=Scout
            message= _ "The elves have been bribed by the humans to capture and deliver the shamans to them."
        [/message]

        [message]
            speaker="Kapou'e"
            message= _ "Over my dead body! The shamans of the Great Council are the only people who can call up the Great Horde. If they are captured then all the orcs on this continent would surely be doomed."
        [/message]

        [message]
            speaker=Grüü
            message= _ "I have a subtle plan, Chief."
        [/message]

        [message]
            speaker="Kapou'e"
            message= _ "Go on, Grüü."
        [/message]

        [message]
            speaker=Grüü
            message= _ "We go and we kill all of them. What do you think?"
        [/message]

        [message]
            speaker="Kapou'e"
            message= _ "..."
        [/message]

        {CLEAR_VARIABLE scout}
    [/event]

    [event]
        name=moveto
        [filter]
            side=1,3
            x=7
            y=30
        [/filter]

        [remove_item]
            x,y=7,30
        [/remove_item]

        [unit]
            id=Jetto
            name= _ "Jetto"
            side=1
            type=Orcish Assassin
            profile=portraits/jetto.png~FL()~RIGHT()
            x=7
            y=30
            random_traits=no
            [modifications]
                {TRAIT_LOYAL}
            [/modifications]
            {IS_LOYAL}
        [/unit]

        [allow_recruit]
            side=1
            type=Orcish Assassin
        [/allow_recruit]

        [message]
            speaker=Jetto
            message= _ "Freedom! Many thanks, Son of the Black-Eye. I’m Jetto, master of assassins, now you can count on the assassins’ guild to help you in your quest!"
        [/message]

        [message]
            speaker="Kapou'e"
            message= _ "Jetto, how did you get captured by the likes of these?"
        [/message]

        [message]
            speaker=Jetto
            message= _ "The Barag Gór council sent me to assassinate the elvish leaders. Unfortunately, I was captured. But now I am free and the elves shall feel my wrath!"
        [/message]

        {VARIABLE freed_Jetto yes}
    [/event]

    [event]
        name=enemies defeated

        [message]
            speaker=Pirk
            message= _ "At last! The siege has been broken."
        [/message]

        [message]
            speaker=Gork
            message= _ "Thank you, Son of the Black-Eye. If you hadn’t arrived when you did, I don’t know what would have happened to us."
        [/message]

        [message]
            speaker="Kapou'e"
            message= _ "No problem! It was fun, wasn’t it, Grüü?"
        [/message]

        [message]
            speaker=Grüü
            message= _ "Hahaha! Yeah!"
        [/message]

        [message]
            speaker="Kapou'e"
            message= _ "But, actually, we have come all the way from our lands to get your help."
        [/message]

        [message]
            speaker=Vraurk
            message= _ "Why? What’s wrong?"
        [/message]

        [message]
            speaker="Kapou'e"
            message= _ "Those insolent humans have massed a huge army and attacked us. We defeated their vanguard but in the end we were forced to retreat."
        [/message]

        [message]
            speaker=Pirk
            message= _ "Hmmmm, this situation is very serious. As you know by now, they have also hired these elves to attack us here."
        [/message]

        [message]
            speaker="Kapou'e"
            message= _ "Yes. It seems to me that the humans are declaring all-out war on us."
        [/message]

        [message]
            speaker=Gork
            message= _ "We must give this matter careful consideration. Come inside the city, and we’ll discuss it."
        [/message]

        [modify_unit]
            [filter]
                id=Pirk,Gork,Vraurk
            [/filter]
            side=1
        [/modify_unit]

        [modify_side]
            side=3
            controller=null
        [/modify_side]

        [if]
            [variable]
                name=freed_Jetto
                not_equals=yes
            [/variable]

            [then]
                [scroll_to]
                    x,y=7,30
                [/scroll_to]

                [message]
                    speaker=narrator
                    caption= _ "Jetto"
                    image=portraits/jetto.png~FL()~RIGHT()
                    message= _ "Son of the Black-Eye! Could I ask for my release from this blighted cage?"
                [/message]

                [message]
                    speaker="Kapou'e"
                    message= _ "How did you get captured by the likes of these?"
                [/message]

                [scroll_to]
                    x,y=7,30
                [/scroll_to]

                [message]
                    speaker=narrator
                    caption= _ "Jetto"
                    image=portraits/jetto.png~FL()~RIGHT()
                    message= _ "The Barag Gór council sent me to assassinate the elvish leaders. Unfortunately, I was captured."
                [/message]

                [message]
                    speaker="Kapou'e"
                    message= _ "Fine, someone go release him."
                [/message]

                [scroll_to]
                    x,y=7,30
                [/scroll_to]

                [remove_item]
                    x,y=7,30
                [/remove_item]

                [unit]
                    id=Jetto
                    name= _ "Jetto"
                    side=1
                    type=Orcish Assassin
                    profile=portraits/jetto.png~FL()~RIGHT()
                    x=7
                    y=30
                    random_traits=no
                    [modifications]
                        {TRAIT_LOYAL}
                    [/modifications]
                    {IS_LOYAL}
                [/unit]

                [allow_recruit]
                    side=1
                    type=Orcish Assassin
                [/allow_recruit]

                [message]
                    speaker=Jetto
                    message= _ "Freedom! Many thanks, Son of the Black-Eye. I’m Jetto, master of assassins, now you can count on my assassins to help you in your quest!"
                [/message]
            [/then]
        [/if]

        {CLEAR_VARIABLE freed_Jetto}

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

    {HERO_DEATHS}
[/scenario]
