#textdomain wesnoth-sotbe
[scenario]
    id="The_Siege_Of_Barag_Gor"
    name= _ "The Siege Of Barag Gór"
    map_data="{campaigns/Son_Of_The_Black_Eye/maps/The_Siege_Of_Barag_Gor.map}"
    {TURNS 28 24 20}
    victory_when_enemies_defeated=yes

    {DEFAULT_SCHEDULE}

    next_scenario="To_the_harbour_of_Tirigaz"

    {SCENARIO_MUSIC "battle.ogg"}
    {VICTORY_AND_DEFEAT_MUSIC}

    [event]
        name=prestart
        [objectives]
            side=1
            [objective]
                condition=win
                description=_ "Break the Siege of Barag Gór"
            [/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]
            [objective]
                condition=lose
                description=_ "Turns run out"
            [/objective]
        [/objectives]
    [/event]

    [side]
        type=Orcish Leader
        description="Kapou'e"
        user_description= _ "Kapou'e"
        side=1
        canrecruit=yes
        controller=human
        recruit= Wolf Rider, Orcish Grunt, Troll Whelp, Orcish Archer
        team_name=Kapoue
        gold=100
        {BLACK_FLAG}
    [/side]

    [side]
        type=Elvish Marshal
        description=Etheliel
        user_description= _ "Etheliel"
        side=2
        team_name=Elves
        canrecruit=yes
        recruit=Elvish Archer, Elvish Fighter
        {GOLD 60 80 100}
        [village]
            x=1
            y=30
        [/village]
        [village]
            x=6
            y=29
        [/village]
        [village]
            x=2
            y=21
        [/village]
        [village]
            x=7
            y=23
        [/village]
        [village]
            x=3
            y=17
        [/village]
        [village]
            x=7
            y=20
        [/village]
        [village]
            x=11
            y=22
        [/village]
        [village]
            x=11
            y=15
        [/village]
        [village]
            x=2
            y=12
        [/village]
    [/side]

    [side]
        type=Orcish Slayer
        description=Rugh
        user_description= _ "Rugh"
        side=3
        team_name=Kapoue
        canrecruit=yes
        recruit= Wolf Rider, Orcish Grunt, Troll Whelp, Orcish Archer
        gold=150

        [ai]
            [leader_goal]
                x=23
                y=14
            [/leader_goal]
        [/ai]
    [/side]

    [side]
        type=Elvish Marshal
        description="Hida'tul"
        user_description= _ "Hida'tul"
        side=4
        team_name=Elves
        canrecruit=yes
        recruit=Elvish Archer, Elvish Fighter
        {GOLD 60 80 100}
        [village]
            x=23
            y=29
        [/village]
        [village]
            x=23
            y=28
        [/village]
        [village]
            x=24
            y=27
        [/village]
        [village]
            x=28
            y=27
        [/village]
        [village]
            x=29
            y=28
        [/village]
        [village]
            x=29
            y=29
        [/village]
    [/side]

    [side]
        type=Elvish Marshal
        description=Ammon
        user_description= _ "Ammon"
        side=5
        team_name=Elves
        canrecruit=yes
        recruit=Elvish Archer, Elvish Fighter
        {GOLD 60 80 100}
        [village]
            x=29
            y=3
        [/village]
        [village]
            x=28
            y=3
        [/village]
        [village]
            x=28
            y=4
        [/village]
        [village]
            x=32
            y=7
        [/village]
        [village]
            x=33
            y=7
        [/village]
        [village]
            x=34
            y=6
        [/village]
    [/side]

    [side]
        type=Elvish Marshal
        description=Sammual
        user_description= _ "Sammual"
        side=6
        team_name=Elves
        canrecruit=yes
        recruit=Elvish Archer, Elvish Fighter
        {GOLD 60 80 100}
        [village]
            x=4
            y=5
        [/village]
        [village]
            x=4
            y=6
        [/village]
        [village]
            x=5
            y=7
        [/village]
        [village]
            x=9
            y=3
        [/village]
        [village]
            x=10
            y=3
        [/village]
        [village]
            x=10
            y=4
        [/village]
    [/side]

    [story]
        [part]
            background=sotbe1.png
            show_title=yes
            {DOT 374 221}
            {DOT 340 228}
            {DOT 304 215}
            {DOT 271 209}
            {DOT 241 212}
            {CROSS 212 213}
        [/part]
    [/story]

    [event]
        name=prestart

        [set_variable]
            name=elvish_casualties
            value=0
        [/set_variable]

        {ELVISH_FIGHTER 18 14}
        {ELVISH_FIGHTER 21 12}
        {ELVISH_FIGHTER 22 11}
        {ELVISH_FIGHTER 18 16}

        {ELVISH_FIGHTER 26 15}
        {ELVISH_FIGHTER 22 17}

        {ELVISH_ARCHER 23 12}
        {ELVISH_ARCHER 26 13}
        {ELVISH_ARCHER 25 17}

        {ELVISH_ARCHER 20 17}
        {ELVISH_ARCHER 20 12}

        {ORCISH_ARCHER_G 19 14}
        {ORCISH_ARCHER_G 22 13}
        {ORCISH_ARCHER_G 20 16}

        {ORCISH_ARCHER_G 23 17}
        {ORCISH_ARCHER_G 24 14}

        {ORCISH_GRUNT_G 24 16}
        {ORCISH_GRUNT_G 22 12}
        {ORCISH_GRUNT_G 20 13}
        {ORCISH_GRUNT_G 19 16}

        {ORCISH_GRUNT_G 25 15}
        {ORCISH_GRUNT_G 22 16}
        {ORCISH_SHAMAN 22 14 Pirk _"Pirk"}
        {OLD_ORCISH_SHAMAN 22 15 Gork _"Gork"}
        {NOVICE_ORCISH_SHAMAN 21 15 Vraurk _"Vraurk"}
        # wmllint: recognize Pirk
        # wmllint: recognize Gork
        # wmllint: recognize 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]

        {ELVISH_FIGHTER_G 5 30}
        {ELVISH_CAPTAIN_G 7 29}
        {ELVISH_FIGHTER_G 9 30}
    [/event]

    [event]
        name=start

        [recall]
            description=Grüü
        [/recall]

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

        [recall]
            role=Scout
        [/recall]

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

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

        [message]
            description="Kapou'e"
            message= _ "What the...! Barag Gór is besieged by elves. I knew the elves have always been jealous of our manly strength, but what reason do they have to attack us just now?"
        [/message]
        [message]
            description=Grüü
            message= _ "What can you expect, Chief, they're elves after all."
        [/message]
        [message]
            description="Kapou'e"
            message= _ "Hmmm, $name.user_description go find out what they are up to."
        [/message]

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

        [store_unit]
            [filter]
                role=Scout
            [/filter]
            variable=move
            kill=yes
        [/store_unit]

        [set_variable]
            name=move.x
            value=13
        [/set_variable]

        [set_variable]
            name=move.y
            value=27
        [/set_variable]

        [move_unit_fake]
            type=$name.type
            x=38,38,37,36,35.34,21,20,19,18,17,16,15,14,13
            y=19,18,18,18,19,19,29,28,28,28,28,28,28,27,27
        [/move_unit_fake]

        [unstore_unit]
            variable=move
        [/unstore_unit]

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

        [message]
            description=Etheliel
            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, tree-shagger. The chief wants to know why you are here, instead of cowering in your dung-spattered forests."
        [/message]

        [message]
            description=Etheliel
            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]
            description=Etheliel
            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 precious to us. If you want us to hand them over you'll have to tell us what you want with them."
        [/message]

        [message]
            description=Etheliel
            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]
            description=Etheliel
            message= _ "Well..."
        [/message]

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

        [message]
            description=Etheliel
            message= _ "KILL HIM!!!"
        [/message]

        [unit]
            type=Elvish Fighter
            side=2
            x=3
            y=26
            generate_description=yes
            random_traits=yes
        [/unit]

        [unit]
            type=Elvish Fighter
            side=2
            x=2
            y=25
            generate_description=yes
            random_traits=yes
        [/unit]

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

        [store_unit]
            [filter]
                role=Scout
            [/filter]
            variable=move
            kill=yes
        [/store_unit]

        [set_variable]
            name=move.x
            value=38
        [/set_variable]

        [set_variable]
            name=move.y
            value=19
        [/set_variable]

        [move_unit_fake]
            type=$name.type
            x=13,14,15,16,17,18,19,20,21,34,35,36,37,38,38
            y=27,27,28,28,28,28,28,28,29,19,19,18,18,18,19
        [/move_unit_fake]

        [unstore_unit]
            variable=move
        [/unstore_unit]

        {CLEAR_VARIABLE move}

        [message]
            description=Etheliel
            message= _ "Blast it, he got away."
        [/message]

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

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

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

        [message]
            description="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]
            description=Grüü
            message= _ "I have a subtle plan, chief."
        [/message]
        [message]
            description="Kapou'e"
            message= _ "Which plan?"
        [/message]

        [message]
            description=Grüü
            message= _ "We go and we kill all of them. What do you think?"
        [/message]
        [message]
            description="Kapou'e"
            message= _ "..."
        [/message]
        [message]
            speaker=narrator
            message= _ "Then, Kapou'e launched his desperate attack to break the siege of Barag Gór."
            image=wesnoth-icon.png
        [/message]
    [/event]

    [event]
        name=moveto

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

        [filter]
            side=1
            x=7
            y=30
        [/filter]

        [unit]
            description=Jetto
            user_description= _ "Jetto"
            side=1
            type=Orcish Assassin
            x=7
            y=30
            random_traits=no
            [modifications]
                {TRAIT_LOYAL}
            [/modifications]
        [/unit]

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

        [message]
            description=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]
            description="Kapou'e"
            message= _ "Jetto, how did you get captured by the likes of these?"
        [/message]

        [message]
            description=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=moveto

        [filter]
            side=1
            [not]
                description=Pirk
            [/not]
            [not]
                description=Gork
            [/not]
            [not]
                description=Vraurk
            [/not]
            x=18-25
            y=11-17
        [/filter]

        [message]
            description=Rugh
            message= _ "Hurrah! Reinforcements at last!"
        [/message]

        [message]
            speaker=unit
            message= _ "That's right! Now let's drive those mincing tree-shaggers back into their forests!"
        [/message]
    [/event]

    [event]
        name=victory

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

        [message]
            description=Gork
            message= _ "Thank you, Son of the Black-Eye. If you hadn't arrived when you did, I don't know what would be our fate."
        [/message]

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

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

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

        [message]
            description=Vraurk
            message= _ "Why? What's wrong?"
        [/message]

        [message]
            description="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]
            description=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]
            description="Kapou'e"
            message= _ "Yes. It seems to me that the humans are declaring all-out war on us."
        [/message]

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

        [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/Alex_Jarocha-Ernst/orcish-assassin.png
                    message= _ "Son of the Black-Eye! Could I ask for my release from this blighted cage?"
                [/message]

                [message]
                    description="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/Alex_Jarocha-Ernst/orcish-assassin.png
                    message= _ "The Barag Gór council sent me to assassinate the elvish leaders. Unfortunately, I was captured."
                [/message]

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

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

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

                [unit]
                    description=Jetto
                    user_description= _ "Jetto"
                    side=1
                    type=Orcish Assassin
                    x=7
                    y=30
                    [modifications]
                        {TRAIT_LOYAL}
                    [/modifications]
                [/unit]

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

                [message]
                    description=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]
            [/then]
        [/if]

        {CLEAR_VARIABLE name}
        {CLEAR_VARIABLE freed_Jetto}
    [/event]

    {@campaigns/Son_Of_The_Black_Eye/utils/deaths.cfg}
[/scenario]
