#textdomain wesnoth-sof
[scenario]
    name= _ "Outriding the Outriders"
    id=7_Outriding_the_Outriders
    turns=12
    map_data="{@campaigns/Sceptre_of_Fire/maps/7_Outriding_the_Outriders.map}"
    next_scenario=8_The_Dragon
    victory_when_enemies_defeated=no
    village_gold=0

    {DEFAULT_MUSIC_PLAYLIST}

    {DEFAULT_SCHEDULE}

    [side]
        description=Alanin
        type=Dragoon
        save_id=Rugnur
        side=1
        canrecruit=yes
        controller=human
        recruit=
        shroud=yes
        fog=yes
        income=-2
    [/side]

    [side]
        no_leader=yes
        side=2
        [ai]
            [target]
                description=Alanin
                value=1
            [/target]
            [target]
                type=Bowman,Spearman
                value=0.1
            [/target]
            [avoid]
                x=11,17,18,16,14,22
                y=5,12,20,33,28,14
            [/avoid]
            village_value=0
            aggression=1.0
            caution=0
            grouping=no
        [/ai]
    [/side]

    [story]
        [part]
            story= _ "Rugnur had fled to the caves, but Alanin could not do that. He went south - back to the Wesnoth border."
        [/part]
        [part]
            story= _ "The elves followed both of them. First I will tell of their pursuit of Alanin, before we descend into the caves to learn Rugnur's fate."
        [/part]
        [part]
            background=maps/wesnoth.png
            show_title=yes
            {DOT 322 157}
            {DOT 322 170}
            {DOT 327 185}
            {CROSS 325 199}
        [/part]
    [/story]

    [event]
        name=prestart

        [unhide_unit][/unhide_unit]
        [modify_side]
            side=1
            gold=0
        [/modify_side]

        [objectives]
            side=1
            [objective]
                description= _ "Reach the Wesnothian outpost in the south"
                condition=win
            [/objective]
            [objective]
                description= _ "Death of Alanin"
                condition=lose
            [/objective]
            [objective]
                description= _ "Time runs out"
                condition=lose
            [/objective]
        [/objectives]
        [unit]
            x,y=1,1
            type=Galleon
            side=2
        [/unit]
    [/event]

    [event]
        name=start
        [message]
            description=Alanin
            message= _ "Well, the elves are behind me for now, but they will send riders to catch me, and elvish riders are faster than me."
        [/message]
        [message]
            description=Alanin
            message= _ "My only hope is to convince the peasants to stop the elves from passing through their land, so I can get ahead of them."
        [/message]
    [/event]

    [event]
        name=side turn
        [unit]
            type=Elvish Outrider
            description=Asaeri
            user_description= _ "Lord Asaeri"
            x,y=18,1
            side=2
            [modifications]
                {TRAIT_STRONG}
                {TRAIT_DEXTROUS}
            [/modifications]
        [/unit]
        [unit]
            type=Elvish Outrider
            description=Gaelir
            user_description= _ "Gaelir"
            x,y=18,1
            side=2
            [modifications]
                {TRAIT_QUICK}
                {TRAIT_DEXTROUS}
            [/modifications]
        [/unit]
        [unit]
            type=Elvish Outrider
            description=Salira
            user_description= _ "Salira"
            x,y=18,1
            side=2
            facing=sw
            [modifications]
                {TRAIT_STRONG}
                {TRAIT_QUICK}
            [/modifications]
        [/unit]
        [unit]
            type=Elvish Outrider
            description=Losnin
            user_description= _ "Losnin"
            x,y=18,1
            side=2
            facing=sw
            [modifications]
                {TRAIT_STRONG}
                {TRAIT_RESILIENT}
            [/modifications]
        [/unit]
        [unit]
            type=Elvish Outrider
            description=Ealin
            user_description= _ "Ealin"
            x,y=18,1
            side=2
            facing=sw
            [modifications]
                {TRAIT_QUICK}
                {TRAIT_RESILIENT}
            [/modifications]
        [/unit]
        [kill]
            type=Galleon
        [/kill]
        [scroll_to]
            x,y=18,1
        [/scroll_to]
        [message]
            description=Asaeri
            message= _ "You cannot outride us, horseman of Wesnoth! Whatever message you are carrying, it will not be delivered!"
        [/message]
        [message]
            description=Alanin
            message= _ "We shall see about that!"
        [/message]
    [/event]

    [event]
        name=turn 2
        [unit]
            type=Elvish Outrider
            description=Raesil
            user_description= _ "Raesil"
            x,y=18,1
            side=2
            [modifications]
                {TRAIT_QUICK}
                {TRAIT_RESILIENT}
            [/modifications]
        [/unit]
    [/event]

    [event]
        name=capture
        [filter]
            description=Alanin
        [/filter]
        [message]
            description=Alanin
            message= _ "The villagers here are loyal to Wesnoth. They should be willing to help me escape these elves!"
        [/message]
        {RANDOM_TRAIT_UNIT (
        type=Spearman
        description=Rolin	# wmllint: ignore
        user_description= _ "Rolin"
        x,y=$x1,$y1
        side=1
        upkeep=loyal)}
        [message]
            description=Rolin	# wmllint: ignore
            message= _ "We will certainly help any warrior of Wesnoth who needs our help!"
        [/message]
    [/event]

    [event]
        name=capture
        first_time_only=no
        [filter]
            description=Alanin
        [/filter]

        {RANDOM "Spearman,Bowman"}
        {RANDOM_TRAIT_UNIT (
        type=$random
        generate_description=yes
        x,y=$x1,$y1
        side=1
        upkeep=loyal)}

        {RANDOM "Spearman,Bowman"}
        {RANDOM_TRAIT_UNIT (
        type=$random
        generate_description=yes
        x,y=$x1,$y1
        side=1
        upkeep=loyal)}
    [/event]

    [event]
        name=moveto
        [filter]
            description=Alanin

            [filter_location]
                terrain=Ce,Ke
            [/filter_location]
        [/filter]
        {RANDOM_TRAIT_UNIT (
        type=Lieutenant
        description=Hadlin	# wmllint: ignore
        user_description= _ "Hadlin"
        x,y=10,63
        side=1
        upkeep=loyal)}
        [message]
            description=Hadlin	# wmllint: ignore
            message= _ "Who goes there?"
        [/message]
        [message]
            description=Alanin
            message= _ "I'm a dragoon, with Haldric II's personal bodyguard. I was sent on a mission in the northlands, and now elvish horsemen are chasing me. I barely evaded them."
        [/message]
        [message]
            description=Hadlin	# wmllint: ignore
            message= _ "I see. Well, come on in. I doubt they would be able to capture this fort, even if they did want to start a war, which I doubt."
        [/message]
        [store_unit]
            [filter]
                description=Alanin
            [/filter]
            variable=alanin
            kill=yes
        [/store_unit]
        [kill]
            side=1
        [/kill]
        {FOREACH dwarves i}
        {VARIABLE dwarves[$i].x "recall"}
        {VARIABLE dwarves[$i].y "recall"}

        [unstore_unit]
            variable=dwarves[$i]
        [/unstore_unit]
        {NEXT i}
        {CLEAR_VARIABLE dwarves}
        [modify_side]
            side=1
            gold=$stored_Rugnur_side.gold
        [/modify_side]
        {CLEAR_VARIABLE stored_Rugnur_side}
        [endlevel]
            result=victory
            bonus=no
        [/endlevel]
    [/event]
[/scenario]
