#textdomain wesnoth-tb

[scenario]
    id=02_The_Chase
    name= _ "The Chase"
    map_data="{campaigns/Two_Brothers/maps/02_The_Chase.map}"
    next_scenario=03_Guarded_Castle
#ifdef EASY
    turns=28
#else
    turns=24
#endif
    victory_when_enemies_defeated=no

    {DEFAULT_SCHEDULE_DUSK}

    {SCENARIO_MUSIC       weight_of_revenge.ogg}
    {EXTRA_SCENARIO_MUSIC heroes_rite.ogg}
    {EXTRA_SCENARIO_MUSIC knolls.ogg}
    {EXTRA_SCENARIO_MUSIC wanderer.ogg}
    {EXTRA_SCENARIO_MUSIC breaking_the_chains.ogg}
    {EXTRA_SCENARIO_MUSIC casualties_of_war.ogg}
    {EXTRA_SCENARIO_MUSIC suspense.ogg}

    [story]
        [part]
            story=_ "Arvith and his band rode north in search of his missing brother."
            background=story/Two_Brothers_M2P1.png
        [/part]
        # Diary entries split into two parts until story screens allow vertical scrolling (FR #17492).
        # wmllint: local spelling Grey
        [part]
            background=story/Two_Brothers_M2P1.png
            story=_ "16 V, 363 YW
Excerpt from the journal of Arvith of Maghre

We’ve been searching three days for Baran, and turned up nothing. My best hunch was to head north into the borderlands, where the necromancer’s minions could safely hide; everywhere else is more farmland. At first I thought the search might be useless, but late in the first day we found a set of tracks. Some of them had been made by skeletal feet.

We’re close enough to be certain now: those tracks are heading into the Grey Woods. No one from Maghre or any of the other villages has gone into that forest in living memory. Stories have been passed down for generations warning against it. Supposedly the place is haunted by lost souls who hunger for the living, and anyone who dies there is doomed to join them."
        [/part]
        [part]
            background=story/Two_Brothers_M2P1.png
            story=_ "16 V, 363 YW
Excerpt from the journal of Arvith of Maghre

But I’m past superstitions now; I’ve seen enough of the world to guess at the truth behind these sorts of tales. The forest is home to elves — unfriendly ones, if the stories have any basis at all. I worry for my men; horses don’t fight well in forests, and the elves will be more dangerous in their own territory. But there are things that need done and questions that need answered. Something bigger is happening. One necromancer terrorizing townsfolk is nothing new, but why didn’t his servants scatter when he was killed? Where are they headed now? And most importantly, why did they take Baran with them?

Besides... I want my brother back."
        [/part]
    [/story]

    {TB_TRACK {JOURNEY_STAGE2}}

    # wmllint: validate-off
    [side]
        side=1
        controller=human
#ifdef EASY
        gold=180
        income=10
#else
        gold=120
#endif
        recruit=Horseman,Bowman,Spearman,Footpad
        team_name=good
        user_team_name= _ "Humans"
        {FLAG_VARIANT loyalist}

        # wmllint: recognize Arvith
        {CHARACTER_STATS_ARVITH}

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

    [side]
        side=2
        controller=ai
#ifdef EASY
        gold=25
#else
        gold=60
#endif
        income=-8
        recruit=Elvish Scout
        team_name=elves
        user_team_name=_"Elves"
        {FLAG_VARIANT wood-elvish}

        type=Elvish Rider
        id=Nil-Galion
        name= _ "Nil-Galion"
        canrecruit=yes
        unrenamable=yes

        facing=se

        [unit]
            side=2
            type=Elvish Scout
            x,y=15,20
        [/unit]

        [unit]
            side=2
            type=Elvish Fighter
            x,y=5,13
        [/unit]

        [unit]
            side=2
            type=Elvish Scout
            x,y=4,36
        [/unit]

        [unit]
            side=2
            type=Elvish Scout
            x,y=7,46
        [/unit]

        [unit]
            side=2
            type=Elvish Scout
            x,y=15,35
        [/unit]

#ifndef EASY
        [unit]
            side=2
            type=Elvish Scout
            x,y=7,25
        [/unit]

        [unit]
            side=2
            type=Elvish Scout
            x,y=10,33
        [/unit]

        [unit]
            side=2
            type=Elvish Hero
            x,y=11,45
        [/unit]

        [unit]
            side=2
            type=Elvish Rider
            x,y=15,23
        [/unit]

        [unit]
            side=2
            type=Wose
            x,y=7,29
        [/unit]
#endif

        [ai]
            recruitment_pattern=scout
        [/ai]
    [/side]

    [side]
        side=3
        hidden=yes
        team_name=elves
        user_team_name=_"Kidnappers"

        type=Dark Adept
        id=Muff Toras
        name= _ "Muff Toras"
        unrenamable=yes
        x,y=9,4

        [ai]
            leader_ignores_keep=yes
            village_value=0

            [modify_ai]
                action=delete
                path=stage[main_loop].candidate_action[villages]
            [/modify_ai]
        [/ai]

#ifdef EASY
        [unit]
            type=Skeleton
            x,y=9,5
        [/unit]

        [unit]
            type=Skeleton
            x,y=9,3
        [/unit]
#else
        [unit]
            type=Revenant
            x,y=9,5
        [/unit]

        [unit]
            type=Revenant
            x,y=9,3
        [/unit]
#endif
    [/side]

    [event]
        id=freezer
        name=side 3 turn refresh
        first_time_only=no

        [modify_unit]
            [filter]
                side=3
            [/filter]
            moves=0
        [/modify_unit]
    [/event]

    {STARTING_VILLAGES 1 7}
#ifdef EASY
    {STARTING_VILLAGES 2 17}
#else
    {STARTING_VILLAGES 2 30}
#endif

    {PLACE_IMAGE scenery/signpost.png 10 1}

    [event]
        name=prestart

        {STORE_BARAN}

        {CLEAR_VARIABLE first_password,second_password}

#ifdef EASY
        [disallow_recruit]
            side=1
            type=Heavy Infantryman
        [/disallow_recruit]
#endif

        [objectives]
            side=1
            [objective]
                [show_if]
                    [have_unit]
                        id=Nil-Galion
                    [/have_unit]
                    [not]
                        [variable]
                            name=found_kidnappers
                            boolean_equals=yes
                        [/variable]
                    [/not]
                [/show_if]
                description= _ "Fight your way through the woods before the kidnappers escape"
                condition=win
            [/objective]
            [objective]
                [show_if]
                    [not]
                        [have_unit]
                            id=Nil-Galion
                        [/have_unit]
                    [/not]
                    [not]
                        [variable]
                            name=found_kidnappers
                            boolean_equals=yes
                        [/variable]
                    [/not]
                [/show_if]
                description= _ "Catch the kidnappers"
                condition=win
            [/objective]
            [objective]
                [show_if]
                    [variable]
                        name=found_kidnappers
                        boolean_equals=yes
                    [/variable]
                [/show_if]
                description= _ "Kill the Dark Adept before his reinforcements arrive"
                condition=win
            [/objective]
            [objective]
                description= _ "Death of Arvith"
                condition=lose
            [/objective]

            {TURNS_RUN_OUT}

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

#ifdef EASY
            {HINT ( _ "The Elvish forces are spread out. Seek to fight them one at a time with several of your units.") (
                [show_if]
                    [have_unit]
                        id=Nil-Galion
                    [/have_unit]
                    [not]
                        [variable]
                            name=found_kidnappers
                            boolean_equals=yes
                        [/variable]
                    [/not]
                [/show_if]
            )}
            {HINT ( _ "Use horsemen or footpads to quickly explore the shrouded woods to locate the kidnappers.") (
                [show_if]
                    [not]
                        [have_unit]
                            id=Nil-Galion
                        [/have_unit]
                    [/not]
                    [not]
                        [variable]
                            name=found_kidnappers
                            boolean_equals=yes
                        [/variable]
                    [/not]
                [/show_if]
            )}
            {HINT ( _ "Separate the Dark Adept from his guards and attack in force for an easy kill.") (
                [show_if]
                    [variable]
                        name=found_kidnappers
                        boolean_equals=yes
                    [/variable]
                [/show_if]
            )}
#endif
        [/objectives]

        [remove_shroud]
            side=1
            x=0-20
            y=15-54
        [/remove_shroud]

#ifdef EASY
        [terrain]
            x=10,13,10,3
            y=44,42,26,34
            terrain=Gg^Vh
        [/terrain]
        [capture_village]
            side=1
            x=10
            y=44
        [/capture_village]
        [capture_village]
            side=2
            x=10,3
            y=26,34
        [/capture_village]
#endif

        {NEED_MERCENARY}
    [/event]

    [event]
        name=start

        [message]
            speaker=Arvith
            message= _ "Come on, men. A stroll through such lovely green woods, what could be finer?"
        [/message]

        [message]
            speaker=Nil-Galion
            message= _ "You there! Halt and explain yourself."
        [/message]

        [message]
            speaker=Arvith
            message= _ "We’re chasing after some men who kidnapped my brother!"
        [/message]

        [message]
            speaker=Nil-Galion
            message= _ "Those men told me their prisoner had attempted to murder their master, and warned that evil men would follow him. Advance no further, or you will die."
        [/message]

        [message]
            speaker=Arvith
            message= _ "So much for those ghost stories. Mere elves will not stop me from freeing Baran!"
        [/message]

        [message]
            role=Mercenary
            message= _ "I am glad at least that we will not have to face ghosts. But those elves will have us at a disadvantage; our horses will not maneuver well in the trees."
        [/message]

        [message]
            speaker=Arvith
            message= _ "Bah, just stay on the paths; our spearmen and bowmen can fight in the deeper woods. We have faced and won through greater perils than those amateurs can offer."
        [/message]
    [/event]

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

        [remove_event]
            id=freezer
        [/remove_event]

        [modify_side]
            side=3
            hidden=no
        [/modify_side]

        [remove_shroud]
            side=1
            x=0-20
            y=0-15
        [/remove_shroud]

        [message]
            speaker=second_unit
            message= _ "I see them! There they are!"
        [/message]

        [message]
            speaker=Muff Toras
            message= _ "Curses! If they had been an hour slower, our master’s reinforcements would already be here to meet us."
        [/message]

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

    [event]
        name=turn 12

        [message]
            speaker=Arvith
            message= _ "Come on, men, let’s catch those kidnappers!"
        [/message]
    [/event]

    [event]
        name=last breath
        [filter]
            id=Muff Toras
        [/filter]

        {NEED_MERCENARY}

        [message]
            speaker=unit
            message= _ "Hah! You have captured me, but it will avail you nothing. I sent your precious brother the mage north with half my men a day since; he will be safely locked away in our master’s dungeons by now."
        [/message]

        [message]
            speaker=Arvith
            message= _ "My blade is at your throat. Give us the way to my brother now, or I will spill your wretched blood on the ground."
        [/message]

        {VARIABLE first_password_1 _"Sithrak"}
        {VARIABLE first_password_2 _"Eleben"}
        {VARIABLE first_password_3 _"Jarlom"}
        {VARIABLE first_password_4 _"Hamik"}

        {VARIABLE_OP first_password rand "1..4"}

        {VARIABLE second_password_1 _"Akranbral"}
        {VARIABLE second_password_2 _"Drakanal"}
        {VARIABLE second_password_3 _"Xaskanat"}
        {VARIABLE second_password_4 _"Katklagad"}

        {VARIABLE_OP second_password rand "1..4"}

        [message]
            speaker=unit
            message= _ "Three days ride to the northeast, in a deserted castle. The passwords to the guards are $first_password_$first_password and $second_password_$second_password|."
        [/message]

        {CLEAR_VARIABLE first_password_1,first_password_2,first_password_3,first_password_4}
        {CLEAR_VARIABLE second_password_1,second_password_2,second_password_3,second_password_4}

        [message]
            speaker=Arvith
            message= _ "Bind him and take him with us. If he has played us false, he will die."
        [/message]

        [heal_unit]
            [filter]
                id=Muff Toras
            [/filter]
            amount=1
        [/heal_unit]

        [message]
            role=Mercenary
            message= _ "Captain, what are we riding into? I thought you wanted nothing to do with Baran any more, not since Toen Caric."
        [/message]

        [message]
            speaker=Arvith
            message= _ "I’m no longer sure. What’s between us remains, but knowing someone else has lain hands on him changes things. Mount up, and let’s get moving."
        [/message]

#ifdef EASY
        [kill]
            id=Brena
        [/kill]

        [move_unit_fake]
            type=Iron Mauler
            side=1
            x=1,1,3,4,8
            y=6,4,3,3,1
        [/move_unit_fake]

        {NAMED_UNIT 1 (Iron Mauler) 8 1 Brena _"Brena" (
            overlays="misc/loyal-icon.png"
            [modifications]
                {TRAIT_LOYAL}
                {TRAIT_STRONG}
            [/modifications]
        )}

        [message]
            speaker=Brena
            message= _ "Greetings. I am Brena, a knight errant. I saw you pursuing and fighting the foul undead. Are there more of them to be destroyed?"
        [/message]

        [message]
            speaker=Arvith
            message= _ "Aye. We think there’s a nest of them north-east of here. They’ve captured my brother."
        [/message]

        [message]
            speaker=Brena
            message= _ "I bear a great hatred towards their kind. I will follow and fight them with you, if you permit."
        [/message]

        [message]
            role=Mercenary
            message= _ "He would only slow us down!"
        [/message]

        [message]
            speaker=Arvith
            message= _ "It is my place to decide this."
            [option]
                label= _ "Oh, all right then. Come along with us."
                [command]
                    [message]
                        speaker=Brena
                        message= _ "Thank you. My comrades and I will help you on your noble quest."
                    [/message]
                [/command]
            [/option]
            [option]
                label= _ "I am sorry. We have not the time to spare."
                [command]
                    [message]
                        speaker=Brena
                        message= _ "Take this, then, for I see that you are on a quest. My comrades will help you whenever you call for them."
                    [/message]

                    [sound]
                        name=gold.ogg
                    [/sound]

                    [gold]
                        side=1
                        amount=70
                    [/gold]

                    [message]
                        speaker=narrator
                        image="wesnoth-icon.png"
                        message= _ "You receive 70 pieces of gold!"
                    [/message]

                    [kill]
                        id=Brena
                    [/kill]
                [/command]
            [/option]
        [/message]
#endif

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

    [event]
        name=time over

        [message]
            speaker=Muff Toras
            message= _ "My reinforcements are here!"
        [/message]

        [message]
            speaker=Arvith
            message= _ "He escaped us..."
        [/message]
    [/event]

    [event]
        name=last breath
        [filter]
            id=Nil-Galion
        [/filter]

        [message]
            speaker=Nil-Galion
            message= _ "Foolish human, you have killed me but you will not catch the undead in time. I have fulfilled my contract, and will be reanimated soon to become a lord of their armies."
        [/message]

        [kill]
            id=Nil-Galion
            animate=yes
        [/kill]

        [message]
            speaker=Arvith
            message= _ "Follow their back trail!"
        [/message]

        [show_objectives][/show_objectives]
    [/event]

    {ARVITH_LAST_BREATH}

    [event]
        name=victory

#ifdef EASY
        [allow_recruit]
            side=1
            type=Heavy Infantryman
        [/allow_recruit]
#endif

        {CLEAR_VARIABLE found_kidnappers}

        {RESTORE_BARAN}
    [/event]
[/scenario]
