#textdomain wesnoth-did

[scenario]
    id=06_Return_to_Parthyn
    name= _ "Return to Parthyn"
    map_file=06_Return_to_Parthyn.map
    {TURNS 19 18 17}
    victory_when_enemies_defeated=no
    next_scenario=07a_A_Small_Favor

    {DEFAULT_SCHEDULE}

    {SCENARIO_MUSIC       the_city_falls.ogg}
    {EXTRA_SCENARIO_MUSIC knolls.ogg}
    {EXTRA_SCENARIO_MUSIC weight_of_revenge.ogg}

    [story]
        [part]
            music=northerners.ogg
            story= _ "Two days’ travel south of the previous battle, Malin picks up the trail of the regrouped orcish warriors. He follows them down the western bank of the river Listra, past the Whitefang Mountains. He wonders why they continue rushing toward the Great River instead of calling for reinforcements, but after a bit of thought, he realizes where the orcs are headed. It is, after all, the season when they usually raid human towns."
            {STORYTXT_BACKGROUND travel.jpg}
        [/part]
        [part]
            story= _ "‘This chieftain has no intention of warning the rest of his clan about me. I suppose he must think that I intend to attack the rest of the Whitefangs rather than pursue him this far; with his brethren occupied against me, he will be able to raid more human towns undisturbed. Selfish creature. Exactly what one would expect from an orc.’ Malin thinks carefully and quickly realizes what he should do."
            {STORYTXT_BACKGROUND travel.jpg}
        [/part]
        [part]
            story= _ "He tramps through the woods tirelessly, forsaking several days’ sleep as he and his servants draw closer to the Great River, hoping to cut off the orcs before they reach Parthyn. Soon, Malin recognizes some familiar surroundings..."
            {STORYTXT_BACKGROUND parthyn.jpg}
        [/part]
    [/story]

    {DID_TRACK {JOURNEY_06_NEW}}

    # wmllint: validate-off
    [side]
        side=1
        controller=human
        recruit=Walking Corpse,Vampire Bat,Ghost,Ghoul,Skeleton Archer,Skeleton
        {GOLD 100 90 80}
        village_support=2
        team_name=good
        user_team_name= _ "Malin Keshar"
        {FLAG_VARIANT undead}
        color=darkblue

        # wmllint: recognize Malin Keshar
        {CHARACTER_STATS_MALIN_KESHAR}

        facing=sw
    [/side]
    # wmllint: validate-on

    # A fallback leader is defined for side 2 here just in case the stored unit
    # doesn't exist for some reason, like if the player has used debug mode to
    # jump to this scenario.
    [side]
        side=2
        controller=ai
#ifdef EASY
        recruit=Wolf Rider,Orcish Archer,Orcish Grunt,Troll Whelp
#else
        recruit=Wolf Rider,Goblin Knight,Orcish Archer,Orcish Crossbowman,Orcish Grunt,Troll Whelp
#endif
        {GOLD 60 85 110}
        {INCOME 3 5 7}
        team_name=orcs
        user_team_name= _ "Orcs"
        {FLAG_VARIANT6 ragged}
        color=white

        type=Orcish Warlord
        id=Borth
        name= _ "Borth"
        profile=portraits/orcs/warlord.png
        canrecruit=yes

        facing=se

        [ai]
            aggression=0.8
            villages_per_scout=8
            village_value=0.5
        [/ai]
    [/side]

    [side]
        side=3
        controller=ai
        recruit=
        gold=0
        village_gold=0
        team_name=guardsmen
        user_team_name= _ "Guardsmen"
        {FLAG_VARIANT loyalist}
        color=green

        type=Lieutenant
        id=Drogan
        name= _ "Drogan"
        profile=portraits/drogan.png
        canrecruit=yes

        facing=nw

        # Drogan has some guards at the river fort
        {NAMED_LOYAL_UNIT 3 (Spearman) 22 18 () ( _ "River fort guard")} {GUARDIAN}
        {NAMED_LOYAL_UNIT 3 (Bowman)   23 19 () ( _ "River fort guard")} {GUARDIAN}
        {NAMED_LOYAL_UNIT 3 (Spearman) 28 17 () ( _ "River fort guard")} {GUARDIAN}

        [ai]
            aggression=0.1
            caution=0.9
        [/ai]
    [/side]

    # wmllint: validate-off
    [side]
        side=4
        controller=ai
        recruit=Spearman,Bowman,Swordsman,Pikeman,Longbowman,Thug,Poacher,Footpad
        gold=15
        {INCOME 6 9 12}
        team_name=guardsmen
        user_team_name= _ "Defenders"
        {FLAG_VARIANT loyalist}
        color=green

        # wmllint: recognize Dela Keshar
        {CHARACTER_STATS_DELA_KESHAR}

        facing=ne

        [ai]
            [goal]
                name=protect_unit
                [criteria]
                    id=Drogan
                [/criteria]
                value=2
            [/goal]
            [goal]
                name=target
                [criteria]
                    id=Malin Keshar
                [/criteria]
                value=2
            [/goal]
        [/ai]
    [/side]
    # wmllint: validate-on

    {STARTING_VILLAGES 1 7}
    {STARTING_VILLAGES 3 6}
    {STARTING_VILLAGES 4 15}

    # Signpost
    {PLACE_IMAGE scenery/signpost.png 17 22}
    {PLACE_IMAGE scenery/monolith2.png 14 9}
    {PLACE_IMAGE items/book2.png 29 25}
    {PLACE_IMAGE scenery/wreck.png 31 15}

#define DID_RTP_HAS_ORC_LEADER
    [have_unit]
        side=2
        canrecruit=yes
    [/have_unit]
#enddef

#define DID_RTP_HAS_DROGAN
    [have_unit]
        id=Drogan
    [/have_unit]
#enddef

#define DID_RTP_OBJECTIVE_KILL_ORCS
    [objective]
        condition=win
        {ALTERNATIVE_OBJECTIVE_CAPTION}
        description= _ "Kill the orcish leader"
        [show_if]
            {DID_RTP_HAS_ORC_LEADER}
        [/show_if]
    [/objective]
#enddef

    [event]
        name=prestart

        {CLEAR_CORPSE_HORDE}

        {COLOR_ADJUST -14 -14 -14}

        [objectives]
            side=1
            [objective]
                condition=win
                description= _ "Remove the traitor Drogan"
            [/objective]

            {DID_RTP_OBJECTIVE_KILL_ORCS}

            [objective]
                condition=lose
                description= _ "Kill any people from Parthyn but Drogan"
            [/objective]
            [objective]
                condition=lose
                description= _ "Death of Malin Keshar"
            [/objective]

            {TURNS_RUN_OUT}

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

        [store_unit]
            [filter]
                id=Borth
            [/filter]
            variable=fallback_orc_leader
            kill=yes
        [/store_unit]

        {CREATE_ADVISOR}
        [move_unit]
            role=advisor
            to_x,to_y=20,9
        [/move_unit]
    [/event]

    [event]
        name=start

        [message]
            speaker=Malin Keshar
            message= _ "I bring word from the north, Drogan! Orcs march on Parthyn, no more than a few hours’ journey away. They mean to raid the village tonight!"
        [/message]

        [if]
            [variable]
                name=malin_used_necromancy
                boolean_equals=yes
            [/variable]
            [then]
                [message]
                    speaker=Drogan
                    message= _ "I hoped I’d never see ya again, Malin. You’re obviously not taking yer banishment seriously, so I’ll tell ya one last time — no matter why you’ve come back, we’re not welcomin’ ya here. Take one step closer to Parthyn and I’ll order tha guards to attack ya."
                [/message]

                [message]
                    speaker=Malin Keshar
                    message= _ "Banishment or not, I’m here to help defend my home against the orcs!"
                [/message]

                [message]
                    speaker=Drogan
                    message= _ "Orcs or not, ya gots ta leave!"
                [/message]

                [message]
                    speaker=Malin Keshar
                    message= _ "Dela, help me! You, at least, must see reason!"
                [/message]

                [message]
                    speaker=Drogan
                    message= _ "Ya know there’s no way she’s sidin’ with ya."
                [/message]

                [message]
                    speaker=Dela Keshar
                    message= _ "That... I don’t really..."
                [/message]

                [message]
                    speaker=Drogan
                    message= _ "See? If ya keep bein’ stubborn, we’ll attack ya. Leave."
                [/message]

                [message]
                    role=advisor
                    message=_ "Master, do not listen to them! He, too, has a choice, but he foolishly chooses to spurn your aid! He jeopardizes the safety of Parthyn!"
                [/message]
            [/then]
            [else]
                [message]
                    speaker=Drogan
                    # po: ’side is short for beside
                    message= _ "I didn’t think I’d ever see ya again, Malin. But what’s this awful thing that stands ’side ya?"
                [/message]

                [message]
                    speaker=Malin Keshar
                    message= _ "It is of little concern to you. It is merely the byproduct of the new magical arts that I have learned."
                [/message]

                [message]
                    speaker=Drogan
                    message= _ "It don’t take a trained mage ta see that yer ‘magical arts’ refers to necromancy! That creature stinks o’ death!"
                [/message]

                [message]
                    speaker=Malin Keshar
                    message= _ "And why should you care about such things? Orcs march on Parthyn! We must defend the town!"
                [/message]

                [message]
                    speaker=Drogan
                    # po: the third sentence is "your father would be turning in his grave if he could see what you've become" with intentionally incorrect grammar because Drogan is not well educated
                    message= _ "Better ta face them orcs alone than ta use dark magic! I warned ya about this before, but obviously ya ignored me. Yer father’d be turnin’ in his grave if he be seein’ what you’ve become."
                [/message]

                [message]
                    speaker=Malin Keshar
                    message= _ "You dare bring my father into this! I’ve fought with every fiber of my being against these orcs, and I’ve done it all to protect my country and kinsmen. Is this how you repay me? With scorn and disdain?"
                [/message]

                [message]
                    role=advisor
                    message=_ "Master, do not listen to him! He is clearly blinded by his own prejudice! He jeopardizes the safety of Parthyn!"
                [/message]
            [/else]
        [/if]

        [message]
            speaker=Malin Keshar
            message= _ "Silence from you."
        [/message]

        [message]
            speaker=Malin Keshar
            message= _ "Drogan! With my newfound powers, I have already eliminated several orcish chieftains! If you will allow me to help, I will crush the one who comes here as well!"
        [/message]

        [message]
            speaker=Drogan
            # po: ’n means and
            message= _ "Fine story ye be tellin’ me. I find it likelier that ya brought yer pet orcs here ta help ya take revenge on us. If I let ya through, yer undead will kill us where we stand ’n sack the whole city. Watchin’ ya grow up, I never could’ve thought you’d turn into such a traitor."
        [/message]

        [message]
            speaker=Malin Keshar
            message= _ "And what of the rest of you? Dela, at least you don’t believe that, do you?"
        [/message]

        [message]
            speaker=Dela Keshar
            message= _ "I..."
        [/message]

        [message]
            speaker=Drogan
            message= _ "Stop lookin’ ta her, Malin. Tha fact that even Dela be rejectin’ ya should tell ya how much o’ a traitor ye are."
        [/message]

        [message]
            role=advisor
            message= _ "Master, he threatens the safety of the city by standing in your way."
        [/message]

        [message]
            speaker=Malin Keshar
            message= _ "You’re the traitor, Drogan! This is twice now that you’ve tried to prevent me from protecting Parthyn. I’ll defend my home no matter the cost, even if it means I must cut you down first."
        [/message]

        # Malin cools down briefly
        [message]
            speaker=Malin Keshar
            message= _ "If I want the people of Parthyn to accept me back, I must be cautious. I musn’t kill any of them besides Drogan or they’ll oust me for good."
        [/message]
    [/event]

    # activate side 4 a tiny bit late or they rush the player a bit quickly
    [event]
        name=turn 3

        [gold]
            side=4
            {QUANTITY amount 20 30 40}
        [/gold]
    [/event]
    [event]
        name=turn 5

        [gold]
            side=4
            {QUANTITY amount 50 70 90}
        [/gold]
    [/event]

    # Placing the orc leader

    [event]
        name=turn 5

        [scroll_to]
            x,y=29,1
        [/scroll_to]

        [move_unit_fake]
            type="Orcish Warlord"
            side=2
            x=29,29,28,28,29,30
            y=1,2,2,3,4,4
        [/move_unit_fake]

        # Replace the fallback orcish leader with the stored one from the
        # previous scenario
        [lua]
            code = <<
                local saved_orc_leader = wml.variables.orc_leader_store
                local fallback_orc_leader = wml.variables.fallback_orc_leader

                if saved_orc_leader ~= nil then
                    saved_orc_leader.side = 2
                    saved_orc_leader.facing = "se"

                    local loc = wesnoth.sides[2].starting_location
                    wesnoth.units.to_map(saved_orc_leader, loc[1], loc[2])

                    wml.variables.orc_leader_store = nil
                else
                    local loc = wesnoth.sides[1].starting_location
                    wesnoth.units.to_map(fallback_orc_leader, loc[1], loc[2])
                end
            >>
        [/lua]

        [terrain]
            x,y=30,4
            terrain=Ke
        [/terrain]
        [terrain]
            x=30,30,29,29
            y=3,5,4,5
            terrain=Ce
        [/terrain]
        [redraw][/redraw]

        [message]
            side=2
            canrecruit=yes
            message= _ "Grunts! Prepare the camp! We attack the city tonight— wait. You! Necromancer, you followed us all the way here?!"
        [/message]

        [if]
            {DID_RTP_HAS_DROGAN}
            [then]
                [message]
                    speaker=Malin Keshar
                    message= _ "Did you really think you could outrun the dead, who need neither rest nor sleep? Prepare to meet your makers, orc. Drogan, I will show you what my new powers are capable of. You will see how foolish you are to oppose me."
                [/message]
            [/then]
            [else]
                [message]
                    speaker=Malin Keshar
                    message= _ "Did you really think you could outrun the dead, who need no rest nor sleep? Prepare to meet your makers, orc."
                [/message]
            [/else]
        [/if]

        [show_objectives][/show_objectives]
    [/event]

    # In-scenario Events

    [event]
        name=moveto
        [filter]
            id=Malin Keshar
            x,y=14,9
        [/filter]
        [filter_condition]
            [have_unit]
                id=Drogan
            [/have_unit]
        [/filter_condition]

        [message]
            speaker=narrator
            message= _ "A monolith of grey stone, appearing solid, but crumbling within."
        [/message]

#ifdef EASY
        {GIVE_MALIN_EXPERIENCE 12}
#endif
#ifdef NORMAL
        {GIVE_MALIN_EXPERIENCE 10}
#endif
#ifdef HARD
        {GIVE_MALIN_EXPERIENCE 8}
#endif
    [/event]

    [event]
        name=moveto
        [filter]
            id=Malin Keshar
            x,y=29,25
        [/filter]

        [message]
            speaker=narrator
            message= _ "Darkness is not the enemy, but believing it is so makes it so."
        [/message]

        {GIVE_MALIN_EXPERIENCE 6}
    [/event]

    [event]
        name=moveto
        [filter]
            type=Soulless
            variation=swimmer
            x,y=31,15
        [/filter]

        # see corresponding easter egg in S1
        [message]
            speaker=Malin Keshar
            message= _ "The dead fish returns home."
        [/message]

        [object]
            id=super_zombie_buff
            take_only_once=yes
            silent=yes
            duration=forever
            [filter]
                x,y=31,15
            [/filter]
            [effect]
                apply_to=new_ability
                [abilities]
                    {ABILITY_FEEDING}
                [/abilities]
            [/effect]
            [effect]
                apply_to=attack
                range=melee
                [set_specials]
                    {WEAPON_SPECIAL_POISON}
                    mode=append
                [/set_specials]
            [/effect]
            [effect]
                apply_to=hitpoints
                increase_total=32
                increase=32
                heal_full=no
            [/effect]
        [/object]
    [/event]

    [event]
        name=moveto
        [filter]
            side=1
            x,y=17,22
        [/filter]

        [message]
            speaker=narrator
            message= _ "Welcome to Parthyn"
            image=scenery/signpost.png
        [/message]
    [/event]

    # Dialog for the rare event you kill the orc leader before Drogan or any town guard
    [event]
        name=die
        [filter]
            side=2
            canrecruit=yes
        [/filter]

        [if]
            {DID_RTP_HAS_DROGAN}
            [then]
                [message]
                    speaker=Malin Keshar
                    message= _ "Behold, Drogan! I have slain the orcish chieftain. Do you trust me now?"
                [/message]

                [message]
                    speaker=Drogan
                    message= _ "I see that you’ve not lost all o’ yer humanity by allying yerself with tha orcs. But ya can’t come back, Malin. No necromancer will ever be welcome in Parthyn."
                [/message]

                [message]
                    speaker=Malin Keshar
                    message= _ "What?! You ungrateful cur! You’d sack tha city and let everyone die, and for what? Only to spurn something you don’t understand? You’re a fool. Parthyn will only be under greater danger with you leading it. If we are to survive, you are the one who must leave!"
                [/message]

                [message]
                    speaker=Dela Keshar
                    message= _ "Have ye lost yer mind, Malin? There’s no way we’re banishin’ Drogan!"
                [/message]

                [message]
                    speaker=Drogan
                    message= _ "Malin, ye were once one o’ my friends and tha pride o’ tha town. I truly don’t want ta fight ya. I’ll give ya one more chance. Leave Parthyn."
                [/message]

                [message]
                    speaker=Malin Keshar
                    message= _ "Your choice, not mine. If you refuse to leave by your own volition, then it will have to be by force. Attack him!"
                [/message]

                [show_objectives][/show_objectives]
            [/then]
            [else]
                [message]
                    speaker=narrator
                    message= _ "The orc was carrying some gold."
                [/message]

                [gold]
                    side=1
                    {QUANTITY amount 60 50 40}
                [/gold]

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

    # Dela Keshar can't actually die here, she needs to reappear in
    # Alone At Last. It's not easy to get to this contingency, which
    # is why we settle for a relatively crude fallback here.
    # This is also an alternative victory condition.
    [event]
        name=last breath
        [filter]
            id=Dela Keshar
        [/filter]

        [message]
            speaker=Dela Keshar
            message= _ "I am defeated but not dead, foul thing that was once my brother. Watch your back, because I will come for you and I will kill you..."
        [/message]

        [move_unit]
            id=Dela Keshar
            to_x,to_y=1,25
        [/move_unit]

        [kill]
            id=Dela Keshar
            animate=no
        [/kill]

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

    # Defeat Conditions
    [event]
        name=die
        [filter]
            side=3,4
            [not]
                id=Drogan
            [/not]
        [/filter]
        [filter_second]
            side=1
        [/filter_second]

        [if]
            {DID_RTP_HAS_DROGAN}
            [then]
                [message]
                    speaker=Malin Keshar
                    message= _ "Now the people of Parthyn will never accept me back!"
                [/message]

                [endlevel]
                    result=defeat
                [/endlevel]
            [/then]
            [else]
                [message]
                    speaker=Malin Keshar
                    message= _ "See how you die when you spurn the help of Malin Keshar..."
                [/message]
            [/else]
        [/if]
    [/event]

    # Victory Conditions
    [event]
        name=die
        [filter]
            id=Drogan
        [/filter]

        # it's kind of subtle, but keep making everything darker
        {COLOR_ADJUST -15 -15 -15}

        {REMOVE_IMAGE 14 9}

        {INCIDENTAL_MUSIC the_dangerous_symphony.ogg}

        [message]
            speaker=Malin Keshar
            message= _ "See what your traitorous ways have won you, Drogan?"
        [/message]

        [message]
            speaker=Dela Keshar
            message= _ "Drogan, no! Malin, you monster, how could ya just murder Drogan in cold blood?"
        [/message]

        [message]
            speaker=Malin Keshar
            message= _ "He chose this fate for himself! I merely retaliated in turn!"
        [/message]

        [message]
            speaker=Dela Keshar
            message= _ "How could ye possibly think Drogan was tha traitor when you’re the one attacking Parthyn?"
        [/message]

        [message]
            speaker=Malin Keshar
            message= _ "What? I have not harmed even a single villager or guardsman besides Drogan! I am only trying to help, but none of you will listen to reason!"
        [/message]

        [message]
            speaker=Dela Keshar
            message= _ "I tried to! I wanted ta believe in ya, I really did. After Father died, you and Drogan were all I had..."
        [/message]

        [message]
            speaker=Malin Keshar
            message= _ "Then why did you listen to him instead of me? I was trying to keep us together. He was trying to tear us apart! You wouldn’t even lift a finger to help me when he threatened to attack me!"
        [/message]

        [message]
            speaker=Dela Keshar
            message= _ "Malin, that’s—"
        [/message]

        [message]
            speaker=Malin Keshar
            message= _ "You’ve always been like this. You never think for yourself. You always just follow whatever other people tell you. Not a single original thought in your head."
        [/message]

        [message]
            speaker=Dela Keshar
            message= _ "Malin—"
        [/message]

        [message]
            speaker=Malin Keshar
            message= _ "That man used necromancy? He must be evil! Never mind that he be your own brother, trying to protect his own home!"
        [/message]

        {MODIFY_UNIT (id=Dela Keshar) profile (portraits/dela-mad.png)}

        [message]
            speaker=Dela Keshar
            message= _ "Enough! There’s nothing I can say ta someone who embraces evil so shamelessly! You’ll pay for Drogan’s death!"
        [/message]

        [message]
            speaker=Malin Keshar
            message= _ "..."
        [/message]

        [message]
            speaker=Malin Keshar
            message= _ "So, no matter what, she’ll be against me? Then this is hopeless. Even if they intend to fight me, I’ve no wish to fight the townsfolk..."
        [/message]

        [message]
            speaker=Malin Keshar
            message= _ "I guess I should just leave and find Darken Volk."
        [/message]

        {HIGHLIGHT_IMAGE 16 1 scenery/signpost.png ()}

        [objectives]
            side=1
            [objective]
                condition=win
                description= _ "Escape to the northwest"
            [/objective]

            {DID_RTP_OBJECTIVE_KILL_ORCS}

            [objective]
                condition=lose
                description= _ "Death of Malin Keshar"
            [/objective]

            {TURNS_RUN_OUT}

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

        {PLACE_IMAGE scenery/dark-monolith.png 19 24}
        {PLACE_IMAGE "items/bones.png" $x1 $y1}
        {VARIABLE loc.x $x1}
        {VARIABLE loc.y $y1}

        [event]
            name=moveto
            [filter]
                id=Malin Keshar
                x,y=19,24
            [/filter]
            [message]
                speaker=narrator
                message= _ "A monolith of dark stone, shadowed panes reflecting distorted images."
            [/message]

#ifdef EASY
            {GIVE_MALIN_EXPERIENCE 12}
#endif
#ifdef NORMAL
            {GIVE_MALIN_EXPERIENCE 10}
#endif
#ifdef HARD
            {GIVE_MALIN_EXPERIENCE 8}
#endif
        [/event]

        [event]
            name=moveto
            [filter]
                id=Malin Keshar
                x,y=16,1
            [/filter]

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

        [event]
            name=moveto
            [filter]
                id=Malin Keshar
                x,y=$loc.x,$loc.y
            [/filter]

            [animate_unit]
                [filter]
                    id=Malin Keshar
                [/filter]
                [primary_attack]
                    range=ranged
                [/primary_attack]
                flag=attack
            [/animate_unit]

            [delay]
                time=400
            [/delay]

            {REMOVE_IMAGE $loc.x $loc.y}

            [unit]
                type=Ghoul DiD
                id=DroganGhoul
                name= _ "Drogan"
                x,y=$loc.x,$loc.y
                side=1
                animate=yes
            [/unit]

            [message]
                speaker=DroganGhoul
                # po: This is just some guttural sound that a ghoul might make since it can't actually talk
                message= _ "Grahhhuralug..." # wmllint: no spellcheck
            [/message]

            [message]
                speaker=Malin Keshar
                message= _ "As ugly in death as he was in life. Darken Volk was right. It is fitting."
            [/message]

            [message]
                speaker=Dela Keshar
                message= _ "What have you done?! Killing Drogan wasn’t enough — ya had ta defile his body as well? How could ya turn him into such a... a hideous thing? I can’t believe how depraved you’ve become!"
            [/message]

            [message]
                speaker=Malin Keshar
                message= _ "What you see on the outside reflects the inside. The face of truth is undoubtedly an ugly one."
            [/message]
        [/event]
    [/event]

    [event]
        name=time over

        [unit]
            type=Orcish Warlord
            side=2
            x,y=17,2
            id=OWarlord
            canrecruit=yes
            animate=yes
            facing=se
        [/unit]
        {GENERIC_UNIT 2 (Orcish Slurbow) 16 1} {FACING se}
        {GENERIC_UNIT 2 (Direwolf Rider) 15 2} {FACING se}
        {GENERIC_UNIT 2 (Goblin Pillager) 17 1} {FACING se}
        {GENERIC_UNIT 2 (Goblin Knight) 16 2} {FACING se}

        [message]
            speaker=OWarlord
            message= _ "Look what we have here! A human city on the verge of collapse and a necromancer with only a few paltry minions at his command. The wolves will feed well tonight!"
        [/message]
        [message]
            speaker=Malin Keshar
            message= _ "More orcs, and powerful ones at that! There’s no way I’m escaping now..."
        [/message]
    [/event]

    [event]
        name=victory

        [if]
            {DID_RTP_HAS_ORC_LEADER}
            [then]
                [message]
                    speaker=Dela Keshar
                    message= _ "Flee while you still can, Malin the Damned! When I have defeated these orcs and secured Parthyn against further raids, I will hunt you down and I will kill you. You are my brother no longer."
                [/message]
            [/then]
            [else]
                [message]
                    speaker=Dela Keshar
                    message= _ "Flee while you still can, Malin the Damned! When I have secured Parthyn against further raids, I will hunt you down and I will kill you. You are my brother no longer."
                [/message]
            [/else]
        [/if]

        [message]
            speaker=Malin Keshar
            # wmllint: local spelling Zephrin
            message= _ "O gods, how did it come to this? My own sister determined to personally see to my demise. Banished from Parthyn, my country, my home... spurned by my people, whom I have given everything for... nothing has gone right ever since I got into an argument with that fat, orc-loving toad Zephrin and tried to curse him. I was only testing my new spell on him! It was only supposed to be a simple curse! How was I supposed to know it would kill him? Blasted Academy."
        [/message]

        [message]
            speaker=Malin Keshar
            message= _ "... Now the only being who still wants to see me alive is a necromancer. I’m beginning to think that I’m the one who was cursed..."
        [/message]

        {CLEAR_VARIABLE malin_used_necromancy}
        {CLEAR_VARIABLE orc_leader_store}
        {CLEAR_VARIABLE fallback_orc_leader}
        {CLEAR_VARIABLE loc}
    [/event]

    {HERODEATH_MALIN}
[/scenario]

#undef DID_RTP_OBJECTIVE_KILL_ORCS
#undef DID_RTP_HAS_DROGAN
#undef DID_RTP_HAS_ORC_LEADER


#textdomain wesnoth-did

[scenario]
    id=07a_A_Small_Favor
    name= _ "A Small Favor — I"
    map_file=07a_A_Small_Favor.map
    {TURNS 20 18 16}
    next_scenario=07b_A_Small_Favor2
    victory_when_enemies_defeated=no

#ifdef EASY
    {FIRST_WATCH_HOUR2}
    {FIRST_WATCH_HOUR2}
    {FIRST_WATCH_HOUR3}
    {FIRST_WATCH_HOUR3}
    {FIRST_WATCH_HOUR4}
    {FIRST_WATCH_HOUR4}
    {MIDNIGHT_HOUR}
    {MIDNIGHT_HOUR}
    {SECOND_WATCH_HOUR1}
    {SECOND_WATCH_HOUR1}
    {SECOND_WATCH_HOUR2}
    {SECOND_WATCH_HOUR2}
    {SECOND_WATCH_HOUR3}
    {SECOND_WATCH_HOUR3}
    {SECOND_WATCH_HOUR4}
    {SECOND_WATCH_HOUR4}
    {SECOND_WATCH_HOUR5}
    {SECOND_WATCH_HOUR5}
    {SECOND_WATCH_HOUR6}
    {SECOND_WATCH_HOUR6}
    {DAWN_HOUR}
#endif

#ifdef NORMAL
    {FIRST_WATCH_HOUR2}
    {FIRST_WATCH_HOUR3}
    {FIRST_WATCH_HOUR3}
    {FIRST_WATCH_HOUR4}
    {FIRST_WATCH_HOUR4}
    {MIDNIGHT_HOUR}
    {MIDNIGHT_HOUR}
    {SECOND_WATCH_HOUR1}
    {SECOND_WATCH_HOUR1}
    {SECOND_WATCH_HOUR2}
    {SECOND_WATCH_HOUR2}
    {SECOND_WATCH_HOUR3}
    {SECOND_WATCH_HOUR3}
    {SECOND_WATCH_HOUR4}
    {SECOND_WATCH_HOUR4}
    {SECOND_WATCH_HOUR5}
    {SECOND_WATCH_HOUR5}
    {SECOND_WATCH_HOUR6}
    {DAWN_HOUR}
#endif

#ifdef HARD
    {FIRST_WATCH_HOUR2}
    {FIRST_WATCH_HOUR3}
    {FIRST_WATCH_HOUR3}
    {FIRST_WATCH_HOUR4}
    {FIRST_WATCH_HOUR4}
    {MIDNIGHT_HOUR}
    {MIDNIGHT_HOUR}
    {SECOND_WATCH_HOUR1}
    {SECOND_WATCH_HOUR1}
    {SECOND_WATCH_HOUR2}
    {SECOND_WATCH_HOUR3}
    {SECOND_WATCH_HOUR3}
    {SECOND_WATCH_HOUR4}
    {SECOND_WATCH_HOUR4}
    {SECOND_WATCH_HOUR5}
    {SECOND_WATCH_HOUR6}
    {DAWN_HOUR}
#endif

    {SCENARIO_MUSIC       elvish-theme.ogg}
    {EXTRA_SCENARIO_MUSIC nunc_dimittis.ogg}
    {EXTRA_SCENARIO_MUSIC the_deep_path.ogg}

    [story]
        [part]
            music=underground.ogg
            story= _ "Fleeing from the city of his birth, Malin escapes into the forested hills north of the Great River. Some distance west, he finally stops after several days bereft of rest and sleep. He closes his eyes, trying to purge the last few hours from his mind, but the darkness only makes the images all the more vivid. He is tired, so tired, but sleep does not come."
            {STORYTXT_BACKGROUND travel.jpg}
        [/part]
        [part]
            story= _ "“No regrets. No regrets...” He repeats it under his breath like a chant, murmuring over and over in his half-conscious state. After a while, a second voice joins, a voice that sounds very much like his own, but somehow feels foreign and alien. ‘There could have been another way. You might have been wrong.’"
            {STORYTXT_BACKGROUND travel.jpg}
        [/part]
        [part]
            story= _ "“No, no. Even if there were another way, they would have spurned me all the same. They are wrong... blind. I have no regrets about what I did. No regrets...” He quells the voice. Sleep comes, long stretches of dreamless darkness punctuated briefly by nightmarish forms — distorted, grotesque things that whisper in eerily familiar voices. ‘You are cursed, Malin the Damned! Cursed! Cursed. Cursed...’ They echo over and over, first a choir, then a duet, both male, then just one, a single voice alone in the darkness."
            {STORYTXT_BACKGROUND travel.jpg}
        [/part]
        [part]
            story= _ "Malin wakes up to a plume of smoke rising behind him. He gives it only a brief thought before heading farther west. Soon, he catches sight of the golden banners of Tath and reunites with his teacher just outside of the city."
            {STORYTXT_BACKGROUND travel.jpg}
        [/part]
        [part]
            story=_ "“For your final test as my apprentice, you will aid me in retrieving a book,” the necromancer says. “The book was... stolen from me long ago. It has personal value to me, so you may think of this as a small favor. However, this task will require you to act against your countrymen of Wesnoth, since it was one of them who took it from me.”"
            {STORYTXT_BACKGROUND book.jpg}
        [/part]
        [part]
            story= _ "Malin replies, “They are no longer countrymen of mine.”"
            {STORYTXT_BACKGROUND book.jpg}
        [/part]
        [part]
            story= _ "Darken Volk continues, “Excellent. There is a lady of Tath by the name of Karae. She was trained as a mage in her youth and now uses her wealth to support a large number of mages in their studies. Among her library is the book we seek. We shall break into her manor and search from there.”"
            {STORYTXT_BACKGROUND book.jpg}
        [/part]
    [/story]

    {DID_TRACK {JOURNEY_07_NEW}}

    # wmllint: validate-off
    [side]
        side=1
        controller=human
        recruit=Walking Corpse,Vampire Bat,Ghost,Ghoul,Skeleton Archer,Skeleton
        {GOLD 180 150 120}
        team_name=intruders
        user_team_name= _ "Intruders"
        {FLAG_VARIANT undead}
        color=darkblue

        village_gold=2
        village_support=1

        # wmllint: recognize Malin Keshar
        {CHARACTER_STATS_MALIN_KESHAR}

        fog=yes
        facing=sw
    [/side]
    # wmllint: validate-on

    [side]
        side=2
        controller=ai
        recruit=Swordsman,Pikeman,Longbowman,Cavalryman,Dragoon,Mage,Heavy Infantryman,Shock Trooper
        gold=0
        team_name=defenders
        user_team_name= _ "Defenders"
        {FLAG_VARIANT loyalist}
        color=gold

        village_gold=0
        income=-2

        type=General
        id=Taylor
        name= _ "Taylor"
        canrecruit=yes

        fog=yes
        share_vision=none
        facing=se

        # Place city guards

        {NAMED_LOYAL_UNIT 2 Bowman 2 17  (Guard1) ( _ "Night Watchman")} {GUARDIAN}
        {NAMED_LOYAL_UNIT 2 Spearman 4 17  (Guard2) ( _ "Night Watchman")} {GUARDIAN}
        {NAMED_LOYAL_UNIT 2 Spearman 4 18 (Guard3) ( _ "Night Watchman")} {GUARDIAN}

        {NAMED_LOYAL_UNIT 2 Spearman 11 3 (Guard4) ( _ "Night Watchman")} {GUARDIAN}
        {NAMED_LOYAL_UNIT 2 Bowman 11 4 (Guard5) ( _ "Night Watchman")} {GUARDIAN}
        {NAMED_LOYAL_UNIT 2 Spearman 13 4 (Guard6) ( _ "Night Watchman")} {GUARDIAN}

        {NAMED_LOYAL_UNIT 2 Pikeman  18 18 () ( _ "Gate Guard")}     {GUARDIAN}
        {NAMED_LOYAL_UNIT 2 Swordsman  16 20 () ( _ "Gate Guard")}     {GUARDIAN}

        {NAMED_LOYAL_UNIT 2 (Heavy Infantryman) 20 22 () ( _ "Gate Guard")} {GUARDIAN}
        {NAMED_LOYAL_UNIT 2 (Heavy Infantryman) 24 20 () ( _ "Gate Guard")} {GUARDIAN}

        {NAMED_LOYAL_UNIT 2 (Heavy Infantryman) 3 12 () ( _ "City Guard")} {GUARDIAN}
        {NAMED_LOYAL_UNIT 2 (Shock Trooper) 5 15 () ( _ "City Guard")} {GUARDIAN}

        # More guards, depending on the difficulty
#ifdef EASY
        {NAMED_LOYAL_UNIT 2 Mage      7  9 () ( _ "Mage Guard")}  {GUARDIAN}
        {NAMED_LOYAL_UNIT 2 Mage      8  7 () ( _ "Mage Guard")} {GUARDIAN}
        {NAMED_LOYAL_UNIT 2 Sergeant 6 13 () ( _ "Head Trainer")}   {GUARDIAN}
#endif

#ifdef NORMAL
        {NAMED_LOYAL_UNIT 2 Mage      7  9 () ( _ "Mage Guard")}  {GUARDIAN}
        {NAMED_LOYAL_UNIT 2 (Red Mage)   8  7  () ( _ "Mage Guard")} {GUARDIAN}
        {NAMED_LOYAL_UNIT 2 (Heavy Infantryman)   12 16  () ( _ "City Guard")}     {GUARDIAN}
        {NAMED_LOYAL_UNIT 2 (Lieutenant) 6 13 () ( _ "Head Trainer")}   {GUARDIAN}
#endif

#ifdef HARD
        {NAMED_LOYAL_UNIT 2 (White Mage)      7  9 () ( _ "Mage Guard")}  {GUARDIAN}
        {NAMED_LOYAL_UNIT 2 (Red Mage)    8   7 () ( _ "Mage Guard")} {GUARDIAN}
        {NAMED_LOYAL_UNIT 2 (Shock Trooper)     12 16 () ( _ "City Guard")} {GUARDIAN}
        {NAMED_LOYAL_UNIT 2 (Lieutenant)  6 13 () ( _ "Head Trainer")}   {GUARDIAN}
#endif

        [ai]
            passive_leader=yes
            aggression=1.0
            caution=0.4
            grouping=offensive

            [goal]
                name=protect_location
                [criteria]
                    # Manor entrance
                    x,y=7,8
                [/criteria]
                protect_radius=5
                value=4
            [/goal]

            [goal]
                name=protect_location
                [criteria]
                    # Rest of city
                    x=3-22
                    y=6-22
                [/criteria]
                protect_radius=1
                value=2
            [/goal]

            [goal]
                name=protect_unit
                [criteria]
                    side=2
                    canrecruit=yes
                [/criteria]
                value=2
            [/goal]
        [/ai]
    [/side]

    [side]
        side=3
        controller=ai
        no_leader=yes
        hidden=yes
        team_name=monsters
        color=orange
        [ai]
            aggression=1.0
            caution=0.0
        [/ai]
    [/side]

    {STARTING_VILLAGES 1 3}
    {STARTING_VILLAGES 2 15}

    {PLACE_IMAGE scenery/whirlpool.png 38 23}

    # City
    {PLACE_IMAGE scenery/well.png 16 12}
    {PLACE_IMAGE scenery/well.png 19 14}
    {PLACE_IMAGE scenery/tent-shop-weapons.png 3 17}
    {PLACE_IMAGE scenery/monolith1.png 11 5}
    {PLACE_IMAGE scenery/monolith1.png 13 6}
    {PLACE_IMAGE scenery/monolith1.png 10 6}
    {PLACE_IMAGE scenery/signpost.png 15 16}
    {PLACE_IMAGE scenery/signpost.png 11 12}
    {PLACE_IMAGE scenery/temple1.png 10 18}
    {PLACE_IMAGE scenery/tent-fancy-red.png 9 15}
    {PLACE_IMAGE items/dragonstatue.png 12 14}

    {PLACE_IMAGE "items/dummy.png~RC(magenta>green)" 7 12}
    {PLACE_IMAGE "items/dummy.png~RC(magenta>green)" 4 11}
    {PLACE_IMAGE items/armor.png 4 12}
    {PLACE_IMAGE items/armor.png 3 16}
    {PLACE_IMAGE items/armor.png 6 16}
    {PLACE_IMAGE items/flower2.png 13 7}
    {PLACE_IMAGE items/flower1.png 16 8}
    {PLACE_IMAGE items/flower3.png 12 7}
    {PLACE_IMAGE items/flower4.png 17 8}

    # Manor
    {PLACE_IMAGE scenery/trapdoor-closed.png 3 6}
    {PLACE_IMAGE items/cloak-green.png 2 6}
    {PLACE_IMAGE items/ornate1.png 5 5}
    {PLACE_IMAGE items/potion-blue.png 4 5}
    {PLACE_IMAGE items/potion-red.png 6 5}
    {PLACE_IMAGE items/altar.png 3 7}

#define WATCHMAN_PATROL_MOVEMENT
    [set_variable]
        name=turn_mod
        value=$($turn_number % 5)
    [/set_variable]

    [switch]
        variable=turn_mod
        [case]
            value=1,0
            [move_unit]
                id=Guard3
                side=2
                to_x,to_y=5,22
            [/move_unit]
            [move_unit]
                id=Guard2
                side=2
                to_x,to_y=4,21
            [/move_unit]
            [move_unit]
                id=Guard1
                side=2
                to_x,to_y=4,20
            [/move_unit]

            [move_unit]
                id=Guard6
                side=2
                to_x,to_y=18,7
            [/move_unit]
            [move_unit]
                id=Guard5
                side=2
                to_x,to_y=16,6
            [/move_unit]
            [move_unit]
                id=Guard4
                side=2
                to_x,to_y=14,5
            [/move_unit]
        [/case]
        [case]
            value=2,4
            [move_unit]
                id=Guard3
                side=2
                to_x,to_y=10,24
            [/move_unit]
            [move_unit]
                id=Guard2
                side=2
                to_x,to_y=10,23
            [/move_unit]
            [move_unit]
                id=Guard1
                side=2
                to_x,to_y=9,24
            [/move_unit]

            [move_unit]
                id=Guard6
                side=2
                to_x,to_y=22,11
            [/move_unit]
            [move_unit]
                id=Guard5
                side=2
                to_x,to_y=21,11
            [/move_unit]
            [move_unit]
                id=Guard4
                side=2
                to_x,to_y=20,9
            [/move_unit]
        [/case]
        [case]
            value=3
            [move_unit]
                id=Guard3
                side=2
                to_x,to_y=14,22
            [/move_unit]
            [move_unit]
                id=Guard2
                side=2
                to_x,to_y=13,23
            [/move_unit]
            [move_unit]
                id=Guard1
                side=2
                to_x,to_y=12,22
            [/move_unit]

            [move_unit]
                id=Guard6
                side=2
                to_x,to_y=20,16
            [/move_unit]
            [move_unit]
                id=Guard5
                side=2
                to_x,to_y=21,16
            [/move_unit]
            [move_unit]
                id=Guard4
                side=2
                to_x,to_y=21,15
            [/move_unit]
        [/case]
    [/switch]

    {CLEAR_VARIABLE turn_mod}
#enddef

    [event]
        name=prestart

        {CLEAR_CORPSE_HORDE}

        [label]
            x,y=9,15
            text= _ "Stables"
        [/label]

        [label]
            x,y=10,18
            text= _ "Temple"
        [/label]

        {COLOR_ADJUST -16 -16 -16}

        [objectives]
            side=1
            [objective]
                condition=win
                description= _ "Move Malin and Darken Volk into the Mage Lady’s manor"
            [/objective]
            [objective]
                {ALTERNATIVE_OBJECTIVE_CAPTION}
                condition=win
                description= _ "Defeat General Taylor"
            [/objective]
            [objective]
                condition=lose
                description= _ "Death of Malin Keshar"
            [/objective]
            [objective]
                condition=lose
                description= _ "Death of Darken Volk"
            [/objective]

            {TURNS_RUN_OUT}

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

            [note]
                description= _ "Enemy units have reduced vision. An enemy unit will see you if two hexes separate you from them."
            [/note]
        [/objectives]

        # Place Darken Volk
        {VARIABLE darken_volk_store.x recall}
        {VARIABLE darken_volk_store.y recall}

        [unstore_unit]
            variable=darken_volk_store
        [/unstore_unit]

        {CLEAR_VARIABLE darken_volk_store}

        [recall]
            id=Darken Volk
            x,y=36,15
        [/recall]

        {MODIFY_UNIT (side=1) facing nw}

        [modify_unit]
            [filter]
                side=2
            [/filter]
            vision=2
        [/modify_unit]

        {VARIABLE guard_alerted 0}
    [/event]

    # Malin doesn't talk in this scenario because he's depressed :(
    [event]
        name=start

        [message]
            speaker=Darken Volk
            message= _ "The stolen book lies within Lady Karae’s manor at the north end of the city. It will be difficult for us to defeat the entire city guard, so we must stay hidden as long as possible. For now, we can make use of this fog. I shall use it to cast a spell to obscure the town guards’ vision."
        [/message]

        [delay]
            time=450
        [/delay]
        [animate_unit]
            [filter]
                id=Darken Volk
            [/filter]
            [primary_attack]
                range=ranged
            [/primary_attack]
            flag=attack
        [/animate_unit]
        [delay]
            time=350
        [/delay]

        [message]
            speaker=Darken Volk
            message= _ "This spell will not hide us completely. If we stray too close to the guards, they will still be able to see us. Once we are spotted, we shall have to make a run for it. The faster we enter the manor, the more time we shall have to search for the book before the guards can pursue us."
        [/message]

        [message]
            speaker=narrator
            message= _ "Note: Only the units you recruit now will be available to you once inside."
            image=wesnoth-icon.png
        [/message]
    [/event]

    [event]
        name=sighted
        [filter]
            side=2
        [/filter]
        [filter_second]
            side=1
        [/filter_second]

        [message]
            speaker=unit
            message= _ "This blasted fog is so thick! I can’t see a thing!"
        [/message]

        [message]
            speaker=Taylor
            message= _ "Stay alert, soldier. Report anything unusual immediately."
        [/message]
    [/event]

    [event]
        name=sighted
        [filter]
            side=1
        [/filter]
        [filter_second]
            side=2
        [/filter_second]

        [if]
            [variable]
                name=second_unit.id
                not_equals=Taylor
            [/variable]
            [then]
                [message]
                    speaker=second_unit
                    message= _ "Undead are emerging from the forest!"
                [/message]
            [/then]
        [/if]
        [message]
            speaker=Taylor
            message= _ "Wake the guard! To arms!"
        [/message]

        [modify_side]
            side=2
            {GOLD 140 170 200}
            {INCOME 12 16 20}
        [/modify_side]

        {VARIABLE guard_alerted 1}
    [/event]

    [event]
        name=side 2 turn refresh
        first_time_only=no
        [filter_condition]
            [variable]
                name=guard_alerted
                numerical_equals=0
            [/variable]
        [/filter_condition]

        {MODIFY_UNIT (side=2) moves 0}
        {WATCHMAN_PATROL_MOVEMENT}
    [/event]

    [event]
        name=moveto
        [filter]
            x,y=38,23
            side=1
        [/filter]

        [sound]
            name=water-blast.wav
        [/sound]

        [unit]
            x,y=38,23
            type=Tentacle of the Deep
            id=Tentacly
            name= _ "Tentacly"
            side=3
            max_hitpoints=66
            level=2
            animate=yes
        [/unit]

        [message]
            speaker=Darken Volk
            message= _ "I have heard rumors that the mages of Tath have been experimenting on the wildlife..."
        [/message]
    [/event]

    [event]
        name=die
        [filter]
            id=Tentacly
        [/filter]
        [filter_second]
            type=Soulless
            variation=swimmer
        [/filter_second]

        [sound]
            name=squishy-hit.wav
        [/sound]

        [object]
            id=sushi_mini_buff
            take_only_once=yes
            silent=yes
            duration=forever
            [filter]
                type=Soulless
                variation=swimmer
            [/filter]
            [effect]
                apply_to=hitpoints
                increase_total=7
                increase=7
                heal_full=no
            [/effect]
            [effect]
                apply_to=movement
                increase=2
            [/effect]
        [/object]
    [/event]

    [event]
        name=moveto
        [filter]
            x,y=10,18
            side=1
        [/filter]

        [message]
            speaker=Darken Volk
            message= _ "Oh? The temple healers are trying to heal a man who is already dead. Perhaps you could... give them a little demonstration as to how it is actually done."
        [/message]

        [animate_unit]
            [filter]
                id=Malin Keshar
            [/filter]
            [primary_attack]
                range=ranged
            [/primary_attack]
            flag=attack
        [/animate_unit]

        [unit]
            x,y=10,18
            type=Soulless
            id=Jaime
            name= _ "Fat Jaime the Drunk Sailor"
            side=1
            animate=yes
        [/unit]

        [object]
            silent=yes
            duration=forever
            [filter]
                id=Jaime
            [/filter]
            [effect]
                apply_to=hitpoints
                increase=23
                increase_total=23
            [/effect]
        [/object]
        [object]
            silent=yes
            duration=forever
            [filter]
                id=Jaime
            [/filter]
            [effect]
                apply_to=new_ability
                [abilities]
                    {ABILITY_DRUNK}
                [/abilities]
            [/effect]
        [/object]
    [/event]

    # a little difficult to get, because it requires you to kill a mounted unit on this scenario with plague and get it to the tent too
    [event]
        name=moveto
        [filter]
            x,y=9,15
            side=1
            type=Walking Corpse, Soulless
            variation=mounted
        [/filter]

        [message]
            speaker=Darken Volk
            message= _ "It appears as if these stables contain some armaments that could be useful for an undead rider."
        [/message]

        [unit]
            x,y=9,15
            type=Chocobone
            side=1
            animate=yes
            overwrite=yes
        [/unit]
    [/event]

    # Undead unit kicks the holy water
    [event]
        name=moveto
        [filter]
            x,y=5,5
            race=undead
        [/filter]

        [message]
            speaker=unit
            # po: Ooouuuh is a cry of pain
            message= _ "Ooouuuh! It burns... burrrrnnns..."  # wmllint: no spellcheck
        [/message]

        [harm_unit]
            [filter]
                x,y=$x1,$y1
            [/filter]
            amount=1
            kill=no
            animate=yes
        [/harm_unit]

        [floating_text]
            x,y=$x1,$y1
            color=255,0,0
            text=-1
        [/floating_text]

        [remove_item]
            x,y=5,5
        [/remove_item]

        [message]
            speaker=Darken Volk
            message= _ "Beware the urns. It appears that they contain holy water that these mages have brewed themselves. As you might guess from the name, it is quite effective against undead."
        [/message]
    [/event]

    [event]
        name=last breath
        [filter]
            id=Taylor
        [/filter]

        [message]
            speaker=Taylor
            message= _ "The undead are too strong! Retreat and regroup!"
        [/message]

        [kill]
            side=2
        [/kill]
        [endlevel]
            result=victory
            linger_mode=no
            bonus=yes
            {NEW_GOLD_CARRYOVER 40}
        [/endlevel]
    [/event]

    # Victory Conditions
    [event]
        name=moveto
        first_time_only=no
        [filter]
            id=Malin Keshar,Darken Volk
            x=2-6
            y=5-7
        [/filter]
        [filter_condition]
            [have_unit]
                id=Malin Keshar
                x=2-6
                y=5-7
            [/have_unit]
            [have_unit]
                id=Darken Volk
                x=2-6
                y=5-7
            [/have_unit]
        [/filter_condition]

        [message]
            speaker=Darken Volk
            message= _ "Here is the entrance! Hurry!"
        [/message]

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

    [event]
        name=victory

        {SET_GOT_INSIDE_MANOR}

#ifdef EASY
        [set_variable]
            name=S7_turns
            value=$("23 - ($turn_number)")
        [/set_variable]
#endif
#ifdef NORMAL
        [set_variable]
            name=S7_turns
            value=$("20 - ($turn_number)")
        [/set_variable]
#endif
#ifdef HARD
        [set_variable]
            name=S7_turns
            value=$("18 - ($turn_number)")
        [/set_variable]
#endif

        {CLEAR_VARIABLE guard_alerted}
    [/event]

    {HERODEATH_MALIN}
    {HERODEATH_VOLK}

    [event]
        name=time over

        [message]
            speaker=Darken Volk
            message= _ "We have no hope of entering the manor now that dawn has broken and the entire city guard is alerted to our presence. Your incompetence is truly appalling."
        [/message]

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


#textdomain wesnoth-did

[scenario]
    id=07b_A_Small_Favor2
    name= _ "A Small Favor — II"
    map_file=07b_A_Small_Favor2.map
    {TURNS 25 22 19}
    next_scenario=07c_A_Small_Favor3
    victory_when_enemies_defeated=no

    [time]
        id=indoors
        name= _ "Indoors"
        image=misc/time-schedules/schedule-indoors.png
        lawful_bonus=-10
    [/time]

    {SCENARIO_MUSIC       casualties_of_war.ogg}
    {EXTRA_SCENARIO_MUSIC battle.ogg}
    {EXTRA_SCENARIO_MUSIC siege_of_laurelmor.ogg}

    # No story; this occurs immediately after the previous scenario

    # wmllint: validate-off
    [side]
        side=1
        controller=human
        gold=0
        team_name=intruders
        user_team_name= _ "Intruders"
        {FLAG_VARIANT undead}
        color=darkblue

        income=-2

        # wmllint: recognize Malin Keshar
        {CHARACTER_STATS_MALIN_KESHAR}

        shroud=yes
        facing=nw
    [/side]
    # wmllint: validate-on

    # Mages
    [side]
        side=2
        controller=ai
        team_name=defenders
        user_team_name= _ "Defenders"
        no_leader=yes
        hidden=yes
        color=purple

        [ai]
            village_value=0
            aggression=0.8
        [/ai]
    [/side]

    # City guard
    [side]
        side=3
        controller=ai
        team_name=defenders
        user_team_name= _ "Defenders"
        no_leader=yes
        hidden=yes
        {FLAG_VARIANT loyalist}
        color=gold
        [ai]
            village_value=0
            aggression=0.8
        [/ai]
    [/side]

    # This macro places the doors and adds the door-opening event
    {MANOR_DOORS 1}

    # Scenery
    {PLACE_IMAGE items/ankh-necklace.png 3 15}
    {PLACE_IMAGE items/ball-blue.png 2 10}
    {PLACE_IMAGE items/ball-magenta.png 25 2}
    {PLACE_IMAGE items/ball-green.png 8 2}
    {PLACE_IMAGE items/stone-tablet.png 6 16}
    {PLACE_IMAGE items/stone-tablet.png 15 13}
    {PLACE_IMAGE items/ornate2.png 17 1}
    {PLACE_IMAGE items/potion-blue.png 26 4}
    {PLACE_IMAGE items/potion-grey.png 27 5}
    {PLACE_IMAGE items/potion-green.png 27 6}
    {PLACE_IMAGE items/potion-red.png 25 6}
    {PLACE_IMAGE items/potion-yellow.png 26 6}
    {PLACE_IMAGE items/altar-evil.png 26 5}
    {PLACE_IMAGE items/barrel.png 24 10}
    {PLACE_IMAGE items/barrel.png 25 10}
    {PLACE_IMAGE items/barrel.png 22 9}
    {PLACE_IMAGE items/box.png 25 9}
    {PLACE_IMAGE items/box.png 22 11}
    {PLACE_IMAGE items/box.png 21 12}
    {PLACE_IMAGE items/box.png 9 7}
    {PLACE_IMAGE items/chest-open.png 8 7}
    {PLACE_IMAGE items/chest-plain-open.png 9 9}
    {PLACE_IMAGE items/barrel.png 8 9}
    {PLACE_IMAGE items/altar.png 15 2}
    {PLACE_IMAGE items/holy-water.png 17 1}
    {PLACE_IMAGE items/holy-water.png 18 1}
    {PLACE_IMAGE items/ring-white.png 13 3}
    {PLACE_IMAGE items/ring-red.png 24 1}

    {PLACE_IMAGE items/dragonstatue.png 11 12}
    {PLACE_IMAGE items/dragonstatue.png 10 12}
    {PLACE_IMAGE items/dragonstatue.png 21 3}
    {PLACE_IMAGE scenery/monolith4.png 14 12}
    {PLACE_IMAGE scenery/monolith3.png 13 15}
    {PLACE_IMAGE scenery/monolith1.png 17 14}

    [event]
        name=prestart

        {COLOR_ADJUST -17 -17 -17}

        [objectives]
            side=1
            [objective]
                condition=win
                description= _ "Find Lady Karae"
            [/objective]
            [objective]
                condition=lose
                description= _ "Death of Malin Keshar"
            [/objective]
            [objective]
                condition=lose
                description= _ "Death of Darken Volk"
            [/objective]

            {TURNS_RUN_OUT}

            [gold_carryover]
                bonus=no
                carryover_percentage=100
            [/gold_carryover]
        [/objectives]

        # Randomize Karae’s location
        {RANDOM 0..3}

        [switch]
            variable=random
            [case]
                value=0
                {VARIABLE karae_x 1}
                {VARIABLE karae_y 11}
            [/case]

            [case]
                value=1
                {VARIABLE karae_x 8}
                {VARIABLE karae_y 1}
            [/case]

            [case]
                value=2
                {VARIABLE karae_x 13}
                {VARIABLE karae_y 3}
            [/case]

            [case]
                value=3
                {VARIABLE karae_x 24}
                {VARIABLE karae_y 1}
            [/case]
        [/switch]

        [unit]
            type=Silver Mage
            id=Lady Karae
            name= _ "Lady Karae"
            profile=portraits/karae.png
            gender=female
            side=2
            x,y=$karae_x,$karae_y
            canrecruit=yes
            random_traits=no
        [/unit]

        {CLEAR_VARIABLE karae_x,karae_y}

        [set_variables]
            name=guardtypetable
            [value]
                type=Shock Trooper
            [/value]
            [value]
                type=Spearman
            [/value]
#ifndef HARD
            [value]
                type=Fencer
            [/value]
#endif
            [value]
                type=Duelist
            [/value]
            [value]
                type=Pikeman
            [/value]
            [value]
                type=Swordsman
            [/value]
#ifndef EASY
            [value]
                type=Swordsman
            [/value]
            [value]
                type=Duelist
            [/value]
#endif
#ifdef HARD
            [value]
                type=Swordsman
            [/value]
            [value]
                type=Pikeman
            [/value]
            [value]
                type=Duelist
            [/value]
#endif
            [value]
                type=Heavy Infantryman
            [/value]
            [value]
                type=Heavy Infantryman
            [/value]
            [value]
                type=Spearman
            [/value]
            [value]
                type=Fencer
            [/value]
            [value]
                type=Fencer
            [/value]
        [/set_variables]

        [random_placement]
            num_items={ON_DIFFICULTY 5 6 7}
            variable=loc
            min_distance=3
            [filter_location]
                terrain=Iwr,Icn,Ior
                [not]
                    x=1-5
                    y=1-5
                [/not]
                [not]
                    [filter][/filter]
                [/not]
            [/filter_location]
            [command]
                {NAMED_NOTRAIT_UNIT 2 "$guardtypetable[$($loc.n % $guardtypetable.length)].type" $loc.x $loc.y () (_ "Guard")} {GUARDIAN}
            [/command]
        [/random_placement]

        [set_variables]
            name=magetypetable
            [value]
                type=Mage
            [/value]
            [value]
                type=White Mage
            [/value]
            [value]
                type=Mage
            [/value]
            [value]
                type=Red Mage
            [/value]
            [value]
                type=Red Mage
            [/value]
#ifdef EASY
            [value]
                type=Mage
            [/value]
#endif
#ifndef EASY
            [value]
                type=White Mage
            [/value]
            [value]
                type=Red Mage
            [/value]
#endif
#ifdef HARD
            [value]
                type=Red Mage
            [/value]
            [value]
                type=White Mage
            [/value]
#endif
            [value]
                type=Mage
            [/value]
            [value]
                type=Mage
            [/value]
            [value]
                type=Mage
            [/value]
        [/set_variables]

        [random_placement]
            num_items={ON_DIFFICULTY 6 7 8}
            variable=loc
            min_distance=2
            [filter_location]
                terrain=Iwr,Icn,Ior
                [not]
                    x=1-5
                    y=1-5
                [/not]
                [not]
                    [filter][/filter]
                [/not]
            [/filter_location]
            [command]
                {GENERIC_UNIT 2 "$magetypetable[$($loc.n % $magetypetable.length)].type" $loc.x $loc.y}
            [/command]
        [/random_placement]

        # this code is a handler in case this scenario is reached via debug or an old save which did not include this variable
        [lua]
            code = << if wml.variables["S7_turns"] == nil then wml.variables["S7_turns"] = 5 end >>
        [/lua]

        [set_variable]
            name=S7_turns
            value=$(min({ON_DIFFICULTY 7 6 5},($S7_turns)))
        [/set_variable]
        [set_variable]
            name=spawn1
            value=$("{ON_DIFFICULTY 7 6 5} + ($S7_turns)")
        [/set_variable]
        [set_variable]
            name=spawn2
            value=$("{ON_DIFFICULTY 14 12 10} + ($S7_turns)")
        [/set_variable]

        [recall]
            id=Darken Volk
            x,y=18,15
        [/recall]

        # We want Volk facing another direction
        {MODIFY_UNIT (id=Darken Volk) facing ne}
    [/event]

    # le Volk is very chatty in this scenario because he's excited to get his book
    # Malin is still pretty quiet here
    [event]
        name=start

        [remove_shroud]
            side=1
            x,y=24,19
            radius=3
        [/remove_shroud]

        [store_unit]
            [filter]
                [filter_wml]
                    [variables]
                        got_inside_manor=yes
                    [/variables]
                [/filter_wml]
            [/filter]

            variable=units_inside_manor
        [/store_unit]

        [foreach]
            array=units_inside_manor
            [do]
                [recall]
                    id=$this_item.id
                [/recall]

                [modify_unit]
                    [filter]
                        id=$this_item.id
                    [/filter]

                    [object]
                        duration=scenario
                        [effect]
                            apply_to=loyal
                        [/effect]
                    [/object]
                [/modify_unit]

                [redraw]
                    clear_shroud=yes
                    side=1
                [/redraw]
            [/do]
        [/foreach]

        {CLEAR_VARIABLE units_inside_manor}

        [message]
            speaker=narrator
            image=wesnoth-icon.png
            message= _ "Malin and Darken Volk enter the mage lady’s manor, closing the heavy gates behind them."
        [/message]

        [message]
            speaker=Darken Volk
            message= _ "That gate will not hold back the soldiers for long. We must hurry."
        [/message]
    [/event]

    [event]
        name=sighted
        [filter]
            side=2
        [/filter]
        [filter_second]
            side=1
        [/filter_second]

        [message]
            speaker=unit
            message= _ "Undead have entered the manor! Defend yourselves!"
        [/message]
    [/event]

    # City guard spawns
#define SPAWN_GUARD
    [random_placement]
        num_items=1
        variable=loc
        min_distance=1
        [filter_location]
            x=22,23,21-26
            y=18,18,19-20
            [not]
                [filter][/filter]
            [/not]
        [/filter_location]
        [command]
            [set_variable]
                name=ind
                rand=1..$guardtypetable.length
            [/set_variable]
            {VARIABLE_OP ind sub 1}
            {GENERIC_UNIT 3 "$guardtypetable[$ind].type" $loc.x $loc.y}
            {CLEAR_VARIABLE ind}
        [/command]
    [/random_placement]
#enddef
#define SPAWN_MAGE
    [random_placement]
        num_items=1
        variable=loc
        min_distance=1
        [filter_location]
            x=22,23,21-26
            y=18,18,19-20
            [not]
                [filter][/filter]
            [/not]
        [/filter_location]
        [command]
            [set_variable]
                name=ind
                rand=1..$magetypetable.length
            [/set_variable]
            {VARIABLE_OP ind sub 1}
            {GENERIC_UNIT 3 "$magetypetable[$ind].type" $loc.x $loc.y}
            {CLEAR_VARIABLE ind}
        [/command]
    [/random_placement]
#enddef

    [event]
        name=new turn
        first_time_only=no

        [if]
            [variable]
                name=turn_number
                greater_than_equal_to=$spawn2
            [/variable]
            [then]
                {RANDOM 0..2}
                [switch]
                    variable=random
                    [case]
                        value=0
                        {SPAWN_GUARD}
#ifdef HARD
                        {SPAWN_GUARD}
#endif
                    [/case]
                    [case]
                        value=1
                        {SPAWN_MAGE}
                    [/case]
                    [case]
                        value=2
                        {SPAWN_GUARD}
                        {SPAWN_MAGE}
                    [/case]
                [/switch]
            [/then]
            [elseif]
                [variable]
                    name=turn_number
                    greater_than_equal_to=$spawn1
                [/variable]
                [then]
                    [set_variable]
                        name=turn_mod
                        value=$("($turn_number - $spawn1) % 2")
                    [/set_variable]
                    [if]
                        [variable]
                            name=turn_mod
                            numerical_equals=0
                        [/variable]
                        [then]
                            {RANDOM 0..3}
                            [switch]
                                variable=random
                                [case]
                                    value=0
                                    {SPAWN_GUARD}
#ifdef HARD
                                    {SPAWN_GUARD}
#endif
                                [/case]
                                [case]
                                    value=1
                                    {SPAWN_GUARD}
                                [/case]
                                [case]
                                    value=2
                                    {SPAWN_MAGE}
                                [/case]
                                [case]
                                    value=3
                                    {SPAWN_GUARD}
                                    {SPAWN_MAGE}
                                [/case]
                            [/switch]
                        [/then]
                    [/if]
                    {CLEAR_VARIABLE turn_mod}
                [/then]
            [/elseif]
            [elseif]
                [variable]
                    name=turn_number
                    greater_than_equal_to=$S7_turns
                [/variable]
                [then]
                    [set_variable]
                        name=turn_mod
                        value=$("($turn_number - $S7_turns) % 3")
                    [/set_variable]
                    [if]
                        [variable]
                            name=turn_mod
                            numerical_equals=0
                        [/variable]
                        [then]
                            {RANDOM 0..3}
                            [switch]
                                variable=random
                                [case]
                                    value=0
                                    {SPAWN_GUARD}
                                [/case]
                                [case]
                                    value=1
                                    {SPAWN_GUARD}
                                [/case]
                                [case]
                                    value=2
                                    {SPAWN_MAGE}
                                [/case]
                                [case]
                                    value=3
#ifndef EASY
                                    {SPAWN_GUARD}
#endif
                                    {SPAWN_MAGE}
                                [/case]
                            [/switch]
                        [/then]
                    [/if]
                    {CLEAR_VARIABLE turn_mod}
                [/then]
            [/elseif]
        [/if]

        [fire_event]
            name=city guard dialogue
        [/fire_event]
        [fire_event]
            name=city guard dialogue2
        [/fire_event]
        [fire_event]
            name=city guard dialogue3
        [/fire_event]
    [/event]

    [event]
        name=city guard dialogue
        [filter_condition]
            [variable]
                name=turn_number
                equals=$S7_turns
            [/variable]
        [/filter_condition]

        [message]
            side=3
            [filter_location]
                x=22,23,21-26
                y=18,18,19-20
            [/filter_location]
            message= _ "Hunt down the undead! Destroy them all!"
        [/message]
        [message]
            speaker=Darken Volk
            message= _ "The city guard has entered the manor. We will have to hold them off while we search."
        [/message]
    [/event]
    [event]
        name=city guard dialogue2
        [filter_condition]
            [variable]
                name=turn_number
                equals=$spawn1
            [/variable]
        [/filter_condition]

        [message]
            speaker=Darken Volk
            message= _ "More guards are coming. We must hasten our search!"
        [/message]
    [/event]
    [event]
        name=city guard dialogue3
        [filter_condition]
            [variable]
                name=turn_number
                equals=$spawn2
            [/variable]
        [/filter_condition]

        [message]
            speaker=Malin Keshar
            message= _ "It does not look like we have much time left..."
        [/message]
    [/event]

    # Flavor text

    [event]
        name=moveto
        [filter]
            x,y=15,13
            side=1
        [/filter]
        # from The Alchemist
        [message]
            speaker=narrator
            message= _ "There is only one thing that makes a dream impossible to achieve."
        [/message]
        [delay]
            time=350
        [/delay]
        [sound]
            name=wail-long.wav
        [/sound]
        [delay]
            time=350
        [/delay]
        [message]
            speaker=narrator
            message= _ "... the fear of failure."
        [/message]
    [/event]
    [event]
        name=moveto
        [filter]
            x,y=6,16
            side=1
        [/filter]
        [message]
            speaker=narrator
            message= _ "There is nothing good or bad, but thinking makes it so."
        [/message]
    [/event]
    [event]
        name=moveto
        [filter]
            x,y=2,10
            side=1
        [/filter]
        [message]
            speaker=narrator
            message= _ "Mirrors of shallow blue, cold and opaque, they stare,
Piercing, unblinking, a pitiless reflection,
Shattering our brittle, fancied reality."
        [/message]
    [/event]
    [event]
        name=moveto
        [filter]
            x,y=8,2
            side=1
        [/filter]
        [message]
            speaker=narrator
            message= _ "Emerald, verdant green gives way,
Touched by shadow, dark dye of black,
An abhorrent stain of pestilence."
        [/message]
    [/event]
    [event]
        name=moveto
        [filter]
            x,y=25,2
            side=1
        [/filter]
        [message]
            speaker=narrator
            message= _ "Crimson pool, essence of life,
Flesh and blood flow away to rot,
Leaving only bones to remain."
        [/message]
    [/event]

    # someone's marriage had some issues at the last moment...
    [event]
        name=moveto
        [filter]
            x,y=13,3
            side=1
        [/filter]
        [message]
            speaker=Darken Volk
            message= _ "This appears to be a wedding ring."
        [/message]
    [/event]

    [event]
        name=moveto
        [filter]
            x=17,18
            y=1,1
            side=1
        [/filter]
        [message]
            speaker=Darken Volk
            message= _ "This vial of holy water is inscribed with a cross and two rings."
        [/message]
    [/event]

    [event]
        name=moveto
        [filter]
            x,y=15,2
            side=1
        [/filter]
        [message]
            speaker=Darken Volk
            message= _ "There is a torn up dress on this altar."
        [/message]
    [/event]

    # Malin gets some extra cold resistance
    [event]
        name=moveto
        [filter]
            x,y=3,15
            id=Malin Keshar
        [/filter]
        [message]
            speaker=Malin Keshar
            message= _ "This amulet feels strangely cold."
        [/message]
        [object]
            silent=yes
            duration=forever
            [filter]
                id=Malin Keshar
            [/filter]
            [effect]
                apply_to=resistance
                [resistance]
                    cold=-10
                [/resistance]
            [/effect]
        [/object]

        {REMOVE_IMAGE 3 15}
    [/event]

    [event]
        name=moveto
        [filter]
            x=8,9
            y=7,9
            side=1
        [/filter]
        [message]
            speaker=Malin Keshar
            message= _ "The mages have hidden their gold somewhere else."
        [/message]
    [/event]

    # Lady Karae

    [event]
        name=sighted
        [filter]
            id=Lady Karae
        [/filter]
        [filter_second]
            side=1
        [/filter_second]

        [message]
            speaker=Lady Karae
            message= _ "Darken Volk! I should have known it was you! What are you doing here?"
        [/message]
        [message]
            speaker=Darken Volk
            message= _ "Taking back what is rightfully mine."
        [/message]
        [message]
            speaker=Lady Karae
            message= _ "As impudent as ever. What lies in that book is not meant for human eyes — yours or mine."
        [/message]
        [message]
            speaker=Darken Volk
            message= _ "I am not here to argue."
        [/message]
        [message]
            speaker=Lady Karae
            message= _ "Of course you are not. I assume your arrogance has only grown over the years."
        [/message]
        [message]
            speaker=Darken Volk
            message= _ "If you wish to continue lecturing me, by all means, do so. It will only make you easier to kill."
        [/message]
        [message]
            speaker=Lady Karae
            message= _ "I regret that it has come to this."
        [/message]
    [/event]

    [event]
        name=moveto
        [filter]
            x,y=26,5
            side=1
        [/filter]
        [message]
            speaker=Darken Volk
            message= _ "Someone was... messing... with some potions here."
        [/message]
    [/event]

    [event]
        name=last breath
        [filter]
            id=Lady Karae
        [/filter]

        [message]
            speaker=Lady Karae
            message= _ "Darken Volk... you... wouldn’t dare..."
        [/message]
        [message]
            speaker=Darken Volk
            message= _ "Enough with your decrepit prattling."
        [/message]

        [kill]
            id=Lady Karae
            animate=yes
            fire_event=yes
        [/kill]

        {QUAKE rumble.ogg}

        [terrain]
            x=6,7
            y=4,4
            terrain=Iwr
        [/terrain]
        [redraw][/redraw]

        [message]
            speaker=Darken Volk
            # po: a vault is a big underground room, sort of like a gigantic basement
            message= _ "I feel the breaking of an illusion spell. The book is in the vault in the northwest corner of the manor. We must find the passageway leading there!"
        [/message]

        [objectives]
            side=1
            [objective]
                condition=win
                description= _ "Move Malin Keshar or Darken Volk through the passageway in the northwest leading to the vault"
            [/objective]
            [objective]
                condition=lose
                description= _ "Death of Malin Keshar"
            [/objective]
            [objective]
                condition=lose
                description= _ "Death of Darken Volk"
            [/objective]

            {TURNS_RUN_OUT}
        [/objectives]
    [/event]

    [event]
        name=moveto
        [filter]
            x,y=1-3,1-3
            id=Malin Keshar,Darken Volk
        [/filter]

        [message]
            speaker=unit
            message=_ "Here is the passage to the vault!"
        [/message]

        [endlevel]
            result=victory
            bonus=no
            linger_mode=no
            {NEW_GOLD_CARRYOVER 100}
            carryover_report=no
        [/endlevel]
    [/event]

    # The player may have created new units using the plague ability. They
    # should carry over to the next scenario.
    [event]
        name=victory

        {SET_GOT_INSIDE_MANOR}
        {CLEAR_VARIABLE guardtypetable}
        {CLEAR_VARIABLE magetypetable}
        {CLEAR_VARIABLE random}
        {CLEAR_VARIABLE S7_turns}
        {CLEAR_VARIABLE spawn1}
        {CLEAR_VARIABLE spawn2}
    [/event]

    [event]
        name=time over

        [if]
            [have_unit]
                id=Lady Karae
            [/have_unit]
            [then]
                [unit]
                    type=Royal Guard
                    side=3
                    x,y=22,18
                    id=RGuard
                    canrecruit=yes
                    animate=yes
                    facing=nw
                [/unit]
                {GENERIC_UNIT 3 (Pikeman) 23 18} {FACING nw}
                {GENERIC_UNIT 3 (Longbowman) 22 19} {FACING nw}
                {GENERIC_UNIT 3 (Swordsman) 21 19} {FACING nw}
                {GENERIC_UNIT 3 (Mage of Light) 23 19} {FACING nw}

                [message]
                    speaker=RGuard
                    message= _ "Surround those necromancers! They cannot escape now!"
                [/message]
                [message]
                    speaker=Darken Volk
                    message= _ "Fool boy! You took too long to defeat Karae! Now we are at the mercy of the city guards!"
                [/message]
            [/then]
            [else]
                [remove_shroud]
                    side=1
                    x=0-3,3,4,5
                    y=0-3,3-4,1-4,4-5
                [/remove_shroud]
                [unit]
                    type=Royal Guard
                    side=3
                    x,y=2,3
                    id=RGuard
                    canrecruit=yes
                    animate=yes
                    facing=se
                [/unit]
                {GENERIC_UNIT 3 (Pikeman) 2 2} {FACING se}
                {GENERIC_UNIT 3 (Longbowman) 3 2} {FACING se}
                {GENERIC_UNIT 3 (Swordsman) 1 3} {FACING se}
                {GENERIC_UNIT 3 (Mage of Light) 2 1} {FACING se}

                [message]
                    speaker=RGuard
                    message= _ "Surround those necromancers! They cannot escape now!"
                [/message]
                [message]
                    speaker=Darken Volk
                    message= _ "Fool boy! You took too long to find the path to the vault! Now we are at the mercy of the city guards!"
                [/message]
            [/else]
        [/if]

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

    {HERODEATH_MALIN}
    {HERODEATH_VOLK_B}
[/scenario]

#undef SPAWN_GUARD
#undef SPAWN_MAGE