#textdomain wesnoth-sotbe
[scenario]
    id=18_Northern_Alliance
    name= _ "Northern Alliance"
    map_data="{campaigns/Son_Of_The_Black_Eye/maps/18_Northern_Alliance.map}"

    turns=-1

    victory_when_enemies_defeated="yes"

    {DEFAULT_SCHEDULE}

    {SCENARIO_MUSIC "the_city_falls.ogg"}
    {EXTRA_SCENARIO_MUSIC "legends_of_the_north.ogg"}
    {EXTRA_SCENARIO_MUSIC "battle.ogg"}
    {EXTRA_SCENARIO_MUSIC "suspense.ogg"}

    next_scenario=19_Epilogue

    [event]
        name=prestart
        [objectives]
            side=1
            [objective]
                condition=win
                description=_ "Kill Shan Taum and Earl Lanbec’h"
            [/objective]
            [objective]
                condition=lose
                description=_ "Death of Kapou’e"
            [/objective]
            [objective]
                description= _ "Death of Grüü"
                condition=lose
            [/objective]
            [objective]
                description= _ "Death of Howgarth III"
                condition=lose
            [/objective]

            {AI_CONTROLLER_NOTE}

            {GREAT_HORDE_NOTE}
        [/objectives]
    [/event]

    [side]
        type=Orcish Leader
        id="Kapou'e"
        name= _ "Kapou’e"
        side=1
        canrecruit=yes
        controller=human
        recruit= Wolf Rider, Orcish Grunt, Troll Whelp, Orcish Archer
        team_name=Kapoue
        user_team_name=_ "Kapou’e"
        {GOLD 800 700 600}
        {BLACK_FLAG}
    [/side]

    {STARTING_VILLAGES_AREA 1 22 5 10}

    {AI_CONTROLLER () 1 2,3,6 ()}

    [side]
        {ALBROCK_SIDE}
        {GOLD 300 250 200}
    [/side]

    {STARTING_VILLAGES 2 6}

    [side]
        {FLARTAR_SIDE}
        {GOLD 300 250 200}
    [/side]

    {STARTING_VILLAGES 3 6}

    [side]
        type=Grand Marshal
        id="Earl Lanbec'h"
        name= _ "Earl Lanbec’h"
        profile=portraits/lanbech.png
        side=4
        canrecruit=yes
        recruit=Dragoon, Swordsman, Pikeman, Longbowman,Shock Trooper,Mage,Duelist,White Mage,Red Mage,Lancer,Knight,Spearman,Bowman,Cavalryman,Horseman
        team_name=villians
        user_team_name=_"Villains"
        {GOLD 800 900 1000}
        [ai]
            recruitment_pattern=scout,scout,fighter,archer,fighter,archer,mixed fighter,mixed fighter,healer
            leader_value=50.0
            villages_per_scout=10
            [protect_unit]
                id="Earl Lanbec'h"
                radius=8
                value=20
            [/protect_unit]
        [/ai]
        [ai]
            time_of_day=dawn,morning,afternoon
            aggression=0.9
            caution=0.2
            village_value=0.2
            grouping=offensive
        [/ai]
        [ai]
            time_of_day=dusk,first_watch,second_watch
            aggression=0.7
            caution=0.5
            village_value=0.8
            grouping=defensive
        [/ai]
        {FLAG_VARIANT loyalist}
    [/side]

    {STARTING_VILLAGES 4 12}

    [side]
        type=Orcish Warlord
        id=Shan Taum
        name= _ "Shan Taum"
        profile=portraits/shan_taum.png
        side=5
        canrecruit=yes
        facing=sw
        recruit= Wolf Rider, Goblin Knight, Orcish Grunt, Ogre, Orcish Archer, Orcish Crossbowman, Orcish Warrior, Orcish Assassin, Orcish Slayer
        team_name=villians
        user_team_name=_"Villains"
        {GOLD 300 350 400}

        [ai]
            [target]
                id="Kapou'e"
                value=10
            [/target]
        [/ai]
    [/side]

    {STARTING_VILLAGES_AREA 5 60 6 10}

    [side]
        type=General
        id=Howgarth III
        name= _ "Howgarth III"
        profile=portraits/howgarth.png
        side=6
        canrecruit=yes
        facing=sw
        recruit=Gryphon Rider, Gryphon Master, Spearman, Swordsman, Javelineer, Pikeman, Dwarvish Steelclad, Dwarvish Fighter, Dwarvish Thunderer, Dwarvish Thunderguard, Dwarvish Scout, Dwarvish Pathfinder, Bowman, Longbowman, Mage, White Mage, Red Mage, Fencer, Duelist
        team_name=Kapoue
        user_team_name=_ "Kapou’e"
        {GOLD 400 350 300}
        {FLAG_VARIANT loyalist}
    [/side]

    {STARTING_VILLAGES_AREA 6 57 27 13}

    [story]
        [part]
            story= _ "Kapou’e agreed to meet Howgarth III. Not trusting the human however, Kapou’e brought along Grüü, as well as one of his most trusted soldiers. Earl Lanbec’h flatly refused to attend the parley."
            background=farnorth.png
        [/part]

        [part]
            story= _ "The human attack having stopped for the time being, both parties met in the middle of the battlefield. Howgarth III demanded that Kapou’e give Dorset back to the humans and return to their lands as defined in the treaty. Kapou’e refused to do so as long as the humans were attacking orcish lands. He demanded that the humans disperse their forces and return any land they had stolen from the orcs. Only then would he return Dorset and disperse the Horde."
            background=farnorth.png
        [/part]

        [part]
            story= _ "Howgarth III agreed and further added that, if Earl Lanbec’h continued in aggression, then under the dictates of the Northern Alliance, he himself would be forced to move against the Earl."
            background=farnorth.png
        [/part]

        [part]
            # wmllint: local spelling Kauran
            story= _ "That having been settled, Kapou’e began to inquire about the death of his father. Howgarth III repeated his story, that the last thing they heard from Black-Eye Karun was the message declining their invitation to join the Northern Alliance, brought by none other then Shan Taum himself."
            background=farnorth.png
        [/part]

        [part]
            story= _ "As they were discussing the matter, a group of orcs charged from the surrounding trees and hills and surrounded the parley."
            background=farnorth.png
        [/part]

        [part]
            show_title=yes
            {TO_NORTHERN_ALLIANCE}
        [/part]
    [/story]

    {GOT_THE_GREAT_HORDE 1,2,3}

    [event]
        name=prestart

        [recall]
            id=Grüü
            x,y=45,20
        [/recall]
        [recall]
            id=Jetto
            x,y=21,6
        [/recall]
        [recall]
            id=Inarix
            x,y=23,6
        [/recall]

        [role]
            type=Orcish Warlord,Orcish Slurbow,Troll Warrior,Direwolf Rider,Goblin Pillager,Orcish Crossbowman,Orcish Warrior,Goblin Knight
            side=1
            role=bodyguard
        [/role]

        [recall]
            role=bodyguard
            x,y=43,21
        [/recall]

        [hide_unit]
            x,y=48,19
        [/hide_unit]

        {GENERIC_UNIT 4 Halberdier 21 26}
        {GENERIC_UNIT 4 Halberdier 23 26}

        {GENERIC_UNIT 4 Pikeman 19 27}
        {GENERIC_UNIT 4 Pikeman 25 27}

        {GENERIC_UNIT 4 Javelineer 16 27}
        {GENERIC_UNIT 4 Javelineer 28 27}

        {GENERIC_UNIT 4 (Iron Mauler) 16 29}
        {GENERIC_UNIT 4 (Iron Mauler) 28 29}

        {GENERIC_UNIT 4 (Shock Trooper) 16 31}
        {GENERIC_UNIT 4 (Shock Trooper) 28 31}

        {GENERIC_UNIT 4 (Shock Trooper) 17 33}
        {GENERIC_UNIT 4 (Shock Trooper) 27 33}

        {GENERIC_UNIT 4 (Shock Trooper) 19 33}
        {GENERIC_UNIT 4 (Shock Trooper) 25 33}

        {GENERIC_UNIT 4 Swordsman 21 34}
        {GENERIC_UNIT 4 Swordsman 23 34}

        {MODIFY_UNIT side,canrecruit=4,no ai_special guardian}
        {MODIFY_UNIT x,y=23-28,25-35 facing sw}

        {GENERIC_UNIT 6 (Royal Guard) 45 22}
        {GENERIC_UNIT 6 (Royal Guard) 47 21}

        {VARIABLE afternoontime 3}
    [/event]

    [event]
        name=start

        [move_unit_fake]
            type=Orcish Warrior
            side=5
            x=46,42
            y=16,19
        [/move_unit_fake]

        [unit]
            type=Orcish Warrior
            side=5
            x=42
            y=19
            generate_name=yes
            random_traits=yes
        [/unit]

        [move_unit_fake]
            type=Orcish Warrior
            side=5
            x=46,44
            y=18,18
        [/move_unit_fake]

        [unit]
            type=Orcish Warrior
            side=5
            x=44
            y=18
            generate_name=yes
            random_traits=yes
        [/unit]

        [move_unit_fake]
            type=Orcish Warrior
            side=5
            x=40,41
            y=24,21
        [/move_unit_fake]

        [unit]
            type=Orcish Warrior
            side=5
            x=41
            y=21
            generate_name=yes
            random_traits=yes
        [/unit]

        [move_unit_fake]
            type=Orcish Warrior
            side=5
            x=40,42
            y=24,22
        [/move_unit_fake]

        [unit]
            type=Orcish Warrior
            side=5
            x=42
            y=22
            generate_name=yes
            random_traits=yes
        [/unit]

        [move_unit_fake]
            type=Orcish Warrior
            side=5
            x=44,45
            y=24,24
        [/move_unit_fake]

        [unit]
            type=Orcish Warrior
            side=5
            x=45
            y=24
            generate_name=yes
            random_traits=yes
        [/unit]

        [move_unit_fake]
            type=Orcish Warrior
            side=5
            x=48,47
            y=24,24
        [/move_unit_fake]

        [unit]
            type=Orcish Warrior
            side=5
            x=47
            y=24
            generate_name=yes
            random_traits=yes
        [/unit]

        [move_unit_fake]
            type=Orcish Warrior
            side=5
            x=47,46
            y=18,18
        [/move_unit_fake]

        [unit]
            type=Orcish Warrior
            side=5
            x=46
            y=18
            generate_name=yes
            random_traits=yes
        [/unit]

        [move_unit_fake]
            type=Orcish Warrior
            side=5
            x=49,49
            y=24,23
        [/move_unit_fake]

        [unit]
            type=Orcish Warrior
            side=5
            x=49
            y=23
            generate_name=yes
            random_traits=yes
        [/unit]

        [move_unit_fake]
            type=Orcish Warlord
            side=5
            x=49,48
            y=19,19
        [/move_unit_fake]

        [unhide_unit]
        [/unhide_unit]

        [message]
            speaker=Shan Taum
            message= _ "Now now now, what do we have here. Collaborating with the enemy again just like your disgusting father, are you?"
        [/message]

        [message]
            speaker="Kapou'e"
            # wmllint: local spelling pfff
            message= _ "Collaborating with the humans, pfff. You’re one to talk. What are you doing here, Shan Taum?"
        [/message]

        [message]
            speaker=Shan Taum
            message= _ "I am here to do to you what I did to your father."
        [/message]

        [message]
            speaker="Kapou'e"
            message= _ "So you did kill my father then."
        [/message]

        [message]
            speaker=Howgarth III
            message= _ "What did I tell you, Kapou’e?"
        [/message]

        [message]
            speaker="Earl Lanbec'h"
            message= _ "Ha ha! Good work Shan Taum. That will teach them. Attack, boys, I want Dorset recaptured by sunset."
        [/message]

        [message]
            speaker=Howgarth III
            message= _ "Hold, Earl Lanbec’h. I have reached an agreement with these orcs. Since your army has been the aggressor, you must immediately disperse your army and withdraw from orcish territory. Once that is done then Kapou’e will give you back Dorset and call off the horde. I have had dealings with Kapou’e’s father before and I believe his blood will be trustworthy. And if that isn’t enough, then we are here to protect you in case he violates the pact."
        [/message]

        [message]
            speaker="Earl Lanbec'h"
            message= _ "You and your damned compromises can go to hell. Your beloved Kapou’e will be joining you shortly."
        [/message]

        [message]
            speaker=Howgarth III
            message= _ "You leave us no choice but to take military action against you."
        [/message]

        [message]
            speaker="Earl Lanbec'h"
            message= _ "Ha ha! Very funny, Howgarth. Look around you. You are going to be dead as soon as my orc friend here gives the order. And then your men will automatically assume that Kapou’e tricked and killed you."
        [/message]

        [message]
            speaker=Howgarth III
            message= _ "Not today, my friend. (<i>Whistles</i>)"
        [/message]

        [move_unit_fake]
            type=Gryphon Master
            side=6
            x=52,46
            y=21,22
        [/move_unit_fake]

        [unit]
            type=Gryphon Master
            x=47
            y=22
            side=6
            generate_name=yes
            random_traits=yes
        [/unit]

        [move_unit_fake]
            type=Gryphon Master
            side=6
            x=47,44
            y=27,23
        [/move_unit_fake]

        [unit]
            type=Gryphon Master
            x=44
            y=23
            side=6
            generate_name=yes
            random_traits=yes
            facing=sw
        [/unit]

        [move_unit_fake]
            type=Gryphon Master
            side=6
            x=51,43
            y=22,20
        [/move_unit_fake]

        [unit]
            type=Gryphon Master
            x=43
            y=20
            side=6
            generate_name=yes
            random_traits=yes
        [/unit]

        [move_unit_fake]
            type=Gryphon Master
            side=6
            x=38,41
            y=22,22
        [/move_unit_fake]

        [unit]
            type=Gryphon Master
            x=41
            y=22
            side=6
            generate_name=yes
            random_traits=yes
        [/unit]

        [move_unit_fake]
            type=Gryphon Master
            side=6
            x=52,45
            y=18,18
        [/move_unit_fake]

        [unit]
            type=Gryphon Master
            x=45
            y=18
            side=6
            generate_name=yes
            random_traits=yes
            facing=sw
        [/unit]

        [message]
            speaker=Howgarth III
            message= _ "Kapou’e, it is essential that I make it back to my camp to bring news of our agreement and this treachery. One of my gryphon riders will take me. My bodyguards and the rest of my gryphons will help you fight free of this ambush. Once you get back to your camp, we will make a joint assault on these traitors. Once they are dead and dispersed, then I trust you will carry out our agreement."
        [/message]

        [message]
            speaker="Kapou'e"
            message= _ "Agreed. Let’s get to it. BLOOD AND STEEL!"
            image=portraits/kapoue-angry.png
        [/message]

        [store_unit]
            [filter]
                id=Howgarth III
            [/filter]

            kill=yes
            variable=stored_Hogwarth
        [/store_unit]

        {VARIABLE stored_Hogwarth.x 57}
        {VARIABLE stored_Hogwarth.y 27}

        {MOVE_UNIT x,y=47,22 56 26}

        [unstore_unit]
            variable=stored_Hogwarth
        [/unstore_unit]

        [message]
            speaker=Shan Taum
            message= _ "Blast! The human has escaped. Orcs, bring me Kapou’e’s head. I must get to my camp and assault the city."
        [/message]

        [store_unit]
            [filter]
                id=Shan Taum
            [/filter]

            kill=yes
            variable=stored_ShanTaum
        [/store_unit]

        {VARIABLE stored_ShanTaum.x 60}
        {VARIABLE stored_ShanTaum.y 6}

        [move_unit_fake]
            type=Orcish Warlord
            side=5
            x=48,52
            y=19,16
        [/move_unit_fake]

        [move_unit_fake]
            type=Orcish Warlord
            side=5
            x=57,60
            y=8,6
        [/move_unit_fake]

        [unstore_unit]
            variable=stored_ShanTaum
        [/unstore_unit]

        [message]
            speaker=Grüü
            message= _ "Shan Taum big coward. Never want to fight."
        [/message]

        {CLEAR_VARIABLE stored_Hogwarth,stored_ShanTaum}
    [/event]

    [event]
        name=new turn
        first_time_only=no

        [set_variable]
            name=afternoontime
            add=1
        [/set_variable]

        [if]
            [variable]
                name=afternoontime
                numerical_equals=6
            [/variable]

            [then]
                [set_variable]
                    name=afternoontime
                    sub=6
                [/set_variable]

                [gold]
                    amount=500
                    side=4
                [/gold]

                {GENERIC_UNIT 4 General 22 37}
                {GENERIC_UNIT 4 Swordsman 22 37}
                {GENERIC_UNIT 4 Swordsman 22 37}
                {GENERIC_UNIT 4 Longbowman 22 37}
                {GENERIC_UNIT 4 Longbowman 22 37}
                {GENERIC_UNIT 4 Horseman 22 37}
                {GENERIC_UNIT 4 Horseman 22 37}
            [/then]
        [/if]
    [/event]

    [event]
        name=die

        [filter]
            id=Shan Taum
        [/filter]

        [if]
            [have_unit]
                side=1,2,3
                x,y=$x2,$y2
            [/have_unit]

            [then]
                [message]
                    speaker=second_unit
                    message= _ "Yeah, we finally got the coward. What do you want us to do with him chief?"
                [/message]
            [/then]

            [else]
                [message]
                    speaker="Kapou'e"
                    message= _ "Blood and steel! The traitor was mine!"
                    image=portraits/kapoue-angry.png
                [/message]

                [message]
                    speaker=Howgarth III
                    message= _ "I’m sorry, Kapou’e. I’ll have my men leave what remains of him to you."
                [/message]

                [message]
                    side=1,2,3
                    canrecruit=no
                    message= _ "What do you want us to do with him chief?"
                [/message]
            [/else]
        [/if]

        [message]
            speaker="Kapou'e"
            message= _ "Stick his head at the end of a pike and let the buzzards pick it clean. I wasn’t joking about making a mug from his skull."
        [/message]
    [/event]

    [event]
        name=victory

        [message]
            speaker=Grüü
            message= _ "YEAH!"
        [/message]

        [endlevel]
            result=victory
            carryover_report=no
            save=no
        [/endlevel]
    [/event]

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