#textdomain wesnoth-After_the_Storm

[scenario]
    id=01_By_the_Moonlight
    name= _ "By the Moonlight"
    {MAP 01_By_the_Moonlight.map}
    {TURNS 42 40 38}
    next_scenario=02_The_Heart_Forest
    victory_when_enemies_defeated=no

    disallow_recall=yes

    {C_DEATHS}

    {SCENARIO_MUSIC       "enchanted_forest.ogg"} {CONTINUE_PLAYING_STORY_MUSIC_FIRST}
    {EXTRA_SCENARIO_MUSIC "knolls.ogg"}
    {EXTRA_SCENARIO_MUSIC "breaking_the_chains.ogg"}

    {STORYTXT_BY_THE_MOONLIGHT}

    {LONGDARK1}
    {LONGDARK2}
    {LONGDARK3}
    {LONGDARK4}
    {DAWN1}
    {MORNING1}
    {MIDDAY1}
    {AFTERNOON1}
    {DUSK1}
    {SHORTDARK}
    {DAWN2}
    {MORNING2}
    {MIDDAY2}
    {AFTERNOON2}
    {DUSK2}

    {AMLA_MENU_HINT}

    # wmllint: validate-off
    [side]
        side=1
        controller=human
        save_id=player
        team_name=good
        user_team_name= _ "team_name^Elynia"

        {NO_ECONOMY}

        shroud=yes
        fog=yes
        share_vision=none

        # wmllint: recognize Elynia
        {CHARACTER_STATS_ELYNIA}
    [/side]
    # wmllint: validate-on

    [side]
        side=2
        controller=null
        team_name=good
        user_team_name= _ "team_name^Humans"

        hidden=yes
        scroll_to_leader=no
        {NO_ECONOMY}

        shroud=yes
        fog=yes
        share_vision=none

        no_leader=yes
        recruit=Footpad,Poacher,Thug,Ruffian,Woodsman

        # wmllint: recognize Aethyr
        {NAMED_GENERIC_UNIT () (Woodsman) 42 19 Aethyr ( _ "Aethyr")} {GUARDIAN} {FACING se}
        # wmllint: recognize Devon
        {NAMED_GENERIC_UNIT () (Poacher)  46 21 Devon  ( _ "Devon") } {GUARDIAN} {FACING sw}
    [/side]

    [side]
        side=3
        controller=null
        team_name=bad
        user_team_name= _ "team_name^Invaders"

        hidden=yes
        {NO_ECONOMY}

        no_leader=yes
        recruit=Footpad,Walking Corpse,Skeleton,Skeleton Archer
    [/side]

    # These wolves have less MP so the player can't be unwittingly attacked.
    # (Elynia's max MP is always 6.)

#define PR_WOLF X Y
    {NOTRAIT_UNIT () (Wolf) ({X}) ({Y})} {GUARDIAN} {NO_UPKEEP_NO_OVERLAY}
    [+unit]
        max_moves=6
    [/unit]
#enddef
#define PR_GREAT_WOLF X Y
    {NOTRAIT_UNIT () (Great Wolf) ({X}) ({Y})} {GUARDIAN} {NO_UPKEEP_NO_OVERLAY}
    [+unit]
        max_moves=6
    [/unit]
#enddef

    [side]
        side=4
        team_name=bad
        user_team_name= _ "team_name^Animals"

        hidden=yes
        {NO_ECONOMY}

        no_leader=yes
        {IS_HOSTILE_NPC}

        {PR_WOLF 22 37}       {FACING nw}
        {PR_WOLF 23 38}       {FACING nw}
        {PR_WOLF 22 38}       {FACING nw}

        {PR_WOLF 16 26}       {FACING se}

        {PR_WOLF 23 25}       {FACING sw}
        {PR_GREAT_WOLF 24 25} {FACING sw}
    [/side]

#undef PR_WOLF
#undef PR_GREAT_WOLF

    {NPC_BIRD_BEHAVIOR 4 1 60 1 40}

    {PLACE_IMAGE (scenery/village-human-burned1.png) 35 12}
    {PLACE_IMAGE (scenery/village-human-burned3.png) 32 27}
    {PLACE_IMAGE (scenery/monolith3.png) 12 15}

    [event]
        name=prestart

        #
        # Retrieve stored stats for Elynia from Episode 1 if applicable.
        #

        {UPDATE_UNIT_FROM_GLOBAL_STORE Elynia episode1_stats_elynia}
        {AMLA_XP_CAP_TIER_2            Elynia}

        [modify_unit]
            [filter]
                id=Elynia
            [/filter]
            hitpoints="$(0.10 * $this_unit.max_hitpoints)"
            facing=ne
        [/modify_unit]

        {OBJECTIVES (
            victory_string= _ "Current Objectives:"
            {OBJECTIVE_VICTORY ( _ "Find a friendly unit")}

            {OBJECTIVE_DEFEAT  ( _ "Death of Elynia")}

            {TURNS_RUN_OUT}
        )}
    [/event]

    [event]
        name=start

        [message]
            speaker=Elynia
            message= _ "There seem to be some hostile animals ahead. I’d better move carefully..."
        [/message]
    [/event]

    [event]
        name=turn 3
        [message]
            speaker=Elynia
            message= _ "I think I can see a village to the northeast..."
        [/message]
    [/event]

    [event]
        name=moveto
        [filter_condition]
            [have_unit]
                side=2
                [filter_vision]
                    visible=yes
                    side=1
                [/filter_vision]
            [/have_unit]
        [/filter_condition]
        [filter]
            id=Elynia
        [/filter]

        [fire_event]
            name=begin regular gameplay
        [/fire_event]
    [/event]

#define PR_FALCON _X _Y
    {NOTRAIT_UNIT 4 (Falcon) ({_X}) ({_Y})} {GUARDIAN} {NO_UPKEEP_NO_OVERLAY}
#enddef

    [event]
        name=begin regular gameplay

        #
        # Uncover Elynia before dialogue in case she's on a forest hex.
        #
        [modify_unit]
            [filter]
                id=Elynia
            [/filter]
            [status]
                uncovered=yes
            [/status]
        [/modify_unit]

        {PR_FALCON 49 33}
        {PR_FALCON  8 17}
        {PR_FALCON 10 18}
        {PR_FALCON 11 16}
        {PR_FALCON 13 17}
        {PR_FALCON 15 19}
        {PR_FALCON 15 17}
        {PR_FALCON 29  6}
        {PR_FALCON 27 16}
        {PR_FALCON 24 21}
        {PR_FALCON 59  1}
        {PR_FALCON 50  3}

        [remove_terrain_overlays]
            terrain=*^Xo
        [/remove_terrain_overlays]

        [modify_side]
            side=1
            {DEFAULT_ECONOMY}
            share_vision=all
        [/modify_side]

        [modify_side]
            side=2
            controller=ai
            hidden=no
            {DEFAULT_ECONOMY}
            {GOLD 70 60 50}
            share_vision=all
            [ai]
                {AI_NEW_SYNTAX}
                {AI_SIMPLE_ALWAYS_ASPECT passive_leader yes}
                {AI_SIMPLE_ALWAYS_ASPECT grouping       defensive}
                # Try not to move units to the keeps reserved for the player.
                {AI_SIMPLE_ALWAYS_ASPECT_VALUE avoid
                (
                    x=54,55
                    y=18,11
                )}
            [/ai]
        [/modify_side]

        [modify_side]
            side=3
            controller=ai
            hidden=no
            {DEFAULT_ECONOMY}
            {GOLD 210 220 230}
        [/modify_side]

        [store_starting_location]
            side=2
        [/store_starting_location]

        [unit]
            side=2
            canrecruit=yes
            type=Huntsman
            id=Luddry
            name= _ "Luddry"
            x=$location.x
            y=$location.y
            [modifications]
                {TRAIT_RESILIENT}
                {TRAIT_QUICK}
            [/modifications]
        [/unit]

        {GENERIC_UNIT 2 (Poacher) 50 11} {GUARDIAN}
        {GENERIC_UNIT 2 (Woodsman) 46 14} {GUARDIAN}
        {GENERIC_UNIT 2 (Woodsman) 47 17} {GUARDIAN}
        {GENERIC_UNIT 2 (Footpad) 44 10} {GUARDIAN}

        {GENERIC_UNIT 2 (Footpad) 35 12}
        {GENERIC_UNIT 2 (Footpad) 41 7}

        {CAPTURE_VILLAGES 2 $location.x $location.y 8}

        [store_starting_location]
            side=3
        [/store_starting_location]

        [unit]
            side=3
            canrecruit=yes
            type=Lich
            id=Daent
            name= _ "Daent"
            x=$location.x
            y=$location.y
            [modifications]
                {TRAIT_INTELLIGENT}
                {TRAIT_STRONG}
            [/modifications]
        [/unit]

        {GENERIC_UNIT 3 (Revenant) 17 8} {NO_UPKEEP_NO_OVERLAY} {FACING nw} {PETRIFIED}
        {GENERIC_UNIT 3 (Revenant) 23 3} {NO_UPKEEP_NO_OVERLAY} {FACING sw} {PETRIFIED}
        {GENERIC_UNIT 3 (Revenant)  9 1} {NO_UPKEEP_NO_OVERLAY} {FACING se} {PETRIFIED}
        {GENERIC_UNIT 3 (Revenant)  3 9} {NO_UPKEEP_NO_OVERLAY} {FACING ne} {PETRIFIED}

        {GENERIC_UNIT 3 (Skeleton) 35 9} {NO_UPKEEP_NO_OVERLAY}
        {GENERIC_UNIT 3 (Skeleton Archer) 38 12} {NO_UPKEEP_NO_OVERLAY}
        {GENERIC_UNIT 3 (Skeleton) 27 10} {NO_UPKEEP_NO_OVERLAY}
        {GENERIC_UNIT 3 (Dark Adept) 34 10} {NO_UPKEEP_NO_OVERLAY}

        {GENERIC_UNIT 3 (Ghoul) 19 5} {NO_UPKEEP_NO_OVERLAY}
        {GENERIC_UNIT 3 (Ghoul) 21 6} {NO_UPKEEP_NO_OVERLAY}

        {CAPTURE_VILLAGES 3 $location.x $location.y 6}

        [redraw][/redraw]

        [message]
            speaker=Aethyr
            message= _ "Halt! Who goes there?"
        [/message]

        [message]
            speaker=Devon
            message= _ "Don’t pay any attention to that — it’s just another of those disgusting forest creatures."
        [/message]

        [message]
            speaker=Aethyr
            message= _ "But she’s injured—"
        [/message]

        [message]
            speaker=Devon
            message= _ "It’s a trick! They lure you into the dark to do whatever they please with your dead body—"
        [/message]

        [message]
            speaker=Elynia
            message= _ "... I need help. Could any of you please—"
        [/message]

        [message]
            speaker=Devon
            message= _ "Begone, unless you want us to slice your throat open!"
        [/message]

        {MOVE_UNIT (id=Luddry) 46 19}

        [message]
            speaker=Luddry
            message= _ "What’s going on here?"
        [/message]

        [message]
            speaker=Aethyr
            message= _ "Chief, this lass here, she—"
        [/message]

        [message]
            speaker=Luddry
            message= _ "You look oddly familiar. What’s your name?"
        [/message]

        [message]
            speaker=Elynia
            message= _ "I am Elynia, the—"
        [/message]

        [message]
            speaker=Luddry
            message= _ "The Lady of Light, as I recall. You weren’t of much help to us in the country."
        [/message]

        [message]
            speaker=Elynia
            message= _ "... Excuse me? I don’t know you."
        [/message]

        # wmllint: local spelling Ardgam

        [message]
            speaker=Luddry
            message= _ "Of course you don’t know me, because you and your friends were too busy battling the dark soldiers to help us civilians in Ardgam. That was my hometown, and my family was trapped, helpless, amidst the fire. What’s your purpose here, and why should we help you??"
        [/message]

        {FACE_DIRECTION (id=Luddry) ne}

        [message]
            speaker=Elynia
            message= _ "I would like to know where I am, and if it would be possible, I’d also like some help to get to the Grand Council. This is a matter of the utmost importance..."
        [/message]

        [delay]
            time=1500
        [/delay]

        [message]
            speaker=Elynia
            message= _ "—Are you even listening to me?!"
        [/message]

        [message]
            speaker=Luddry
            message= _ "I don’t feel particularly inclined to help you — at least not right now. If you really need to get to those useless elders, you are on your own. We don’t have any time for this nonsense, as we need to defend our town by our own means right now."
        [/message]

        [store_starting_location]
            side=2
        [/store_starting_location]

        {MOVE_UNIT (id=Luddry) $location.x $location.y}

        [redraw][/redraw]

        [delay]
            time=750
        [/delay]

        [message]
            speaker=Elynia
            message= _ "It feels like I’ve been in a similar situation before..."
        [/message]

        [delay]
            time=1000
        [/delay]

        [message]
            speaker=Aethyr
            message= _ "Can you help us? I know our leader appears to be very resentful of you, but it’s said that the evil mage Daent has returned from the land of the dead to get his revenge upon us, for banishing him from the village. The rumors of the power he has amassed since then are terrifying."
        [/message]

        [message]
            speaker=Elynia
            message= _ "Hm... Well, I may be able to provide you with my assistance if you would help me in exchange. Really, I’m not asking for much. "
        [/message]

        [message]
            speaker=Devon
            message= _ "We can’t make any promises, faerie. Our leader isn’t that kind of person — you’ll have to figure out how to solve your problems on your own."
        [/message]

        [delay]
            time=750
        [/delay]

        [message]
            speaker=Elynia
            message= _ "So be it, then."
        [/message]

        [if]
            [not]
                [have_unit]
                    id=Elynia
                    x=49-60
                    y=1-18
                [/have_unit]
            [/not]
            [then]
                {MOVE_UNIT (id=Elynia) 49 18}
            [/then]
        [/if]

        [modify_unit]
            [filter]
                id=Elynia
            [/filter]
            moves=$this_unit.max_moves
        [/modify_unit]

        [modify_side]
            side=1
            shroud=no
            {GOLD 80 70 50}
            recruit=Faerie Sprite,Footpad,Ruffian
        [/modify_side]

        [modify_side]
            side=2
            shroud=no
        [/modify_side]

        {CLEAR_VARIABLE location}

        {OBJECTIVES (
            {OBJECTIVE_VICTORY ( _ "Defeat the enemy leader")}

            {OBJECTIVE_DEFEAT  ( _ "Death of Elynia")}
            {OBJECTIVE_DEFEAT  ( _ "Death of Luddry")}

            {TURNS_RUN_OUT}

            {OBJECTIVE_CARRYOVER}
        )}

        [redraw]
            side=1
        [/redraw]

        [redraw]
            side=2
        [/redraw]
    [/event]

#undef PR_FALCON

    [event]
        name=last breath
        [filter]
            id=Luddry
        [/filter]

        [message]
            speaker=Luddry
            message= _ "Argh! I’m done for."
        [/message]
    [/event]

    [event]
        name=die
        [filter]
            id=Luddry
        [/filter]

        [message]
            speaker=Elynia
            message= _ "I don’t suppose these people would want to help me now that they are leaderless..."
        [/message]

        [message]
            speaker=Devon
            message= _ "Thanks for your absolutely useless help, faerie."
        [/message]

        {ENDLEVEL_DEFEAT}
    [/event]

    [event]
        name=moveto
        [filter]
            side=1
            x=1-21,22-23,24 ,25 ,26 ,22
            y=1-16,1-10 ,1-8,2-8,2-6,14-15
        [/filter]

        [message]
            speaker=Daent
            message= _ "Arise! Arise once again, fallen warriors of times long past! Arise!"
        [/message]

        [message]
            side=1
            canrecruit=no
            message= _ "I don’t like the sound of that... not at all..."
        [/message]

        [unpetrify]
            side=3
        [/unpetrify]
    [/event]

    [event]
        name=moveto
        [filter]
            side=1
            [filter_location]
                [filter]
                    canrecruit=yes
                    side=3
                [/filter]
                radius=6
            [/filter_location]
        [/filter]

        [redraw][/redraw]

        [message]
            speaker=Daent
            message= _ "Ah, you have been sent by my brother to destroy me, isn’t that right?"
        [/message]

        [message]
            side=1,2
            canrecruit=no
            message= _ "Your brother?"
        [/message]

        [message]
            speaker=Daent
            message= _ "Well, less chatter and more action, I say! You all shall embrace undeath soon, no matter whether you want or not!"
        [/message]
    [/event]

    [event]
        name=last breath
        [filter]
            id=Daent
        [/filter]
        [filter_second]
            id=Elynia
        [/filter_second]

        [message]
            speaker=Daent
            message= _ "Ahhh, you think you can destroy me, don’t you? Well—"
        [/message]

        [message]
            speaker=Elynia
            message= _ "Enough of this."
        [/message]

        {THUNDER (
            [kill]
                id=Daent
                fire_event=no
                animate=yes
            [/kill]
        )}
    [/event]

    [event]
        name=last breath
        [filter]
            id=Daent
        [/filter]
        [filter_second]
            [not]
                id=Elynia
            [/not]
        [/filter_second]

        [message]
            speaker=Daent
            # wmllint: local spelling MWAHAHAHAHA
            message= _ "Ahhh, you think you can destroy me, don’t you? Well, a few have already tried to vanquish me before to no avail... What makes you think it will be different this time? MWAHAHAHAHA!"
        [/message]

        {COLOR_ADJUST 67 0 67}
        {COLOR_ADJUST 100 0 100}

        [kill]
            id=Daent
            fire_event=no
            animate=no
        [/kill]

        {COLOR_ADJUST 33 0 33}
        {COLOR_ADJUST 0 0 0}

        [message]
            side=1
            canrecruit=no
            message= _ "He’s gone!"
        [/message]
    [/event]

    [event]
        name=enemies defeated
        [filter_condition]
            [have_unit]
                canrecruit=yes
                side=2
            [/have_unit]
        [/filter_condition]

        {ENDLEVEL_VICTORY yes}
    [/event]

    [event]
        name=victory

        [message]
            speaker=Elynia
            message= _ "That wasn’t too hard."
        [/message]

        [message]
            side=2
            canrecruit=no
            [not]
                id=Aethyr
                [or]
                    id=Devon
                [/or]
            [/not]
            message= _ "Our village is saved!"
        [/message]

        [message]
            speaker=Devon
            message= _ "Heh. I admit I didn’t expect this to work out with a faerie leading those impressionable fools."
        [/message]

        [message]
            speaker=Luddry
            message= _ "Well done, everybody. As for you, faerie... What is it that you needed from us again?"
        [/message]

        [message]
            speaker=Elynia
            message= _ "I also have a name, as I told you before."
        [/message]

        [message]
            speaker=Luddry
            message= _ "I suggest that you get to the point before I change my mind."
        [/message]

        [message]
            speaker=Aethyr
            message= _ "But sir, her help in defeating the undead was..."
        [/message]

        [message]
            speaker=Elynia
            message= _ "I need to know exactly where I am, and I must also meet with the Grand Council of the Northern Peoples as soon as I may, for which I could need some help depending on our location."
        [/message]

        [message]
            speaker=Luddry
            message= _ "I see. Well, we also need to arrange a meeting with the Council for our own purposes. Sending some of our most capable hunters with you along with our messengers might not be a bad idea after all, as you seem to excel in the arts of healing and the northern forests are not particularly safe nowadays."
        [/message]

        [message]
            speaker=Elynia
            # po: "But where am I?"
            message= _ "I’d be very grateful if you provided me with such help, then. But—"
        [/message]

        [message]
            speaker=Luddry
            message= _ "And welcome to the Heart Forest."
        [/message]
    [/event]
[/scenario]

# kate: indent-mode normal; encoding utf-8; space-indent on;


#textdomain wesnoth-After_the_Storm

[scenario]
    id=02_The_Heart_Forest
    name= _ "The Heart Forest"
    {MAP 02_The_Heart_Forest.map}
    {TURNS 40 39 38}
    next_scenario=03_01_Unrest_in_Raelthyn
    victory_when_enemies_defeated=no

    {C_DEATHS}

    {SCENARIO_MUSIC       "a_land_of_adventure.ogg"} {CONTINUE_PLAYING_STORY_MUSIC_FIRST}
    {EXTRA_SCENARIO_MUSIC "wanderer.ogg"}
    {EXTRA_SCENARIO_MUSIC "nunc_dimittis.ogg"}

    {STORYTXT_THE_HEART_FOREST}

    {TWO_SUNS_DEFAULT_SCHEDULE}

    # wmllint: validate-off
    [side]
        side=1
        controller=human
        save_id=player
        team_name=good
        user_team_name= _ "team_name^Elynia"

        shroud=yes
        fog=yes
        {GOLD 175 175 160}

        # wmllint: recognize Elynia
        {CHARACTER_STATS_ELYNIA}
    [/side]
    # wmllint: validate-on

    [side]
        side=2
        team_name=bandits
        user_team_name= _ "team_name^Thieves"

        hidden=yes
        no_leader=yes

        recruit=Thief,Footpad,Poacher
        gold=0
        {NO_INCOME}
    [/side]

    [side]
        side=3
        team_name=forest
        user_team_name= _ "team_name^Trolls"

        recruit=Troll Whelp
        {GOLD 150 175 190}

        type=Troll Rocklobber
        id=Reck
        name= _ "Reck"
        canrecruit=yes
        unrenamable=yes
        [modifications]
            {TRAIT_FEARLESS}
            {TRAIT_RESILIENT}
        [/modifications]
    [/side]

    [side]
        side=4
        team_name=forest,bandits
        user_team_name= _ "team_name^Forest Creatures"

        hidden=yes
        no_leader=yes

        gold=0
        {NO_INCOME}
        village_gold=0

        {GENERIC_UNIT () (Wolf) 39 11} {GUARDIAN} {NO_UPKEEP_NO_OVERLAY}
#ifndef EASY
        {GENERIC_UNIT () (Wolf) 40 11} {GUARDIAN} {NO_UPKEEP_NO_OVERLAY}
#endif
#ifdef HARD
        {GENERIC_UNIT () (Wolf) 39 12} {GUARDIAN} {NO_UPKEEP_NO_OVERLAY}
#endif

        {GENERIC_UNIT () (Wolf)  2 23} {GUARDIAN} {NO_UPKEEP_NO_OVERLAY}
#ifndef EASY
        {GENERIC_UNIT () (Wolf)  1 24} {GUARDIAN} {NO_UPKEEP_NO_OVERLAY}
#endif
#ifdef HARD
        {GENERIC_UNIT () (Wolf)  1 23} {GUARDIAN} {NO_UPKEEP_NO_OVERLAY}
#endif

        {GENERIC_UNIT () (Wolf) 11 50} {GUARDIAN} {NO_UPKEEP_NO_OVERLAY}
#ifndef EASY
        {GENERIC_UNIT () (Wolf) 12 50} {GUARDIAN} {NO_UPKEEP_NO_OVERLAY}
#endif
#ifdef HARD
        {GENERIC_UNIT () (Wolf) 12 49} {GUARDIAN} {NO_UPKEEP_NO_OVERLAY}
#endif
    [/side]

    [side]
        side=5
        team_name=forest,bandits
        user_team_name= _ "team_name^Birds"
        color=pink

        hidden=yes
        no_leader=yes

        gold=0
        {NO_INCOME}
        village_gold=0

        {IS_HOSTILE_NPC}

        {GENERIC_UNIT () (Falcon) 17 41} {GUARDIAN}
        {GENERIC_UNIT () (Falcon)  4 30} {GUARDIAN}
        {GENERIC_UNIT () (Falcon) 32 14} {GUARDIAN}
        {GENERIC_UNIT () (Falcon) 26  2} {GUARDIAN}
        {GENERIC_UNIT () (Falcon)  5 10} {GUARDIAN}
        {GENERIC_UNIT () (Falcon) 17 22} {GUARDIAN}
        {GENERIC_UNIT () (Falcon) 35 26} {GUARDIAN}
    [/side]

    {NPC_BIRD_BEHAVIOR 5 1 40 1 50}

    {STARTING_VILLAGES 1 4}

    {STARTING_VILLAGES 3 6}

    {SET_LABEL 17  3 ( _ "Talwyn")}
    {SET_LABEL 20  8 ( _ "Talwyn Bridge")}

    {PLACE_IMAGE "items/burial.png"           27 33}
    {PLACE_IMAGE "items/burial.png~FL(horiz)" 23 34}
    {PLACE_IMAGE "items/burial.png"            8 34}
    {PLACE_IMAGE "items/burial.png"           11 33}
    {PLACE_IMAGE "items/straw-bale2.png"       8  6}
    {PLACE_IMAGE "scenery/trash.png"          20  1}

    [event]
        name=prestart

        {VARIABLE seen_bridge_town no}

        # wmllint: recognize Durvan
        {RECALL_DURVAN}

        [allow_recruit]
            side=1
            type=Poacher,Thug
        [/allow_recruit]

        {OBJECTIVES (
            {OBJECTIVE_VICTORY ( _ "Reach the top edge of the map")}

            {OBJECTIVE_DEFEAT  ( _ "Death of Elynia")}
            {OBJECTIVE_DEFEAT  ( _ "Death of Durvan")}

            {TURNS_RUN_OUT}

            {OBJECTIVE_CARRYOVER}
        )}
    [/event]

    [event]
        name=start
        [message]
            speaker=Elynia
            message= _ "Frankly, when the village chief said ‘capable’ I was expecting something better."
        [/message]

        [message]
            speaker=Durvan
            message= _ "It’d be a grave mistake to underestimate us, lass. Life ’round here ain’t easy these days, and we have to be prepared to deal with anything."
        [/message]

        [message]
            speaker=Elynia
            message= _ "I’m well aware of that, having lived in the wilderness myself before, but these are mostly novices and untrained youths!"
        [/message]

        [message]
            speaker=Durvan
            message= _ "The chief wouldn’t want to send off veterans on the chance that our home is attacked again. Anyway, we’d better get going. Look out for the trolls that control this road — they hunt unwary travelers and eat them alive."
        [/message]
    [/event]

    {HERO_DEATH_BASE
    (Durvan)
    (
        [message]
            speaker=unit
            message= _ "Blast! I wasn’t counting on this happening!"
        [/message]
    ) ()}

    [event]
        name=moveto
        [filter]
            side=1
            [filter_adjacent]
                id=Reck
            [/filter_adjacent]
            [or]
                id=Reck
                [filter_adjacent]
                    side=1
                [/filter_adjacent]
            [/or]
        [/filter]

        [message]
            speaker=Reck
            message= _ "Reck don’t like humans on his base. We smash them!"
        [/message]
    [/event]

    [event]
        name=last breath
        [filter]
            id=Reck
        [/filter]

        [message]
            speaker=Reck
            message= _ "Reck dying... and don’t know why."
        [/message]
    [/event]

    {PLACE_IMAGE "items/gold-coins-small.png" 13 36}

    [event]
        name=moveto
        [filter]
            side=1
            x,y=13,36
        [/filter]

        [message]
            speaker=unit
            message= _ "That big troll was hoarding a considerable amount of gold in these ruins."
        [/message]

        {RETRIEVE_GOLD ({DIFF 120 100 80})}

        [remove_item]
            x,y=$x1,$y1
        [/remove_item]
    [/event]

    [event]
        name=moveto
        [filter]
            side=1
            x=1-40
            y=1-28
        [/filter]

        [fire_event]
            name=allyna_appearance
            [primary_unit]
                x,y=$x1,$y1
            [/primary_unit]
        [/fire_event]
    [/event]

    [event]
        name=allyna_appearance

        [unit]
            id=Dremorran
            name= _ "Dremorran"
            type=Fugitive
            side=2
            placement=leader
            canrecruit=yes
            [modifications]
                {TRAIT_RESILIENT}
                {TRAIT_QUICK}
            [/modifications]
        [/unit]

        [modify_side]
            side=2
            hidden=no
            {GOLD 160 190 210}
            {INCOME 2 3 4}
        [/modify_side]

        [store_starting_location]
            side=2
        [/store_starting_location]

        {CAPTURE_VILLAGES 2 $location.x $location.y 6}

        {CLEAR_VARIABLE location}

#define THF_GUARD _TYPE _X _Y
    {GENERIC_UNIT 2 ({_TYPE}) ({_X}) ({_Y})} {NO_UPKEEP_NO_OVERLAY} {GUARDIAN}
#enddef

#define THF_NAMED _TYPE _ID _NAME _X _Y
    {NAMED_UNIT 2 ({_TYPE}) ({_X}) ({_Y}) ({_ID}) ({_NAME}) (
        upkeep=free
        random_traits=yes
        random_gender=no
        [variables]
            bandit=yes
        [/variables]
    )}
#enddef

        # wmllint: whofield THF_NAMED 2

        {THF_GUARD (Bandit) 14 3}
        {THF_GUARD (Rogue)  14 5}
        {THF_GUARD (Bandit) 21 9} {FACING se}

        # wmllint: recognize Allyna
        [unit]
            {CHARACTER_STATS_ALLYNA}
            side=1
            facing=n
            x,y=20,25
        [/unit]

        # Used later in an event
#define THF_BANDITS_LIST
    "Cic,Glynvan,Quorren,Caror,Danon"
#enddef

        {THF_NAMED (Thief) (Cic) ( _ "Cic") 21 21} {FACING s}
        {THF_NAMED (Footpad) (Glynvan) ( _ "Glynvan") 18 22} {FACING se}
        {THF_NAMED (Footpad) (Quorren) ( _ "Quorren") 20 23} {FACING s}
        {THF_NAMED (Footpad) (Caror) ( _ "Caror") 24 21} {FACING sw}
        {THF_NAMED (Thug) (Danon) ( _ "Danon") 23 24} {FACING sw}

        # wmllint: whofield clear THF_NAMED

#undef THF_GUARD
#undef THF_NAMED

        [remove_shroud]
            side=1
            x,y=19,25
            radius=6
            [and]
                x,y=23,22
                radius=6
            [/and]
        [/remove_shroud]

        [redraw]
            side=1
        [/redraw]

        [message]
            speaker=unit
            message= _ "I hear some commotion ahead..."
        [/message]

        [scroll_to_unit]
            id=Allyna
        [/scroll_to_unit]

        [redraw][/redraw]

        [delay]
            time=500
        [/delay]

        [message]
            speaker=Quorren
            message= _ "Drop everything you’re carrying with you gal, and we may spare your pretty neck!"
        [/message]

        [message]
            speaker=Elynia
            message= _ "We don’t have time for this—"
        [/message]

        [message]
            speaker=Durvan
            message= _ "We can’t just leave that poor girl at their mercy! We must help her!"
        [/message]

        [message]
            speaker=Elynia
            message= _ "(sigh) Of course, that’s what I was planning to do anyway."
        [/message]

        {OBJECTIVES (
            victory_string= _ "Current Objectives:"
            {OBJECTIVE_VICTORY ( _ "Save Allyna from the bandits")}

            {OBJECTIVE_DEFEAT  ( _ "Death of Elynia")}
            {OBJECTIVE_DEFEAT  ( _ "Death of Durvan")}
            {OBJECTIVE_DEFEAT  ( _ "Death of Allyna")}

            {TURNS_RUN_OUT}

            {OBJECTIVE_CARRYOVER}
        )}
    [/event]

    {HERO_DEATH_BASE
    (Allyna)
    (
        [message]
            speaker=unit
            message= _ "Alas! I never got a chance to see the great towers of the capital!"
        [/message]
    ) (
        [message]
            speaker=Durvan
            message= _ "We shouldn’t have let this happen!"
        [/message]
    )}

    [event]
        name=die
        first_time_only=no
        [filter]
            id={THF_BANDITS_LIST}
        [/filter]

        #
        # TODO: We need a more elaborate mechanism to detect when Allyna is
        #       out of danger.
        #

        [if]
            [not]
                [have_unit]
                    count=3-4
                    id={THF_BANDITS_LIST}
                    [not]
                        x,y=$x1,$y1
                    [/not]
                [/have_unit]
            [/not]
            [then]
                [fire_event]
                    name=allyna_introduction
                [/fire_event]
            [/then]
        [/if]
    [/event]

    [event]
        name=moveto
        [filter]
            side=1
            x=1-40
            y=1-9
        [/filter]

        [allow_undo][/allow_undo]

        {VARIABLE seen_bridge_town yes}

        [fire_event]
            name=save_bridge_town_objectives
        [/fire_event]
    [/event]

    [event]
        name=allyna_introduction
        first_time_only=yes

        [message]
            speaker=Allyna
            message= _ "Oh, thank you for saving my life, sir, I’ll be forever grateful! Is there anything I could do to repay you?"
        [/message]

        [message]
            speaker=Durvan
            message= _ "Hm, actually, it is this lass here who is leading us..."
        [/message]

        [message]
            side=1
            [not]
                id=Durvan
            [/not]
            [not]
                id=Elynia
            [/not]
            [not]
                id=Allyna
            [/not]
            message= _ "She’s the legendary Lady of Light!"
        [/message]

        [message]
            speaker=Allyna
            message= _ "Oh, I see! I beg your pardon, my lady."
        [/message]

        [message]
            speaker=Elynia
            message= _ "May I ask what business brings a young girl like you to such a dangerous location alone? What’s your name, anyway?"
        [/message]

        [message]
            speaker=Allyna
            message= _ "I’m Allyna of Dalbloom, from the eastern border. It’s a very tiny village, so you may not have heard of it before. I was sent on a mission to deliver an important message to the Grand Council of the—"
        [/message]

        [message]
            speaker=Elynia
            message= _ "Sure, we also need to deliver our own messages to them. I would strongly suggest that you join us — it’s a miracle that you have made it this far through these uncivilized lands in one piece. What do you think?"
        [/message]

        [message]
            speaker=Allyna
            message= _ "Yes! —I mean, if it doesn’t bother you, of course. Sure it is uncivilized around here — I don’t think I have ever seen a town get ransacked like that before..."
        [/message]

        [if]
            {VARIABLE_BOOLEAN_EQUALS seen_bridge_town no}
            [then]
                [message]
                    speaker=Durvan
                    message= _ "What are you talking about?"
                [/message]

                [message]
                    speaker=Allyna
                    message= _ "The bridge town ahead was captured by a large armed band. I turned back as soon as I could, but some of their brutes chased me, and then I found you!"
                [/message]

                [message]
                    speaker=Elynia
                    message= _ "Sounds like we may have to cleanse the town a bit before proceeding, then."
                [/message]

                [message]
                    speaker=Durvan
                    message= _ "Good plan. Gods, I never thought Talwyn would fall like that..."
                [/message]

                [fire_event]
                    name=save_bridge_town_objectives
                [/fire_event]
            [/then]
        [/if]
    [/event]

    [event]
        name=save_bridge_town_objectives

        {OBJECTIVES (
            {OBJECTIVE_VICTORY ( _ "Defeat the bandit leader in Talwyn")}

            {OBJECTIVE_DEFEAT  ( _ "Death of Elynia")}
            {OBJECTIVE_DEFEAT  ( _ "Death of Durvan")}
            {OBJECTIVE_DEFEAT  ( _ "Death of Allyna")}

            {TURNS_RUN_OUT}

            {OBJECTIVE_CARRYOVER}
        )}
    [/event]

    [event]
        name=last breath
        [filter]
            id=Dremorran
        [/filter]

        [message]
            speaker=Dremorran
            message= _ "No! All our efforts have been in vain!"
        [/message]
    [/event]

    [event]
        name=die
        [filter]
            id=Dremorran
        [/filter]

        [fire_event]
            name=allyna_introduction
        [/fire_event]

        {ENDLEVEL_VICTORY yes}
    [/event]

    [event]
        name=victory

        [message]
            speaker=Durvan
            message= _ "Onwards we go, to the capital!"
        [/message]

        [message]
            speaker=Allyna
            message= _ "So are you truly the Lady of Light? I’ve heard many amazing stories about you! Do you mind if I ask you some questions?"
        [/message]

        {CLEAR_VARIABLE seen_bridge_town}
    [/event]

#undef THF_BANDITS_LIST
[/scenario]

# kate: indent-mode normal; encoding utf-8; space-indent on;


#textdomain wesnoth-After_the_Storm

[scenario]
    id=03_01_Unrest_in_Raelthyn
    name= _ "Unrest in Raelthyn"
    {MAP 03_01_Unrest_in_Raelthyn.map}
    turns=-1
    next_scenario=03_02_Revelations
    victory_when_enemies_defeated=no

    {FULLSCREEN_CUTSCENE_UI}

    {SCENARIO_MUSIC "loyalists.ogg"} {CONTINUE_PLAYING_STORY_MUSIC_FIRST}

    {STORYTXT_UNREST_IN_RAELTHYN}

    {LONGDARK2}

    # wmllint: validate-off
    [side]
        side=1
        controller=human
        save_id=player
        team_name=good
        user_team_name= _ "team_name^Elynia"

        {NO_ECONOMY}

        # wmllint: recognize Elynia
        {CHARACTER_STATS_ELYNIA}
    [/side]
    # wmllint: validate-on

    # Castle
    [side]
        side=2
        team_name=good
        user_team_name= _ "team_name^Raelthyn"
        {ARAGWAITH_FLAG}
        color=blue

        {NO_ECONOMY}

        canrecruit=yes
        type=Aragwaith Greatbow
        id=Dethanel
        name= _ "Dethanel"
        [modifications]
            {TRAIT_RESILIENT}
            {TRAIT_INTELLIGENT}
        [/modifications]
    [/side]

    # City
    [side]
        side=3
        team_name=good
        user_team_name= _ "team_name^Raelthyn"
        {ARAGWAITH_FLAG}
        color=purple
        hidden=yes

        {NO_ECONOMY}

        canrecruit=yes
        type=Aragwaith Slayer
        id=Lord Durstrang
        name= _ "Lord Durstrang"
        #profile="portraits/humans/marshal-2.png"
        [modifications]
            {TRAIT_STRONG}
            {TRAIT_RESILIENT}
        [/modifications]
    [/side]

    # Arnesius
    [side]
        side=4
        team_name=good
        user_team_name= _ "team_name^Raelthyn"
        {ARAGWAITH_FLAG}
        no_leader=yes
        color=black
        hidden=yes

        {NO_ECONOMY}
    [/side]

    # Torancyn
    [side]
        side=5
        team_name=good
        user_team_name= _ "team_name^Raelthyn"
        {ARAGWAITH_FLAG}
        no_leader=yes
        color=orange
        hidden=yes

        {NO_ECONOMY}
    [/side]

    # Valen
    [side]
        side=6
        team_name=good
        user_team_name= _ "team_name^Raelthyn"
        {ARAGWAITH_FLAG}
        no_leader=yes
        color=teal
        hidden=yes

        {NO_ECONOMY}
    [/side]

    {STARTING_VILLAGES_ALL 3}
    {STARTING_VILLAGES 2 4}

    [label]
        x,y=33,4
        text= _ "Arphalad"
    [/label]

    [label]
        x,y=29,9
        text= _ "River Lorin"
    [/label]

    [label]
        x,y=17,26
        text= _ "Lake Wylven"
    [/label]

    [label]
        x,y=13,16
        text= _ "Adavyan’s Keep"
    [/label]

    [label]
        x,y=5,11
        text= _ "Danaerad"
    [/label]

    [label]
        x,y=23,6
        text= _ "Tower of Silence"
    [/label]

    {PLACE_IMAGE scenery/leanto.png 5 5}
    {PLACE_IMAGE scenery/temple1.png 10 7}
    {PLACE_IMAGE scenery/oak-leaning.png 18 17}
    {PLACE_IMAGE scenery/oak-leaning.png 18  8}
    {PLACE_IMAGE scenery/oak-leaning.png 10  8}
    {PLACE_IMAGE items/archery-target-right.png 3 10}
    {PLACE_IMAGE items/archery-target-right.png 13 14}

    {PLACE_IMAGE "scenery/temple1.png" 30  1}
    {PLACE_IMAGE "items/straw-bale1.png" 37  4}
    {PLACE_IMAGE "items/straw-bale2.png" 35 22}
    {PLACE_IMAGE "items/grain-sheaf.png" 38 30}
    {PLACE_IMAGE "items/straw-bale1.png" 31 34}
    {PLACE_IMAGE "items/straw-bale1.png" 39 22}

#define UIR_HIGH _TYPE _X _Y
    {GENERIC_UNIT 2 ({_TYPE}) ({_X}) ({_Y})} {NO_UPKEEP_NO_OVERLAY}
#enddef
#define UIR_LOW _TYPE _X _Y
    {GENERIC_UNIT 3 ({_TYPE}) ({_X}) ({_Y})} {NO_UPKEEP_NO_OVERLAY}
#enddef

    [event]
        name=prestart
        # wmllint: recognize Durvan
        {RECALL_DURVAN}
        # wmllint: recognize Allyna
        {RECALL_ALLYNA}

        {FACE_DIRECTION side=1 nw}

        {UIR_LOW (Aragwaith Pikeman)       26 22} {FACING se}
        {UIR_LOW (Aragwaith Pikeman)       22 24} {FACING se}
        {UIR_LOW (Aragwaith Pikeman)       29 16} {FACING se}
        {UIR_LOW (Aragwaith Pikeman)       29 12} {FACING se}

        {UIR_LOW (Aragwaith Pikeman)       19 28} {FACING se}
        {UIR_LOW (Aragwaith Pikeman)       14 29} {FACING sw}
        {UIR_LOW (Aragwaith Pikeman)        4 29} {FACING sw}
        {UIR_LOW (Aragwaith Pikeman)        4 26} {FACING sw}
        {UIR_LOW (Aragwaith Guard)          2 23} {FACING sw}

        {UIR_HIGH (Aragwaith Guardian)      2 17} {FACING sw}

        {UIR_LOW (Aragwaith Guard)          1 10} {FACING sw}
        {UIR_LOW (Aragwaith Pikeman)        2  2} {FACING nw}
        {UIR_LOW (Aragwaith Guard)          9  3} {FACING nw}

        {UIR_HIGH (Aragwaith Shield Guard) 17  3} {FACING ne}
        {UIR_LOW (Aragwaith Pikeman)       19  4} {FACING ne}
        {UIR_LOW (Aragwaith Pikeman)       27  7} {FACING ne}

        {UIR_HIGH (Aragwaith Strongbow)    17 12} {FACING se}
        {UIR_HIGH (Aragwaith Guardian)     19 15} {FACING nw}
        {UIR_HIGH (Aragwaith Captain)      13 23} {FACING sw}

        {UIR_LOW (Aragwaith Guard)         27  1} {FACING ne}
        {UIR_LOW (Aragwaith Guard)         28  2} {FACING ne}

        {UIR_LOW (Ruffian)                 20  6} {FACING se}

        {UIR_LOW (Peasant)                 38 29} {FACING se}
        {UIR_LOW (Woodsman)                35 28} {FACING nw}

        # wmllint: recognize Valen
        [unit]
            {CHARACTER_STATS_VALEN}
            canrecruit=yes
            side=6
            x,y=22,11
            facing=sw
        [/unit]

        # wmllint: recognize Torancyn
        [unit]
            {CHARACTER_STATS_TORANCYN}
            canrecruit=yes
            side=5
            x,y=6,12
            facing=nw
        [/unit]

        # wmllint: recognize Arnesius
        [unit]
            {CHARACTER_STATS_ARNESIUS}
            canrecruit=yes
            side=4
            x,y=13,8
            facing=se
        [/unit]

        {NAMED_UNIT 3 (Aragwaith Pikeman) 32 31 Darren ( _ "Darren") (
            upkeep=free
            random_traits=yes
            facing=nw
        )}

        {NAMED_UNIT 3 (Aragwaith Pikeman) 24 25 Aethyncyn ( _ "Aethyncyn") (
            upkeep=free
            random_traits=yes
            facing=se
        )}

        {LOCK_VIEW}
    [/event]

#undef UIR_LOW
#undef UIR_HIGH

    [event]
        name=start

        [message]
            speaker=Durvan
            message= _ "Finally, the walls of Raelthyn! It’s a pity it’s too dark to see the glory of the capital city!"
        [/message]

        [message]
            speaker=Elynia
            message= _ "I have been here before. Now, let’s move."
        [/message]

        # wmlindent: start ignoring
        {MOVE_UNIT (id=Durvan)
            (33,33,31,28)
            (32,31,30,29)
        }
        # wmlindent: stop ignoring

        [message]
            speaker=Lord Durstrang
            message= _ "Halt! Who goes there?"
        [/message]

        [message]
            speaker=Durvan
            message= _ "I’m a humble messenger from the small village of Suthwood in the Heart Forest. We came here to meet with the Grand Council."
        [/message]

        [message]
            speaker=Lord Durstrang
            message= _ "You and who else?"
        [/message]

        # wmlindent: start ignoring
        {MOVE_UNIT (id=Allyna)
            (33,33,31,30)
            (32,31,30,28)
        }
        {MOVE_UNIT (id=Elynia)
            (33,33,31,29)
            (32,31,30,29)
        }
        # wmlindent: stop ignoring

        [message]
            speaker=Lord Durstrang
            message= _ "Seize the traitor!"
        [/message]

        [message]
            speaker=Durvan
            message= _ "Traitor? Who?"
        [/message]

        {MOVE_UNIT (id=Aethyncyn) 28 28}
        {MOVE_UNIT (id=Darren)    30 29}

        [message]
            speaker=Elynia
            message= _ "Exactly what in the world is going on here?"
        [/message]

        [message]
            speaker=Lord Durstrang
            message= _ "You, faerie, are accused of betraying the Alliance of the Peoples of the Far North, leading an elvish faction found to be collaborating with our enemies in times of war, and disclosing vital tactical information which jeopardizes the safety of the Aragwaith country and our allies."
        [/message]

        [delay]
            time=500
        [/delay]

        [message]
            speaker=Elynia
            message= _ "Certainly, this must be some kind of misunderstanding... I would never shift my allegiances against what’s best for the free civilizations of Irdya!"
        [/message]

        # wmlindent: start ignoring
        {MOVE_UNIT (id=Torancyn)
            (10,17,22,22,25)
            (14,18,20,22,24)
        }
        # wmlindent: stop ignoring

        [message]
            speaker=Torancyn
            message= _ "Imprisoning her will not be necessary. Allow her to come to the Grand Council."
        [/message]

        [message]
            speaker=Lord Durstrang
            message= _ "But, my lord..."
        [/message]

        # wmlindent: start ignoring
        {MOVE_UNIT (id=Arnesius)
            (14,14,16,16,17,17,22,22,24,24)
            (10,13,14,15,16,18,20,22,23,25)
        }
        {MOVE_UNIT (id=Valen)
            (23,23,25,25,27,27,22,22,25,25)
            (12,13,14,16,17,18,20,22,24,25)
        }
        # wmlindent: stop ignoring

        [message]
            speaker=Valen
            message= _ "A trial won’t be required either. She’s been framed by the enemy."
        [/message]

        [message]
            speaker=Arnesius
            message= _ "Elynia, we have been eagerly awaiting your return. It’s been a long time..."
        [/message]

        [message]
            speaker=Elynia
            message= _ "Lord Arnesius, it’s good to see you again. Something terrible has happened..."
        [/message]

        [message]
            speaker=Arnesius
            message= _ "Yes, yes... Valen has told us everything, and there’s more you need to know as well. Come with us."
        [/message]

        [message]
            speaker=Durvan
            message= _ "My Lord, I— our messengers were promised an audience with the Council as well..."
        [/message]

        [message]
            speaker=Arnesius
            message= _ "That will have to wait while we discuss some war matters, but since you have come from so far protecting her, you may also come and listen."
        [/message]

        [message]
            speaker=Durvan
            message= _ "Very well, my lord."
        [/message]

        {ENDLEVEL_QUIET} {NO_START_OF_SCENARIO_SAVE} {NO_REPLAY_SAVE}
    [/event]
[/scenario]

# kate: indent-mode normal; encoding utf-8; space-indent on;


#textdomain wesnoth-After_the_Storm

[scenario]
    id=03_02_Revelations
    name= _ "Revelations"
    {MAP 03_02_Revelations.map}
    turns=-1
    next_scenario=04_Shifting_Allegiances
    victory_when_enemies_defeated=no

    {CUTSCENE_UI}

    {SCENARIO_MUSIC       "revelation.ogg"}
    {EXTRA_SCENARIO_MUSIC "heroes_rite.ogg"}
    {EXTRA_SCENARIO_MUSIC "nunc_dimittis.ogg"}
    {EXTRA_SCENARIO_MUSIC "underground.ogg"}

    #{STORYTXT_REVELATIONS}

    {INDOORS}

    # wmllint: validate-off
    [side]
        side=1
        controller=human
        save_id=player
        team_name=good
        user_team_name= _ "team_name^Elynia"

        {NO_ECONOMY}

        # wmllint: recognize Elynia
        {CHARACTER_STATS_ELYNIA}
        facing=se
    [/side]

    # Arnesius
    [side]
        side=2
        team_name=good
        user_team_name= _ "team_name^Raelthyn"
        {ARAGWAITH_FLAG}
        color=black

        {NO_ECONOMY}

        # wmllint: recognize Arnesius
        canrecruit=yes
        {CHARACTER_STATS_ARNESIUS}
        facing=sw
    [/side]

    # Torancyn
    [side]
        side=3
        team_name=good
        user_team_name= _ "team_name^Raelthyn"
        {ARAGWAITH_FLAG}
        color=orange

        {NO_ECONOMY}

        # wmllint: recognize Torancyn
        canrecruit=yes
        {CHARACTER_STATS_TORANCYN}
        facing=sw
    [/side]

    # Valen
    [side]
        side=4
        team_name=good
        user_team_name= _ "team_name^Raelthyn"
        {ARAGWAITH_FLAG}
        color=teal

        {NO_ECONOMY}

        # wmllint: recognize Valen
        canrecruit=yes
        {CHARACTER_STATS_VALEN}
        facing=nw
    [/side]
    # wmllint: validate-on

    [event]
        name=prestart
        # wmllint: recognize Durvan
        {RECALL_DURVAN}
        # wmllint: recognize Allyna
        {RECALL_ALLYNA}

        {FACE_DIRECTION (side=1) se}

        {LOCK_VIEW}
    [/event]

    [event]
        name=start

        [message]
            speaker=Arnesius
            message= _ "We’d like to start by apologizing for our actions, or more accurately, our lack thereof. Had we understood the importance of your mission to Zocthanol we’d have sent a whole fleet with you, and Galas’ demise could have surely been avoided."
        [/message]

        [message]
            speaker=Elynia
            message= _ "I... I don’t think that would have made a great difference. The storm that caught us was a trap set up by our enemies."
        [/message]

        [message]
            speaker=Torancyn
            message= _ "As soon as we got word of your plan to assault the Wesmere hive on your own, we sent a platoon in your aid, but their path was obstructed by those Shaxthal creatures, who took over the Bay of Glamdrol to the south-west."
        [/message]

        [message]
            speaker=Torancyn
            message= _ "By the time the soldiers arrived, it was already too late. Not only did we not find you or the lich Mal Keshar, but the plains had completely disappeared."
        [/message]

        [delay]
            time=1000
        [/delay]

        [message]
            speaker=Elynia
            message= _ "But... disappeared?"
        [/message]

        [message]
            speaker=Arnesius
            message= _ "Everything vanished at the center of the explosion from which you escaped. The hive, the rocks, the clouds — everything had completely disappeared, according to the reports we got. The area surrounding the massive crater turned into a vast ashy desert devoid of any traces of life, artificial or otherwise. They also said the air itself had turned thin as in the tallest peaks of the Heart Mountains. We could only assume you had also been caught in the explosion and were destroyed along with the necromancer."
        [/message]

        [message]
            speaker=Arnesius
            message= _ "With the ongoing war, we couldn’t spend much time or resources in searching for you, so we decided to seek assistance from a seer who could tell us what happened and why. That’s when we found Valen, who has been of great help to us this past year."
        [/message]

        [delay]
            time=1000
        [/delay]

        [message]
            speaker=Elynia
            message= _ "Hold on..."
        [/message]

        [delay]
            time=1000
        [/delay]

        [message]
            speaker=Elynia
            message= _ "That isn’t possible! A year? But— it has been— it has been less than a month!"
        [/message]

        [delay]
            time=1000
        [/delay]

        [message]
            speaker=Valen
            message= _ "For you, my lady, time only continued to flow after the point you reappeared in our country’s borders, but for us, time has gone by as usual. It’s been a little more than a year since the destruction of Wesmere."
        [/message]

        [message]
            speaker=Arnesius
            message= _ "We suspect you were at the very center of the explosion, which may have caused an anomaly that brought you forward in time."
        [/message]

        [delay]
            time=750
        [/delay]

        [message]
            speaker=Elynia
            message= _ "... Actually, it may be my own fault. I used a teleportation spell I had just learned, without mastering it first, just as I felt as though my very existence had come to an end..."
        [/message]

        [delay]
            time=500
        [/delay]

        [message]
            speaker=Elynia
            message= _ "But the entire place vanishing doesn’t make sense... How could that happen?"
        [/message]

        [message]
            speaker=Torancyn
            message= _ "There are many things we still haven’t learned about our enemies that are, perhaps, essential for putting an end to this war."
        [/message]

        [message]
            speaker=Elynia
            message= _ "Where’s Kyara? And Horo? We sent them to you after securing the Chaos outpost in Wesmere!"
        [/message]

        [message]
            speaker=Arnesius
            message= _ "I fear we have never heard those names before."
        [/message]

        [message]
            speaker=Torancyn
            message= _ "Assuming they stumbled upon the same class and number of enemies as our men did, it’s very likely they didn’t make it."
        [/message]

        [delay]
            time=1000
        [/delay]

        [message]
            speaker=Valen
            message= _ "If you can provide me with more information, I may be able to find out what occurred to them, but it will take time."
        [/message]

        [message]
            speaker=Torancyn
            message= _ "While Valen was trying to determine your whereabouts, new riots took place between the elves in the lands to the east. There are rumors of a certain rose-haired faerie allying herself with the leaders of the Chaos Empire, which is why you and your people have become rather unpopular amongst our peers."
        [/message]

        [message]
            speaker=Arnesius
            message= _ "The elves are once again divided and fighting their own kinsmen on the eastern border of our country, but one of the factions is clearly at an advantage thanks to their alliance with the Empire. We suspect they may be planning to invade us next, taking advantage of the tight situation on the southern borders."
        [/message]

        [message]
            speaker=Torancyn
            message= _ "Furthermore, it is said a great explosion took place in Glamdrol a few days ago. We haven’t received any confirmation yet, but we fear it’s of a similar nature to the one which destroyed Wesmere. If that’s true, then we have just lost our largest western garrison."
        [/message]

        [message]
            speaker=Elynia
            message= _ "I see..."
        [/message]

        [message]
            speaker=Arnesius
            message= _ "It’s of utmost importance that the situation in the east is cleared up. The friendly elvish faction has asked us for aid, but as it is now we are unable to gather the complete Council to come to an agreement. We currently don’t have many men to spare, so it has been suggested that you could lead a militia in order to assist them, and hopefully discover the identity of this mysterious impersonator."
        [/message]

        [message]
            speaker=Elynia
            message= _ "I think I’ve had enough experience with leading militiamen in the forests for my liking, and I highly doubt they could stand a chance against those demons and biomechanical creatures."
        [/message]

        [message]
            speaker=Durvan
            message= _ "Eh?"
        [/message]

        [message]
            speaker=Torancyn
            message= _ "It was never our intention to send you alone with barely-trained fighters. Amongst your messengers was one of Mal Keshar’s very own disciples, a woman by the name of Zynara. She’s willing to assist by leading a new undead horde against our enemies for you."
        [/message]

        [message]
            speaker=Arnesius
            message= _ "If you agree to help us, we will also make sure to keep you informed of any important events from the main battle front, sending you messages through Valen. You’ll also be able to communicate with us this way."
        [/message]

        [delay]
            time=1000
        [/delay]

        [message]
            speaker=Elynia
            message= _ "There’s a very important journal we retrieved from the Chaos capital, and Mal Keshar told me before his destruction that he passed it to Kyara, the desert elf, in case neither of us would make it back from the hive. It is my hope that she and Horo are still alive somewhere, or that at the very least they passed the journal to another trustworthy person. I will agree to lead the expedition on the condition that you also do your best to locate it."
        [/message]

        [message]
            speaker=Arnesius
            message= _ "That’s a fair deal, although I would first like to know what this journal contains that makes it such a great priority for you, over your reputation and people."
        [/message]

        [message]
            speaker=Elynia
            message= _ "Mal Keshar didn’t get a chance to talk with me about the contents of the journal besides the location of the hive, where the heart of Yechnagoth was supposedly stored. Before his destruction, he referred to “a greater cause, one that transcends the fate of Irdya” — I have a feeling that it’s about something he read in it. The journal was written by the Chaos Emperor himself, so the information within should be accurate and relevant for our purposes."
        [/message]

        [delay]
            time=750
        [/delay]

        [message]
            speaker=Elynia
            message= _ "That is, assuming the heart of the colossal creature we destroyed in Wesmere was truly Yechnagoth’s."
        [/message]

        [message]
            speaker=Valen
            message= _ "I’ll do whatever it takes to find out about that journal, my lady."
        [/message]

        [message]
            speaker=Arnesius
            message= _ "Very well, then. Tomorrow we’ll provide you with further instructions for your mission. We’ll talk with the messengers from Suthwood now."
        [/message]

        {ENDLEVEL_CONTINUE} {NO_REPLAY_SAVE}
    [/event]
[/scenario]

# kate: indent-mode normal; encoding utf-8; space-indent on;


#textdomain wesnoth-After_the_Storm

[scenario]
    id=04_Shifting_Allegiances
    name= _ "Shifting Allegiances"
    {MAP 04_Shifting_Allegiances.map}
    {TURNS 28 27 26}
    next_scenario=05_The_Eastern_Front

    {D_DEATHS}

    {SCENARIO_MUSIC       "nunc_dimittis.ogg"}
    {EXTRA_SCENARIO_MUSIC "breaking_the_chains.ogg"}
    {EXTRA_SCENARIO_MUSIC "battle.ogg"}

    {STORYTXT_SHIFTING_ALLEGIANCES}

    {DAWN2}
    {MORNING2}
    {MIDDAY2}
    {AFTERNOON2}
    {DUSK2}
    {LONGDARK1}
    {LONGDARK2}
    {LONGDARK3}
    {LONGDARK4}
    {DAWN1}
    {MORNING1}
    {MIDDAY1}
    {AFTERNOON1}
    {DUSK1}
    {SHORTDARK}

    {SHAXTHAL_SET_SURFACE_VARIATIONS_FLAG}

    # wmllint: validate-off
    [side]
        side=1
        controller=human
        save_id=player
        team_name=good
        user_team_name= _ "team_name^Elynia"

        {GOLD 190 180 175}

        # wmllint: recognize Elynia
        {CHARACTER_STATS_ELYNIA}
    [/side]

    [side]
        side=2
        team_name=rebels
        user_team_name= _ "team_name^Demons"
        {RAGGED_FLAG}
        color=black

        # wmllint: recognize Elorran
        {CHARACTER_STATS_ELORRAN}
        canrecruit=yes
        facing=sw

        {GOLD 135 120 110}
        recruit=Demon,Faerie Sprite,Animated Rock

        {ai/aliases/stable_singleplayer.cfg}
        [ai]
            {AI_SIMPLE_ALWAYS_ASPECT recruitment_pattern "archer,mixed fighter,fighter,fighter,fighter,mixed fighter"}

            #
            # Ignore Elorran for attacking
            #

            {AI_SIMPLE_ALWAYS_ASPECT passive_leader yes}

            #
            # Become defensive on turn 3
            #

            {AI_ASPECT "grouping" (
                [facet]
                    value="no"
                    turns="1-2"
                [/facet]
                [facet]
                    value="defensive"
                    turns="3-100"
                [/facet]
            )}
        [/ai]
    [/side]
    # wmllint: validate-on

    [side]
        side=3
        team_name=shaxthals
        user_team_name= _ "team_name^Shaxthals"
        {CHAOS_FLAG}
        hidden=yes
        no_leader=yes

        recruit=Shaxthal Drone,Shaxthal Rayblade,Shaxthal Razorbird

        {ai/aliases/stable_singleplayer.cfg}
        [ai]
            {AI_SIMPLE_ALWAYS_ASPECT passive_leader yes}
            #
            # This one is farther away from Elorran, so it can be allowed
            # to be fully aggressive.
            #
            {AI_SIMPLE_ALWAYS_ASPECT aggression 1.00}
            {AI_SIMPLE_ALWAYS_ASPECT caution    0.00}
            {AI_SIMPLE_ALWAYS_ASPECT recruitment_pattern "mixed fighter,scout,mixed fighter,fighter,mixed fighter,mixed fighter"}
        [/ai]
    [/side]

    [side]
        side=4
        team_name=shaxthals
        user_team_name= _ "team_name^Shaxthals"
        {CHAOS_FLAG}
        hidden=yes
        no_leader=yes

        recruit=Shaxthal Runner Drone,Shaxthal Rayblade

        {ai/aliases/stable_singleplayer.cfg}
        [ai]
            {AI_SIMPLE_ALWAYS_ASPECT passive_leader yes}
            {AI_SIMPLE_ALWAYS_ASPECT recruitment_pattern "fighter,mixed fighter,mixed fighter,mixed fighter"}
        [/ai]
    [/side]

    [side]
        side=5
        team_name=shaxthals
        user_team_name= _ "team_name^Undead"
        {RAGGED_FLAG}
        color=brightgreen
        hidden=yes
        no_leader=yes
        controller=null

        {ai/aliases/stable_singleplayer.cfg}
        [ai]
            {AI_SIMPLE_ALWAYS_ASPECT grouping   no }
            {AI_SIMPLE_ALWAYS_ASPECT aggression 1.0}
            {AI_SIMPLE_ALWAYS_ASPECT caution    0.0}
        [/ai]
    [/side]

    {UNDEAD_RECRUITMENT:ZYNARA:WILD_GHOSTS_SIDE 5}

    {STARTING_VILLAGES 1 8}
    {STARTING_VILLAGES 2 10}

    {FORCE_CHANCE_TO_HIT () (id=Elorran) 0 ()}

    [event]
        name=prestart
        # wmllint: recognize Durvan
        {RECALL_DURVAN_AT_LOCATION  7 22}
        # wmllint: recognize Allyna
        {RECALL_ALLYNA_AT_LOCATION  7 21}
        # wmllint: recognize Zynara
        {RECALL_ZYNARA_AT_LOCATION  5 21}

        {MODIFY_UNIT (id=Allyna) experience 0}
        {FACE_DIRECTION (side=1) ne}

        {OBJECTIVES (
            {OBJECTIVE_VICTORY ( _ "Defeat the enemy leader")}

            {OBJECTIVE_DEFEAT  ( _ "Death of Elynia")}
            {OBJECTIVE_DEFEAT  ( _ "Death of Durvan")}
            {OBJECTIVE_DEFEAT  ( _ "Death of Zynara")}

            {TURNS_RUN_OUT}

            {ZYNARA_UNDEAD_RECRUITMENT_NOTES}

            {OBJECTIVE_CARRYOVER}
        )}

        [hide_unit]
            id=Elorran
        [/hide_unit]

        [unit]
            side=2
            type=Elvish Marksman
            gender=female
            x,y=12,16
            hitpoints,max_hitpoints=1,1
            moves,max_moves=0,0
            experience,max_experience=0,0
            facing=se
            [status]
                petrified=yes
            [/status]
        [/unit]

        [unit]
            side=2
            type=Elvish Marksman
            gender=male
            x,y=16,17
            hitpoints,max_hitpoints=1,1
            moves,max_moves=0,0
            experience,max_experience=0,0
            facing=sw
            [status]
                petrified=yes
            [/status]
        [/unit]

        {LOCK_VIEW}
    [/event]

    # wmllint: recognize Anya
    # wmllint: recognize Tara
#define SA_HIDE_ANYA_AND_TARA
    [store_unit]
        [filter]
            id=Anya
            [or]
                id=Tara
            [/or]
        [/filter]
        kill=yes
        variable=anya_tara_store
    [/store_unit]

    [redraw][/redraw]
#enddef

#define SA_RESTORE_ANYA_AND_TARA
    [store_locations]
        [filter]
            id=Elorran
        [/filter]
        variable=elorran_loc
    [/store_locations]

    [foreach]
        array=anya_tara_store
        [do]
            [unstore_unit]
                variable=this_item
                find_vacant=yes
                x,y=$elorran_loc.x,$elorran_loc.y
            [/unstore_unit]
        [/do]
    [/foreach]

    {CLEAR_VARIABLE anya_tara_store,elorran_loc}
#enddef

    [event]
        name=start
        [message]
            speaker=Durvan
            message= _ "It’s really been a long trip. Are we there yet?"
        [/message]

        [message]
            speaker=Elynia
            message= _ "No, but we should reach Dalbloom in the middle of the night if we keep our pace and don’t stop to rest."
        [/message]

        [message]
            speaker=Allyna
            message= _ "Ah, if you only knew how to use the Ruby’s power to its full extent, we could have avoided all this."
        [/message]

        [message]
            speaker=Elynia
            message= _ "Right. But—"
        [/message]

        [redraw][/redraw]

        [delay]
            time=1000
        [/delay]

        [message]
            speaker=Elynia
            message= _ "(disconcerted) You can’t possibly know about the Ruby of Fire! Who are you?"
        [/message]

        {FACE_DIRECTION (id=Allyna) sw}

        [message]
            speaker=Allyna
            message= _ "I’m sorry for lying to you. I really like you, but... I needed you to come here."
        [/message]

        {INCIDENTAL_MUSIC "the_dangerous_symphony.ogg"}

        {PLAY_LEVELOUT_ANIM id=Allyna}

        [store_unit]
            [filter]
                id=Allyna
            [/filter]
            variable=allyna_store
            kill=yes
        [/store_unit]

        [unit]
            # NOTE: Her experience and HP are not preserved. This is intentional.
            {CHARACTER_STATS_ANYA}
            x,y=$allyna_store.x,$allyna_store.y
            facing=$allyna_store.facing
            side=2
        [/unit]
        {NO_UPKEEP}

        {PLAY_LEVELIN_ANIM id=Anya}

        {CLEAR_VARIABLE allyna_store}

        [delay]
            time=500
        [/delay]

        [message]
            speaker=Zynara
            message= _ "An impostor!"
        [/message]

        [message]
            speaker=Anya
            message= _ "No, I simply needed to disguise myself as a helpless human girl so I’d be allowed to travel with you and guide you to this place."
        [/message]

        [store_unit]
            [filter]
                id=Anya
            [/filter]
            variable=anya_store
        [/store_unit]

        [object]
            silent=yes
            [filter]
                id=Anya
            [/filter]
            [effect]
                apply_to=image_mod
                add="FL(horiz)"
            [/effect]
        [/object]

        {MOVE_UNIT (id=Anya)  9 20}

        {VARIABLE anya_store.facing sw}

        [unstore_unit]
            # Undo image_mod effect.
            variable=anya_store
            find_vacant=no
            x,y=9,20
        [/unstore_unit]

#define SA_STATUE_SHAPESHIFT _X _Y _WML
    [scroll_to]
        x={_X}
        y={_Y}
    [/scroll_to]

    {PLAY_LEVELOUT_ANIM (
        x={_X}
        y={_Y}
    )}

    [store_unit]
        [filter]
            x={_X}
            y={_Y}
        [/filter]
        kill=yes
        variable=statue_store
        mode=replace
    [/store_unit]

    [unit]
        x=$statue_store.x
        y=$statue_store.y
        facing=$statue_store.facing
        side=2
        random_traits,random_gender,generate_name=no,no,no
        {_WML}
    [/unit]

    {PLAY_LEVELIN_ANIM (
        x=$statue_store.x
        y=$statue_store.y
    )}

    {CLEAR_VARIABLE statue_store}
#enddef

        {SA_STATUE_SHAPESHIFT 12 16 (type=Rock Golem)}
        {SA_STATUE_SHAPESHIFT 16 17 (type=Rock Golem)}

#undef SA_STATUE_SHAPESHIFT

        [scroll_to_unit]
            id=Elynia
        [/scroll_to_unit]

        [delay]
            time=250
        [/delay]

        {FACE_DIRECTION (id=Elorran) sw}

        [unhide_unit]
            id=Elorran
        [/unhide_unit]

        [teleport]
            [filter]
                id=Elorran
            [/filter]
            x,y=10,20
        [/teleport]

        [animate_unit]
            [filter]
                id=Elorran
            [/filter]
            flag=post_teleport
            with_bars=yes
        [/animate_unit]

        [hidden_unit]
            {CHARACTER_STATS_TARA}
            side=2
            x,y=9,19
            facing=sw
            upkeep=loyal
            {IS_LOYAL}
        [/hidden_unit]

        [unhide_unit]
            id=Tara
        [/unhide_unit]

        [animate_unit]
            [filter]
                id=Tara
            [/filter]
            flag=post_teleport
            with_bars=yes
        [/animate_unit]

        [redraw][/redraw]

        [delay]
            time=500
        [/delay]

        [message]
            speaker=Elorran
            message= _ "The Lady of Light."
        [/message]

        [message]
            speaker=Tara
            message= _ "It is an honor to meet you."
        [/message]

        [message]
            speaker=Elynia
            message= _ "What do you want from us?"
        [/message]

        [message]
            speaker=Elorran
            message= _ "We just want your staff, or to be more specific, the gem decorating its top: the Ruby of Fire."
        [/message]

        [message]
            speaker=Elynia
            message= _ "You already tried this once and didn’t succeed; what makes you think this time will be any different?"
        [/message]

        [message]
            speaker=Elorran
            message= _ "Actually... I presume you speak of someone else?"
        [/message]

        [message]
            speaker=Zynara
            message= _ "My lady, we are wasting precious time here! Let us purge the Northlands of this blight!"
        [/message]

        [message]
            speaker=Elynia
            message= _ "The power of the Ruby of Fire is too great and too evil for it to fall into the wrong hands. You fiends shall not obtain it as long as I live!"
        [/message]

        [message]
            speaker=Elorran
            message= _ "So be it, then. I was hoping to achieve something with a more civilized approach, but I guess diplomacy has become a thing of the past on this world as well."
        [/message]

        [store_starting_location]
            side=2
        [/store_starting_location]

#define SA_TELEPORT_BACK _ID _X _Y
    [animate_unit]
        [filter]
            id={_ID}
        [/filter]
        flag=pre_teleport
        with_bars=yes
    [/animate_unit]

    [teleport]
        [filter]
            id={_ID}
        [/filter]
        x={_X}
        y={_Y}
    [/teleport]

    [redraw][/redraw]
#enddef

        {SA_TELEPORT_BACK Elorran $location.x $location.y}

        [message]
            speaker=Anya
            message= _ "I’m truly sorry. It wasn’t my intention for things to come to this."
        [/message]

        {SA_TELEPORT_BACK Tara $location.x $location.y}

        {SA_TELEPORT_BACK Anya $location.x $location.y}

#undef SA_TELEPORT_BACK

        {SA_HIDE_ANYA_AND_TARA}

        [delay]
            time=750
        [/delay]

        [message]
            speaker=Durvan
            message= _ "What... was that?"
        [/message]

        [message]
            speaker=Elynia
            message= _ "I’m not sure. There’s something very... unusual about these demons, aside from the fact that there are two faerie beings allied with them."
        [/message]

        {VARIABLE player_ghost_limit {UNDEAD_RECRUITMENT:ZYNARA:LIMIT}}

        {VARIABLE sep "• "}

        [allow_recruit]
            side=1
            type=Ghost,Skeleton,Skeleton Archer,Walking Corpse
        [/allow_recruit]

        [transient_message]
            image="units/undead/wraith-s-attack-3.png~RC(magenta>red)"
            message= _ "You can now recruit undead units.

However, because Zynara is not as powerful as Mal Keshar, her abilities have certain restrictions:"+"

$sep|"+_"You cannot recruit Vampire Bats."+"
$sep|"+_"Zynara can only control up to $player_ghost_limit units from the Ghost unit line at a time."+"
$sep|"+_"If you attempt to recruit an additional Ghost, you will permanently lose control of a random Ghost line unit and become unable to recruit—but not recall—more for the remainder of the scenario."+"
$sep|"+_"Ghost line units in your recall list also count towards the limit."
        [/transient_message]

        {CLEAR_VARIABLE player_ghost_limit,sep}

        {UNLOCK_VIEW}
    [/event]

    [event]
        name=turn 2
        [sound]
            name={SOUND_LIST:BIOMECHANICAL_ROAM}
        [/sound]

        [delay]
            time=750
        [/delay]

        [message]
            speaker=Durvan
            message= _ "Did you all hear that?"
        [/message]

        [message]
            speaker=Elynia
            message= _ "That’s the sound of bad news — Shaxthal creatures are approaching."
        [/message]
    [/event]

    [event]
        name=turn 3
        [sound]
            name={SOUND_LIST:BIOMECHANICAL_ROAM}
        [/sound]

        [store_starting_location]
            side=4
        [/store_starting_location]

        [move_unit_fake]
            type=Shaxthal War Drone
            side=4
            x=54,$location.x
            y=22,$location.y
        [/move_unit_fake]

        [unit]
            canrecruit=yes
            type=Shaxthal War Drone
            side=4
            x,y=$location.x,$location.y
            facing=nw
            [modifications]
                {TRAIT_BIOMECHANICAL}
                {TRAIT_STRONG}
            [/modifications]
        [/unit]

        {CAPTURE_VILLAGES 4 $location.x $location.y 7}

        [redraw][/redraw]

        [modify_side]
            side=4
            hidden=no
            {GOLD 180 200 220}
            {INCOME 2 3 4}
        [/modify_side]

        [store_starting_location]
            side=3
        [/store_starting_location]

        [move_unit_fake]
            type=Shaxthal Enforcer Drone
            variation=surface
            side=3
            x=40,$location.x
            y=26,$location.y
        [/move_unit_fake]

        [unit]
            canrecruit=yes
            type=Shaxthal Enforcer Drone
            variation=surface
            side=3
            x,y=$location.x,$location.y
            facing=nw
            [modifications]
                {TRAIT_BIOMECHANICAL}
                {TRAIT_ARMORED}
            [/modifications]
        [/unit]

        {CAPTURE_VILLAGES 3 $location.x $location.y 7}

        [redraw][/redraw]

        [modify_side]
            side=3
            hidden=no
            {GOLD 160 180 200}
            {INCOME 2 3 4}
        [/modify_side]

        [message]
            speaker=Zynara
            message= _ "They have arrived!"
        [/message]

        [message]
            speaker=Elorran
            message= _ "Curse Uria! They have found us!"
        [/message]
    [/event]

    [event]
        name=turn 5

        {SA_RESTORE_ANYA_AND_TARA}

        [message]
            speaker=Durvan
            message= _ "Those metallic beasts don’t seem interested in us as much as they are interested in our foes, but why?"
        [/message]

        [message]
            speaker=Elorran
            message= _ "Lady of Light, I’d like to call a truce. These creatures are our enemies too, and we don’t really want to get involved in a slaughter."
        [/message]

        [message]
            speaker=Elynia
            message= _ "Why should my side accede? Don’t you all work for Uria?"
        [/message]

        [message]
            speaker=Anya
            message= _ "We don’t! We are struggling against her!"
        [/message]

        [message]
            speaker=Zynara
            message= _ "My lady, those demons cannot be trusted! They must be staging a trap, posing as enemies of Uria!"
        [/message]

        [role]
            role=doubtful faerie
            side=1
            race=faerie
            [not]
                id=Elynia
            [/not]
        [/role]

        [role]
            role=suspecting human
            side=1
            race=human
            [not]
                id=Zynara
            [/not]
            [not]
                id=Durvan
            [/not]
        [/role]

        [if]
            [have_unit]
                role=doubtful faerie
            [/have_unit]
            [have_unit]
                role=suspecting human
            [/have_unit]
            [then]
                [message]
                    role=doubtful faerie
                    message= _ "I don’t know, they do seem to have a few of us amongst them. I am fairly sure our kind wouldn’t ally with demons without a very good reason."
                [/message]

                [message]
                    role=suspecting human
                    message= _ "And what if that reason is destroying us? Your kind can’t be trusted!"
                [/message]
            [/then]
        [/if]

        [message]
            speaker=Durvan
            message= _ "My lady?"
        [/message]

        [message]
            speaker=narrator
            caption= _ "Elynia"
            image= # wmllint: ignore
            # po: This line corresponds to Elynia's thoughts.
            message=""+_"What would Galas and Anlindë have done in this situation?"+"" # wmllint: ignore
        [/message]

        [message]
            speaker=Zynara
            message= _ "My lady, you must decide now!"
        [/message]

        [delay]
            time=750
        [/delay]

        [message]
            speaker=Elynia
            message= _ "Let us cooperate with these strange demons and repel the Shaxthal incursion before they infest the countryside. We’ll decide what to do about them later."
        [/message]

        [message]
            speaker=Zynara
            message= _ "This is ridiculous! My master must have overestimated your ability to command!"
        [/message]

        [message]
            speaker=Elynia
            message= _ "Your master would have been destroyed if Galas and Anlindë hadn’t been at the command of the elvish troops. They gave him a chance to redeem himself. If it weren’t for that, none of us would be here today discussing this."
        [/message]

        [message]
            speaker=Durvan
            message= _ "Very well, let’s do this!"
        [/message]

        [modify_side]
            side=2
            team_name=good
        [/modify_side]

        {OBJECTIVES (
            {OBJECTIVE_VICTORY ( _ "Repel the Shaxthal incursion")}

            {OBJECTIVE_DEFEAT  ( _ "Death of Elynia")}
            {OBJECTIVE_DEFEAT  ( _ "Death of Durvan")}
            {OBJECTIVE_DEFEAT  ( _ "Death of Zynara")}
            {OBJECTIVE_DEFEAT  ( _ "Death of Elorran")}

            {TURNS_RUN_OUT}

            {ZYNARA_UNDEAD_RECRUITMENT_NOTES}

            {OBJECTIVE_CARRYOVER}
        )}

        {SA_HIDE_ANYA_AND_TARA}
    [/event]

    {HERO_DEATH_BASE
    (Elorran)
    (
        [message]
            speaker=Elorran
            message= _ "My people! Now that Uria knows we are plotting against her, they are doomed without my guidance!"
        [/message]
    ) ()}

    {PLACE_IMAGE "scenery/signpost.png" 32 10}

    [event]
        name=moveto
        first_time_only=yes
        [filter]
            side=1
            x,y=32,10
        [/filter]

        [redraw][/redraw]

        [allow_undo][/allow_undo]

        [message]
            speaker=narrator
            image="scenery/signpost.png"
            message= _ "Fort Dalbloom"
        [/message]
    [/event]

    {AMBER_WARD 41 23}

    [event]
        name=enemies defeated

        {ENDLEVEL_VICTORY yes}
    [/event]

    [event]
        name=victory

        {SA_RESTORE_ANYA_AND_TARA}

        [message]
            speaker=Anya
            message= _ "Yes! We did it! We did it together!"
        [/message]

        [message]
            speaker=Elynia
            message= _ "Am I right in assuming that the village of Dalbloom doesn’t truly exist anymore, and it’s just the name of an ancient stronghold from the times before the Fall?"
        [/message]

        [message]
            speaker=Elorran
            message= _ "That’s right. We needed you to come here, away from the Alliance’s troops, and away from the Chaos forces. Or at least, we thought they would not be roaming around these parts. It’s alarming that their war beasts have come this far within the human country."
        [/message]

        [fade_out_music]
            duration=500
        [/fade_out_music]

        {REPLACE_SCENARIO_MUSIC weight_of_revenge.ogg}

        [message]
            speaker=Elynia
            message= _ "May I know why you believe acquiring the Ruby of Fire will do good to your cause, whatever it is?"
        [/message]

        [message]
            speaker=Tara
            message= _ "My lady, Elorran is one of the few demon lords who refused to heed Uria’s call to war against the good peoples of Irdya. He came to me seeking support for his mission. Our intention was to contact you and destroy that artifact you hold."
        [/message]

        [message]
            speaker=Elorran
            message= _ "According to what Anya heard, you set foot in the Kalari stronghold once, and confronted the Iron Council. You know well by now that the Ruby isn’t a mere piece of magic jewelry, but you may still be unaware of the full extent of its power. Long ago, a group of human sorcerers created it and killed Irdya’s Gatekeeper, the creature that was charged with the task of guarding the entrance to Inferno. That disaster and the unexplained disappearance of Inferno’s very own Gatekeeper on the other side eventually brought this world to Uria’s attention."
        [/message]

        [message]
            speaker=Elorran
            message= _ "The many Gatekeepers were created from the ancient Guardian of Secrets, Uria’s sister. They were assigned to different locations to protect them from external interference, preventing anything from entering or leaving Inferno. Uria has figured this out, and she wants the Ruby of Fire to create a path to allow her to enter and invade a world much like yours, called Ethea. We do not know yet what her motives are — there may be something there which she could use against the few remaining gods who may oppose her."
        [/message]

        [message]
            speaker=Tara
            message= _ "To that end she is using Irdya to test her forces and breed a massive army of biomechanical creatures for use against those who will defend Ethea."
        [/message]

        [message]
            speaker=Elorran
            message= _ "Although some of us think the right being could use the power of the Ruby to destroy or incapacitate Uria, nobody wants to run the risk and unwittingly deliver the artifact to her by failing in such a suicidal mission. Hence we want to destroy it."
        [/message]

        [message]
            speaker=Anya
            message= _ "We really need your help..."
        [/message]

        [delay]
            time=500
        [/delay]

        [message]
            speaker=Elynia
            message= _ "The Ruby of Fire— this staff, originally owned by my master, the Great Sorceress Niryone... it belongs to me. I have sacrificed much keeping it away from those who could threaten the future of the peoples of Irdya. Surely we can thwart Uria’s plans in a different way."
        [/message]

        [message]
            speaker=Elorran
            message= _ "We aren’t the only group that has stood against her rule, but we are one of the few to survive to this day. We’ve seen her real power, and only the wielder of the Union could possibly stand a chance against her — if only that power hadn’t fallen into her hands following your short incursion into her territory."
        [/message]

        [message]
            speaker=Elynia
            message= _ "What do you mean— she cannot use that power, right?"
        [/message]

        [message]
            speaker=Anya
            message= _ "Not yet..."
        [/message]

        [message]
            speaker=Tara
            message= _ "What she expects to find on Ethea may be another artifact that could enable her to wield the Union."
        [/message]

        [message]
            speaker=Elynia
            message= _ "I’m not convinced destroying the Ruby is the solution. What if there’s an equivalent somewhere else on Irdya, or on another world?"
        [/message]

        [message]
            speaker=Elorran
            message= _ "That’s a risk we’ll have to take. As things stand right now, Uria is more likely to obtain the Ruby than any other alternative in order to accelerate her plans."
        [/message]

        [delay]
            time=1000
        [/delay]

        [message]
            speaker=Elynia
            message= _ "The elves... the people whom I swore to protect ages ago need me at this very moment. Let me use the power of the Ruby once more, and then we’ll make sure it will never be used again."
        [/message]

        [delay]
            time=1000
        [/delay]

        [message]
            speaker=Tara
            message= _ "My lord, we won’t be able to convince her to do otherwise."
        [/message]

        [message]
            speaker=Elorran
            message= _ "(sighs) Your tenacity has not gone unnoticed, Lady of Light. Uria knows you are a formidable enemy, albeit notably foolish at times. Do what you feel is right, and then come back to us as soon as you may so we can put an end to her plans together. Anya will go with you; her necklace will allow you to find us, no matter the distance or the time."
        [/message]

        [message]
            speaker=Anya
            message= _ "I will... go with her? Yes! I mean... if that’s not a problem."
        [/message]

        [message]
            speaker=Elynia
            message= _ "We are heading towards a war zone and we welcome the support of every man or woman who can wield a weapon, cast a spell, or tend to the injured. However, I am... unsure about allowing a young girl like Anya to accompany us."
        [/message]

        [message]
            speaker=Tara
            message= _ "You might underestimate her now because making use of her magic before would have blown her cover, but I assure you, she is an excellent spellcaster under the right circumstances."
        [/message]

        [message]
            speaker=Anya
            message= _ "Don’t say that! It’s rather embarrassing..."
        [/message]

        [message]
            speaker=Elynia
            message= _ "Very well, Lord Elorran. I swear I will do my best to keep the Ruby away from our enemies."
        [/message]

        [message]
            speaker=Zynara
            message= _ "Dealing with demons... (sigh) This can’t end well..."
        [/message]

        [message]
            speaker=Elynia
            message= _ "I would like to keep our pact a secret between us. Even if the Grand Council understood, there seems to be a fair chance they could fall and provide Uria’s henchmen with information about our plans. No-one should speak of this."
        [/message]

        [message]
            speaker=Durvan
            message= _ "Understood, my lady."
        [/message]

        [message]
            speaker=Zynara
            message= _ "Understood..."
        [/message]

        [message]
            speaker=Elynia
            message= _ "Well, let’s continue onwards. Hopefully we won’t come across any more interruptions."
        [/message]

        [store_unit]
            [filter]
                id=Anya
            [/filter]
            variable=anya_store
        [/store_unit]

        [set_variables]
            mode=merge
            name=anya_store
            [literal]
                side=1
                {IS_HERO}
            [/literal]
        [/set_variables]

        [unstore_unit]
            variable=anya_store
            find_vacant=no
        [/unstore_unit]

        {CLEAR_VARIABLE anya_store}
    [/event]

    [event]
        name=time over

        [message]
            speaker=Elorran
            message= _ "There is an army of hostile elves approaching... Things would have worked out much better if this Lady of Light had not turned out to be such a dreadful disappointment as a leader and a tactician."
        [/message]
    [/event]

#undef SA_HIDE_ANYA_AND_TARA
#undef SA_RESTORE_ANYA_AND_TARA
[/scenario]

# kate: indent-mode normal; encoding utf-8; space-indent on;