#textdomain wesnoth-dm

[scenario]
    id=12_Terror_at_the_Ford_of_Parthyn
    name= _ "Terror at the Ford of Parthyn"
    next_scenario=13_The_Return_of_Trouble
    {MEMOIRS_MAP 12_Terror_at_the_Ford_of_Parthyn.map}
    {TURNS 36 36 34}

    {DEFAULT_SCHEDULE_DUSK}

    {SCENARIO_MUSIC underground.ogg}    # No story text, so no intro music
    {EXTRA_SCENARIO_MUSIC loyalists.ogg}
    {EXTRA_SCENARIO_MUSIC battle.ogg}
    {EXTRA_SCENARIO_MUSIC knolls.ogg}
    {EXTRA_SCENARIO_MUSIC vengeful.ogg}

    {DM_TRACK {CHANTAL_STAGE2} }

    [event]
        name=prestart
        [objectives]
            side=1
            [objective]
                description= _ "Find out what is happening at the Ford"
                condition=win
            [/objective]
            [objective]
                description= _ "Death of Delfador"
                condition=lose
            [/objective]
            [objective]
                description= _ "Death of Chantal"
                condition=lose
            [/objective]

            {TURNS_RUN_OUT}

            [gold_carryover]
                bonus=yes
                carryover_percentage=80
            [/gold_carryover]
        [/objectives]
    [/event]

    [event]
        name=enemies
        first_time_only=yes
        [objectives]
            side=1
            [objective]
                description= _ "Defeat all enemy leaders"
                condition=win
            [/objective]
            [objective]
                description= _ "Death of Delfador"
                condition=lose
            [/objective]
            [objective]
                description= _ "Death of Chantal"
                condition=lose
            [/objective]

            {TURNS_RUN_OUT}

            [gold_carryover]
                bonus=yes
                carryover_percentage=80
            [/gold_carryover]
        [/objectives]
    [/event]

    {PLACE_IMAGE scenery/village-human-burned1.png 34 6}    # has moveto
    {PLACE_IMAGE scenery/village-human-burned2.png 29 13}   # has moveto
    {PLACE_IMAGE scenery/village-human-burned3.png 31 10}   # has moveto
    {PLACE_IMAGE scenery/village-human-burned4.png 37 17}
    {PLACE_IMAGE scenery/village-human-burned4.png 35 17}
    {PLACE_IMAGE scenery/village-human-burned4.png 45 23}
    {PLACE_IMAGE scenery/village-human-burned1.png 49 28}
    {PLACE_IMAGE scenery/village-human-burned2.png 24 7}
    {PLACE_IMAGE scenery/village-human-burned3.png 32 23}       # has moveto

    [side]
        {YOUNG_DELFADOR}
        side=1
        save_id=Player
        persistent=yes
        controller=human
        recruit={ELVES}
        team_name=allies
        user_team_name= _ "Loyalists"
        fog=yes
        gold=240
        {FLAG_VARIANT long}
    [/side]
    [event]
        name=prestart
        [recall]
            id=Chantal
            x,y=32,2
        [/recall]
        {MAKE_HERO Chantal}
        {MODIFY_UNIT (side=1) facing sw}
    [/event]

    [side]
        type=Orcish Warlord
        id=Upgar
        name= _ "Upgar"
        facing=se
        side=2
        controller=ai
        canrecruit=yes
#ifdef EASY
        recruit=Orcish Archer, Orcish Assassin, Orcish Grunt, Wolf Rider, Orcish Crossbowman, Goblin Pillager, Goblin Knight, Goblin Spearman
#endif

#ifdef NORMAL
        recruit=Orcish Archer, Orcish Assassin, Orcish Grunt, Wolf Rider, Orcish Crossbowman, Goblin Pillager, Goblin Knight, Orcish Slayer, Orcish Warrior, Goblin Spearman
#endif

#ifdef HARD
        recruit=Orcish Archer, Orcish Assassin, Orcish Grunt, Wolf Rider, Orcish Crossbowman, Orcish Warrior, Goblin Knight, Goblin Pillager, Orcish Slayer, Goblin Spearman, Goblin Impaler, Direwolf Rider
#endif
        {GOLD 250 290 370}
        {INCOME 1 2 4}
        team_name=enemies
        user_team_name= _ "Pillagers"
        {FLAG_VARIANT6 ragged}
    [/side]

    [side]
        type=Death Knight
        id=Dirator
        name=_ "Dirator"
        facing=sw
        side=3
        team_name=enemies
        user_team_name= _ "Undead"
        controller=ai

        {GOLD 250 290 390}
        {INCOME 1 2 4}

        canrecruit=yes
        [ai]
            recruitment_pattern=scout,fighter,archer
            aggression=0.9
        [/ai]

#ifdef EASY
        recruit=Skeleton, Skeleton Archer, Vampire Bat, Ghost
#endif
#ifdef NORMAL
        recruit=Skeleton, Revenant, Skeleton Archer, Bone Shooter, Ghost, Vampire Bat, Blood Bat, Chocobone, Dark Adept
#endif
#ifdef HARD
        recruit=Skeleton, Skeleton Archer, Revenant, Draug, Banebow, Bone Shooter, Deathblade, Ghost, Wraith, Shadow, Chocobone, Dark Adept, Spectre, Nightgaunt
#endif
        {FLAG_VARIANT undead}
    [/side]

    [side]
        type=Lieutenant
        id=Niktor
        name= _ "Niktor"
        [modifications]
            {TRAIT_STRONG}
            {TRAIT_RESILIENT}
        [/modifications]
        facing=se
        side=4
        controller=ai
        canrecruit=yes
        team_name=allies
        user_team_name= _ "Loyalists"
        {GOLD 180 150 120}
        recruit=Bowman,Spearman,Cavalryman,Heavy Infantryman,Horseman
        [ai]
            # This is so Niktor's men won't move men onto certain
            # moveto event sights and have the event trigger on the
            # side change (observer during playtest).
            [avoid]
                x,y=34,25
            [/avoid]
            [avoid]
                x,y=29,26
            [/avoid]
            [avoid]
                x,y=29,24
            [/avoid]
        [/ai]
        {FLAG_VARIANT loyalist}
    [/side]
    [side]
        type=White Mage
        id=Arpus
        name= _ "Arpus"
        [modifications]
            {TRAIT_QUICK}
            {TRAIT_RESILIENT}
        [/modifications]
        facing=nw
        side=5
        controller=ai
        canrecruit=yes
        team_name=allies
        user_team_name= _ "Mages"
        {GOLD 180 150 120}
        recruit=Mage, Arch Mage,Red Mage, White Mage, Silver Mage
        [ai]
            village_value=0
            leader_value=0
            [goal]
                name=protect_unit
                [criteria]
                    side=5
                    canrecruit=yes
                [/criteria]
                value=0
            [/goal]
            [avoid] # 5x5 hex centered on keep
                x=1-60, 1-60,1-36,42-60
                y=1-37,43-50,1-50, 1-50
            [/avoid]
        [/ai]
    [/side]

    # Loyalists get the villages reaching south and west to Parthyn
    {STARTING_VILLAGES_AREA 4 25 46 10}

    # Mages get the villages right near their keep
    {STARTING_VILLAGES 5 2}

    # Start
    [event]
        name=start

        [message]
            speaker=Chantal
            # Historical background: Parthyn appears as the home town
            # of Malin Keshar from Descent Into Darkness; he is exiled
            # sometime in 389-390 YW.  Garard I ends the civil war in
            # 417 YW; Parthyn is strongly garrisoned within the next
            # few years.  It is now 470 YW and Garard I died a few months
            # previously. Garard II, the new King, is 30 years old.
            message= _ "This is the nearest human garrison, Delfador. Here is the only place to cross the river. Soon after the last King of Wesnoth began his reign, he put a strong garrison not far south of here in the town of Parthyn, and orcs have not been able to cross into Wesnoth over this part of the river since."
        [/message]
        [message]
            id=Delfador
            message= _ "This mist is unusual, though, even if we are close to the river. I have never seen it so thick before."
        [/message]
    [/event]

    [event]
        name=turn 2
        [message]
            id=Chantal
            message= _ "There should be no orcs this far south. But I do not like the feel of this mist."
        [/message]
        [message]
            id=Delfador
            message= _ "Stay close. I don’t like the feel of it either."
        [/message]
    [/event]

#define SECOND_WAVE
    [unit]
        id=Axhamr
        name=_ "Axhamr"
        type=Draug
        side=3
        x=48
        y=27
        [modifications]
            {TRAIT_STRONG}
            {TRAIT_RESILIENT}
        [/modifications]
    [/unit]
    [unit]
        id=Horfir
        name=_ "Horfir"
        type=Spectre
        side=3
        x=40
        y=31
        [modifications]
            {TRAIT_STRONG}
            {TRAIT_RESILIENT}
        [/modifications]
    [/unit]

    [unit]
        id=Backu
        name=_ "Backu"
        type=Nightgaunt
        side=3
        x=41
        y=35
        [modifications]
            {TRAIT_STRONG}
            {TRAIT_RESILIENT}
        [/modifications]
    [/unit]

    [unit]
        id=Camdun
        name=_ "Camdun"
        type=Chocobone
        side=3
        x=40
        y=31
        [modifications]
            {TRAIT_STRONG}
            {TRAIT_RESILIENT}
        [/modifications]
    [/unit]

    [unit]
        id=Drapug
        name=_ "Drapug"
        type=Wraith
        side=3
        x=36
        y=32
        [modifications]
            {TRAIT_STRONG}
            {TRAIT_RESILIENT}
        [/modifications]
    [/unit]

    [unit]
        id=Kalip
        name=_ "Kalip"
        type=Ghost
        side=3
        x=38
        y=34
        [modifications]
            {TRAIT_STRONG}
            {TRAIT_RESILIENT}
        [/modifications]
    [/unit]

    [unit]
        id=Abmin
        name=_ "Abmin"
        type=Deathblade
        side=3
        x=42
        y=30
        [modifications]
            {TRAIT_STRONG}
            {TRAIT_RESILIENT}
        [/modifications]
    [/unit]
#enddef

#define AMBUSH_WARNING X Y RADIUS
    [event]
        name=enter_hex
        first_time_only=yes

        [cancel_action]
        [/cancel_action]

        [filter]
            side=1
            [filter_location]
                x,y={X},{Y}
                radius={RADIUS}
            [/filter_location]
        [/filter]
        [message]
            speaker=unit
            message=_"Be wary. Something does not feel right about that village..."
        [/message]
    [/event]
#enddef

    ##### Utility events used for sighting other sides
    [event]
        name=undeads
        first_time_only=yes

        [if]
            [not]
                [variable]
                    name=unit.id
                    equals=Delfador
                [/variable]
            [/not]
            [then]
                [message]
                    speaker=unit
                    message= _ "What in the wide green world is this abomination?"
                [/message]
            [/then]
        [/if]
        [message]
            id=Delfador
            message= _ "One of Iliah-Malal’s creatures. So it has begun!"
        [/message]
        [set_variable]
            name=undead_spotted
            value=yes
        [/set_variable]
        [fire_event]
            name=enemies
        [/fire_event]
    [/event]

    [event]
        name=orcs
        first_time_only=yes

        [message]
            speaker=unit
            message= _ "Orcs! Orcs at the Ford!"
        [/message]
        [message]
            speaker=Delfador
            message= _ "Prepare to fight them! We must clear the Ford!"
        [/message]
        [fire_event]
            name=enemies
        [/fire_event]
    [/event]

    # Sighted Loyalist fort on the south shore
    [event]
        name=loyalists
        first_time_only=yes

        # If the Commander, Niktor is dead, let someone else take command (ranked by level).
        [role]
            role=Commander
            side=4
            id=Niktor
            [else]
                [role]
                    role=Commander
                    side=4
                    type="Master Bowman,Royal Guard,Halberdier,Cavalier,Iron Mauler,Paladin,Grand Knight," +
                        "Longbowman,Swordsman,Pikeman,Javelineer,Dragoon,Shock Trooper,Knight,Lancer," +
                        "Bowman,Spearman,Cavalryman,Heavy Infantryman,Horseman"
                    # no [else]; triggered by a unit so this cannot fail
                [/role]
            [/else]
        [/role]

        # So the player has time to see the sighted loyalist unit that triggered the event
        [delay]
            time=1500
        [/delay]

        # Lift fog from the Commander so player can see him during dialog
        [lift_fog]
            [filter_side]
                side=1
            [/filter_side]
            [filter]
                role=Commander
            [/filter]
            radius=2
        [/lift_fog]

        [message]
            role=Commander
            message= _ "Halt! Who goes there?"
        [/message]
        [message]
            speaker=Delfador
            message= _ "I am Delfador, a court mage of Wesnoth and the legate of Arch-Mage Leollyn; with me is Chantal, a great lady of the Lintanir Elves. Quickly, I must speak with your commander; death treads upon our very heels."
        [/message]
        [message]
            role=Commander
            message= _ "I command here, but we have lost the north shore. Uncanny creatures stalk the night; our weapons scarcely seem to scathe them. I fear we cannot hold against an attack in strength."
        [/message]
        [message]
            speaker=Delfador
            #po: "be of heart" -> "have courage" in modern English.
            message= _ "I have fought these before. Be of heart: impact weapons and magic can defeat them. Do I recall aright that there is a school of mages not far from here?"
        [/message]
        [message]
            role=Commander
            message= _ "Yes, close by the southeast wall of our fort across the Ford. But they are jealous of their privileges and hold aloof from us."
        [/message]
        [message]
            speaker=Delfador
            message= _ "That shall soon end. Send to them in my name and the Arch-Mage Leollyn’s; nay, tell them that in this matter I speak with the King’s voice!"
        [/message]
        [message]
            role=Commander
            message= _ "I heed the King’s voice. My men are at your command."
        [/message]

        {SUBSUME_SIDE_AND_VILLAGES 4}

        [scroll_to]
            x,y = 39,40
        [/scroll_to]

        [message]
            speaker=narrator
            message= _ "To wake up the mages, move a unit near their tower."
            image=wesnoth-icon.png
        [/message]
        ##dialog with loyalists

        [fire_event]
            name=enemies
        [/fire_event]
    [/event]

    # Spotting other sides through the fog/shroud.

    # The sighted event currently only triggers if

#define SIGHTED_EVENT SIDE_NUMBER EVENT_NAME
    [event]
        name=sighted

        [filter]
            side={SIDE_NUMBER}
        [/filter]
        [filter_second]
            side=1
        [/filter_second]

        [fire_event]
            [primary_unit]
                x=$second_unit.x
                y=$second_unit.y
            [/primary_unit]
            name={EVENT_NAME}
        [/fire_event]
    [/event]
    [event]
        name=moveto
        first_time_only=no

        [filter]
            [not]
                side=1
            [/not]
        [/filter]

        [if]
            [have_unit]
                side={SIDE_NUMBER}
                [filter_vision]
                    visible=yes
                    side=1
                [/filter_vision]
            [/have_unit]
            [then]
                [store_unit]
                    variable=speaker
                    [filter]
                        side=1
                        [not]
                            id=Delfador
                        [/not]
                        #[filter_vision]
                        #    visible=yes
                        #    side=2
                        #[/filter_vision]
                    [/filter]
                [/store_unit]
                [fire_event]
                    [primary_unit]
                        x=$speaker.x
                        y=$speaker.y
                    [/primary_unit]
                    name={EVENT_NAME}
                [/fire_event]
                {CLEAR_VARIABLE speaker}
            [/then]
        [/if]
    [/event]
#enddef

    {SIGHTED_EVENT 2 orcs}
    {SIGHTED_EVENT 3 undeads}
    {SIGHTED_EVENT 4 loyalists}
#undef SIGHTED_EVENT

    # This wakes up the mages
    [event]
        name=moveto
        first_time_only=yes
        [filter]
            side=1
            x=37-41
            y=38-42
        [/filter]
        [filter_condition]
            [have_unit]
                side=5
            [/have_unit]
        [/filter_condition]

        # If the Teacher, Arpus is dead, let someone else take the role (ranked by level).
        [role]
            role=Teacher
            side=5
            id=Arpus
            [else]
                [role]
                    role=Teacher
                    side=5
                    type="Great Mage,Mage of Light,Arch Mage,Silver Mage,White Mage,Red Mage,Mage"
                [/role]
                # no [else]; filtered by a unit so this cannot fail
            [/else]
        [/role]

        {MODIFY_UNIT (role=Teacher) facing nw} # most likely direction
        [message]
            role=Teacher
            message= _ "What are you doing here, disturbing our peace and concentration?"
        [/message]
        [message]
            speaker=unit
            message= _ "Undead are attacking the fort on the north shore. We need your help!"
        [/message]
        [message]
            role=Teacher
            message= _ "I have told the commander of that garrison that we take orders from none other than the Chief Mage of the High Council, Master Leollyn!"
        [/message]
        [message]
            speaker=unit
            message= _ "Leollyn’s emissary, Delfador, requests your help. He bears Leollyn’s token, which is not lightly given."
        [/message]
        [message]
            role=Teacher
            message= _ "I recognize it. Very well; we shall join battle."
        [/message]

        {SUBSUME_SIDE_AND_VILLAGES 5}
    [/event]

    #################from here on

    # Move to 34,6 burned village (nearest keep):
    # Nobody there
    [event]
        name=moveto
        [filter]
            side=1
            x=34
            y=6
        [/filter]

        [message]
            speaker=unit
            message= _ "What is going on here? This village has been burned to the ground!"
        [/message]
        [message]
            speaker=Chantal
            message= _ "Maybe there are survivors? We should check."
        [/message]
    [/event]

    # Move to 29,13 burned village (north edge of farmed patch): empty
    [event]
        name=moveto
        [filter]
            side=1
            x=29
            y=13
        [/filter]
        [message]
            speaker=unit
            message= _ "Another village burned. Nobody to be seen!"
        [/message]
    [/event]

    # Move to 31,10 burned village (south of camp, west of main road): Theorin
    [event]
        name=moveto
        [filter]
            side=1
            x=31
            y=10
        [/filter]
        [move_unit_fake]
            type=Spearman
            side=1
            x=31,31
            y=10,9
        [/move_unit_fake]
        [unit]
            type=Spearman
            id=Theorin
            name= _ "Theorin"
            side=1
            x=31
            y=9
            {IS_LOYAL}
            [modifications]
                {TRAIT_LOYAL}
                {TRAIT_INTELLIGENT}
            [/modifications]
        [/unit]
        #{NAMED_LOYAL UNIT 1 (Spearman) (Theorin) 31 9 (_ "Theorin") }
        [message]
            speaker=Theorin
            message= _ "Please, spare me..."
        [/message]
        [message]
            speaker=Delfador
            message= _ "Spare you from whom, soldier? What has happened here?"
        [/message]
        [message]
            speaker=Theorin
            message= _ "They come at night... and leave no one alive..."
        [/message]
        [message]
            speaker=Delfador
            message= _ "Get hold of yourself, soldier! Who is ‘they’?"
        [/message]
        [message]
            speaker=Theorin
            message= _ "I do not know. No one has seen their faces and lived. All I could hear is my comrades’ screams as they were being slaughtered."
        [/message]

        [fire_event]
            name=enemies
        [/fire_event]
    [/event]

    # Move to 29,24 village (northernmost in keep):
    # brave Loyalists Donc, Stanis
    [event]
        name=moveto
        [filter]
            side=1
            x=29
            y=24
        [/filter]
        #{NAMED_LOYAL_UNIT 1 (Heavy Infantryman) 29 23 (Donc) ( _ "Donc") }
        #{NAMED_LOYAL_UNIT 1 (Halberdier) (Stanis) 29 25 ( _ "Stanis") }
        [move_unit_fake]
            type=Heavy Infantryman
            side=1
            x=29,29
            y=24,23
        [/move_unit_fake]
        [unit]
            type=Heavy Infantryman
            id=Donc
            name= _ "Donc"
            side=1
            x=29
            y=23
            [modifications]
                {TRAIT_RESILIENT}
                {TRAIT_STRONG}
            [/modifications]
        [/unit]
        [move_unit_fake]
            type=Halberdier
            side=1
            x=29,29
            y=24,25
        [/move_unit_fake]
        [unit]
            type=Halberdier
            id=Stanis
            name= _ "Stanis"
            side=1
            x=29
            y=25
            {IS_LOYAL}
            [modifications]
                {TRAIT_LOYAL}
                {TRAIT_STRONG}
            [/modifications]
        [/unit]
        [message]
            speaker=Donc
            message= _ "It’s time to stand up and fight... What’s this?"
        [/message]
        [message]
            speaker=unit
            message= _ "Friends, soldiers. Why were you hiding?"
        [/message]
        [message]
            speaker=Stanis
            message= _ "Our post was overrun. Very few of us survived."
        [/message]
        [message]
            speaker=Delfador
            message= _ "Your orders from the King are to fight. Just stay close to me."
        [/message]
        [fire_event]
            name=enemies
        [/fire_event]
    [/event]

    # Move into 44,11 village (touching riverbank): Big undead ambush
    {AMBUSH_WARNING 44 11 5}
    [event]
        name=moveto
        [filter]
            side=1
            x=44
            y=11
        [/filter]
        [message]
            speaker=unit
            message= _ "This village seems unharmed. Anyone here?"
        [/message]
        #{NAMED_LOYAL UNIT 3 (Deathblade)  44  12 Bled (_ "Bled") }
        #{NAMED_LOYAL UNIT 3 (Ghost) 38 11 Crod (_ "Crod") }
        #{NAMED_LOYAL UNIT 3 (Wraith) 36 11 Angedd (_ "Angedd") }
        [move_unit_fake]
            type=Deathblade
            side=3
            x=44,44
            y=11,12
        [/move_unit_fake]
        [unit]
            type=Deathblade
            id=Bled
            name= _ "Bled"
            side=3
            x=44
            y=12
            [modifications]
                {TRAIT_INTELLIGENT}
                {TRAIT_STRONG}
            [/modifications]
        [/unit]
        [move_unit_fake]
            type=Ghost
            side=3
            x=44,45
            y=11,11
        [/move_unit_fake]
        [unit]
            type=Ghost
            id=Crod
            name= _ "Crod"
            side=3
            x=45
            y=11
            [modifications]
                {TRAIT_RESILIENT}
                {TRAIT_STRONG}
            [/modifications]
        [/unit]

        [move_unit_fake]
            type=Wraith
            side=3
            x=44,43
            y=11,11
        [/move_unit_fake]
        [unit]
            type=Wraith
            id=Angedd
            name= _ "Angedd"
            side=3
            x=43
            y=11
            [modifications]
                {TRAIT_RESILIENT}
                {TRAIT_STRONG}
            [/modifications]
        [/unit]
        [message]
            speaker=Angedd
            message= _ "Surprise, surprise..."
        [/message]
        [message]
            speaker=Bled
            message= _ "We have not waited all this time for nothing!"
        [/message]
        [fire_event]
            name=undeads
            [primary_unit]
                side=1
                x=44
                y=11
            [/primary_unit]
        [/fire_event]
    [/event]

    # Move to 29,26 village (southwest in keep): More brave loyalists
    [event]
        name=moveto
        [filter]
            side=1
            x=29
            y=26
        [/filter]
        #{NAMED_LOYAL_UNIT 1 (Heavy Infantryman)  29  25 Zagar (_ "Zagar")}
        #{NAMED_LOYAL_UNIT 1 (Heavy Infantryman) 29 27 Brox (_ "Brox")}
        #{NAMED_LOYAL_UNIT 1 (Longbowman) 28 26 Adran (_ "Adran")}
        [move_unit_fake]
            type=Heavy Infantryman
            side=1
            x=29,29
            y=26,25
        [/move_unit_fake]
        [unit]
            type=Heavy Infantryman
            id=Zagar
            name= _ "Zagar"
            side=1
            x=29
            y=25
            [modifications]
                {TRAIT_RESILIENT}
                {TRAIT_STRONG}
            [/modifications]
        [/unit]
        [move_unit_fake]
            type=Heavy Infantryman
            side=1
            x=29,29
            y=26,27
        [/move_unit_fake]
        [unit]
            type=Heavy Infantryman
            id=Brox
            name= _ "Brox"
            side=1
            x=29
            y=27
            [modifications]
                {TRAIT_RESILIENT}
                {TRAIT_STRONG}
            [/modifications]
        [/unit]

        [move_unit_fake]
            type=Longbowman
            side=1
            x=29,28
            y=26,26
        [/move_unit_fake]
        [unit]
            type=Longbowman
            id=Adran
            name= _ "Adran"
            side=1
            x=28
            y=26
            [modifications]
                {TRAIT_RESILIENT}
                {TRAIT_DEXTROUS}
            [/modifications]
        [/unit]

        [message]
            speaker=Adran
            message= _ "Long live the King! Wait, you are not—"
        [/message]
        [message]
            speaker=Delfador
            message= _ "—The enemy? Yes, we’re on your side."
        [/message]
        [message]
            speaker=Delfador
            message= _ "Soldiers of Wesnoth, rise to fight for your King!"
        [/message]
        [fire_event]
            name=enemies
        [/fire_event]
    [/event]

    # Move to 32,23 burned village: Cowardly loyalists
    [event]
        name=moveto
        [filter]
            side=1
            x=32
            y=23
        [/filter]
        #{NAMED_LOYAL_UNIT 1 (Heavy Infantryman)  31  23 Axios (_ "Axios")}
        #{NAMED_LOYAL_UNIT 1 (Spearman) 32 24 Ulfter (_ "Ulfter")}
        #{NAMED_LOYAL_UNIT 1 (Bowman) 33 23 Ogdal (_ "Ogdal")}
        [move_unit_fake]
            type=Heavy Infantryman
            side=1
            x=32,31
            y=23,23
        [/move_unit_fake]
        [unit]
            type=Heavy Infantryman
            id=Axios
            name= _ "Axios"
            side=1
            x=31
            y=23
            [modifications]
                {TRAIT_RESILIENT}
                {TRAIT_STRONG}
            [/modifications]
        [/unit]
        [move_unit_fake]
            type=Spearman
            side=1
            x=32,32
            y=23,24
        [/move_unit_fake]
        [unit]
            type=Spearman
            id=Ulfter
            name= _ "Ulfter"
            side=1
            x=32
            y=24
            [modifications]
                {TRAIT_RESILIENT}
                {TRAIT_STRONG}
            [/modifications]
        [/unit]
        [move_unit_fake]
            type=Bowman
            side=1
            x=32,33
            y=23,23
        [/move_unit_fake]
        [unit]
            type=Bowman
            id=Ogdal
            name= _ "Ogdal"
            side=1
            x=33
            y=23
            [modifications]
                {TRAIT_RESILIENT}
                {TRAIT_DEXTROUS}
            [/modifications]
        [/unit]
        [message]
            speaker=Ulfter
            message= _ "Is the enemy gone?"
        [/message]
        [message]
            speaker=Delfador
            message= _ "He will be, if you help. Now follow me into battle!"
        [/message]
        [fire_event]
            name=enemies
        [/fire_event]
    [/event]

    # Move to 34,25 village (east in keep): Second undead ambush
    [event]
        name=moveto
        [filter]
            side=1
            x=34
            y=25
        [/filter]
        [message]
            speaker=unit
            message= _ "Anyone here?"
        [/message]
        #{NAMED_LOYAL UNIT 3 (Draug)  34  24 Dreadred (_ "Dredred")}
        [move_unit_fake]
            type=Draug
            side=3
            x=34,34
            y=25,24
        [/move_unit_fake]
        [unit]
            type=Draug
            id=Dreadred
            name= _ "Dreadred"
            side=3
            x=34
            y=24
            [modifications]
                {TRAIT_RESILIENT}
                {TRAIT_STRONG}
            [/modifications]
        [/unit]
        [message]
            speaker=Dreadred
            message= _ "Master said more would come!"
        [/message]
        [fire_event]
            name=undeads
            [primary_unit]
                side=1
                x=34
                y=25
            [/primary_unit]
        [/fire_event]
    [/event]

    # Move to 24,11 village (woods northwest of farmed patch): orcish ambush
    {AMBUSH_WARNING 24 11 5}
    [event]
        name=moveto
        [filter]
            side=1
            x=24
            y=11
        [/filter]
        [message]
            speaker=unit
            message= _ "There are signs of a battle, but nobody seems to be here..."
        [/message]
        #{LOYAL UNIT 2 (Orcish Warrior)  24  12 Crum (_ "Crum")}
        #{LOYAL UNIT 2 (Orcish Grunt)  24  10 Smalg (_ "Smalg")}
        #{LOYAL UNIT 2 (Orcish Archer)  25  11 Grubar (_ "Grubar")}
        #{LOYAL UNIT 2 (Orcish Assassin)  23  11 Ulkar (_ "Ulkar")}
        [move_unit_fake]
            type=Orcish Warrior
            side=2
            x=24,24
            y=11,12
        [/move_unit_fake]
        [unit]
            type=Orcish Warrior
            id=Crum
            name= _ "Crum"
            side=2
            x=24
            y=12
            [modifications]
                {TRAIT_RESILIENT}
                {TRAIT_STRONG}
            [/modifications]
        [/unit]
        [move_unit_fake]
            type=Orcish Grunt
            side=2
            x=24,24
            y=11,10
        [/move_unit_fake]
        [unit]
            type=Orcish Grunt
            id=Smalg
            name= _ "Smalg"
            side=2
            x=24
            y=10
            [modifications]
                {TRAIT_RESILIENT}
                {TRAIT_STRONG}
            [/modifications]
        [/unit]
        [move_unit_fake]
            type=Orcish Archer
            side=2
            x=24,25
            y=11,11
        [/move_unit_fake]
        [unit]
            type=Orcish Archer
            id=Grubar
            name= _ "Grubar"
            side=2
            x=25
            y=11
            [modifications]
                {TRAIT_RESILIENT}
                {TRAIT_STRONG}
            [/modifications]
        [/unit]
        [move_unit_fake]
            type=Orcish Assassin
            side=2
            x=24,23
            y=11,11
        [/move_unit_fake]
        [unit]
            type=Orcish Assassin
            id=Ulkar
            name= _ "Ulkar"
            side=2
            x=23
            y=11
            [modifications]
                {TRAIT_RESILIENT}
                {TRAIT_STRONG}
            [/modifications]
        [/unit]

        [message]
            speaker=Crum
            message= _ "Wrong!"
        [/message]
        [fire_event]
            name=orcs
            [primary_unit]
                side=1
                x=24
                y=11
            [/primary_unit]
        [/fire_event]
    [/event]

    # Enemy deaths

    [event]
        name=last breath
        [filter]
            id=Upgar
        [/filter]
        [message]
            speaker=Upgar
            message= _ "You may have defeated me, but the great Zorlan will have revenge! I have done my duty attacking the Wesnoth perimeter, so that no Wesnoth forces can come to the aid of your doomed army. It will be a glorious massacre!"
        [/message]
        [if]
            [not]
                [have_unit]
                    id=Dirator
                [/have_unit]
            [/not]

            [then]
                [endlevel]
                    result=victory
                [/endlevel]
            [/then]
        [/if]
    [/event]

    [event]
        name=last breath
        [filter]
            id=Dirator
        [/filter]
        [message]
            speaker=Dirator
            message= _ "Master will avenge me!"
        [/message]

        [if]
            [not]
                [have_unit]
                    id=Upgar
                [/have_unit]
            [/not]

            [then]
                [endlevel]
                    result=victory
                [/endlevel]
            [/then]
        [/if]
    [/event]
    #end deaths of enemies

    # Victory
    [event]
        name=victory
        [message]
            speaker=Delfador
            message= _ "We have much less time than I thought. Iliah-Malal’s offensive has begun. I must close his portal before it’s too late, and I have no idea how to do that. And we must also defeat those that have already escaped the Land of the Dead."
        [/message]
        [message]
            speaker=Delfador
            message= _ "But there is something else those orcs said that deeply worries me in a different way. I have wondered why the orcs have been attacking in concert all along the frontier; they do not coordinate well. If that orc was telling the truth and a paramount chief strong enough to marshal their entire host has arisen among them, the King may be walking into a lethal trap at the Ford of Abez."
        [/message]
        [message]
            speaker=Chantal
            message= _ "Word had just arrived when I left Lintanir that the High Lord Kalenz was mustering an elvish army against the orcs, but he is not aware of the King’s movements or of any trap in wait for him. And he certainly does not know of the undead menace."
        [/message]

        [message]
            speaker=Delfador
            message= _ "Maybe we can warn the King in time. Lionel should be back in Weldyn by now; I shall send one of the garrison’s message-riders to him, but I cannot spare the time to go south myself. I will gather as many troops as I can move quickly through these wildlands and head west from here."
        [/message]
        [message]
            speaker=Delfador
            message= _ "Will you join me? Elves know these northern paths better than any human."
        [/message]
        [message]
            speaker=Chantal
            message= _ "It is not to be, Delfador. I must return to Lintanir as swiftly as I may; the Northern Elves must be informed immediately — and mayhap I can find High Lord Kalenz or get a message to him."
        [/message]
        [message]
            speaker=Delfador
            message= _ "My King does not command him... but if Elves and Humans do not stand together in this, I fear we will fall separately."
        [/message]
        [message]
            speaker=Chantal
            message= _ "I do not doubt it. Go to your King, Delfador, and have faith in yourself; for I sense that you hold the fate of Wesnoth in your hands, and will need all the strength you have. I think we will meet again."
        [/message]

        {CHANTAL_DEPARTS}

        {CLEAR_VARIABLE undead_spotted}
    [/event]

    # Second wave of undead
    [event]
        name=turn 7
        {SECOND_WAVE}
        [if]
            [variable]
                name=undead_spotted
                equals=yes
            [/variable]
            [then]
                [message]
                    speaker=Delfador
                    message= _ "They have unleashed a second wave. Soldiers, stand firm and send these abominations back to the darkness!"
                [/message]
            [/then]
        [/if]
    [/event]

    # Time over
    [event]
        name=time over
        [message]
            speaker=Delfador
            message= _ "This is hopeless. Many more enemies are coming, while our numbers are limited."
        [/message]
    [/event]

    {MEMOIRS_DEATHS}
[/scenario]

#undef AMBUSH_WARNING
#undef SECOND_WAVE
