#textdomain wesnoth-nr

[scenario]
    id=07a_Settling_Disputes
    name= _ "Settling Disputes"
    map_file=07a_Settling_Disputes.map
    {TURNS 25 20 15}
    next_scenario=08a_Elvish_Princess

    {DEFAULT_SCHEDULE}

    {INTRO_AND_SCENARIO_MUSIC "knolls.ogg" "frantic.ogg"}
    {EXTRA_SCENARIO_MUSIC "knalgan_theme.ogg"}
    {EXTRA_SCENARIO_MUSIC "siege_of_laurelmor.ogg"}

    # wmllint: local spelling geez
    # He won't be talking like this for long...
    # wmllint: directory spelling Highbrook
    [story]
        [part]
            story= _ "Tallin and his men made an orderly withdrawal into the caves, the orcs pressing close behind them."
        [/part]
        [part]
            story= _ "The dwarves were more than ready for them, however, and as soon as the humans got through the defenses the well-prepared dwarves fell on the battle-weary and bloodied orcs."
        [/part]
        [part]
            story= _ "Wave after wave of orcs crashed onto the dwarven defenses only to be shattered."
        [/part]
        [part]
            story= _ "As the battle raged on, Tallin again made council with Hamel."
        [/part]

        {STORY_PART_HAMEL (_ "How did ye fare?")}

        {STORY_PART_TALLIN (_ "It was fierce and bloody. We fought them for three days and nights. Every time we killed an orc, it seemed that two more would take his place. We most assuredly cannot win fighting like this.")}

        {STORY_PART_HAMEL (_ "So you withdrew. Rightly done, me lad. Our prepared defenses will be able to hold the orcs off far longer and with less loss than ye could ha’ done in the open field. I see that my training of you hasna’ been for naught.")}

        {STORY_PART_TALLIN (_ "And I am grateful — but what should we do from here? The number of humans and dwarves is limited, unlike the orcs whose numbers seem unlimited.")}

        {STORY_PART_HAMEL (_ "Aye. But we must utterly crush this orcish host if we are to ever ha’ peace.")}

        {STORY_PART_HAMEL (_ "Orcs are fickle; if we negotiated a treaty with them — assuming they would accept — it would just be broken as soon as the next warlord arose among them.")}

        {STORY_PART_TALLIN (_ "Then what shall we do? Can we assassinate this Rakshas fellow and throw them into disarray once more?")}

        #po: "coil" meant, in Middle and Early Modern English, a difficulty
        #po: or problem.
        {STORY_PART_HAMEL (_ "That will be very difficult. We did that last time and they will no doubt be alert to that threat now. Anyway, it would be but a temporary solution. Soon another strong leader would come along, and we’d find oursel’ back in the same coil.")}

        {STORY_PART_TALLIN (_ "Well, back to the drawing board. What should we do?")}

        {STORY_PART_HAMEL (_ "I think we should try to gather more allies. That way we can engage them on many fronts, or divide them into smaller groups, or cut them off from their supplies. The possibilities are endless.")}

        {STORY_PART_TALLIN (_ "Wise words, but who is there in these wild Northlands that might aid us?")}

        {STORY_PART_HAMEL (_ "You can count the elves out. They are a selfish lot, only interested in themselves. They would only aid us if something drastic happened to them and they needed our help. What about Wesnoth?")}

        {STORY_PART_TALLIN (_ "Wesnoth is too far away, and we have no idea what political state they are in.")}

        {STORY_PART_TALLIN (_ "The last news we heard of them was years ago when Prince Konrad passed through here. At that time the evil Queen Asheviere was ruling, and it was said that she was in alliance with the orcs.")}

        {STORY_PART_TALLIN (_ "And then that Princess Li’sar was in hot pursuit of Konrad as well. I wonder what became of them.")}

        {STORY_PART_HAMEL (_ "The last time any dwarf set eyes on Konrad was when he set out to the eastern tunnels in search of the Sceptre of Fire, so he could claim his place as ruler.")}

        {STORY_PART_TALLIN (_ "Geez, what a fool’s quest. Everyone in these Northlands knows that the Sceptre is long gone.")}

        {STORY_PART_TALLIN (_ "But we’re meandering. Where can we find allies in these wild Northlands?")}

        {STORY_PART_FATHER_MORVIN (_ "Tallin, before I was captured by Malifor, I used to be in contact with a powerful magician called Ro’Arthian and his brother Ro’Sothian.")}

        {STORY_PART_HAMEL (_ "Ro’Arthian, bah! Don’t utter that cursed name!")}

        {STORY_PART_TALLIN (_ "Why not, Hamel, have you a grievance with him?")}

        {STORY_PART_HAMEL (_ "I have heard all about him from my good friend Stalrag. He is — or was anyway, haven’t heard from him in years — the chief o’ the villages that lay along Highbrook Pass.")}

        {STORY_PART_HAMEL (_ "Those foul mages have long terrorized Stalrag and his people.")}

        {STORY_PART_FATHER_MORVIN (_ "Remember, Hamel, there are often two sides to a story like this. Perhaps the mages see your dwarves as invaders. How would you feel if say... the elves decided to come in and level Knalga so they can grow another big forest on top?")}

        {STORY_PART_HAMEL (_ "Those filthy elves! I’ll...")}

        {STORY_PART_FATHER_MORVIN (_ "See?")}

        {STORY_PART_HAMEL (_ "What were you doing keeping contact with mages such as those anyway? Trying to save their souls?")}

        {STORY_PART_SISTER_THERA (_ "(<i>Giggle</i>) Something like that.")}

        {STORY_PART_FATHER_MORVIN (_ "(<i>Rolls eyes</i>)")}

        {STORY_PART_HAMEL (_ "Father Morvin, what are you trying to say?")}

        {STORY_PART_FATHER_MORVIN (_ "I propose that we go to Highbrook Pass and see how matters stand for ourselves. If the wizards are still alive, we might be able to persuade them to help us. What’s more, if Stalrag is still around we could use his help too.")}

        {STORY_PART_TALLIN (_ "I don’t see how just two mages could help us very much, Father.")}

        {STORY_PART_FATHER_MORVIN (_ "They are not just any two mages. They have fine control over many creatures of the wild such as ogres, gryphons, and sometimes even trolls! It would be no bad thing to have those on your side for once.")}

        {STORY_PART_TALLIN (_ "That sounds really good. What do you think, Hamel?")}

        # wmllint: local spelling hrmph
        {STORY_PART_HAMEL (_ "Hrmph. These are desperate times. If those lunatics of mages will agree to help, I guess we’ll nae have any other choice but to accept.")}

        {STORY_PART_TALLIN (_ "Hey, we have had experiences with crazy mages ourselves. Believe me, they are dangerous! You will feel a lot better with some of them on your side.")}

        {STORY_PART_HAMEL (_ "Ye’ll need to travel light to reach Highbrook Pass before the orcs mount another assault in force. I think ye should take as little gold as possible. We’ll store the rest in the tunnels furthest away from the attacking orcs in case they break through.")}

        {STORY_PART_TALLIN (_ "So it shall be. Now how exactly do we get to this mountain pass?")}
    [/story]

    [story]
        [part]
            story= _ "And so Tallin and his party set out to secure the help of the mages."
            {NR_BIGMAP}
            {REVOLT_STAGE5}
            show_title=yes
        [/part]
    [/story]

    # Players side, allied with dwarves
    # wmllint: validate-off
    [side]
        side=1
        controller=human
        recruit=Thug,Poacher,Spearman,Bowman,Footpad
        gold=0 #player has large carryover here, is handled in prestart event
        team_name=knalgans
        user_team_name= _ "Knalgans"

        # wmllint: recognize Tallin
        {CHARACTER_STATS_TALLIN}

        fog=yes
        share_vision=all
        facing=se
    [/side]
    # wmllint: validate-on

    # Allied AI, recruits Ulfserkers only
    [side]
        side=2
        controller=ai
        recruit=Dwarvish Ulfserker
        {GOLD 100 90 60}
        team_name=knalgans
        user_team_name= _ "Knalgans"
        {FLAG_VARIANT knalgan}

        type=Dwarvish Lord
        id=Stalrag
        name= _ "Stalrag"
        profile=portraits/Stalrag.webp
        canrecruit=yes

        [modifications]
            {TRAIT_HEALTHY}
        [/modifications]

        hitpoints=1
        fog=yes
        share_vision=all
        facing=se

        # Place some combatants at various states of hp/xp
        {NOTRAIT_UNIT 2 "Dwarvish Ulfserker" 28 8}
        [+unit]
            hitpoints=12
            experience=40
            facing=se
        [/unit]

        {NOTRAIT_UNIT 2 "Dwarvish Ulfserker" 24 7}
        [+unit]
            hitpoints=34
            experience=8
            facing=ne
        [/unit]

        {NOTRAIT_UNIT 2 "Dwarvish Ulfserker" 24 4}
        [+unit]
            hitpoints=28
            experience=18
            facing=sw
        [/unit]

        {NOTRAIT_UNIT 2 "Dwarvish Ulfserker" 23 2}
        [+unit]
            hitpoints=30
            experience=16
            facing=s
        [/unit]

        {NOTRAIT_UNIT 2 "Dwarvish Ulfserker" 30 7}
        [+unit]
            hitpoints=12
            experience=16
            facing=nw
        [/unit]

        {NOTRAIT_UNIT 2 "Dwarvish Ulfserker" 22 6}
        [+unit]
            hitpoints=9
            experience=41
            facing=sw
        [/unit]
    [/side]

    # Enemy AI, not bad but uncooperative guy, setting it to ignore combat/movement evaluation to force it to use recruit list in full
    [side]
        side=3
        controller=ai
        recruit=Gryphon,Young Ogre,Ogre,Troll Whelp,Troll,Troll Rocklobber,Red Mage,Mage
        {GOLD 950 1100 1600}
        team_name=liches
        user_team_name= _ "Liches"
        {FLAG_VARIANT undead}

        type=Ancient Lich
        id="Ro'Arthian"
        name= _ "Ro’Arthian"
        profile=portraits/Arthian.webp
        canrecruit=yes

        facing=nw

        {NOTRAIT_UNIT 3 Troll 30 9}
        [+unit]
            hitpoints=36
            experience=14
            facing=nw
        [/unit]

        {NOTRAIT_UNIT 3 "Young Ogre" 28 6}
        [+unit]
            hitpoints=6
            experience=31
            facing=se
        [/unit]

        {NOTRAIT_UNIT 3 "Young Ogre" 20 7}
        [+unit]
            hitpoints=12
            experience=12
            facing=ne
        [/unit]

        {NOTRAIT_UNIT 3 "Ogre" 23 3}
        [+unit]
            hitpoints=27
            experience=8
            facing=n
        [/unit]

        # Place sidekick
        [unit]
            type=Lich
            id="Ro'Sothian"
            profile=portraits/Ro_Sothian.webp
            name= _ "Ro’Sothian"
            x,y=26,7
            facing=nw
        [/unit]
    [/side]

    {STARTING_VILLAGES 1 6}
    {STARTING_VILLAGES 2 6}
    {STARTING_VILLAGES 3 7}

    {FORCE_CHANCE_TO_HIT side=3 id=Stalrag 0 (
        [variable]
            name=turn_number
            less_than=3
        [/variable]
    )}

    {PLACE_IMAGE items/cage.png 25 6}

    [event]
        name=prestart

        # Store player's carryover gold and give him initial starting gold
        [store_gold]
            side=1
            variable=stored_gold
        [/store_gold]
        [modify_side]
            side=1
            {GOLD 200 100 80}
        [/modify_side]

        # Recall heroes
        {RECALL_SUPPORTER}

        {RECALL_OR_REPLACE id=Abhai}

        [recall]
            id=Father Morvin
        [/recall]

        [recall]
            id=Sister Thera
        [/recall]

        {RECALL_OR_REPLACE id=Krash}

        {RECALL_OR_REPLACE id=Camerin}

        {RECALL_OR_REPLACE id=Elenia}

        {MODIFY_UNIT side=1 facing se}

        [objectives]
            side=1
            [objective]
                description= _ "Save Stalrag from Ro’Sothian"
                condition=win
                [show_if]
                    [have_unit]
                        id="Ro'Sothian"
                    [/have_unit]
                [/show_if]
            [/objective]
            [objective]
                description= _ "Capture Ro’Arthian"
                condition=win
                [show_if]
                    {VARIABLE_CONDITIONAL defeat_arthian boolean_equals yes}
                [/show_if]
            [/objective]
            [objective]
                description= _ "Death of Tallin"
                condition=lose
            [/objective]
            [objective]
                description= _ "Death of Stalrag"
                condition=lose
            [/objective]

            {TURNS_RUN_OUT}

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

    [event]
        name=start

        # Do the talk with extra bits if Camerin is still there
        [message]
            speaker=narrator
            message= _ "Upon arriving at the mountain pass it appeared to Tallin and his men that they were just a bit too late."
            image=wesnoth-icon.png
        [/message]

        [message]
            speaker="Ro'Sothian"
            message= _ "HAH! I finally have you, you wretched dwarf!"
        [/message]

        [message]
            speaker=Stalrag
            message= _ "Argh! You blasted mages! How many times do I have to kill you two before you will leave us in peace!"
        [/message]

        [message]
            speaker="Ro'Sothian"
            message= _ "Leave <i>you</i> in peace?! It is your kind that won’t leave <i>us</i> in peace! Ever since you blasted dwarves built that damn road you have harassed us unceasingly! Now, it ends here! After I kill you I will split your carcass and hang it at the mouth of this pass as a warning for any other fools like you! And unlike us, <i>you</i> won’t come back."
        [/message]

        [message]
            speaker=Stalrag
            message= _ "You cursed mage! I now go to join all of my men you have killed. But know this, the Shinsplitters will <i>never</i> submit! We will defy you to our last breath!"
        [/message]

        [message]
            speaker=Tallin
            message= _ "Hold it! What’s going on here?"
        [/message]

        [message]
            speaker=Father Morvin
            message= _ "Ro’Sothian, is that you?"
        [/message]

        [message]
            speaker="Ro'Sothian"
            message= _ "Not now, Father. I’m a little busy at the moment."
        [/message]

        [if]
            [have_unit]
                #wmllint: recognize Camerin
                id=Camerin
            [/have_unit]
            [then]
                [message]
                    speaker=Camerin
                    # wmllint: local spelling erm
                    message= _ "Ro’Sothian! How are you doing, my old friend! Boy, you sure look... erm... different!"
                [/message]

                [message]
                    speaker="Ro'Sothian"
                    message= _ "Camerin! Great Lords of Darkness, I haven’t seen you in ages! Here, let me just finish off this little vermin and I’ll be right over."
                [/message]

                [message]
                    speaker=Tallin
                    message={WHISPER (_ "whisper^Camerin, you know him?")}
                [/message]

                [message]
                    speaker=Camerin
                    message={WHISPER (_ "whisper^Duh! His brother Ro’Arthian is the one who taught me magic!")}
                [/message]

                [message]
                    speaker=Tallin
                    message={WHISPER (_ "whisper^Oh...!")}
                [/message]
            [/then]
        [/if]

        [message]
            speaker=Father Morvin
            message= _ "Hang on a sec, Ro’Sothian, you don’t want to kill him."
        [/message]

        [message]
            speaker="Ro'Sothian"
            message= _ "Huh?! He killed me!"
        [/message]

        [message]
            speaker=Father Morvin
            message= _ "Oh... I see. But we come on more pressing business. We are in desperate need of your help. Here is Tallin from the community of Dwarven Doors. As you know, the people of Dwarven Doors were enslaved by the orcs for many years. They have broken their chains and together with Lord Hamel from Knalga, they are beginning to reclaim Knalga from the chaos that it was in."
        [/message]

        [message]
            speaker="Ro'Sothian"
            message= _ "So? What does this have to do with me? And hurry up, my staff is buzzing to blast this little vermin once and for all."
        [/message]

        [message]
            speaker=Father Morvin
            message= _ "Don’t! Please, my friend, listen. The orcs are on the rise again and they are threatening to complete their conquest of Knalga and convert it into an orcish stronghold. We can’t let that happen! That’s why we have come here, to seek your and your brother’s help in defeating the orcs."
        [/message]

        [message]
            speaker="Ro'Sothian"
            message= _ "Take your begging and shove it, Father! We don’t help no-one. Not even you and <i>especially</i> not any dwarf!"
        [/message]

        [if]
            [have_unit]
                id=Camerin
            [/have_unit]
            [then]
                [message]
                    speaker=Camerin
                    message= _ "Hold a moment, my friend. You won’t believe what a blast it is fighting with these guys. You get to fry skeletons, orcs, trolls, and wolves by the thousands! Come on old pal, be a sport."
                [/message]

                [message]
                    speaker="Ro'Sothian"
                    message= _ "Camerin, you were always a little crazy. Now I see you have gone stark raving mad! Do you really think we would help anyone? <i>Especially</i> a bunch of dwarves!"
                [/message]
            [/then]
        [/if]

        [message]
            speaker="Ro'Sothian"
            message= _ "I tire of this; prepare to die, wretched dwarf! And the rest of you, get lost and don’t come back, unless you’re tired of life!"
        [/message]

        [message]
            speaker=Sister Thera
            message= _ "Uh oh, he is gathering energy for a cold blast."
        [/message]

        [message]
            speaker=Father Morvin
            message= _ "Quick, honey, we’ve got to stop him!"
        [/message]

        [if]
            [have_unit]
                id=Camerin
            [/have_unit]
            [then]
                [message]
                    speaker=Camerin
                    message= _ "Hey, are you two going to hog all the fun for yourselves?"
                [/message]

                [message]
                    speaker=Father Morvin
                    message= _ "All right, all right, hang on!"
                [/message]
            [/then]
        [/if]

        # Teleport three spellcasters near the sidekick to do some asskicking
        {FLASH_WHITE (
            [teleport]
                [filter]
                    id=Sister Thera
                [/filter]
                x,y=25,6
            [/teleport]
        )}

        [delay]
            time=1250
        [/delay]

        [if]
            [have_unit]
                id=Camerin
            [/have_unit]
            [then]
                {FLASH_WHITE (
                    [teleport]
                        [filter]
                            id=Camerin
                        [/filter]
                        x,y=27,5
                    [/teleport]
                )}

                [delay]
                    time=1250
                [/delay]
            [/then]
        [/if]

        {FLASH_WHITE (
            [teleport]
                [filter]
                    id=Father Morvin
                [/filter]
                x,y=27,6
            [/teleport]
        )}

        [delay]
            time=1250
        [/delay]
    [/event]

    # First sidekick die event - place him in jail, talk a bit, fires once
    [event]
        name=last breath
        [filter]
            id="Ro'Sothian"
        [/filter]

        [message]
            speaker="Ro'Sothian"
            message= _ "BROTHER! HELP ME!"
        [/message]

        [message]
            speaker="Ro'Arthian"
            message= _ "(<i>Booming voice coming from all directions</i>) SO YOU MAGES HAVE THE AUDACITY TO ATTACK MY BROTHER! YOU SHALL DIE FOR YOUR FOLLY!"
        [/message]

        [message]
            speaker=Father Morvin
            message= _ "Ro’Arthian, listen to me. We don’t want to fight with you, we have come here to seek your assistance."
        [/message]

        [message]
            speaker=narrator
            image=none
            message= _ "(<i>No answer</i>)"
        [/message]

        [message]
            speaker=Father Morvin
            message= _ "I know you can hear me, Ro’Arthian. Please, the fate of every creature in the north depends on your help."
        [/message]

        [message]
            speaker=narrator
            image=none
            message= _ "(<i>No answer</i>)"
        [/message]

        [message]
            speaker=Tallin
            message= _ "Give it up, father, he isn’t answering. I am afraid we may have to use um... more forceful means to convince him."
        [/message]

        [message]
            speaker=Father Morvin
            message= _ "(<i>Sigh</i>) Yes, you are right."
        [/message]

        [message]
            speaker=Tallin
            message= _ "Put Ro’Sothian into that jail over there until we capture his brother."
        [/message]

        [message]
            speaker=Father Morvin
            message= _ "Very well."
        [/message]

        [message]
            speaker=Tallin
            message= _ "And someone keep an eye on him. We don’t want him to get away."
        [/message]

        # Set up release from jail event that will trigger each time it's full
        [event]
            name=moveto
            first_time_only=no
            [filter]
                side=3
                x,y=25,6
            [/filter]
            [filter_condition]
                [not]
                    [have_unit]
                        id="Ro'Sothian"
                    [/have_unit]
                [/not]
            [/filter_condition]

            [remove_item]
                x,y=25,6
            [/remove_item]

            [unstore_unit]
                variable=rosothian
                x,y=25,6
                find_vacant=yes
            [/unstore_unit]
            [heal_unit]
                [filter]
                    id="Ro'Sothian"
                [/filter]
                amount=full
                moves=full
                restore_attacks=yes
            [/heal_unit]
            {CLEAR_VARIABLE rosothian}

            [message]
                speaker="Ro'Sothian"
                message= _ "Ha! I am free! Now you foul traitors will pay!"
            [/message]

            [message]
                speaker=Tallin
                message= _ "Oh no, he got away! Quick, men, we must capture him again!"
            [/message]

            # And will set second sidekick die event
            [event]
                name=last breath
                [filter]
                    id="Ro'Sothian"
                [/filter]

                [message]
                    speaker="Ro'Sothian"
                    message= _ "Ahhhh! Not again!"
                [/message]

                [message]
                    speaker=Father Morvin
                    message= _ "Come on, Ro’Sothian, we really don’t have to be doing this. Come, join us!"
                [/message]

                [message]
                    speaker="Ro'Sothian"
                    message= _ "Never!"
                [/message]

                [message]
                    speaker=Tallin
                    message= _ "Sigh, we’ll talk later."
                [/message]

                [message]
                    speaker=second_unit
                    message= _ "Back to jail, my friend."
                [/message]
            [/event]
        [/event]

        {VARIABLE defeat_arthian yes}
        [show_objectives]
        [/show_objectives]
    [/event]

    [event]
        name=die
        first_time_only=no
        [filter]
            id="Ro'Sothian"
        [/filter]

        [store_unit]
            [filter]
                id="Ro'Sothian"
            [/filter]
            kill=no
            variable=rosothian
        [/store_unit]
        {PLACE_IMAGE "units/undead-necromancers/lich.png~RC(magenta>green)~BLIT(items/cage.png)" 25 6}
    [/event]

    # If the uncooperative boss dies player wins
    [event]
        name=last breath
        [filter]
            id="Ro'Arthian"
        [/filter]

        {INCIDENTAL_MUSIC "sad.ogg"}

        [heal_unit]
            [filter]
                id="Ro'Arthian"
            [/filter]

            amount=1
        [/heal_unit]

        [message]
            speaker=Tallin
            message= _ "Ro’Arthian, are you ready to talk yet?"
        [/message]

        [message]
            speaker="Ro'Arthian"
            message= _ "Fine, you trespassers. What do you want?"
        [/message]

        [message]
            speaker=Tallin
            message= _ "Well... First, why don’t you tell us what <i>you</i> want?"
        [/message]

        [message]
            speaker="Ro'Arthian"
            message= _ "What do <i>I</i> want? I’ll tell you what I want! I want the stinking carcasses of you, all your henchmen and those dwarvish vermin off my land! And <i>stay</i> off!"
        [/message]

        [message]
            speaker=Tallin
            message= _ "So basically, you want to be left alone in peace, right?"
        [/message]

        [message]
            speaker="Ro'Arthian"
            message= _ "Wow! Someone <i>finally</i> figured it out!"
        [/message]

        [message]
            speaker=Tallin
            message= _ "All right! Listen, then. Right now we have very little power to grant your request. We are simply a band of peasants fighting for the freedom of our homeland."
        [/message]

        [message]
            speaker=Tallin
            message= _ "But when we defeat the orcish host, re-establish Knalga, and bring law and order into these Northlands, we will have gained some authority by right of conquest."
        [/message]

        [message]
            speaker=Tallin
            message= _ "When that time comes, I hereby make a solemn oath: no man or dwarf shall ever set foot on your land without your leave. If any of my men violates this law they shall be punished with death, and I believe I may speak for Hamel in this as well."
        [/message]

        [message]
            speaker=Tallin
            message= _ "In order for that to come about, we must crush the orcish host. But we can’t do that without your help. Will you join us?"
        [/message]

        [message]
            speaker=Father Morvin
            message= _ "Think of it, Ro’Arthian, it is a fair bargain. If you don’t agree to Tallin’s proposal, the endless war you two wage with the dwarves will never be resolved. You have been haunting these mountains for far too long. It is high time for you and your brother to rest in peace."
        [/message]

        [message]
            speaker="Ro'Arthian"
            message= _ "Hrmph. What do you think, brother?"
        [/message]

        [if]
            [not]
                [have_unit]
                    id="Ro'Sothian"
                [/have_unit]
            [/not]
            [then]
                [remove_item]
                    x,y=25,6
                [/remove_item]

                [unstore_unit]
                    variable=rosothian
                    x,y=25,6
                    find_vacant=yes
                [/unstore_unit]
                [heal_unit]
                    [filter]
                        id="Ro'Sothian"
                    [/filter]
                    amount=full
                    moves=full
                    restore_attacks=yes
                [/heal_unit]
                {CLEAR_VARIABLE rosothian}
            [/then]
        [/if]

        [message]
            speaker="Ro'Sothian"
            message= _ "(<i>Shrugs</i>) I don’t think we have any other choice left."
        [/message]

        [message]
            speaker=Camerin
            message= _ "Come on, guys, it will be great! Those orcs will never know what hit them! Together we’ll rip them to shreds! If you are planning to retire after this, this is the perfect chance for you guys to go out with a bang! You guys will become legends! <i>“The two terrible mages, risen from the dead to devastate the orcish hordes!”</i>"
        [/message]

        [message]
            speaker="Ro'Arthian"
            message= _ "Very well, Tallin. We accept under the terms that your people will forever leave us in peace after this."
        [/message]

        [message]
            speaker=Tallin
            message= _ "Ro’Arthian, I am not of royal blood, but I am a man of my word. I will uphold the oath I have given even at the cost of my life."
        [/message]

        [message]
            speaker="Ro'Arthian"
            message= _ "Very well. The orcish hosts shall feel our wrath!"
        [/message]

        [message]
            speaker=Stalrag
            message= _ "Wait a second, Tallin. Are you saying that we should abandon our homeland to these wretched mages?!"
        [/message]

        [message]
            speaker="Ro'Arthian"
            message= _ "(<i>Snicker</i>)"
        [/message]

        [message]
            speaker=Tallin
            message= _ "Chief Stalrag, it is said that to save a family, we should be willing to sacrifice one person; to save a town we should be willing to sacrifice a family; and to save a nation we should be willing to sacrifice a town."
        [/message]

        [message]
            speaker=Tallin
            message= _ "Now, Stalrag, it is up to you. Do you want to save Knalga or not?"
        [/message]

        [message]
            speaker=Stalrag
            message= _ "Well Tallin, if you put it that way... We don’t like it, but if that’s what is needed to save Knalga, we shall do it."
        [/message]

        [message]
            speaker=Tallin
            message= _ "Thank you, Stalrag. I am sure that the sacrifice of you and your people will always be remembered."
        [/message]

        [message]
            speaker=Stalrag
            message= _ "(<i>Mumbles</i>) Yeah, great compensation..."
        [/message]

        [message]
            speaker="Ro'Arthian"
            message= _ "I have the power to control many creatures, such as gryphons, trolls and ogres. So while I am with you they shall be at your command."
        [/message]

        [message]
            speaker=Stalrag
            message= _ "The Shinsplitters will be at your service, Tallin."
        [/message]

        [message]
            speaker=Tallin
            message= _ "My thanks, Stalrag and Ro’Arthian. However, I have sufficient forces under my control presently and I think that merging our forces will just create confusion. Your gryphons will be of use, but I think you should retain command of your trolls and ogres, until they are needed."
        [/message]

        [message]
            speaker="Ro'Arthian"
            message= _ "Very well."
        [/message]

        [message]
            speaker=Tallin
            message= _ "Great. Now let’s get back to the caves and start planning the best way teach those orcs a lesson they will never forget!"
        [/message]

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

    [event]
        name=victory

        # Only for debug mode, in normal play the unit would have been unstored in the previous event
        [if]
            [not]
                [have_unit]
                    id="Ro'Sothian"
                [/have_unit]
            [/not]
            [then]
                [unstore_unit]
                    variable=rosothian
                    x,y=recall,recall
                [/unstore_unit]
                {CLEAR_VARIABLE rosothian}
            [/then]
        [/if]

        # This complex code is used instead of [modify_unit] because it
        # - allows to add the loyal trait at first place in the trait list
        # - leaves the units on the field as is, the changes are only visible in the next scenario

        [store_unit]
            # Get references to the new companions joining us next scenario.
            [filter]
                id="Stalrag,Ro'Arthian,Ro'Sothian"
            [/filter]
            variable=new_companions
            kill=no # Leave them visible on the field during linger mode.
        [/store_unit]

        [foreach]
            array=new_companions
            [do]
                {VARIABLE this_item.side 1}
                {VARIABLE this_item.canrecruit no}
                # We'll be unstoring these units onto the recall list, which won't heal them automatically, so we do it here.
                {CLEAR_VARIABLE this_item.attacks_left}
                {CLEAR_VARIABLE this_item.moves}
                {CLEAR_VARIABLE this_item.hitpoints}
                {CLEAR_VARIABLE this_item.status}
                {CLEAR_VARIABLE this_item.overlays}
                {CLEAR_VARIABLE this_item.ellipse}
                # Must be cleared too, otherwise the loyal trait won't change it
                {CLEAR_VARIABLE this_item.upkeep}
                # Stalrag gains the loyal and healthy traits, while Ro'Arthian and Ro'Sothian get loyal and undead.
                [if]
                    [variable]
                        name=this_item.id
                        equals=Stalrag
                    [/variable]
                    [then]
                        [set_variables]
                            name=this_item.modifications
                            mode=replace
                            [literal]
                                {TRAIT_LOYAL}
                                {TRAIT_HEALTHY}
                            [/literal]
                        [/set_variables]
                    [/then]
                    [else]
                        [set_variables]
                            name=this_item.modifications
                            mode=replace
                            [literal]
                                {TRAIT_UNDEAD}
                                {TRAIT_LOYAL_HERO}
                            [/literal]
                        [/set_variables]
                    [/else]
                [/if]

                [unstore_unit]
                    # Put our referenced units onto the recall list so we have them in the next scenario.
                    variable=this_item
                    x,y=recall,recall
                [/unstore_unit]
            [/do]
        [/foreach]

        {CLEAR_VARIABLE new_companions,defeat_arthian}
    [/event]

    # And if the allied AI dies player loses
    [event]
        name=last breath
        [filter]
            id=Stalrag
        [/filter]

        [message]
            speaker=Stalrag
            message= _ "Farewell, my friends. I now go to join my fallen brethren."
        [/message]

        [message]
            speaker=Tallin
            message= _ "No! If Stalrag dies now none of his men will follow us. We are finished."
        [/message]

        [endlevel]
            result=defeat
        [/endlevel]
    [/event]

    # Load standard death events
    {HERODEATH_TALLIN}
    {HERODEATH_CAMERIN}
    {HERODEATH_KRASH}
    {HERODEATH_ELENIA}
    {HERODEATH_THERA_AND_MORVIN_NO_DIALOG}

    {SUPPORTER_DEATH_HANDLER}
[/scenario]
