#textdomain wesnoth-l
[scenario]
    id=01_The_Raid
    name= _ "The Raid"
    map_data="{campaigns/Liberty/maps/01_The_Raid.map}"
    {TURNS 24 18 14}

    next_scenario=02_Civil_Disobedience

    {INTRO_AND_SCENARIO_MUSIC "heroes_rite.ogg" "northerners.ogg"}
    {EXTRA_SCENARIO_MUSIC "the_king_is_dead.ogg"}
    {EXTRA_SCENARIO_MUSIC "frantic.ogg"}
    {EXTRA_SCENARIO_MUSIC "knolls.ogg"}

    [label]
        x,y=9,1
        text= _ "Dallben"
    [/label]

    [story]
        [part]
            story= _ "In the Era of Turmoil, during the reign of King Garard II, the border towns of Delwyn and Dallben in the Province of Annuvin grew increasingly dissatisfied with the King’s rule. Being preoccupied with the great wars, the King was unable to send adequate forces to protect the frontier."
            background=story/frontier.jpg
        [/part]
        [part]
            story= _ "The hardy people of these marches learned self-reliance and survival skills against the raiding orc hordes and savage saurians. They established their own trading routes and pacts of mutual defense."
            background=story/frontier.jpg
        [/part]
        [part]
            story= _ "Although not permitted to train with proper military weapons, these woodsmen were at home in the forests and swamps of the Western Marches, and became very effective with their simple slings and clubs."
            background=story/frontier.jpg
        [/part]
        [part]
            story= _ "After the betrayal of the King by Queen Asheviere, the new regent of Wesnoth sought to consolidate her ill-gotten power. She sent her armies across Wesnoth to intimidate the provincial rulers and secure her continued reign."
            background=story/frontier.jpg
        [/part]
        [part]
            story= _ "The people of Annuvin were unwilling to relinquish their hard-earned self-rule, especially not to this pretender..."
            background=story/frontier.jpg
        [/part]
    [/story]

    {LIBERTY_BIGMAP {JOURNEY_01_NEW} }

    {DEFAULT_SCHEDULE_DUSK}

    [side]
        type=Bandit_Peasant
        id=Baldras
        name= _ "Baldras"
        profile=portraits/baldras.png
        side=1
        canrecruit=yes
        recruit=
        controller=human
        unrenamable=yes
        experience=25
        gold=0
        [modifications]
            [object]
                duration=forever
                silent=yes
                [effect]
                    apply_to=attack
                    name=mace-spiked
                    #textdomain wesnoth-units
                    set_description= _ "mace"
                    set_icon=attacks/mace.png
                    #textdomain wesnoth-l
                [/effect]
            [/object]
        [/modifications]
    [/side]

    {STARTING_VILLAGES 1 4}

    [side]
        type=Goblin Pillager
        id=Fal Khag
        name= _ "Fal Khag"
        side=2
        controller=ai
        canrecruit=yes
        facing=sw
        team_name=orcs
        user_team_name=_"Orcs"
        gold=25
        {FLAG_VARIANT6 ragged}
        defeat_condition=no_units_left
    [/side]

    [event]
        name=prestart

        [micro_ai]
            side=2
            ai_type=messenger_escort
            action=add

            id=Fal Khag
            waypoint_x,waypoint_y=9,1
        [/micro_ai]

        [objectives]
            side=1
            [objective]
                description= _ "Defeat all of the Goblin marauders"
                condition=win
            [/objective]
            [objective]
                description= _ "Goblins reach the village of Dallben"
                condition=lose
            [/objective]
            [objective]
                description= _ "Death of Baldras"
                condition=lose
            [/objective]
            [objective]
                description= _ "Death of Harper"
                condition=lose
            [/objective]

            {TURNS_RUN_OUT}

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

        #sign to mark the village location
        {PLACE_IMAGE scenery/signpost.png  9 3}

        {SET_VILLAGE 8 1 1}
        {SET_VILLAGE 10 1 1}

#define DALLBEN_PEASANT TYPE X Y ID_STRING NAME_STRING
    [unit]
        type={TYPE}
        id={ID_STRING}
        name={NAME_STRING}  # wmllint: ignore
        x,y={X},{Y}
        side=1
        random_traits=yes
    [/unit]
#enddef

#define GOBLIN_RAIDER TYPE X Y NAME_STRING
    [unit]
        side=2
        type={TYPE}
        x,y={X},{Y}
        name={NAME_STRING}  # wmllint: ignore
        random_traits=yes
        facing=sw
    [/unit]
#enddef

        {GOBLIN_RAIDER (Goblin Pillager) 19 29 ( _ "Gatrakh")}
        {GOBLIN_RAIDER (Goblin Pillager) 17 29 ( _ "Thurg")}

#ifdef EASY
        {GOBLIN_RAIDER (Wolf Rider) 17 30 ( _ "Krung")}
        {GOBLIN_RAIDER (Wolf Rider) 18 29 ( _ "Gorokh")}
#endif

#ifdef NORMAL
        {GOBLIN_RAIDER (Goblin Pillager) 17 30 ( _ "Krung")}
        {GOBLIN_RAIDER (Wolf Rider) 18 29 ( _ "Gorokh")}
#endif

#ifdef HARD
        {GOBLIN_RAIDER (Goblin Pillager) 17 30 ( _ "Krung")}
        {GOBLIN_RAIDER (Goblin Pillager) 18 29 ( _ "Gorokh")}
#endif

#undef GOBLIN_RAIDER

        # now store the good guys so they are invisible during the
        # goblin conversation
        [store_unit]
            variable=goodguys_store
            kill=yes
            [filter]
                side=1
            [/filter]
        [/store_unit]
    [/event]

    # Starting conversation and actions
    [event]
        name=start

        [message]
            speaker=Fal Khag
            message= _ "I long to burn human cities, but until our great chieftains provide us with sufficient forces we must look to these villagers to feed our wolves and slake the thirst of our blades."
        [/message]
        [message]
            speaker=Fal Khag
            message= _ "Ride, you worms, I want to finish our raid before the hunting party returns to the human village."
        [/message]

        #Put the leader back and make some other good guys
        [unstore_unit]
            variable=goodguys_store
        [/unstore_unit]
        {CLEAR_VARIABLE goodguys_store}

        {DALLBEN_PEASANT Footpad_Peasant 6 29 Jalak ( _ "Jalak")}
        {DALLBEN_PEASANT Footpad_Peasant 5 29 Delurin ( _ "Delurin")}
        {DALLBEN_PEASANT Footpad_Peasant 5 27 Red ( _ "Red")}
        {DALLBEN_PEASANT Bandit_Peasant 3 28 Ordo ( _ "Ordo")}
        {DALLBEN_PEASANT Bandit_Peasant 4 30 Novus ( _ "Novus")}
        {DALLBEN_PEASANT Thug_Peasant 5 30 Teneor ( _ "Teneor")}
        {DALLBEN_PEASANT Poacher_Peasant 3 28 Kembe ( _ "Kembe")}
        {DALLBEN_PEASANT Poacher_Peasant 3 30 Treagh ( _ "Treagh")}
        # wmllint: recognize Red
        # wmllint: recognize Kembe

        [unit]
            type=Footpad_Peasant
            id=Harper
            name= _ "Harper"
            profile=portraits/harper.png
            x,y=6,30
            side=1
            random_traits=no
            [modifications]
                [object]
                    duration=forever
                    silent=yes
                    [effect]
                        apply_to=attack
                        name=mace-spiked
                        #textdomain wesnoth-units
                        set_description= _ "club"
                        set_icon=attacks/club.png
                        #textdomain wesnoth-l
                    [/effect]
                [/object]
                {TRAIT_LOYAL}
            [/modifications]
            {IS_HERO}
            unrenamable=yes
        [/unit]

        [message]
            speaker=Red
            message= _ "Look, goblin riders approach! You were right, they were going to raid Dallben while we were gone."
        [/message]
        [message]
            speaker=Baldras
            message= _ "We must stop them before they reach the village. Damn the crown, they have long since forgotten about us out here."
        [/message]
        [message]
            speaker=Harper
            message= _ "That goblin leader is heading full-speed straight for Dallben. But we’ll need to chase them all down if we’re going to stop them."
        [/message]
        [message]
            speaker=Baldras
            message= _ "Do it. Try to hold them back until us old-timers can get there and finish them off."
        [/message]
        [message]
            speaker=Baldras
            #po: Some languages, including Norwegian and Old English, don't
            #po: have a single word for "uncle", dividing it into
            #po: mother's-brother vs. father's-brother. Baldras is
            #po: Harper's mother's brother.  In some human societies,
            #po: including the Navaho and Akan, this would give him a
            #po: special responsibility for the boy.
            message= _ "And Harper... don’t get yourself killed. I’m responsible for you now that your father is gone, and I won’t dishonor his memory by breaking my promise to keep you safe."
        [/message]
        [message]
            speaker=Harper
            message= _ "... I know... All right now, let’s stop these goblins!"
        [/message]
    [/event]

    # we set a flag on any side 1 death so that Harper doesn't comment on more
    # having died today unless someone did
    [event]
        name=die

        [filter]
            side=1
        [/filter]

        {VARIABLE any_villagers_died yes}
    [/event]

    #
    # Victory
    #
    [event]
        name=enemies defeated

        {CLEAR_VARIABLE town_guards_awakened}
        [if]
            [variable]
                name=any_villagers_died
                boolean_equals=yes
            [/variable]

            [then]
                {CLEAR_VARIABLE any_villagers_died}
                [message]
                    speaker=Harper
                    message= _ "We are barely able to survive these orc raids. We lost two men last week, more today... yet Weldyn does nothing!"
                [/message]
            [/then]

            [else]
                [message]
                    speaker=Harper
                    message= _ "We are barely able to survive these orc raids. We lost two men last week, more could have died today... yet Weldyn does nothing!"
                [/message]
            [/else]
        [/if]
        [message]
            speaker=Baldras
            message= _ "The King stopped sending patrols out here once the war started. Once that happened, the burden fell to us. We are citizens of Wesnoth, and as long as her banner flies we will resist the horde."
        [/message]
        [message]
            speaker=Harper
            message= _ "The banner will fly over a ghost town if help does not come soon."
        [/message]
        [endlevel]
            result=victory
            bonus=yes
            {NEW_GOLD_CARRYOVER 100}
        [/endlevel]
    [/event]

    # Orcs near the villlage

    [event]
        name=moveto
        [filter]
            side=2

            [filter_location]
                x,y=9,2
                radius=12
            [/filter_location]
        [/filter]
        [filter_condition]
            [variable]
                name=town_guards_awakened
                not_equals=yes
            [/variable]
        [/filter_condition]

        [message]
            speaker=Harper
            message= _ "They’re getting closer to our village! What about the town guards, can they help us?"
        [/message]
        [message]
            speaker=Baldras
            message= _ "They’ll come out when they see those riders, or us, approaching, but there aren’t many of them... I wouldn’t count on them being able to protect the village alone for long."
        [/message]
    [/event]

    [event]
        name=moveto
        [filter]
            [filter_location]
                x,y=9,2
                radius=9
            [/filter_location]
        [/filter]

        {DALLBEN_PEASANT Thug_Peasant 10 2 Remald ( _ "Remald")}
        {DALLBEN_PEASANT Thug_Peasant 8 2 Wolmas ( _ "Wolmas")}
        # wmllint: recognize Remald
        # wmllint: recognize Wolmas

#ifdef EASY
        {DALLBEN_PEASANT Thug_Peasant 9 4 Jasken ( _ "Jasken")}
#endif

        {IF_VAR unit.side equals 1 (
            [then]
                [message]
                    speaker=Wolmas
                    message= _ "What’s happening here? Why are you running like mad, $unit.name|?"
                [/message]
                [message]
                    speaker=unit
                    message= _ "Goblin riders on the hunt. We must not let any of them to the village!"
                [/message]
            [/then]

            [else]
                [message]
                    speaker=Wolmas
                    message= _ "Look! Goblin riders are on the hunt — and heading right for Dallben!"
                [/message]
                [message]
                    speaker=Remald
                    message= _ "Halt!"
                [/message]
            [/else]
        )}

        {VARIABLE town_guards_awakened yes}
    [/event]

    #
    # Loss conditions - the orcs reach the village
    #
    [event]
        name=moveto
        [filter]
            side=2
            x=7-11
            y=1-2
        [/filter]
        [message]
            speaker=Baldras
            message= _ "The goblins reached the village! There will surely be nothing left when they are done pillaging it."
        [/message]
        [endlevel]
            result=defeat
        [/endlevel]
    [/event]

    [event]
        name=defeat

        [message]
            speaker=narrator
            image=wesnoth-icon.png
            message=_ "None remarked on the passing of the tiny, isolated frontier town. It was but a harbinger of the evil to come under the tyranny of Asheviere."
        [/message]
    [/event]

    {LIBERTY_DEATHS}
[/scenario]

#undef GOBLIN_RAIDER
#undef DALLBEN_PEASANT
