#textdomain wesnoth-ei

#define SCENARIO_TURN_LIMIT
25 #enddef
#define TURNS_LOW_WARNING
20 #enddef

[scenario]
    id=08_Xenophobia
    name= _ "Xenophobia"
    map_file=08_Xenophobia.map
    victory_when_enemies_defeated=no
    turns={SCENARIO_TURN_LIMIT}
    next_scenario=09_Castle_in_the_Ice

    {NORTHERN_SCHEDULE}
    current_time=1

    {SCENARIO_MUSIC battle.ogg}
    {EXTRA_SCENARIO_MUSIC northern_mountains.ogg}

    # see notes in S09 regarding the goal of the whole wildlands arc, which this scenario is more or less a part of

    [story]
        [part]
            title= _ "<b><span color='#00cc99'>Part II: The Wildlands</span></b>"
            music=silence.ogg
        [/part]
        [part]
            title= _ "<b><span color='#00cc99'>Part II: The Wildlands</span></b>"
            story= _ "Gweddry and his men made good time past the Great River’s northern banks, leaving the undead far behind. With winter drawing near, they unexpectedly stumbled upon an inhabited valley..."
            {EI_BIGMAP}
        [/part]
    [/story]
    {EI_TRACK {JOURNEY_08_NEW} }

    [side]
        side=1
        controller=human
        {GOLD 180 150 120}
        income=0
        team_name=good
        user_team_name= _ "Wesnothians"
        {FLAG_VARIANT loyalist}
        # wmllint: recognize Gweddry
        {CHARACTER_STATS_GWEDDRY}
    [/side]

    #--------------------
    # DWARVES
    #--------------------
    [side]
        color=blue
        side=2
        type=Dwarvish Lord
        id=Pelathsil
        name= _ "Pelathsil"
        facing=se
        canrecruit=yes
        [modifications]
            {TRAIT_HEALTHY}
            {TRAIT_RESILIENT}
        [/modifications]
        controller=ai
        team_name=dwarf
        user_team_name= _ "Dwarves"
        recruit=Dwarvish Thunderguard,Dwarvish Steelclad,Dwarvish Berserker,Dwarvish Runesmith,Dwarvish Fighter,Dwarvish Thunderer,Dwarvish Ulfserker
        {GOLD 70 140 210} # reduced scaling, since enemies spend most of their gold fighting each other
        {INCOME 1 4 7}
        {FLAG_VARIANT knalgan}
        {GENERIC_UNIT 2 (Dwarvish Guardsman) 6 7}
        {GENERIC_UNIT 2 (Dwarvish Guardsman) 13 6}
        {NOTRAIT_UNIT 2 (Dwarvish Guardsman) 3 7} # go and steal some villages
        [+unit]
            [modifications]
                {TRAIT_QUICK}
            [/modifications]
        [/unit]

        [+unit]
            [modifications]
                {TRAIT_STRONG}
            [/modifications]
        [/unit]
    [/side]
    {LIMIT_CONTEMPORANEOUS_RECRUITS 2 "Dwarvish Steelclad" 2}
    {LIMIT_CONTEMPORANEOUS_RECRUITS 2 "Dwarvish Thunderguard" 2}
    {LIMIT_RECRUITS 2 "Dwarvish Runesmith" 1}
    {LIMIT_CONTEMPORANEOUS_RECRUITS 2 "Dwarvish Berserker" 1}
    {STARTING_VILLAGES 2 3}
    {SILENTLY_LIMIT_LEADER_MOVES 2 2}
    [event]
        name=side 2 turn
        first_time_only=no
        {RESET_SIDE_AI 2 defensive 0.8 0.25}
        {MODIFY_AI_DELETE_CANDIDATE_ACTION 2 main_loop leader_shares_keep}

        # always man the guardposts, or else we look stupid
        {MODIFY_SIDE_AI (2) ({GOAL_LOCATION 2 (x,y=6,7)})  }
        {MODIFY_SIDE_AI (2) ({GOAL_LOCATION 2 (x,y=13,6)}) }

        {RETREAT_WHEN_WEAK 2 {ON_DIFFICULTY 0-4 0-6 0-8} (
            {GOAL_LOCATION 99 (x,y=6,7)} # man the guardposts a lot more aggressively when we're weak
            {GOAL_LOCATION 99 (x,y=13,6)}
            {GOAL_LOCATION 77 (x,y=9,6)}
            {GOAL_LOCATION 55 (x,y=12,3)}
        )}
        {MODIFY_SIDE_AI (2) ({GOAL_SEEK_SIDE 1 3 0})}
    [/event]

    #--------------------
    # ORCS
    #--------------------
    [side]
        color=white
        side=3
        type=Orcish Nightblade
        id=Bagork
        name= _ "Bagork"
        facing=sw
        canrecruit=yes
        [modifications]
            {TRAIT_STRONG}
            {TRAIT_RESILIENT}
        [/modifications]
        controller=ai
        team_name=orc
        #po: Whitefang Orcs, the same clan that attacked Tath at the start of Descent into Darkness
        user_team_name= _ "Clan Whitefang"
        recruit=Orcish Grunt,Orcish Archer,Orcish Assassin,Wolf Rider
        {GOLD 70 140 210} # reduced scaling, since enemies spend most of their gold fighting each other
        {INCOME 5 12 19}
        {FLAG_VARIANT6 ragged}
    [/side]
    {STARTING_VILLAGES 3 7}
    {SILENTLY_LIMIT_LEADER_MOVES 3 1}

    [side]
        color=white
        side=4
        type=Orcish Warlord
        id=Prok-Bak
        name= _ "Prok-Bak"
        facing=sw
        canrecruit=yes
        [modifications]
            {TRAIT_INTELLIGENT}
            {TRAIT_STRONG}
        [/modifications]
        controller=ai
        team_name=orc
        user_team_name= _ "Clan Whitefang"
        recruit=Troll,Goblin Knight,Goblin Pillager,Orcish Warrior,Orcish Grunt,Troll Whelp,Orcish Archer,Wolf Rider
        {GOLD 75 150 225} # reduced scaling, since enemies spend most of their gold fighting each other
        {INCOME 8 18 28}
        {FLAG_VARIANT6 ragged}
    [/side]
    {LIMIT_CONTEMPORANEOUS_RECRUITS 4 "Troll" 1}
    {LIMIT_CONTEMPORANEOUS_RECRUITS 4 "Goblin Pillager" 2}
    {LIMIT_CONTEMPORANEOUS_RECRUITS 4 "Goblin Knight" 1}
    {LIMIT_CONTEMPORANEOUS_RECRUITS 4 "Orcish Warrior" 1}
    {LIMIT_RECRUITS 4 "Direwolf Rider" 1}
    {STARTING_VILLAGES 4 9}
    {SILENTLY_LIMIT_LEADER_MOVES 4 3}
    [event]
        name=side 3 turn
        first_time_only=no
        {RESET_SIDE_AI 3,4 offensive 0.8 0.25}
        {MODIFY_SIDE_AI (3) ({GOAL_LOCATION 2 (x,y=35,10)}) }
        {MODIFY_SIDE_AI (3) ({GOAL_LOCATION 2 (x,y=36,12)}) }

        {RETREAT_WHEN_WEAK 3 {ON_DIFFICULTY 0-5 0-7 0-9} (
            {GOAL_LOCATION 99 (x,y=24,15)}
            {GOAL_LOCATION 55 (x,y=28,9)}
            {GOAL_LOCATION 66 (x,y=22,12)}
            {GOAL_LOCATION 66 (x,y=23,14)}
        )}
        {RETREAT_WHEN_WEAK 4 {ON_DIFFICULTY 0-6 0-8 0-10} (
            {GOAL_LOCATION 99 (x,y=36,12)}
            {GOAL_LOCATION 77 (x,y=41,9)}
            {GOAL_LOCATION 55 (x,y=37,10)}
            {GOAL_LOCATION 55 (x,y=38,10)}
        )}

        {MODIFY_SIDE_AI (3) ({GOAL_SEEK_SIDE 1 2 0})}
        {MODIFY_SIDE_AI (4) ({GOAL_SEEK_SIDE 1 5 0})}

        {VARY_AI_BY_SCHEDULE 3,4}
    [/event]

    #--------------------
    # NAGA
    #--------------------
    [side]
        side=5
        color=green
        type=Naga Centurion
        id=Aleii
        name= _ "Aleii"
        gender=female
        facing=sw
        canrecruit=yes
        [modifications]
            {TRAIT_INTELLIGENT}
            {TRAIT_RESILIENT}
        [/modifications]
        controller=ai
        team_name=naga
        user_team_name= _ "Naga"
        recruit=Naga Fighter,Naga Warrior,Naga Guard,Naga Shield Guard
        {GOLD 70 140 210} # reduced scaling, since enemies spend most of their gold fighting each other
        {INCOME 1 4 7}
        {GENERIC_UNIT 5 (Naga High Guard) 37 25}
        {GENERIC_UNIT 5 (Naga High Guard) 38 26}
    [/side]
    {LIMIT_CONTEMPORANEOUS_RECRUITS 5 "Naga Warrior" 2}
    {LIMIT_CONTEMPORANEOUS_RECRUITS 5 "Naga Shield Guard" 2}
    {STARTING_VILLAGES 5 5}
    {SILENTLY_LIMIT_LEADER_MOVES 5 2}
    [event]
        name=side 5 turn
        first_time_only=no
        {RESET_SIDE_AI 5 defensive 0.8 0.25} # most xenophobic faction
        {RETREAT_WHEN_WEAK 5 {ON_DIFFICULTY 0-6 0-8 0-10} (
            {GOAL_LOCATION 99 (x,y=37,25)}
            {GOAL_LOCATION 99 (x,y=37,26)}
            {GOAL_LOCATION 99 (x,y=39,24)}
        )}
        {MODIFY_SIDE_AI (5) ({GOAL_SEEK_SIDE 1 4 0})}
    [/event]

    [event]
        name=prestart

        {PLACE_IMAGE items/whitefang-flag.png 36 9}

        # extra villages on easy/normal, since 1) gold is the victory condition
        # 2) we can't reduce the victory condition or we make future scenarios harder, and
        # 3) reducing enemy gold doesn't help too much, since they waste most of it fighting eachother anyway
#ifndef EASY
        {MODIFY_TERRAIN Hh     15 29} {MODIFY_TERRAIN Hh     18 26}
        {MODIFY_TERRAIN Rb^Gvs 15 11} {MODIFY_TERRAIN Rb^Gvs 17 12} #endif
#ifdef HARD
        {MODIFY_TERRAIN Rb^Gvs 12 16} {MODIFY_TERRAIN Rb^Gvs 20 18}
        {MODIFY_TERRAIN Gll    10 17} {MODIFY_TERRAIN Rb^Gvs  3 15} #endif

        # make Gweddry's ogres cost less gold to recall, so they're more useful
        [modify_unit]
            [filter]
                type=Young Ogre,Ogre,Great Ogre,Ancient Ogre
            [/filter]

            [object]
                duration=forever
                [effect]
                    apply_to=recall_cost
                    set=10
                [/effect]
            [/object]
        [/modify_unit]

        [objectives]
            side=1
            [objective]
                description= _ "Gather as much gold as you can before turns run out.
300 gold is the suggested minimum, but the more the better.
<span size='small'><i>(You’ll want as much gold as possible when you try to leave the wildlands!)</i></span>"
                condition=win
            [/objective]
            [objective]
                {BONUS_OBJECTIVE_CAPTION}
                #po: two male dwarves
                description= _ "Move Dolburras next to Pelathsil."
                condition=win
                [show_if]
                    [variable]
                        name=dolburras_event_active
                        equals=yes
                    [/variable]
                [/show_if]
            [/objective]
            [objective]
                description= _ "Death of Gweddry, Dacyn, or Owaec"
                condition=lose
            [/objective]
            [gold_carryover]
                bonus=no
                carryover_percentage=100
            [/gold_carryover]
            [note]
                description= _ "The next 4 scenarios have 100% gold carryover, but few villages and 0 starting gold."
            [/note]
        [/objectives]
    [/event]

    [event]
        name=start
        {RECALL Dacyn}
        {RECALL Owaec}
        {RECALL Addogin}
        {RECALL (Hahid al-Ali)}
        {RECALL Terraent}
        {RECALL Dolburras}
        {RECALL Grug}

        [message]
            speaker=Dacyn
            message= _ "Farmland, in these remote reaches? Our supply situation has become rather dire since abandoning the outposts, so we are fortunate to have found such a fertile valley."
        [/message]
        [message]
            speaker=Addogin
            message= _ "Huh, maybe throwin’ in my lot with you ain’t so bad after all. This place would make for a good retirement."
        [/message]

        {SCROLL_TO 1 1}
        [if]
            [have_unit]
                id=Terraent
            [/have_unit]

            [then]
                [message]
                    speaker=Terraent
                    message= _ "Hail, honorable dwarves! Winter comes fast on our heels and we seek provisions and supplies for our holy journey. Can you be of aid?"
                    scroll=no
                [/message]
            [/then]

            [else]
                [message]
                    speaker=Owaec
                    message= _ "Hail, stout-hearted dwarves! Winter comes fast on our heels and we seek provisions and supplies for our journey north. Can you be of aid?"
                    scroll=no
                [/message]
            [/else]
        [/if]
        [message]
            speaker=Prok-Bak
            #po: A 3-way battle between orcs, dwarves and saurians was just starting when our protagonists arrived on the scene
            message= _ "Don’t bother asking those freeloading dwarves for anything! They can’t even manage to pay their tribute on time."
        [/message]
        [message]
            speaker=Pelathsil
            #po: "To flames with your tribute! What's ours is ours, and don't any of you orcs or humans try to take it."
            message= _ "To flames with yer tribute! What’s ours be ours, and don’t no orcs nor any o’ ye humans be tryin and takin’ it!"
        [/message]
        [if]
            [have_unit]
                id=Dolburras
            [/have_unit]

            [then]
                [message]
                    speaker=Dolburras
                    #po: "No, these humans are good folk! You can trust us to help against the orcs. All we ask is some food and drink to reprovision."
                    message= _ "Nay, these humans be good folk! Ye can trust us to help against them orcs. All we be askin’ be some food and drink to reprovision."
                [/message]
            [/then]

            [else]
                [message]
                    speaker=Gweddry
                    message= _ "Can we not work together, for our mutual benefit? All we ask is some food and drink to reprovision."
                [/message]
            [/else]
        [/if]
        [message]
            speaker=Pelathsil
            #po: "Never! Not since the days of Ulrek and Delfador have any of our clan helped one of you gangly humans!"
            message= _ "Never! Not since tha days o’ Ulrek and Delfador ha’ any o’ our clan helped one o’ ye gangly humans!"
        [/message]
        [message]
            speaker=Aleii
            message= _ "Hsss... orcsss, dwarvesss, humansss. We have traveled far to find thisss warmth. I have called the vote; the clutch has ssspoken. These waters are only for Naga. Leave usss be."
        [/message]
        [message]
            speaker=Prok-Bak
            #po: Whitefang Orcs, the same clan that attacked Tath at the start of Descent into Darkness
            message= _ "That’s Whitefang territory you’re squatting in, snake! Show some respect for the Chief!"
        [/message]
        [message]
            speaker=Bagork
            message= _ "And I bet they haven’t paid tribute either! Dwarves, snakes, humans, I say we kill ’em all!"
        [/message]
        [if]
            [have_unit]
                id=Hahid al-Ali
            [/have_unit]

            [then]
                [message]
                    speaker=Hahid al-Ali
                    message= _ "Barbarians, the lot of you! I’m going to starve because you’re busy fighting like a hatch of desert scorplings. <span size='small'>Don’t know what I expected, throwing in my lot with a bunch of primitive northerners...</span>"
                [/message]
            [/then]

            [else]
                [message]
                    speaker=Dacyn
                    message= _ "Infuriating. We may find scant supplies in the coming winter, but we cannot risk starving in the wilds while undead ravage Wesnoth."
                [/message]
            [/else]
        [/if]
        [message]
            speaker=Dacyn
            message= _ "Gweddry, we will have to reprovision despite this conflict. If we spend cautiously and control enough farms, we should be able to gather enough supplies to see us through the winter."
        [/message]
    [/event]

    # Dolburras tells Gweddry he can convince the dwarvish lord
    [event]
        name=side 1 turn 2
        [filter_condition]
            [have_unit]
                id=Dolburras
            [/have_unit]
        [/filter_condition]
        [message]
            speaker=Dolburras
            #po: to Gweddry
            #po: "Ack, that Pelathsil has a skull full of mud. If you get me next to him, I'm sure I can talk some sense into him."
            message= _ "Ack, that Pelathsil ha’ a skull full o’ mud. If ye get me next ta him I’m sure I ken talk some sense into him."
        [/message]
        {VARIABLE dolburras_event_active yes}
        [show_objectives]
        [/show_objectives]
        [event]
            name=moveto
            [filter]
                id=Dolburras
                [filter_adjacent]
                    id=Pelathsil
                [/filter_adjacent]
            [/filter]
            [message]
                speaker=Dolburras
                #po: start of a discussion between two male dwarves
                #po: "Oi, mud for brains! What do you think you're doing, fighting with these men of Wesnoth?"
                message= _ "Oi, mud-fer-brains! What do ye think ye be doin’, fighin’ wi’ these men o’ Wesnoth?"
            [/message]
            [message]
                speaker=Pelathsil
                #po: "Men of Wesnoth aren't dwarves! I am a dwarf lord, not a man friend."
                message= _ "Men o’ Wesnoth ain’t dwarves! I be a dwarf lord, not a man-friend."
            [/message]
            [message]
                speaker=Dolburras
                #po: "Yeah, and so instead you send your subjects to die on man-spears? What kind of lordship is that? If you don't want to help us, at least don't fight us!"
                message= _ "Aye, and so instead ye send yer subjects to die on man-spears? What kind o’ lordship be that? If ye dinnae want ta help us, at least dinnae fight us!"
            [/message]
            [message]
                speaker=Pelathsil
                #po: "A man-friend and a blood-traitor you are... but I suppose I can see your point. We won't fight you any longer."
                message= _ "A man-friend and a blood-traitor ye be... but I suppose I ken see yer point. We won’t be fightin’ ye any longer."
            [/message]
            [modify_side]
                side=2
                team_name=good
            [/modify_side]
            {CLEAR_VARIABLE dolburras_event_active}
            [set_achievement]
                content_for=eastern_invasion
                id=ei_S08
            [/set_achievement]

            [show_objectives]
            [/show_objectives]
        [/event]
    [/event]

    # be careful about spending too much gold
    [event]
        name=recruit,recall
        [filter]
            side=1
        [/filter]
        [filter_condition]
            [have_unit]
                side=1
                count=10-99
            [/have_unit]
        [/filter_condition]
        [message]
            speaker=Dacyn
            #po: to Gweddry or the player, but overheard by Owaec
            message= _ "Remember, if we spend too much on soldiers now, we may struggle to save enough supplies to see us through the winter."
        [/message]
        [message]
            speaker=Owaec
            #po: to Dacyn
            message= _ "And how do you expect us to capture farms without enough soldiers to take them?"
        [/message]
    [/event]

    #--------------------
    # FLAVOR
    #--------------------
    [event]
        name=turn 7
        [message]
            speaker=Owaec
            message= _ "... I have held my tongue long enough. While Wesnoth bleeds, the High Advisor leads us north to forage for food. And as our men and our people die, we seek an unknown mage hovel with some unknown power that the High Advisor has yet to explain more about. Gweddry, surely you feel this is strange?"
        [/message]
        [message]
            speaker=Gweddry
            message= _ "I don’t know, Owaec. It is odd, but Dacyn’s light and wisdom are well-known throughout Wesnoth."
        [/message]
        [message]
            speaker=Owaec
            message= _ "So were his friend Ravan’s, if Dacyn’s story is to be believed."
        [/message]
    [/event]

    [event]
        name=attack
        [filter]
            id=Grug
        [/filter]
        [message]
            speaker=Grug
            message= _ "Excited Grug fight friends help!"
        [/message]
    [/event]

    [event]
        name=attack
        [filter]
            id=Dolburras
        [/filter]
        [filter_second]
            side=2
        [/filter_second]
        [message]
            speaker=Dolburras
            #po: "It's a sad day when dwarf fights dwarf... can you not let us pass peacefully?"
            message= _ "It be a sad day when dwarf fights dwarf... ken ye not let us pass peaceable-like?"
        [/message]
        [message]
            speaker=second_unit
            message= _ "I’m not afraid of ye! Raise yer axe, foreigner!"
        [/message]
    [/event]
    [event]
        name=attack
        [filter]
            id=Dolburras
        [/filter]
        [filter_second]
            side=3,4
        [/filter_second]
        [message]
            speaker=Dolburras
            message= _ "Ach, it’s been too long since I put my axe in an orc’s skull!"
        [/message]
        [message]
            speaker=second_unit
            message= _ "For the Chief!"
        [/message]
    [/event]
    [event]
        name=attack
        [filter]
            id=Dolburras
        [/filter]
        [filter_second]
            side=5
        [/filter_second]
        [message]
            speaker=Dolburras
            #po: attacking a saurian
            message= _ "Ooch, what manner o’ creature be you?"
        [/message]
        [message]
            speaker=second_unit
            message= _ "Your sssslayer!"
        [/message]
    [/event]

    [event]
        name=attack
        [filter]
            id=Terraent
        [/filter]
        [filter_second]
            side=3,4
        [/filter_second]
        [message]
            speaker=Terraent
            message= _ "I have smote many evil orcs in my day, yet I have known some to show as much honor as any knight. Can we not resolve this peacefully?"
        [/message]
        [message]
            speaker=second_unit
            message= _ "The only honor here belongs to the Chief!"
        [/message]
    [/event]
    [event]
        name=attack
        [filter]
            id=Terraent
        [/filter]
        [filter_second]
            side=5
        [/filter_second]
        [message]
            speaker=Terraent
            message= _ "Naga, I know little of your kind, yet I do not wish to make enemies of you so hastily. Can we not come to parley?"
        [/message]
        [message]
            speaker=second_unit
            message= _ "Thisss river is oursss!"
        [/message]
    [/event]

    # some gold guarded by each of the factions
#define GOLD_PICKUP X Y PICTURE AMOUNT LABEL_TEXT MESSAGE
    {PLACE_IMAGE {PICTURE} {X} {Y}}
    {SET_LABEL {X} {Y} {LABEL_TEXT}}
    [event]
        name=moveto
        [filter]
            side=1
            x,y={X},{Y}
        [/filter]
        [message]
            speaker=unit
            message={MESSAGE}
            sound=gold.ogg
        [/message]
        [gold]
            side=1
            amount={AMOUNT}
        [/gold]
        {REMOVE_IMAGE $unit.x $unit.y}
        {REMOVE_LABEL $unit.x $unit.y}
    [/event]
#enddef
    {GOLD_PICKUP 11 4  items/gold-coins-small.png 10 (_"10 gold") (_"These dwarves have a pile of 10 gold pieces!")}
    {GOLD_PICKUP 37 26 items/gold-coins-small.png 20 (_"20 gold") (_"These nagas have a pile of 20 gold pieces!")}
    {GOLD_PICKUP 38 10 items/gold-coins-small.png 20 (_"20 gold") (_"These orcs have a pile of 20 gold pieces!")}
    {PLACE_ITEM_SHIELD_OF_THE_SENTINEL 9 4}
    [item]
        x,y=9,4
        image=items/shield-of-the-sentinel-stand.png
    [/item]
    #     {SET_LABEL 9 4 _"Shield of
    # the Sentinel"} # this label doesn't get removed when you pick up the item. I don't think it's a big deal; item pickup/drop WML is already complex enough.

    [event]
        name=last breath
        [filter]
            id=Bagork
        [/filter]
        [message]
            speaker=Bagork
            message= _ "I will kill all of you!"
        [/message]
    [/event]
    [event]
        name=die
        [filter]
            id=Bagork
        [/filter]
        [message]
            speaker=second_unit
            #po: The unit who killed Bagork responds to Bagork's last breath, which was "I will kill all of you!"
            message= _ "Not likely."
        [/message]
    [/event]
    [event]
        name=last breath
        [filter]
            id=Prok-Bak
        [/filter]
        [message]
            speaker=Prok-Bak
            message= _ "Chief Dra-Nak will hear of this!"
        [/message]
    [/event]

    [event]
        name=last breath
        [filter]
            id=Aleii
        [/filter]
        [message]
            speaker=Aleii
            message= _ "Thisss isss why we avoid outsssidersss..."
        [/message]
    [/event]

    [event]
        name=last breath
        [filter]
            id=Pelathsil
        [/filter]
        [filter_second]
            side=1
        [/filter_second]
        [message]
            speaker=Pelathsil
            #po: "It seems those humans were mightier than I thought..."
            message= _ "It seems yon humans be mightier than I kenned..."
        [/message]
    [/event]
    [event]
        name=last breath
        [filter]
            id=Pelathsil
        [/filter]
        [filter_second]
            side=3,4
        [/filter_second]
        [message]
            speaker=Pelathsil
            #po: "Foul orcs! Perhaps we should have allied with the humans..."
            message= _ "Foul orcs! Mayhaps we should ha’ allied wi’ the humans..."
        [/message]
    [/event]

    # dacyn warns the player to get enough gold
    [event]
        name=turn {TURNS_LOW_WARNING}
        [store_gold]
            side=1
        [/store_gold]
        [if]
            [variable]
                name=gold
                greater_than_equal_to=300
            [/variable]

            [then]
                [message]
                    speaker=Dacyn
                    #po: $gold is at least 300
                    message= _ "We are doing well. Our forces have already gathered $gold gold — plenty for the winter, and there is enough time remaining to gather even more."
                [/message]
            [/then]
            [else]
                [message]
                    speaker=Dacyn
                    message= _ "Gweddry, I urge you to gather at least 300 gold before we head further north. We cannot afford to tarry here while Wesnoth contends against Mal-Ravanal."
                [/message]
            [/else]
        [/if]
    [/event]

    [event]
        name=time over

        [store_gold]
            side=1
        [/store_gold]
        [if]
            [variable]
                name=gold
                greater_than_equal_to=300
            [/variable]

            # we have enough gold
            [then]
                [message]
                    speaker=Gweddry
                    message= _ "I’ve finished gathering the supplies from all our captured farms! We should have plenty for our journey ahead."
                [/message]
                [message]
                    speaker=Dacyn
                    message= _ "Let us forge onward. We have almost reached our destination, and will soon have the power to save Wesnoth from Mal-Ravanal."
                [/message]
            [/then]

            # we don't have enough gold
            [else]
                [message]
                    speaker=Gweddry
                    message= _ "I’ve tried my best, but I still haven’t been able to gather very much gold. The farms we’ve captured simply don’t have enough supplies to sustain us for a long journey."
                [/message]
                [message]
                    speaker=Dacyn
                    message= _ "Without more provisions it will be difficult to travel further north, but neither can we afford to spend any more time here while Wesnoth battles Mal-Ravanal..."
                [/message]
                [message]
                    speaker=narrator
                    [option]
                        label= _ "Travel north regardless. <i>(challenging)</i>"
                        [command]
                            [message]
                                speaker=Owaec
                                message= _ "Bah, a Clansman never succumbs to despair! Let us press forth and fight to save our homeland, whatever the odds!!"
                            [/message]
                        [/command]
                    [/option]
                    [option]
                        label= _ "Restart the level."
                        [command]
                            [endlevel]
                                result=defeat
                                bonus=no
                            [/endlevel]
                            [return]
                            [/return]
                        [/command]
                    [/option]
                [/message]
            [/else]
        [/if]

        {CLEAR_VARIABLE dolburras_event_active}

        [if]
            {VARIABLE_CONDITIONAL fork_06b equals yes}
            [then]
                [message]
                    speaker=Gweddry
                    message= _ "I only hope we are not too late... If what we saw at Soradoc was any guide, Mal-Ravanal may soon overrun all of Wesnoth!"
                [/message]
            [/then]

            [else]
                [message]
                    speaker=Gweddry
                    message= _ "I only hope we are not too late! We have heard nothing of the undead since they overran us at the outposts. I wish we knew how Weldyn’s armies fare..."
                [/message]
            [/else]
        [/if]

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

    {FOREIGN_DEFEAT}

    {HERODEATH_GWEDDRY}
    {HERODEATH_DACYN}
    {HERODEATH_OWAEC}
    {HERODEATH_ADDOGIN}
    {HERODEATH_HAHID}
    {HERODEATH_TERRAENT}
    {HERODEATH_GRUG}
    {HERODEATH_DOLBURRAS}
[/scenario]

#undef SCENARIO_TURN_LIMIT
#undef TURNS_LOW_WARNING
#undef GOLD_PICKUP
