#textdomain wesnoth-tsg
[scenario]
    id=3_A_Desperate_Errand

    name= _ "A Desperate Errand"
    next_scenario=4_Vale_of_Tears
    [music]
        name=revelation.ogg
        ms_before=500
    [/music]
    [music]
        name=loyalists.ogg
        ms_before=500
        append=yes
    [/music]
    [music]
        name=wanderer.ogg
        ms_before=500
        append=yes
    [/music]

    map_data="{campaigns/The_South_Guard/maps/3_A_Desperate_Errand.map}"

    {campaigns/The_South_Guard/utils/sg_deaths.cfg}

    {DUSK}
    {FIRST_WATCH}
    {SECOND_WATCH}
    {DAWN}
    {MORNING}
    {AFTERNOON}

    victory_when_enemies_defeated=no
    {TURNS 30 24 20}

    # The South Guard

    [side]
        side=1
        type=Horseman Commander
        description=Deoran
        user_description= _ "Deoran"
        unrenamable=yes

        team_name=South_Guard
        controller=human
        {CUSTOM_SG_FLAG}

        {GOLD 120 105 75}

        canrecruit=yes
        recruit=Bowman, Spearman

        [village]
            x,y=40,32
        [/village]
    [/side]

    {STARTING_VILLAGES 1 4}

    # The Bandit Armies

    [side]
        side=2
        type=Rogue
        description=Urza Fastik
        user_description= _ "Urza Fastik"

        team_name=bandits
        controller=ai

        {GOLD 20 40 70}

        canrecruit=yes
        [ai]
            recruitment_pattern=fighter,scout,archer,scout
            {QUANTITY aggression 0.55 0.75 0.85}
            {ATTACK_DEPTH 3 4 5}
            village_value=0.1
            villages_per_scout=10
            [target]
                description=Deoran
                value=10.0
            [/target]
            [protect_location]
                x,y=28,16
                radius=10
                value=5.0
            [/protect_location]
            [avoid]
                x,y=1-24,1-9
            [/avoid]
        [/ai]

#ifdef EASY
        recruit=Ruffian,Thug,Footpad,Vampire Bat
#endif
#ifdef NORMAL
        recruit=Ruffian,Thug,Thief,Poacher,Vampire Bat,Skeleton
#endif
#ifdef HARD
        recruit=Footpad,Thief,Poacher,Vampire Bat,Skeleton,Skeleton Archer
#endif
    [/side]

    {STARTING_VILLAGES_AREA 2 28 21 5}
    {STARTING_VILLAGES_AREA 2 12 27 10}

    [event]
        name=prestart

        # Reduce the size of the enemy camp on 'trivial' difficulty
#ifdef EASY
        {MODIFY_TERRAIN Gg 16 21}
        {MODIFY_TERRAIN Gg 15 21}
#endif
    [/event]

    #start
    [event]
        name=start
        [recall]
            description=Sir Gerrick
        [/recall]
        [recall]
            description=Minister Hylas
        [/recall]

        [message]
            speaker=narrator
            message= _ "Deoran and his men came to the eastern border of the Aethenwood..."
            image=wesnoth-icon.png
        [/message]

        [message]
            speaker=Deoran
            message= _ "Look, men! There is the forest of the Elves to the northwest. Let us hasten across the river and the hills."
        [/message]

        [message]
            speaker=Minister Hylas
            message= _ "Be careful, Deoran. No man has set foot in the elvish woods for many a year. We do not know how they will receive us. Sir Loris thought that it was some trick of theirs trying to bring him into the woods..."
        [/message]

        [message]
            speaker=Deoran
            message= _ "But if we do not discover the source of these undead warriors, the whole province shall surely be swallowed up by them, and then their bandit masters will fare no better. We cannot allow it!"
        [/message]

        [message]
            speaker=Urza Fastik
            message= _ "I have lost two brothers to Deoran - I shall not allow him to reach the accursed elves! Deoran will die before he reaches the western forest!"
        [/message]

        {HIGHLIGHT_IMAGE 17 7 items/gohere.png ()}

#ifdef EASY
        [message]
            speaker=narrator
            message= _ "You must move Deoran to the center of the elvish citadel. Be sure to recruit a force strong enough to drive off the bandits before moving Deoran from his encampment!"
            image=wesnoth-icon.png
        [/message]
#endif

        [scroll_to_unit]
            description=Deoran
        [/scroll_to_unit]

        [objectives]
            side=1
            [objective]
                description= _ "Move Deoran to the Elvish city in the northern woods"
                condition=win
            [/objective]
            [objective]
                description= _ "Death of Deoran"
                condition=lose
            [/objective]
            [objective]
                description= _ "Death of Sir Gerrick"
                condition=lose
            [/objective]
            [objective]
                description= _ "Death of Minister Hylas"
                condition=lose
            [/objective]
            [objective]
                description= _ "Time runs out"
                condition=lose
            [/objective]
        [/objectives]
    [/event]

    [event]
        name=turn 1

        [message]
            speaker=Deoran
            message= _ "There is so much ground to cover. If only our riders would arrive!"
        [/message]
    [/event]

    [event]
        name=turn 2

        [unit]
            side=1
            description=Jarek
            user_description= _ "Jarek"
            {QUANTITY type Cavalier Dragoon Cavalryman}
            x,y=41,33
            facing=sw
            upkeep=full
            [modifications]
                {TRAIT_STRONG}
                {TRAIT_QUICK}
            [/modifications]
        [/unit]

        [message]
            speaker=Jarek
            message= _ "Commander, I received your request for reinforcements, and I have brought my riders with me!"
        [/message]

        [message]
            speaker=narrator
            image="human-loyalists/cavalryman-attack.png~RC(magenta>red)"
            message= _ "You may now recruit Cavalrymen. They are fast and deadly on grassland, but weak in forests and hills. They can keep up with Deoran, so use them to guard him!"
        [/message]

        [allow_recruit]
            side=1
            type=Cavalryman
        [/allow_recruit]
    [/event]

    [event]
        name=die
        [filter]
            speaker=Urza Fastik
        [/filter]

        [message]
            speaker=unit
            message= _ "What have we done?! Even our undead allies cannot stand against this commander!"
        [/message]

        [role]
            role=second
            type=Spearman,Swordsman,Pikeman,Javelineer,Bowman,Longbowman,Cavalryman,Dragoon
        [/role]

        [message]
            role=second
            message= _ "I hope that's the last of the bandits! How many more of these foul undead must we fight?"
        [/message]

        # Deoran arrives at the elvish citadel

        [message]
            speaker=Deoran
            message= _ "If we are to check the advance of the dead, I must reach the home of the elves!"
        [/message]
    [/event]

    [event]
        name=moveto
        [filter]
            description=Deoran
            x,y=17,7
        [/filter]

        [removeitem]
            x,y=17,7
        [/removeitem]

        {SG_UNIT (Elvish Ranger) (Linderion) (_"Linderion") 1 15 4}
        {SG_UNIT (Elvish Marksman) (Mithalwe) (_"Mithalwe") 1 19 4}
        {SG_UNIT (Elvish Ranger) (Sidaurios) (_"Sidaurios") 1 13 7}
        {SG_UNIT (Elvish Avenger) (Eltenmir) (_"Eltenmir") 1 21 7}
        {SG_UNIT (Elvish Hero) (Vardanos) (_"Vardanos") 1 15 10}
        {SG_UNIT (Elvish Outrider) (Talchar) (_"Talchar") 1 19 10}

        [unit]
#ifdef EASY
            type=Elvish Shyde
#endif
#ifdef NORMAL
            type=Elvish Druid
#endif
#ifdef HARD
            type=Elvish Druid
#endif
            description=Ethiliel
            user_description= _ "Ethiliel"
            profile=portraits/ethiliel.png
            {IS_HERO}
            side=1
            x,y=18,6
            facing=sw
            [modifications]
                {TRAIT_LOYAL}
                {TRAIT_QUICK}
            [/modifications]
        [/unit]

        [message]
            speaker=Linderion
            message= _ "Halt! Who has entered our citadel without leave?"
        [/message]

        [message]
            speaker=Deoran
            message= _ "De..."
        [/message]

        [message]
            speaker=Linderion
            message= _ "Speak carefully, for the penalty for trespass on our lands is death, and your life is thus forfeit."
        [/message]

        [message]
            speaker=Deoran
            image=portraits/deoran-mad.png
            message= _ "Deora..."
        [/message]

        [message]
            speaker=Ethiliel
            message= _ "Stay a moment. This man wears the colors of Wesnoth, and Kalenz told us not all the folk of Wesnoth are foes of the elves. Tell us, then, what brings you to the hallowed citadel of Elrath?"
        [/message]

        [message]
            speaker=Deoran
            message= _ "My lady, we have come to the elves to seek guidance. Bandits and criminals in our land have summoned the dead to help them plunder our farms and villages. They are coming across the river from the great forest to the south of our lands, where no man has yet traveled."
        [/message]

        [message]
            speaker=Ethiliel
            message= _ "The elves know of the great southern forest, and have walked its paths many times. What would you do, Deoran?"
        [/message]

        [message]
            speaker=Deoran
            message= _ "I would lead my men south of the river to find the source of these beings of darkness that we might destroy it. For surely, ere that be done, we cannot stand against them for long."
        [/message]

        [message]
            speaker=Ethiliel
            message= _ "Indeed you are brave to face such foes. But I fear that alone you will fail and fall. One elf now lives who remembers the secrets of the undead that we learned when Haldric I came to our land. His name is Mebrin, and he lives, secluded in the hills, near here. I will take you to him."
        [/message]

        [message]
            speaker=Deoran
            image=portraits/deoran-glad.png
            message= _ "My thanks, lady."
        [/message]

        [kill]
            type=Elvish Ranger,Elvish Avenger,Elvish Outrider,Elvish Hero,Elvish Marksman
            animate=no
            fire_event=no
        [/kill]

        [endlevel]
            bonus=yes
            result=victory
        [/endlevel]
    [/event]
[/scenario]
