#textdomain wesnoth-After_the_Storm

[scenario]
    id=03_Civil_War
    name= _ "Civil War in the North"
    {MAP 03_Civil_War.map}
    turns=4
    next_scenario="04_Terror_at_Dusk"
    victory_when_enemies_defeated="no"

    {Z_DEATHS}

    {SCENARIO_MUSIC "revelation.ogg"} {CONTINUE_PLAYING_STORY_MUSIC_FIRST}

    {STORYTXT_CIVIL_WAR}

    {TWO_SUNS_DEFAULT_SCHEDULE}

    # wmllint: validate-off
    [side]
        save_id=player

        controller=human
        side=1
        team_name=player
        user_team_name= _ "team_name^Galas"

        shroud=yes
        {GOLD 300 275 250}

        # wmllint: recognize Galas
        {CHARACTER_STATS_GALAS}
    [/side]
    # wmllint: validate-on

#define CW_WARRIOR _TYPE _X _Y
    [unit]
        type={_TYPE}
        x,y={_X},{_Y}
        generate_name=yes
        random_traits=yes
        random_gender=yes
        [modifications]
            {TRAIT_LOYAL}
        [/modifications]
    [/unit]
#enddef

#define CW_GUARDIAN _TYPE _X _Y
    [unit]
        type={_TYPE}
        x,y={_X},{_Y}
        generate_name=yes
        random_traits=yes
        random_gender=yes
        ai_special=guardian
        [modifications]
            {TRAIT_LOYAL}
        [/modifications]
    [/unit]
#enddef

    #
    # Northern elves.
    #
    [side]
        controller=ai
        side=2
        team_name=elves_N
        user_team_name= _ "team_name^Elves (North)"
        hidden=yes
        {FLAG_VARIANT long}

        recruit="Elvish Shaman, Elvish Archer, Elvish Fighter, Elvish Scout"

        canrecruit=yes
        id=Celán
        name= _ "Celán"
        type=Elvish Champion
        unrenamable=yes
        [modifications]
            {TRAIT_INTELLIGENT}
            {TRAIT_STRONG}
        [/modifications]

        {CW_WARRIOR  (Elvish Hero) 19 19}
        {CW_GUARDIAN (Elvish Fighter) 10 13}
        {CW_WARRIOR  (Elvish Marksman) 19 16}
        {CW_GUARDIAN (Elvish Hero) 11 11}
        {CW_WARRIOR  (Elvish Marshal) 18 10}
        {CW_GUARDIAN (Elvish Marksman) 16  9}
        {CW_GUARDIAN (Elvish Druid) 6 15}
        {CW_WARRIOR  (Elvish Druid) 9 8}
        {CW_GUARDIAN (Elvish Sorceress) 19 6}
        {CW_WARRIOR  (Elvish Enchantress) 12 18}
        {CW_WARRIOR  (Elvish Marksman) 21 14}

        {CW_WARRIOR  (Elvish Scout) 21 10}

        {CW_WARRIOR  (Elvish Archer) 53 24}
        {CW_WARRIOR  (Elvish Fighter) 50 24}
        {CW_WARRIOR  (Elvish Rider) 52 27}
        {CW_WARRIOR  (Elvish Fighter) 58 23}
        {CW_WARRIOR  (Elvish Scout) 60 33}
        {CW_WARRIOR  (Elvish Archer) 47 21}
        {CW_WARRIOR  (Elvish Shaman) 45 22}
    [/side]

    #
    # South-eastern elves.
    #
    [side]
        controller=ai
        side=3
        team_name=elves_SE
        user_team_name= _ "team_name^Elves (Southeast)"
        hidden=yes
        {FLAG_VARIANT long}

        recruit="Elvish Shaman, Elvish Archer, Elvish Fighter, Elvish Scout"

        canrecruit=yes
        gender=female
        id=Unidë
        name= _ "Unidë"
        type=Elvish Avenger
        unrenamable=yes
        [modifications]
            {TRAIT_RESILIENT}
            {TRAIT_QUICK}
        [/modifications]

        {CW_GUARDIAN (Elvish Druid) 26 11}

        {CW_GUARDIAN (Elvish Ranger) 58 28}
        {CW_GUARDIAN (Elvish Avenger) 57 33}
        {CW_GUARDIAN (Elvish Ranger) 62 22}

        {CW_WARRIOR  (Elvish Captain) 58 26}
        {CW_WARRIOR  (Elvish Captain) 56 27}
        {CW_WARRIOR  (Elvish Rider) 55 22}
        {CW_WARRIOR  (Elvish Rider) 65 32}

        {CW_WARRIOR  (Elvish Fighter) 31 40}
        {CW_WARRIOR  (Elvish Fighter) 42 31}
        {CW_WARRIOR  (Elvish Scout) 40 23}
        {CW_WARRIOR  (Elvish Shaman) 47 25}
        {CW_WARRIOR  (Elvish Fighter) 50 28}
        {CW_WARRIOR  (Elvish Archer) 52 22}
        {CW_WARRIOR  (Elvish Archer) 46 27}

        {CW_WARRIOR  (Elvish Archer) 31 14}
        {CW_WARRIOR  (Elvish Archer) 28 15}
        {CW_WARRIOR  (Elvish Hero) 26 14}
        {CW_WARRIOR  (Elvish Fighter) 31 12}
        {CW_WARRIOR  (Elvish Archer) 4 13}
        {CW_WARRIOR  (Elvish Shaman) 4 14}
        {CW_WARRIOR  (Elvish Archer) 1 13}

        {CW_WARRIOR  (Elvish Ranger) 17 20}
        {CW_WARRIOR  (Elvish Hero) 21 17}
        {CW_WARRIOR  (Elvish Captain) 29 16}
    [/side]

    #
    # Fort Eldáin
    #
    [side]
        side=4
        team_name=player
        # wmllint: local spelling Eldáin
        user_team_name=_ "team_name^Fort Eldáin"
        hidden=yes
        controller=null
        no_leader=yes
        gold=0
        village_gold=0
        {NO_INCOME}

        {LOYAL_UNIT () (Bowman) 30 34} {FACING sw}
        {LOYAL_UNIT () (Footpad) 26 32} {FACING sw}
        {LOYAL_UNIT () (Spearman) 16 26} {FACING sw}
        {LOYAL_UNIT () (Bowman) 20 21} {FACING se}
        {LOYAL_UNIT () (Spearman) 23 31} {FACING se}
        {LOYAL_UNIT () (Spearman) 26 26} {FACING nw}
        {LOYAL_UNIT () (Peasant) 36 31} {FACING se}
        {LOYAL_UNIT () (Peasant) 21 26} {FACING n}
        {LOYAL_UNIT () (Bowman) 18 24} {FACING se}
        {LOYAL_UNIT () (Bowman) 23 23} {FACING sw}
        {LOYAL_UNIT () (Bowman) 39 29} {FACING se}
        {LOYAL_UNIT () (Bowman) 29 28} {FACING sw}
        {LOYAL_UNIT () (Swordsman) 34 32} {FACING ne}
        {LOYAL_UNIT () (Spearman) 38 27} {FACING se}
        {LOYAL_UNIT () (Swordsman) 28 25} {FACING nw}
        {LOYAL_UNIT () (Footpad) 23 29} {FACING nw}
        {LOYAL_UNIT () (Peasant) 29 32} {FACING sw}
        {LOYAL_UNIT () (Woodsman) 33 25} {FACING ne}
        {LOYAL_UNIT () (Woodsman) 36 26} {FACING ne}
        {LOYAL_UNIT () (Swordsman) 34 25} {FACING ne}
    [/side]
    [event]
        name=transfer side 4
        {TRANSFER_UNITS_FROM_SIDE (4) () (1)}
    [/event]
    [event]
        name=restore side 4
        {TRANSFER_UNITS_FROM_SIDE (1) (
            [filter_wml]
                [variables]
                    transferred_from_side=4
                [/variables]
            [/filter_wml]
        ) (4)}
    [/event]
    [event]
        name=victory
        [fire_event]
            name=restore side 4
        [/fire_event]
    [/event]

    #
    # Council of War's messengers.
    #
    [side]
        side=5
        team_name=player,elves_N,elves_SE
        user_team_name=_ "team_name^Grand Council"
        hidden=yes
        controller=null
        no_leader=yes
        gold=0
        village_gold=0
        {NO_INCOME}
    [/side]

    [side]
        side,color=6,5
        team_name=elves_N,elves_SE,player
        user_team_name=_ "team_name^Grand Council"
        hidden=yes
        controller=null
        no_leader=yes
        gold,village_gold=,0,0
        {NO_INCOME}
        defeat_condition=never
    [/side]

    {STARTING_VILLAGES 1 5}
    {STARTING_VILLAGES 2 15}
    {STARTING_VILLAGES 3 15}

    {PLACE_IMAGE ("scenery/oak-leaning.png") 17 36}
    {PLACE_IMAGE ("scenery/oak-leaning.png") 41 12}
    {PLACE_IMAGE ("scenery/oak-leaning.png") 61  8}

    {PLACE_IMAGE ("items/grain-sheaf.png") 54 11}

    {PLACE_IMAGE ("items/scarecrow.png") 57 12}
    {PLACE_IMAGE ("items/scarecrow.png") 53  8}

    {PLACE_IMAGE ("items/straw-bale1.png") 54  5}
    {PLACE_IMAGE ("items/straw-bale2.png") 53  6}
    {PLACE_IMAGE ("items/straw-bale2.png~FL(horiz)") 49 13}

    [event]
        name=prestart
        #
        # Initially disable AI players. We cannot use controller=null
        # on their declaration because then their leader units would not
        # be spawned.
        #
        [modify_side]
            side=2,3
            controller=null
        [/modify_side]

        [capture_village]
            side=6
            x=36-65
            y= 1-17
        [/capture_village]

        [allow_recruit]
            side=1
            type="Vampire Bat"
        [/allow_recruit]

        # wmllint: recognize Elynia
        {RECALL_ELYNIA}
        # wmllint: recognize Mal Keshar
        {RECALL_MAL_KESHAR}
        # wmllint: recognize Igor
        {RECALL_IGOR}

        {FACE_DIRECTION (side=1) se}

        {OBJECTIVES (
            victory_string= _ "Current Objectives:"
            {OBJECTIVE_VICTORY ( _ "Move Galas, Elynia and Mal Keshar to Fort Eldáin")}

            {OBJECTIVE_DEFEAT  ( _ "Death of Galas")}
            {OBJECTIVE_DEFEAT  ( _ "Death of Elynia")}
            {OBJECTIVE_DEFEAT  ( _ "Death of Mal Keshar")}

            {TURNS_RUN_OUT}

            {OBJECTIVE_CARRYOVER_NO_BONUS}
        )}
    [/event]

    [event]
        name=start
        [message]
            speaker=Elynia
            message= _ "I don’t like this... There are signs of a recent battle in this area."
        [/message]

        [message]
            speaker=Galas
            message= _ "Quickly, let us investigate what happened here. I hope it’s not too late."
        [/message]
    [/event]

#define CW_TELEPORT_AND_RESET_MOVES _ID _X _Y
    [store_unit]
        [filter]
            id={_ID}
        [/filter]
        kill=yes
        variable=temp_CW_TELEPORT_AND_RESET_MOVES
    [/store_unit]

    {VARIABLE temp_CW_TELEPORT_AND_RESET_MOVES.moves $temp_CW_TELEPORT_AND_RESET_MOVES.max_moves}

    [unstore_unit]
        variable=temp_CW_TELEPORT_AND_RESET_MOVES
        find_vacant=yes
        x={_X}
        y={_Y}
    [/unstore_unit]

    {CLEAR_VARIABLE "temp_CW_TELEPORT_AND_RESET_MOVES"}
#enddef

    {FIRE_EVENT_ON_STUMBLE_UPON "start survival" (side=4)}

    [event]
        name=turn 4
        [fire_event]
            name=start survival
        [/fire_event]
    [/event]

    [event]
        name=start survival
        first_time_only=yes

        #
        # Remove the ^Xo (Impassable) overlay without changing the
        # base layer.
        #

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

        #
        # Initialize enemy sides
        #

        [modify_side]
            side=2
            controller=ai
            hidden=no
            {GOLD 230 270 320}
            {INCOME 2 4 7}
        [/modify_side]

        [modify_side]
            side=3
            controller=ai
            hidden=no
            {GOLD 250 280 330}
            {INCOME 2 4 7}
        [/modify_side]

        #
        # Remove shroud for side 1
        #

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

        [redraw][/redraw]

        [message]
            type=Bowman
            side=4
            message= _ "Who are you? Why, do you bring your unholy slaves to feast on our fallen remains?!"
        [/message]

        [message]
            speaker=Galas
            message= _ "We are sworn allies of the peoples of the Far North, and the undead support us against our enemies."
        [/message]

        [message]
            type=Footpad
            side=4
            message= _ "It is... it is the Lady of Light! I had heard rumors but this is..."
        [/message]

        [message]
            speaker=Elynia
            message= _ "This fortress barely stands. What vile creatures have come to plague the northern country?"
        [/message]

        [message]
            type=Bowman
            side=4
            message= _ "The elves, my lady. The elves have gone mad and are attacking each other, laying waste to every settlement in their path. Neither faction is willing to seek a peaceful end to this conflict, and we don’t think we can withstand their siege for much longer. Most of our men have died defending the city walls, and resources are increasingly scarce."
        [/message]

        [scroll_to_unit]
            id=Celán
        [/scroll_to_unit]

        [redraw][/redraw]

        [delay]
            time=500
        [/delay]

        [scroll_to_unit]
            id=Unidë
        [/scroll_to_unit]

        [redraw][/redraw]

        [delay]
            time=500
        [/delay]

        [message]
            type=Bowman
            side=4
            message= _ "We cannot continue without help, and the messengers we sent to the Grand Council for reinforcements have not returned yet. I’ll probably hate myself for the rest of my life for asking help from those who deal with dark magic, but..."
        [/message]

        [message]
            speaker=Mal Keshar
            # wmllint: local spelling Pfft
            message= _ "Pfft, we cannot waste our time here."
        [/message]

        {REPLACE_SCENARIO_MUSIC "battle.ogg"}
        {APPEND_MUSIC           "the_city_falls.ogg"}
        {APPEND_MUSIC           "loyalists.ogg"}

        [message]
            speaker=Galas
            message= _ "We must help these poor people and try to negotiate a deal with our kinsmen. We must not allow another civil war to tear our civilization apart! Otherwise..."
        [/message]

        [message]
            speaker=Elynia
            message= _ "Our sacrifices would have been in vain."
        [/message]

        [message]
            speaker=Galas
            message= _ "We’ll help you defend your fortress until those reinforcements arrive."
        [/message]

        [message]
            type=Bowman
            side=4
            message= _ "Thank you."
        [/message]

        #
        # Since there are too few units in side 4, it's not feasible to let the AI control these -
        # they'd probably end up committing suicide or staying behind and being otherwise completely
        # useless.
        #
        # Transfer side 4 units to side 1. If they still survive by the end of the scenario, they
        # are returned to side 4 in the victory event.
        #

        [message]
            type=Footpad
            side=4
            message= _ "Lead us, my lord."
        [/message]

        [fire_event]
            name=transfer side 4
        [/fire_event]

        [capture_village]
            x= 1-54
            y=22-40
            side=1
        [/capture_village]

        [modify_side]
            side=1
            {INCOME 8 6 4}
        [/modify_side]

        #
        # Set the survival turn limit
        #

        {VARIABLE survival_turn_limit ({DIFF 15 15 18})}

        [modify_turns]
            add=$survival_turn_limit
        [/modify_turns]

        {CW_TELEPORT_AND_RESET_MOVES Galas 31 29}
        {CW_TELEPORT_AND_RESET_MOVES Elynia 30 25}
        {CW_TELEPORT_AND_RESET_MOVES (Mal Keshar) 25 30}

        [if]
            [have_unit]
                id=Igor
            [/have_unit]
            [then]
                {CW_TELEPORT_AND_RESET_MOVES Igor 34 29}
            [/then]
        [/if]

        [scroll_to]
            x,y=31,29
        [/scroll_to]

        {OBJECTIVES (
            {OBJECTIVE_VICTORY ( _ "Resist until the Grand Council’s reinforcements arrive at the end of turns")}

            {OBJECTIVE_DEFEAT  ( _ "Death of Galas")}
            {OBJECTIVE_DEFEAT  ( _ "Death of Elynia")}
            {OBJECTIVE_DEFEAT  ( _ "Death of Mal Keshar")}

            {OBJECTIVE_CARRYOVER_NO_BONUS}

            {OBJECTIVE_NOTE ( _ "You will not be able to recall the human defense in later scenarios")}
        )}

        [event]
            name="turn $( $turn_number + 1 )"
            delayed_variable_substitution=no
            first_time_only=yes

            [fire_event]
                name=introduce unide
            [/fire_event]

            {OBJECTIVES (
                {OBJECTIVE_VICTORY ( _ "Resist until the Grand Council’s reinforcements arrive at the end of turns")}

                {OBJECTIVE_DEFEAT  ( _ "Death of an enemy leader")}
                {OBJECTIVE_DEFEAT  ( _ "Death of Galas")}
                {OBJECTIVE_DEFEAT  ( _ "Death of Elynia")}
                {OBJECTIVE_DEFEAT  ( _ "Death of Mal Keshar")}

                {OBJECTIVE_CARRYOVER_NO_BONUS}

                {OBJECTIVE_NOTE ( _ "You will not be able to recall the human defense in later scenarios")}
            )}
        [/event]

        [event]
            name=introduce unide
            delayed_variable_substitution=yes
            first_time_only=yes

            {FACE_DIRECTION (id="Unidë") sw}

            [redraw][/redraw]

            [message]
                speaker=Unidë
                message= _ "Who is it that helps the human sub-people defend their town against the true rulers of the forest?"
            [/message]

            [message]
                speaker=Galas
                message= _ "I am Galas, an elf of the Valley of Elynia like you. What is the reason for this unnecessary bloodshed?"
            [/message]

            [message]
                speaker=Unidë
                message= _ "We are at war with those who have taken the life of Lord Inodien and his successor! Are you supporters of their foul cause too?"
            [/message]

            [message]
                speaker=Galas
                message= _ "You know me well, Unidë — I would not support anyone, elf or otherwise, who would threaten the life of our leaders and our civilization. However, you are not doing any good by murdering innocent humans and elves."
            [/message]

            [message]
                speaker=Elynia
                message= _ "There must be a way to solve this problem without resorting to fighting. In these grim times, with war already raging in the outer lands, the last thing we need is conflict between ourselves as well. It will be our definitive doom. The traitors must be judged by elvish law, not by chaos and death."
            [/message]

            [message]
                speaker=Unidë
                message= _ "Who do you think you are to give me orders? I am in charge of our people now, and I do not listen to those who ally themselves with this worthless human scum and their foul dark sorcerers."
            [/message]

            [message]
                speaker=Mal Keshar
                message= _ "Diplomacy isn’t going to work, of course — this petty elf has a death wish."
            [/message]

            [message]
                speaker=Elynia
                message= _ "Avoid killing their leaders at all costs. If we want to solve this conflict, we’ll need the Grand Council to negotiate with the faction leaders, and without them, I fear that their successors may incite an even worse bloodshed. I only wish we could stop our kinsmen without resorting to violence."
            [/message]

            [message]
                speaker=Galas
                message= _ "As it seems now, there is no other option for us than to hold out against their troops until help arrives. To arms!"
            [/message]
        [/event]

        {CLEAR_VARIABLE survival_turn_limit,survival_turn_limit}
    [/event]

    [event]
        name=last breath
        [filter]
            id=Unidë
        [/filter]

        [message]
            speaker=Unidë
            message= _ "Though our enemies will not die by my hand, my brethren will avenge me! May this be the last day the traitors live to see the light of Naia and Sela!"
        [/message]
    [/event]

    [event]
        name=die
        [filter]
            id=Unidë
        [/filter]

        [message]
            speaker=Elynia
            message= _ "We shouldn’t have allowed her to die. Now it will be nigh impossible to put an end to this!"
        [/message]

        {ENDLEVEL_DEFEAT}
    [/event]

    [event]
        name=last breath
        [filter]
            id=Celán
        [/filter]

        [message]
            speaker=Celán
            message= _ "Alas, I have fallen before putting an end to this conflict."
        [/message]
    [/event]

    [event]
        name=die
        [filter]
            id=Celán
        [/filter]

        [message]
            speaker=Elynia
            message= _ "We shouldn’t have allowed him to die. Now it will be nigh impossible to put an end to this!"
        [/message]

        {ENDLEVEL_DEFEAT}
    [/event]

    [event]
        name=last breath
        [filter]
            canrecruit=no
            [and]
                side=2
                [or]
                    side=3
                [/or]
            [/and]
        [/filter]
        [filter_second]
            side=1
        [/filter_second]

        [message]
            speaker=unit
            message= _ "I die... for our people!"
        [/message]
    [/event]

    [event]
        name=die
        [filter]
            canrecruit=no
            [and]
                side=2
                [or]
                    side=3
                [/or]
            [/and]
        [/filter]
        [filter_second]
            side=1
        [/filter_second]

        [message]
            speaker=Mal Keshar
            message= _ "Ahh, great. Now we are killing other elves."
        [/message]

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

    [event]
        name=turn 10
        [message]
            speaker=Galas
            message= _ "The situation is not improving. If those reinforcements don’t arrive soon we won’t be able to hold this place for much longer!"
        [/message]
    [/event]

    [event]
        name=time over

        {ENDLEVEL_VICTORY no}
    [/event]

#define CW_CAVALRY _X _Y
    [unit]
        side=5
        type=Cavalryman
        generate_name=yes
        random_traits=yes
        facing=sw
        x={_X}
        y={_Y}
    [/unit]
#enddef

    [event]
        name=victory

        [fade_out_music]
            duration=500
        [/fade_out_music]

        {REPLACE_SCENARIO_MUSIC "revelation.ogg"}

        {CW_CAVALRY 43 5}
        {CW_CAVALRY 44 8}
        {CW_CAVALRY 45 3}
        {CW_CAVALRY 51 5}
        {CW_CAVALRY 48 1}

        # wmllint: recognize Arnesius
        [unit]
            {CHARACTER_STATS_ARNESIUS}
            side=5
            facing=sw
            x,y=46,4
        [/unit]

        [unit]
            side=5
            type=Orcish Slurbow
            id=Kar-velgan
            name= _ "Kar-velgan"
            facing=sw
            x=45
            y=4
            [modifications]
                {TRAIT_RESILIENT}
                {TRAIT_QUICK}
            [/modifications]
        [/unit]

        # wmllint: recognize Unarye
        [unit]
            {CHARACTER_STATS_UNARYE}
            side=5
            facing=sw
            x,y=47,5
        [/unit]

        {FACE_DIRECTION (id="Unidë") nw}
        {FACE_DIRECTION (id="Celán") ne}

        [redraw][/redraw]

        [message]
            speaker=Arnesius
            message= _ "Elves, stop this brutal bloodshed! You have slaughtered many innocent northerners; humans, orcs, and elves alike. This dreadful display breaches the treaty we signed with Lord Galas!"
        [/message]

        [message]
            speaker=Unidë
            message= _ "We do not listen to human sub-people!"
        [/message]

        [message]
            speaker=Unarye
            message= _ "Then you shall listen to your own authorities. I came as soon as I could to bring order to this chaos. You have not only disobeyed the will of your former leader, Lord Galas; you also ignored the advice and command of Elynia, the Lady of Light herself."
        [/message]

        [message]
            speaker=Arnesius
            message= _ "In light of these events and the terms of the treaty, the Grand Council has decided to banish the elvish kind from the northern country. You shall put an end to your civil war and prepare to leave our territory before five days have passed, or we shall order our own troops to deal with you. We do not want to do this, and you are well aware that you are at a numerical disadvantage."
        [/message]

        [delay]
            time=750
        [/delay]

        [message]
            speaker=Celán
            message= _ "Did one of your kind kill the puny ‘lord’ of these rebels as part of a ruse to banish us from the forests, then?"
        [/message]

        [message]
            speaker=Kar-velgan
            message= _ "Listen, wose-born scum: Inodien was slain by no elf, human or orc!"
        [/message]

        [delay]
            time=750
        [/delay]

        [message]
            speaker=Unarye
            message= _ "We have good reasons to think that the Chaos Empire sent forth their mercenaries for the purpose of causing this revolt and sending us all to our doom. But we are not letting that happen, at least not today."
        [/message]

        [message]
            speaker=Unidë
            message= _ "This is not fair! Why should we pay for crimes committed by outsiders?"
        [/message]

        [message]
            speaker=Kar-velgan
            message= _ "Your hands are not clean, elf! How do you even dare to ignore that fact in front of the bearers of the law?"
        [/message]

        [delay]
            time=750
        [/delay]

        [message]
            speaker=Elynia
            message= _ "It is true. We have spilled much elvish blood with this fight. Galas and I shall leave these lands as soon as we can."
        [/message]

        [message]
            speaker=Igor
            message= _ "But my lady, how? None of this is your fault..."
        [/message]

        [message]
            speaker=Mal Keshar
            message= _ "What? And how are we going to travel to Zocthanol Isle then?"
        [/message]

        [message]
            speaker=Unidë
            message= _ "I swear that my people will never forget this, the most vile of treacheries. I shall withdraw my troops and my people from this accursed country today, but I do intend to return some day to demand proper justice!"
        [/message]

        [message]
            speaker=Celán
            message= _ "If the Lady of Light is willing to depart from these lands to never return because of our own misdeeds, then we shall abandon the country as well. Come with me, men!"
        [/message]

        [scroll_to_unit]
            id=Mal Keshar
        [/scroll_to_unit]

        [delay]
            time=750
        [/delay]

        [message]
            speaker=Mal Keshar
            message= _ "Elynia? Can you tell us your plan?"
        [/message]

        [message]
            speaker=Elynia
            message= _ "There is a port to the west in the Bay of Tirigaz. It’s controlled by orcs, but perhaps we can find a way to bribe them so they lend us ships and provisions. It is the only port that doesn’t belong to the Aragwaithi nowadays."
        [/message]

        [message]
            speaker=Mal Keshar
            # wmllint: local spelling Pah
            # po: Here Mal Keshar is supposed to be about to say something like "this is ridiculous" or such.
            message= _ "This is— Pah. We shall go to Tirigaz, then. But how will we determine the location of Zocthanol Isle?"
        [/message]

        [message]
            speaker=Elynia
            message= _ "That will be my job to do."
        [/message]

        [if]
            [have_unit]
                id=Igor
            [/have_unit]
            [then]
                [message]
                    speaker=Igor
                    message= _ "Then... I suppose this is where it ends."
                [/message]

                [message]
                    speaker=Galas
                    message= _ "Are you really sure about this, Igor? I thought you would prefer to live among your people in the west instead."
                [/message]

                [message]
                    speaker=Igor
                    message= _ "I mean, yes, being with goblins is great! But I’m scared after what happened — you know, the whole Chaos thing? And it seems like the orc chieftains are still bad at guarding the land from invaders from the south. No, I think I’m done being village goblin. I’m gonna become city goblin now!"
                [/message]

                [message]
                    speaker=Mal Keshar
                    message= _ "Hmph. How would a filthy runt like you survive the perils of civilization, I wonder."
                [/message]

                [message]
                    speaker=Igor
                    message= _ "Hey, I can do artsy stuff! Haven’t you heard me sing before? Ahem—"
                [/message]

                [message]
                    speaker=Mal Keshar
                    message= _ "If I have to listen to that again, I swear to the Dark Gods—"
                [/message]

                [message]
                    speaker=Elynia
                    message= _ "It has been a long journey for you, and we certainly cannot force you to stick around considering all the dangers that await us next. I just hope we will get to see each other again some day. I think I speak for all three of us when I say we are deeply grateful for your help and support, even through the most nightmarish of circumstances."
                [/message]

                [message]
                    speaker=Galas
                    message= _ "We will miss you greatly. Best of luck, my friend."
                [/message]

                [message]
                    speaker=Igor
                    message= _ "Awww, you guys, I’m tearing up... I will miss you too!"
                [/message]

                [message]
                    speaker=Mal Keshar
                    message= _ "Can we just... please. Let us move on already."
                [/message]

                # Force reset Igor's stats before copying him to persistent storage

                {RESET_UNIT_STATUSES id=Igor}

                {UNIT_TO_GLOBAL_STORE Igor episode1_stats_igor}

                [modify_unit]
                    [filter]
                        id=Igor
                    [/filter]
                    side=5
                [/modify_unit]
            [/then]
        [/if]
    [/event]

#undef CW_GUARDIAN
#undef CW_WARRIOR
#undef CW_CAVALRY
#undef CW_TELEPORT_AND_RESET_MOVES
[/scenario]

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


#textdomain wesnoth-After_the_Storm

[scenario]
    id=04_Terror_at_Dusk
    name= _ "Terror at Dusk"
    {MAP 04_Terror_at_Dusk.map}
    {TURNS 28 25 23}
    next_scenario="05_Bay_of_Tirigaz"

    {Z_DEATHS}

    {SCENARIO_MUSIC "underground.ogg"} {CONTINUE_PLAYING_STORY_MUSIC_FIRST}

    {STORYTXT_TERROR_AT_DUSK}

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

    {SHAXTHAL_SET_SURFACE_VARIATIONS_FLAG}

    # wmllint: validate-off
    [side]
        save_id=player

        controller=human
        side=1
        team_name=player
        user_team_name= _ "team_name^Galas"
        fog=yes

        {GOLD 310 300 290}

        # wmllint: recognize Galas
        {CHARACTER_STATS_GALAS}
    [/side]
    # wmllint: validate-on

    [side]
        side=2
        team_name=foe
        user_team_name= _ "team_name^Enemies"
        {CHAOS_FLAG}

        {GOLD 130 145 160}
        recruit=Shaxthal Drone, Shaxthal Runner Drone, Shaxthal Razorbird

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

        canrecruit=yes
        type=Shaxthal Assault Drone
        unrenamable=yes
        [modifications]
            {TRAIT_BIOMECHANICAL}
            {TRAIT_RESILIENT}
        [/modifications]
    [/side]

    [side]
        side=3
        team_name=foe
        user_team_name= _ "team_name^Enemies"
        {CHAOS_FLAG}

        {GOLD 120 130 140}
        recruit=Shaxthal Runner Drone, Shaxthal Razorbird, Shaxthal Drone

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

        canrecruit=yes
        type=Shaxthal Assault Drone
        unrenamable=yes
        [modifications]
            {TRAIT_BIOMECHANICAL}
            {TRAIT_ARMORED}
        [/modifications]
    [/side]

    [side]
        side=4
        team_name=foe
        user_team_name= _ "team_name^Enemies"
        {CHAOS_FLAG}

        {GOLD 120 150 170}
        recruit=Shaxthal Runner Drone, Chaos Invader, Shaxthal Drone, Chaos Headhunter

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

        canrecruit=yes
        id=Darglen
        name= _ "Darglen"
        type=Chaos Lorekeeper
        unrenamable=yes
        [modifications]
            {TRAIT_BIOMECHANICAL}
            {TRAIT_STRONG}
        [/modifications]
    [/side]

    {STARTING_VILLAGES 1 5}
    {STARTING_VILLAGES 2 5}
    {STARTING_VILLAGES 3 5}
    {STARTING_VILLAGES 4 5}

    {OBSIDIAN_BATTLE_AXE 11 5}

    [event]
        name=prestart

        # wmllint: recognize Elynia
        {RECALL_ELYNIA}
        # wmllint: recognize Mal Keshar
        {RECALL_MAL_KESHAR}

        {FACE_DIRECTION (id=Elynia)     se}
        {FACE_DIRECTION (id=Mal Keshar) ne}
        {FACE_DIRECTION (id=Galas)      nw}

        {OBJECTIVES (
            {OBJECTIVE_VICTORY ( _ "Defeat all enemy leaders")}

            {OBJECTIVE_DEFEAT  ( _ "Death of Galas")}
            {OBJECTIVE_DEFEAT  ( _ "Death of Elynia")}
            {OBJECTIVE_DEFEAT  ( _ "Death of Mal Keshar")}

            {TURNS_RUN_OUT}

            {OBJECTIVE_CARRYOVER}
        )}
    [/event]

    [event]
        name=start

        [sound]
            name={SOUND_LIST:BIOMECHANICAL_ROAM}
        [/sound]

        [delay]
            time=500
        [/delay]

        {FACE_DIRECTION (id=Elynia,Mal Keshar) nw}

        [redraw][/redraw]

        [delay]
            time=750
        [/delay]

        [message]
            speaker=Mal Keshar
            message= _ "That is the sound of those blasted creatures!"
        [/message]

        [delay]
            time=500
        [/delay]

        [message]
            speaker=Galas
            message= _ "Um... that’s unusual. Could they be behind the death of Inodien? But then..."
        [/message]

        [message]
            speaker=Elynia
            message= _ "... The Chaos Empire must not be in disarray as we thought."
        [/message]

        [message]
            speaker=Galas
            message= _ "They shall pay for the senseless destruction and bloodshed they caused. Let us get rid of them before they bring more strife to this country!"
        [/message]

        {REPLACE_SCENARIO_MUSIC "suspense.ogg"}
        {APPEND_MUSIC           "nunc_dimittis.ogg"}
    [/event]

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

        [message]
            speaker=Mal Keshar
            message= _ "Don’t die yet, vermin! We want some answers before crushing your useless skull against the rocks!"
        [/message]

        [message]
            speaker=Darglen
            message= _ "... And do you really believe I would speak? Heh... you can torture me as much as you want, but you won’t get anything from me!"
        [/message]

        [message]
            speaker=Mal Keshar
            message= _ "Stupid..."
        [/message]

        [message]
            speaker=Elynia
            message= _ "Let him."
        [/message]

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

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

        [message]
            speaker=Mal Keshar
            message= _ "That bastard... Hekuba... He and the Iron Triad must be behind this. But what are they trying to accomplish?"
        [/message]

        [message]
            speaker=Elynia
            message= _ "They want to take revenge on us and our kind after Argan’s death, of course. It seems that as long as their cult exists, so will the Chaos Empire."
        [/message]

        [scroll_to]
            x,y=$x2,$y2
        [/scroll_to]
    [/event]

    [event]
        name=enemies defeated

        {ENDLEVEL_VICTORY yes}
    [/event]

    [event]
        name=victory

        [message]
            speaker=Galas
            message= _ "This was the last one, and it doesn’t seem like there are any more groups coming here."
        [/message]

        [message]
            speaker=Mal Keshar
            message= _ "Let’s not worry a lot about them. These pathetic weaklings are nothing compared to the hordes we fought before."
        [/message]

        [message]
            speaker=Elynia
            message= _ "Let’s proceed to Tirigaz now, quickly."
        [/message]

        [message]
            speaker=Mal Keshar
            message= _ "Why don’t we go after their leaders and put an end to this stupid war now?"
        [/message]

        [message]
            speaker=Elynia
            message= _ "No... That would be a highly reckless choice. We don’t know what kind of enemies we might be facing other than Mal Hekuba — you have not forgotten our last encounter with him, have you? We are at a disadvantage without more information about them — their leaders, their weapons, their plans. This is why we must find Zocthanol first."
        [/message]

        [message]
            speaker=Mal Keshar
            message= _ "(sighs) Very well, then."
        [/message]
    [/event]

    [event]
        name=time over

        [message]
            speaker=Mal Keshar
            message= _ "We have wasted far too much time dealing with these pests. Look! A large swarm is approaching from the south!"
        [/message]

        [message]
            speaker=Elynia
            message= _ "Indeed. This... this was not a very prudent idea."
        [/message]
    [/event]
[/scenario]

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


#textdomain wesnoth-After_the_Storm

[scenario]
    id=05_Bay_of_Tirigaz
    name= _ "Bay of Tirigaz"
    {MAP 05_Bay_of_Tirigaz.map}
    {TURNS 22 20 18}
    next_scenario="06_01_Quenoth_Isle"

    {Z_DEATHS}

    {SCENARIO_MUSIC       "breaking_the_chains.ogg"}
    {EXTRA_SCENARIO_MUSIC "loyalists.ogg"}

    {STORYTXT_BAY_OF_TIRIGAZ}

    {TWO_SUNS_DEFAULT_SCHEDULE}

    # wmllint: validate-off
    [side]
        save_id=player

        controller=human
        side=1
        team_name=player
        user_team_name= _ "team_name^Galas"

        {GOLD 320 310 300}

        # wmllint: recognize Galas
        {CHARACTER_STATS_GALAS}
    [/side]
    # wmllint: validate-on

    [side]
        side=2
        team_name=player
        user_team_name= _ "team_name^Tirigaz"

        # Deliberately weak.
        {GOLD 100 90 80}
        village_gold=1
        recruit="Orcish Grunt, Orcish Archer, Wolf Rider, Goblin Spearman"

        id="Tan-Vatar"
        name= _ "Tan-Vatar"
        canrecruit=yes
        type=Orcish Sovereign
        unrenamable=yes
        profile="portraits/orcs/grunt-6.png"
        [modifications]
            {TRAIT_RESILIENT}
            {TRAIT_STRONG}
        [/modifications]

        {ai/aliases/stable_singleplayer.cfg}
        [ai]
            {AI_NO_SCOUTS}
            {AI_SIMPLE_ALWAYS_ASPECT aggression 0.80}
            {AI_SIMPLE_ALWAYS_ASPECT caution    0.20}
        [/ai]

        [unit]
            generate_name,random_traits=yes,yes
            ai_special=guardian
            type=Orcish Slurbow
            x,y=2,8
            facing=sw
            upkeep=free
        [/unit]
        [unit]
            generate_name,random_traits=yes,yes
            ai_special=guardian
            type=Orcish Grunt
            x,y=25,8
            facing=sw
            upkeep=free
        [/unit]
        [unit]
            generate_name,random_traits=yes,yes
            ai_special=guardian
            type=Orcish Warlord
            x,y=12,7
            facing=se
            upkeep=free
        [/unit]
        [unit]
            generate_name,random_traits=yes,yes
            ai_special=guardian
            type=Orcish Slurbow
            x,y=34,5
            facing=sw
            upkeep=free
        [/unit]
        [unit]
            id="Chiis Kun"
            name="Chiis Kun"
            type=Orcish Warlord
            ai_special=guardian
            x,y=26,2
            unrenamable=yes
            facing=se
            upkeep=free
            [modifications]
                {TRAIT_QUICK}
                {TRAIT_STRONG}
            [/modifications]
        [/unit]
        [unit]
            generate_name,random_traits=yes,yes
            type=Goblin Knight
            x,y=28,18
            facing=sw
            upkeep=free
        [/unit]
        [unit]
            generate_name,random_traits=yes,yes
            type=Goblin Knight
            x,y=24,17
            facing=sw
            upkeep=free
        [/unit]
        [unit]
            generate_name,random_traits=yes,yes
            type=Goblin Rouser
            x,y=27,16
            facing=se
            upkeep=free
        [/unit]
        [unit]
            generate_name,random_traits=yes,yes
            type=Goblin Impaler
            x,y=24,16
            facing=sw
            upkeep=free
        [/unit]
        [unit]
            generate_name,random_traits=yes,yes
            type=Goblin Spearman
            x,y=27,23
            upkeep=free
        [/unit]
        [unit]
            generate_name,random_traits=yes,yes
            type=Orcish Warrior
            x,y=22,16
            facing=s
            upkeep=free
        [/unit]
        [unit]
            generate_name,random_traits=yes,yes
            type=Orcish Warrior
            x,y=23,24
            facing=nw
            upkeep=free
        [/unit]
    [/side]

    [side]
        side=3
        team_name=lizards
        user_team_name= _ "team_name^Invaders"
        {FLAG_VARIANT6 ragged}

        {GOLD 150 180 210}
        recruit="Saurian Skirmisher, Saurian Augur, Mudcrawler, Vampire Bat"

        id=Rishix
        name= _ "Rishix"
        canrecruit=yes
        type=Saurian Flanker
        unrenamable=yes
        [modifications]
            {TRAIT_STRONG}
            {TRAIT_RESILIENT}
        [/modifications]

        {ai/aliases/stable_singleplayer.cfg}
        [ai]
            {AI_SIMPLE_ALWAYS_ASPECT aggression           1.00}
            {AI_SIMPLE_ALWAYS_ASPECT caution              0.00}
            {AI_SIMPLE_ALWAYS_ASPECT passive_leader        yes}
            {AI_SIMPLE_ALWAYS_ASPECT recruitment_pattern "scout,scout,healer,scout,archer,scout,archer"}
        [/ai]

        [unit]
            generate_name,random_traits=yes,yes
            type=Saurian Ambusher
            x,y=22,18
            facing=ne
            upkeep=free
        [/unit]
        [unit]
            generate_name,random_traits=yes,yes
            type=Saurian Soothsayer
            x,y=27,21
            facing=n
            upkeep=free
        [/unit]
        [unit]
            generate_name,random_traits=yes,yes
            type=Saurian Ambusher
            x,y=22,22
            facing=se
            upkeep=free
        [/unit]
        [unit]
            generate_name,random_traits=yes,yes
            type=Saurian Ambusher
            x,y=19,18
            facing=se
            upkeep=free
        [/unit]
        [unit]
            generate_name,random_traits=yes,yes
            type=Saurian Skirmisher
            x,y=24,22
            facing=ne
            upkeep=free
        [/unit]
        [unit]
            generate_name,random_traits=yes,yes
            type=Saurian Ambusher
            x,y=20,24
            facing=se
            upkeep=free
        [/unit]
        [unit]
            generate_name,random_traits=yes,yes
            type=Saurian Soothsayer
            x,y=24,19
            facing=sw
            upkeep=free
        [/unit]
    [/side]

    [side]
        side=4
        team_name=lizards
        user_team_name= _ "team_name^Invaders"
        {FLAG_VARIANT6 ragged}

        {GOLD 330 360 390}
        {INCOME 2 4 5}
        recruit="Saurian Skirmisher, Saurian Augur, Mudcrawler, Vampire Bat"

        id=Ishkaal
        name= _ "Ishkaal"
        canrecruit=yes
        type=Saurian Oracle
        unrenamable=yes
        [modifications]
            {TRAIT_RESILIENT}
            {TRAIT_INTELLIGENT}
        [/modifications]

        {ai/aliases/stable_singleplayer.cfg}
        [ai]
            {AI_SIMPLE_ALWAYS_ASPECT aggression           1.00}
            {AI_SIMPLE_ALWAYS_ASPECT caution              0.00}
            {AI_SIMPLE_ALWAYS_ASPECT recruitment_pattern "scout,scout,healer,scout,archer,scout,archer,scout,healer"}
        [/ai]

        [unit]
            generate_name,random_traits=yes,yes
            ai_special=guardian
            type=Saurian Flanker
            x,y=13,33
            upkeep=free
        [/unit]
        [unit]
            generate_name,random_traits=yes,yes
            ai_special=guardian
            type=Saurian Flanker
            x,y=12,30
            upkeep=free
        [/unit]
        [unit]
            generate_name,random_traits=yes,yes
            ai_special=guardian
            type=Saurian Flanker
            x,y=9,30
            upkeep=free
        [/unit]
        [unit]
            generate_name,random_traits=yes,yes
            ai_special=guardian
            type=Saurian Flanker
            x,y=3,33
            upkeep=free
        [/unit]
        [unit]
            generate_name,random_traits=yes,yes
            ai_special=guardian
            type=Saurian Flanker
            x,y=6,35
            upkeep=free
        [/unit]
#ifndef EASY
        [unit]
            generate_name,random_traits=yes,yes
            ai_special=guardian
            type=Saurian Flanker
            x,y=12,35
            upkeep=free
        [/unit]
#endif
    [/side]

    [side]
        side=5
        team_name=lizards
        user_team_name= _ "team_name^Sea Creatures"
        {FLAG_VARIANT6 ragged}
        hidden=yes
        no_leader=yes

        {ai/aliases/stable_singleplayer.cfg}
        [ai]
            [goal]
                [criteria]
                    x=16-28
                    y=13-40
                [/criteria]
                value=10.0
            [/goal]
            {AI_SIMPLE_ALWAYS_ASPECT aggression 200.00}
            {AI_SIMPLE_ALWAYS_ASPECT caution      0.00}
            {AI_SIMPLE_ALWAYS_ASPECT grouping       no}
        [/ai]
    [/side]

    [side]
        side=6
        team_name=lizards
        user_team_name= _ "team_name^Water Serpents"
        {FLAG_VARIANT6 ragged}
        hidden=yes
        no_leader=yes

        {ai/aliases/stable_singleplayer.cfg}
        [ai]
            [goal]
                [criteria]
                    side=1
                [/criteria]
                value=9.9
            [/goal]
            [goal]
                [criteria]
                    side=2
                [/criteria]
                value=0.1
            [/goal]
            {AI_SIMPLE_ALWAYS_ASPECT aggression 200.00}
            {AI_SIMPLE_ALWAYS_ASPECT caution      0.00}
            {AI_SIMPLE_ALWAYS_ASPECT grouping       no}
        [/ai]
    [/side]

    {STARTING_VILLAGES 2 40}
    {STARTING_VILLAGES 3 5 }
    {STARTING_VILLAGES 4 5 }

    #
    # Some location names
    #
    [label]
        x,y=29,5
        # wmllint: local spelling Arthol
        text= _ "Arthol"
    [/label]
    [label]
        x,y=9,9
        text= _ "Tirigaz"
    [/label]
    [label]
        x,y=22,24
        # wmllint: local spelling Krisval
        text= _ "Krisval"
    [/label]
    [label]
        x,y=33,13
        # wmllint: local spelling Burdyr
        text= _ "Burdyr"
    [/label]

    {ANIMATED_FOUNTAIN 29 5 }

    {PLACE_IMAGE ("scenery/oak-leaning.png") 9 9}

    {PLACE_IMAGE ("units/transport/galleon.png~FL(horiz)~RC(magenta>blue)")           6 10}
    {PLACE_IMAGE ("units/transport/transport-galleon.png~FL(horiz)~RC(magenta>blue)") 8 11}
    {PLACE_IMAGE ("units/transport/galleon.png~FL(horiz)~RC(magenta>blue)")           11 13}
    {PLACE_IMAGE ("units/transport/galleon.png~RC(magenta>blue)")                     14 11}

    {PLACE_IMAGE ("units/transport/boat.png")           5  14}
    {PLACE_IMAGE ("units/transport/boat.png~FL(horiz)") 12 18}
    {PLACE_IMAGE ("units/transport/boat.png~FL(horiz)") 16 9 }

    {PLACE_IMAGE ("items/straw-bale1.png") 35 14}
    {PLACE_IMAGE ("items/straw-bale2.png") 32 14}
    {PLACE_IMAGE ("items/grain-sheaf.png") 37 16}
    {PLACE_IMAGE ("items/straw-bale2.png") 37 10}

    {PLACE_IMAGE ("items/scarecrow.png")   34 12}
    {PLACE_IMAGE ("items/scarecrow.png")   33 19}

    {PLACE_IMAGE ("items/archery-target-right.png") 3  7 }
    {PLACE_IMAGE ("items/archery-target-right.png") 7  5 }
    {PLACE_IMAGE ("items/archery-target-right.png") 11 6 }

    {PLACE_IMAGE ("scenery/signpost.png") 30 1 }

    # wmllint: local spellings NE NW SE SW

    [event]
        name=moveto
        first_time_only=yes
        [filter]
            side,x,y=1,30,1
        [/filter]
        [redraw][/redraw]
        [allow_undo][/allow_undo]
        [message]
            speaker=narrator
            image="scenery/signpost.png"
            # wmllint: local spelling Bisbarl
            message= _"N: Bisbarl"
        [/message]
    [/event]

    {PLACE_IMAGE ("scenery/signpost.png") 24 10}

    [event]
        name=moveto
        first_time_only=yes
        [filter]
            side,x,y=1,24,10
        [/filter]
        [redraw][/redraw]
        [allow_undo][/allow_undo]
        [message]
            speaker=narrator
            image="scenery/signpost.png"
            # wmllint: display on
            message= _"N: Bisbarl
NW: Port of Tirigaz
NE: Arthol"
            # wmllint: display off
        [/message]
    [/event]

    {PLACE_IMAGE ("scenery/signpost.png") 11 40}

    [event]
        name=moveto
        first_time_only=yes
        [filter]
            side,x,y=1,11,40
        [/filter]
        [redraw][/redraw]
        [allow_undo][/allow_undo]
        [message]
            speaker=narrator
            image="scenery/signpost.png"
            # wmllint: local spelling Wyndill
            message= _"SW: Province of Wyndill"
        [/message]
    [/event]

#define BOT_FOUNTAIN_LIT_SCHEDULE _BONUS _X _Y
    [+time]
        image="misc/schedule-twosuns.png~CROP({_X},{_Y},125,39)~BLIT(misc/tod-bright.png)"
        lawful_bonus={_BONUS}
    [/time]
#enddef

    [event]
        name=prestart

        [item]
            x,y=29,5
            halo="halo/illuminates-aura.png~O(0.50)"
        [/item]

        [time_area]
            id=fountain_of_courage
            x,y=29,5
            radius=1
            {DAWN1}      {BOT_FOUNTAIN_LIT_SCHEDULE 25   1   1}
            {MORNING1}
            {MIDDAY1}
            {AFTERNOON1}
            {DUSK1}      {BOT_FOUNTAIN_LIT_SCHEDULE 25 127  41}
            {SHORTDARK}  {BOT_FOUNTAIN_LIT_SCHEDULE  0 253  41}
            {DAWN2}      {BOT_FOUNTAIN_LIT_SCHEDULE 25   1  81}
            {MORNING2}
            {MIDDAY2}
            {AFTERNOON2}
            {DUSK2}      {BOT_FOUNTAIN_LIT_SCHEDULE 25 127 121}
            {LONGDARK1}  {BOT_FOUNTAIN_LIT_SCHEDULE  0 253 121}
            {LONGDARK2}  {BOT_FOUNTAIN_LIT_SCHEDULE  0   1 161}
            {LONGDARK3}  {BOT_FOUNTAIN_LIT_SCHEDULE  0 127 161}
            {LONGDARK4}  {BOT_FOUNTAIN_LIT_SCHEDULE  0 253 161}
        [/time_area]

        {VARIABLE swam_in_fountain_of_courage no} # Must persist after scenario

        {VARIABLE undead_attacks 0}
        {VARIABLE fountain_checked no}

        {OBJECTIVES (
            {OBJECTIVE_VICTORY ( _ "Defeat both enemy leaders")}

            {OBJECTIVE_DEFEAT  ( _ "Death of Galas")}
            {OBJECTIVE_DEFEAT  ( _ "Death of Elynia")}
            {OBJECTIVE_DEFEAT  ( _ "Death of Mal Keshar")}
            {OBJECTIVE_DEFEAT  ( _ "Death of Vuruk or the ally leader")}
            {OBJECTIVE_DEFEAT  ( _ "The port of Tirigaz or the town of Arthol are captured by the enemy")}

            {TURNS_RUN_OUT}

            {OBJECTIVE_CARRYOVER}
        )}

        {LOG_ATS_DBG "enter Tirigaz 'moveto' event generator"}

        #
        # Generate shipwreck treasure locations
        #

        [set_variables]
            name=shipwrecks
            mode=replace
            [value]
                gold=170
                message= _ "170 gold! It seems it was a trading ship!"
                alert= _ "You retrieve 170 pieces of gold." # wmllint: ignore
            [/value]
            [value]
                gold=25
                message= _ "Bah, only 25 pieces of gold. Better than nothing, I guess."
                alert= _ "You retrieve 25 pieces of gold." # wmllint: ignore
            [/value]
            [value]
                gold=2
                message= _ "Two pieces of gold? Damn, this must be a joke!"
                alert= _ "You retrieve two pieces of gold." # wmllint: ignore
            [/value]
            [value]
                gold=50
                message= _ "Well, well, 50 pieces of gold can be put to good use!"
                alert= _ "You retrieve 50 pieces of gold." # wmllint: ignore
            [/value]
        [/set_variables]

        [set_variables]
            name=locations
            mode=replace
            [value]
                x,y=14,16
            [/value]
            [value]
                x,y=1,23
            [/value]
            [value]
                x,y=4,29
            [/value]
            [value]
                x,y=18,23
            [/value]
        [/set_variables]

        [foreach]
            array=locations
            variable=loc
            [do]
                {VARIABLE_RANDOM r     "0..$($shipwrecks.length - 1)"}
                {VARIABLE_RANDOM image "scenery/wreck.png,scenery/wreck-2.png,scenery/wreck-3.png"}

                [item]
                    x,y=$loc.x,$loc.y
                    image=$image
                [/item]

                # Generate the event

                [event]
                    delayed_variable_substitution=no
                    name=moveto
                    first_time_only=true
                    [filter]
                        side=1
                        x,y=$loc.x,$loc.y
                    [/filter]

                    [redraw][/redraw]

                    [message]
                        speaker=unit
                        {UNIT_SPEAKS_FOR_UNDEAD_MINION (id=Mal Keshar)}
                        scroll=no
                        message=$shipwrecks[$r].message
                    [/message]

                    [message]
                        speaker=narrator
                        image="items/gold-coins-medium.png"
                        sound=gold.ogg
                        message=$shipwrecks[$r].alert
                    [/message]

                    [gold]
                        side=1
                        amount=$shipwrecks[$r].gold
                    [/gold]
                [/event]

                {CLEAR_VARIABLE "r,image,shipwrecks[$r]"}
            [/do]
        [/foreach]

        {CLEAR_VARIABLE shipwrecks,locations}

        [store_unit]
            [filter]
                id=Galas
            [/filter]
            variable=galas_store
            kill=yes
        [/store_unit]

        {LOCK_VIEW}
    [/event]

    [event]
        name=start

        [message]
            speaker=Ishkaal
            # po: The pointy-eared demons here are the elves.
            message= _ "You filthy soft-skinned beasts, this is your last opportunity to return our swamps! We are not planning to retreat to the forests of the pointy-eared demons!"
        [/message]

        [message]
            speaker=Tan-Vatar
            message= _ "We care nothing for your stupid conflicts on the eastern borders. You trespassed our frontiers and broke our treaty, and now you ask from us the very lands you took by force; after raiding our southern garrison, no less! If you believe we will accede now—"
        [/message]

        [message]
            speaker=Ishkaal
            message= _ "To the Dark Gods with you and your treaty! The words of an orc are no more meaningful than his fetid breath! Maybe you’ll admit your defeat once we have razed every single one of your precious buildings to the ground. Go ahead, Rishix! Teach them a lesson!"
        [/message]

        [message]
            speaker=Rishix
            message= _ "We’ll make these puny dirt-dwellers rue the day they were born!"
        [/message]

        [delay]
            time=250
        [/delay]

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

        [delay]
            time=250
        [/delay]

        [move_unit_fake]
            x="40,$galas_store.x"
            y="28,$galas_store.y"
            type="$galas_store.type"
            side="$galas_store.side"
            image_mods="RC(magenta>brown)"
        [/move_unit_fake]

        [unstore_unit]
            variable=galas_store
        [/unstore_unit]

        {CAPTURE_VILLAGES 1 $galas_store.x $galas_store.y 5}

        {CLEAR_VARIABLE galas_store}

        # wmllint: recognize Elynia
        {RECALL_ELYNIA}
        # wmllint: recognize Mal Keshar
        {RECALL_MAL_KESHAR}

        [terrain]
            x=36,35,37,35-37
            y=24,25,25,26
            terrain=Ce
        [/terrain]

        [terrain]
            x,y=36,25
            terrain=Ke
        [/terrain]

        {FACE_DIRECTION side=1 nw}

        [redraw][/redraw]

        [delay]
            time=500
        [/delay]

        [message]
            speaker=Galas
            message= _ "That city to the northwest... is it the port of Tirigaz?"
        [/message]

        [message]
            speaker=Elynia
            message= _ "Yes... it wasn’t so well fortified during my time. So many things have changed since then."
        [/message]

        [message]
            speaker=Galas
            # po: "Is that smoke I smell?"
            message= _ "Is that smoke I— Wait, I hear steps..."
        [/message]

        [delay]
            time=250
        [/delay]

        [move_unit_fake]
            side=1
            type=Orcish Crossbowman
            x=32,33,34,34,35
            y=31,31,30,29,29
        [/move_unit_fake]

        [unit]
            type=Orcish Crossbowman
            id=Vuruk
            name= _ "Vuruk"
            {IS_HERO}
            x,y=35,29
            side=1
            facing=ne
            [modifications]
                {TRAIT_LOYAL}
                {TRAIT_STRONG}
            [/modifications]
        [/unit]

        [delay]
            time=750
        [/delay]

        [message]
            speaker=Vuruk
            message= _ "Hello, strangers! Are you loyal to the Grand Council?"
        [/message]

        [message]
            speaker=Mal Keshar
            message= _ "Ehm..." # wmllint: no spellcheck
        [/message]

        [message]
            speaker=Elynia
            message= _ "Yes, we are."
        [/message]

        [message]
            speaker=Vuruk
            message= _ "Those vile saurians hold the port of Tirigaz under siege, leaving me unable to reach the city to deliver some important news to our lord. I think I speak for all of us when I say that your help would be very appreciated. I need to get to the city keep, but the journey across isn’t safe while those vermin roam about our lands!"
        [/message]

        [message]
            speaker=Elynia
            message= _ "The enemies of our friends are our enemies. We can help you."
        [/message]

        [message]
            speaker=Mal Keshar
            message= _ "(<i>whispering</i>) I am curious about their motives... Don’t you think your trust in the orcs could be misplaced?"
        [/message]

        [message]
            speaker=Elynia
            message= _ "We must stop and repel those saurians before they take over Tirigaz or the northern town that provides resources to the port."
        [/message]

        {UNLOCK_VIEW}
    [/event]

    [event]
        name=turn 2

        [message]
            speaker=Galas
            message= _ "Vuruk, what is it that you need to report to the lord of Tirigaz?"
        [/message]

        [message]
            speaker=Vuruk
            message= _ "Hmm... I fear it is nothing I’m allowed to share with anyone but Lord Tan-Vatar and his trusted commanders, at least not at this time."
        [/message]

        [message]
            speaker=Galas
            message= _ "Fair enough."
        [/message]
    [/event]

    [event]
        name=turn 3

        {LOCK_VIEW}

        #
        # Mandatory generic sea creatures' appearance.
        # No campaign is ever complete without this.
        #

        [message]
            speaker=Ishkaal
            message= _ "Come in aid of your kin, friends from the deep sea!"
        [/message]

        [scroll_to]
            x,y=2,16
        [/scroll_to]

        [unit]
            animate=yes
            side,x,y=5,2,16
            type=Sea Serpent
            facing=se
            [modifications]
                {TRAIT_LOYAL}
                {TRAIT_RESILIENT}
            [/modifications]
        [/unit]

        [unit]
            animate=yes
            side,x,y=5,1,16
            type=Cuttle Fish
            facing=se
            [modifications]
                {TRAIT_LOYAL}
                {TRAIT_STRONG}
            [/modifications]
        [/unit]

#ifndef EASY
        [unit]
            animate=yes
            side,x,y=5,1,17
            type=Cuttle Fish
            facing=se
            [modifications]
                {TRAIT_LOYAL}
                {TRAIT_QUICK}
            [/modifications]
        [/unit]
#endif

        [redraw][/redraw]

        [delay]
            time=500
        [/delay]

        [message]
            speaker=Mal Keshar
            message= _ "Ah, ha, ha, hah! They have the support of some wild creatures from the ocean! Nothing we cannot handle."
        [/message]

        {UNLOCK_VIEW}
    [/event]

    [event]
        name=attack end
        first_time_only=no
        [filter]
            race=undead
            side=1
        [/filter]

        {VARIABLE_INC undead_attacks}

        [fire_event]
            name=remark on undead
            [primary_unit]
                x,y=$x1,$y1
            [/primary_unit]
        [/fire_event]
    [/event]

    [event]
        name=attack end
        first_time_only=no
        [filter_second]
            race=undead
            side=1
        [/filter_second]

        {VARIABLE_INC undead_attacks}

        [fire_event]
            name=remark on undead
            [primary_unit]
                x,y=$x1,$y1
            [/primary_unit]
        [/fire_event]
    [/event]

    [event]
        name=remark on undead
        [filter_condition]
            {VARIABLE_NUMERICAL_EQUALS undead_attacks 6}
        [/filter_condition]

        [message]
            [not]
                x,y=$x1,$y1
            [/not]
            [not]
                [filter_adjacent]
                    x,y=$x1,$y1
                [/filter_adjacent]
            [/not]
            [and]
                side=3
                [or]
                    side=4
                [/or]
            [/and]
            scroll=no
            message= _ "Where did all these damned creatures come from?"
        [/message]
    [/event]

    [event]
        name=turn 6

        [message]
            speaker=Ishkaal
            message= _ "This is turning out to be much harder than we expected..."
        [/message]

        [set_variables]
            mode=replace
            name=serpent_locs
            [literal]
                x,y,facing=23,36,nw
            [/literal]
            [literal]
                x,y,facing=13,30,ne
            [/literal]
#ifndef EASY
            [literal]
                x,y,facing=18,34,n
            [/literal]
            [literal]
                x,y,facing=10,24,se
            [/literal]
#endif
        [/set_variables]

        [foreach]
            array=serpent_locs
            variable=loc
            [do]
                [unit]
                    generate_name,random_traits=yes,yes
                    x=$loc.x
                    y=$loc.y
                    facing=$loc.facing
                    type=Water Serpent
                    side=6
                [/unit]
            [/do]
        [/foreach]

        [foreach]
            array=serpent_locs
            variable=loc
            [do]
                [scroll_to]
                    x=$loc.x
                    y=$loc.y
                [/scroll_to]

                [redraw][/redraw]
            [/do]
        [/foreach]

        {CLEAR_VARIABLE serpent_locs}
    [/event]

    #
    # Defeat condition: village tiles in the Arthol/Tirigaz areas get captured by saurians
    #

    [event]
        name=capture
        [filter]
            x=25-34
            y= 3-8
            [and]
                side=3
                [or]
                    side=4
                [/or]
            [/and]
        [/filter]

        [message]
            speaker=Vuruk
            message= _ "Arthol is being ransacked by the saurians! Now there’s no hope for Tirigaz!"
        [/message]

        {ENDLEVEL_DEFEAT}
    [/event]

    [event]
        name=capture
        [filter]
            x=1-16
            y=1-12
            [and]
                side=3
                [or]
                    side=4
                [/or]
            [/and]
        [/filter]

        [message]
            speaker=Galas
            message= _ "Tirigaz has been captured! Our mission has failed, and we won’t be able to reach Zocthanol now!"
        [/message]

        {ENDLEVEL_DEFEAT}
    [/event]

    #
    # Victory condition: enemies defeated
    #

    [event]
        name=enemies defeated

        {ENDLEVEL_VICTORY yes}
    [/event]

    #
    # Defeat condition: Vuruk dies
    #

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

        [message]
            speaker=unit
            # wmllint: local spelling uuugh
            message= _ "No! I’ve got to... uuugh..."
        [/message]
    [/event]

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

        [message]
            speaker=Galas
            message= _ "We let the orcish messenger perish on the battlefield! The lord of Tirigaz is not going to like this..."
        [/message]

        {ENDLEVEL_DEFEAT}
    [/event]

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

        [message]
            speaker=unit
            # wmllint: local spelling Eeaack
            message= _ "The treacherous ones cannot win! Eeaack..."
        [/message]

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

    [event]
        name=last breath
        [filter]
            id=Rishix
        [/filter]
        [filter_second]
            [not]
                race=undead
            [/not]
            [not]
                status=not_living
            [/not]
        [/filter_second]

        [message]
            speaker=unit
            message= _ "Damn you, dirt-dwellers!"
        [/message]

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

    [event]
        name=last breath
        [filter]
            id=Rishix
        [/filter]
        [filter_second]
            race=undead
            [or]
                status=not_living
            [/or]
            [not]
                id=Mal Keshar
            [/not]
        [/filter_second]

        [message]
            speaker=unit
            message= _ "I have been struck down by the damned minions of a lich! This is not fair!"
        [/message]

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

    [event]
        name=last breath
        [filter]
            id=Rishix
        [/filter]
        [filter_second]
            id=Mal Keshar
        [/filter_second]

        [message]
            speaker=unit
            message= _ "Accursed lich! May the Dark Gods smite you down for this atrocity— Eaugh!!!" # wmllint: no spellcheck
        [/message]

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

    [event]
        name=die
        [filter]
            type=Cuttle Fish
            [or]
                type=Sea Serpent
            [/or]
        [/filter]

        [message]
            speaker=Ishkaal
            message= _ "Noooooo! You’ll suffer for this atrocity!"
        [/message]

        [scroll_to]
            x,y=$x2,$y2
        [/scroll_to]
    [/event]

    #
    # Defeat condition: Tan-Vatar dies
    #

    [event]
        name=last breath
        [filter]
            id=Tan-Vatar
        [/filter]

        [message]
            speaker=second_unit
            message= _ "Ha, ha, ha! Die, fool!"
        [/message]

        [message]
            speaker=unit
            message= _ "No! The city will fall... without my leadership... *ack*"
        [/message]

        [message]
            speaker=Ishkaal
            message= _ "Take that, orcish scum! Your leader is dead now, and your city is ours!"
        [/message]
    [/event]

    [event]
        name=die
        [filter]
            id=Tan-Vatar
        [/filter]

        [message]
            speaker=Elynia
            message= _ "The commander of the defense of Tirigaz has been slain! The city won’t resist for much longer now..."
        [/message]

        {ENDLEVEL_DEFEAT}
    [/event]

    [event]
        name=moveto
        [filter]
            x=1-40
            y=1-13
            [and]
                side=3
                [or]
                    side=4
                [/or]
            [/and]
        [/filter]

        [message]
            side=2
            canrecruit=no
            message= _ "Don’t get any closer to our villages, you vermin!"
        [/message]

        [message]
            speaker=Ishkaal
            message= _ "Crush their villages into the ground!"
        [/message]

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

    [event]
        name=capture
        first_time_only=no
        [filter]
            side=1
            x=25-39,1-17
            y= 2-17,1-13
        [/filter]
        [capture_village]
            x=$x1
            y=$y1
            side=2
        [/capture_village]
    [/event]

    [event]
        name=capture
        first_time_only=yes
        [filter]
            side=1
            x=25-39,1-17
            y= 2-17,1-13
        [/filter]

        [message]
            speaker=Galas
            message= _ "These villages belong to the lord of Tirigaz! We must protect them, not capture them!"
        [/message]
    [/event]

    [event]
        id=fountain_of_courage:regular_eh
        name=moveto
        first_time_only=no
        [filter]
            side=1
            x,y=29,5
            [not]
                race=faerie
                [not]
                    id=Elynia
                [/not]
            [/not]
        [/filter]

        [message]
            speaker=narrator
            image=wesnoth-icon.png
            [show_if]
                {VARIABLE_BOOLEAN_EQUALS fountain_checked no}
            [/show_if]
            message= _ "The fountain’s water is overflowing with an unusual energy.

You catch a glimpse of a strange-looking faerie observing you from behind a nearby tree, but by the time you approach it she has seemingly vanished. In the hurry to return to the fray you almost slip on a puddle."
        [/message]

        [message]
            speaker=narrator
            image=wesnoth-icon.png
            [show_if]
                {VARIABLE_BOOLEAN_EQUALS fountain_checked yes}
            [/show_if]
            message= _ "The fountain’s water continues to overflow with an unusual energy."
        [/message]

        {VARIABLE fountain_checked yes}

        [allow_undo][/allow_undo]
    [/event]

    [event]
        id=fountain_of_courage:faerie_eh
        name=moveto
        [filter]
            side=1
            x,y=29,5
            race=faerie
            [not]
                id=Elynia
            [/not]
        [/filter]

        {VARIABLE swam_in_fountain_of_courage yes}

        [message]
            speaker=unit
            message= _ "(<i>jumps in</i>) Wheeeeeeee!!!"
        [/message]

        [heal_unit]
            [filter]
                x,y=$x1,$y1
            [/filter]
            amount="full"
            animate=yes
            restore_statuses=yes
        [/heal_unit]

        [modify_unit]
            [filter]
                x,y=$x1,$y1
            [/filter]

            {TRAIT_FEARLESS}
        [/modify_unit]

        [object]
            # NOTE: id is used in Lua by ats_unit_used_fountain_of_courage()
            id=fountain_of_courage
            duration=forever
            silent=yes

            [filter]
                x,y=$x1,$y1
            [/filter]

            [effect]
                apply_to=hitpoints
                increase,increase_total=25%,25%
            [/effect]

            [effect]
                apply_to=resistance
                replace=no
                [resistance]
                    blade=-10
                    fire=-10
                    cold=-10
                    impact=-10
                    pierce=-10
                [/resistance]
            [/effect]
        [/object]

        [transient_message]
            caption= _ "Shimmering Fountain"
            image=attacks/waterspray.png
            sound=water-blast.wav
            message= _ "The Naiad’s spell blesses anyone who takes a swim in the water of this fountain with newfound vim and courage."
            duration=forever
        [/transient_message]

        # This removes only the halo, not the fountain
        [remove_item]
            x,y=$x1,$y1
        [/remove_item]

        [remove_time_area]
            id=fountain_of_courage
        [/remove_time_area]

        [remove_event]
            id=fountain_of_courage:regular_eh,fountain_of_courage:faerie_eh
        [/remove_event]
    [/event]

    [event]
        name=victory

        {MODIFY_UNIT id=Vuruk side 2}

        [unit]
            type=Orcish Warrior
            side=2
            id=Vitork
            name= _ "Vitork"
            x,y=11,5
            facing=se
            [modifications]
                {TRAIT_RESILIENT}
                {TRAIT_QUICK}
            [/modifications]
        [/unit]

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

        [message]
            speaker=Tan-Vatar
            message= _ "This is an important battle you’ve helped us win, travelers. The city of Tirigaz shall be eternally thankful for your assistance."
        [/message]

        [message]
            speaker=Elynia
            message= _ "It is our duty to assist our allies in these times. However, I believe this soldier has something to tell you..."
        [/message]

        [message]
            speaker=Vitork
            message= _ "Vuruk, brother, you made it! Did you discover anything new?"
        [/message]

        [message]
            speaker=Vuruk
            message= _ "Ha, indeed! I need to talk with you about it later, but now I must report to the chieftains."
        [/message]

        [message]
            speaker=Tan-Vatar
            message= _ "I see you helped Vuruk return home safe and sound. Well done! So, what can we do for you to repay our debt?"
        [/message]

        [message]
            speaker=Mal Keshar
            message= _ "Um, we are currently looking for transportation services. We must sail the open ocean to find a certain island..."
        [/message]

        [message]
            speaker=Tan-Vatar
            message= _ "I mean no offense, but only fools would dare sail the <i>open ocean</i>! Nobody has ventured into farther waters and returned in one piece, ever! Nobody knows exactly what kind of creatures inhabit the Vast Sea! Nobody knows for certain what lies beyond the horizon, but it surely can’t be good, you see! Why would anyone want to travel so far into unknown waters, when there are plenty of safer unexplored lands awaiting back whence you came?"
        [/message]

        [message]
            speaker=Mal Keshar
            message= _ "We have a mission to complete, but much like Vuruk’s, it is not something we should discuss with..."
        [/message]

        [message]
            speaker=Elynia
            message= _ "We know the location of a certain isle where some people who once lived on the Great Continent went to. We need to gather some information from them — as part of a mission for the Grand Council."
        [/message]

        [message]
            speaker=Mal Keshar
            message= _ "Uh, huh."
        [/message]

        [message]
            speaker=Tan-Vatar
            message= _ "The Grand Council? Why didn’t you say so in the first place! We’ll do anything we can to help you in your mission. It’ll be difficult to gather an appropriate crew for you, but at least I can give you one of our fastest transport vessels."
        [/message]

        {CLEAR_VARIABLE undead_attacks,fountain_checked}
    [/event]
[/scenario]

#undef BOT_FOUNTAIN_LIT_SCHEDULE

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


#textdomain wesnoth-After_the_Storm

[scenario]
    id=06_01_Quenoth_Isle
    name= _ "Quenoth Isle"
    {MAP 06_01_Shore.map}
    turns=-1
    next_scenario="06_02_Elves_of_a_Different_Land"
    victory_when_enemies_defeated=no

    {FULLSCREEN_CUTSCENE_UI}

    {SCENARIO_MUSIC       "knolls.ogg"}

    {STORYTXT_QUENOTH_ISLE}

    {DUSK2}
    {LONGDARK1}

    # wmllint: validate-off

    [side]
        save_id=player

        controller=human
        side=1
        team_name=player
        user_team_name= _ "team_name^Galas"

        gold=0
        village_gold=0
        income=-2

        # This is solely to prevent a map snapshot from being used in the
        # Load Game menu when all terrain grahics are loaded. The shroud
        # is disabled later during prestart.
        shroud=yes

        # wmllint: recognize Galas
        {CHARACTER_STATS_GALAS}
    [/side]

    [side]
        side=2
        no_leader,hidden=yes,yes
        team_name=enemy
        user_team_name= _ "team_name^Quenoth"
        controller=null
    [/side]

    # wmllint: validate-on

    {PLACE_IMAGE ("units/transport/boat.png~FL(horiz)") 21 21}

    [event]
        name=prestart
        [modify_side]
            side=1
            shroud=no
        [/modify_side]

        # wmllint: recognize Elynia
        {RECALL_ELYNIA_AT_LOCATION 19 19}

        [teleport]
            [filter]
                id=Galas
            [/filter]
            x,y=19,18
        [/teleport]

        [allow_recruit]
            side=1
            type=Orcish Grunt,Orcish Archer,Goblin Spearman
        [/allow_recruit]

        {LOCK_VIEW}
    [/event]

    #
    # Cutscene 1.
    #

    [event]
        name=start
        {MOVE_UNIT id=Galas  18 14}
        {MOVE_UNIT id=Galas  17 14}
        {MOVE_UNIT id=Elynia 18 14}
        {MOVE_UNIT id=Galas  17 13}

        [message]
            speaker=Galas
            message= _ "This place appears to be abandoned... Are you sure this is the correct island?"
        [/message]

        [message]
            speaker=Elynia
            message= _ "Not completely... but it’s possible that the Quenoth elves just avoid these shores for some reason."
        [/message]

        [message]
            speaker=Galas
            message= _ "Let’s explore and try to find them, then."
        [/message]

        {MOVE_UNIT id=Galas 17 11}

        [store_unit]
            [filter]
                id=Galas
            [/filter]
            variable=galas_store
            kill=no
        [/store_unit]

        [store_unit]
            [filter]
                id=Elynia
            [/filter]
            variable=elynia_store
            kill=yes
        [/store_unit]

        [hide_unit]
            x,y=$galas_store.x,$galas_store.y
        [/hide_unit]

        [set_variables]
            mode=merge
            name=galas_store
            [literal]
                facing=nw
                x,y=21,5
                moves=0
                attacks_left=0
            [/literal]
        [/set_variables]

        [set_variables]
            mode=merge
            name=elynia_store
            [literal]
                facing=se
                x,y=22,6
                moves=0
                attacks_left=0
            [/literal]
        [/set_variables]

        [redraw][/redraw]

        {FADE_TO_BLACK}

        #
        # HACK: this code is necessary to prevent the Objectives
        # pop-up from appearing at the start of side 1 turn 2 with
        # the "No objectives available" message on 1.10.x!
        #
        [lua]
            code = << wesnoth.sides[1].objectives_changed = false >>
        [/lua]

        [end_turn][/end_turn]
    [/event]

    #
    # Cutscene 2.
    #

#define __UNIT_FROM_THE_TREES _SOURCE_X _SOURCE_Y _X _Y _UNIT_CODE
    [unit]
        to_variable=temp___UNIT_FROM_THE_TREES
        {_UNIT_CODE}
        x={_X}
        y={_Y}
    [/unit]
    [move_unit_fake]
        type=$temp___UNIT_FROM_THE_TREES.type
        x={_SOURCE_X},{_X}
        y={_SOURCE_Y},{_Y}
        side=$temp___UNIT_FROM_THE_TREES.side
        variation=$temp___UNIT_FROM_THE_TREES.variation
        gender=$temp___UNIT_FROM_THE_TREES.gender
    [/move_unit_fake]
    [unstore_unit]
        variable=temp___UNIT_FROM_THE_TREES
        find_vacant=yes
    [/unstore_unit]
    {CLEAR_VARIABLE temp___UNIT_FROM_THE_TREES}
#enddef

#define __MOVE_UNIT_KEEP_FACING _FILTER _X _Y
    [store_unit]
        [filter]
            {_FILTER}
        [/filter]
        kill=yes
        variable=temp___MOVE_UNIT_KEEP_FACING
    [/store_unit]
    [move_unit_fake]
        x=$temp___MOVE_UNIT_KEEP_FACING.x,{_X}
        y=$temp___MOVE_UNIT_KEEP_FACING.y,{_Y}
        variation=$temp___MOVE_UNIT_KEEP_FACING.variation
        type=$temp___MOVE_UNIT_KEEP_FACING.type
        side=$temp___MOVE_UNIT_KEEP_FACING.side
        gender=$temp___MOVE_UNIT_KEEP_FACING.gender
        # NOTE: this assumes that these will never get north-facing
        # frames.
        image_mods="FL(horiz)"
    [/move_unit_fake]
    [unstore_unit]
        find_vacant=yes
        variable=temp___MOVE_UNIT_KEEP_FACING
        x={_X}
        y={_Y}
    [/unstore_unit]
    {CLEAR_VARIABLE temp___MOVE_UNIT_KEEP_FACING}
#enddef

    [event]
        name=turn 2
        [delay]
            time=750
        [/delay]

        [message]
            speaker=narrator
            image=wesnoth-icon.png
            message= _ "Time passes..."
        [/message]

        [delay]
            time=250
        [/delay]

        [scroll_to]
            x,y=$galas_store.x,$galas_store.y
            {WARP}
        [/scroll_to]

        {FADE_IN}

        [kill]
            id=Galas
        [/kill]

        [unstore_unit]
            variable=galas_store
        [/unstore_unit]

        [unstore_unit]
            variable=elynia_store
        [/unstore_unit]

        [redraw][/redraw]

        {CLEAR_VARIABLE galas_store,elynia_store}

        [message]
            speaker=Elynia
            message= _ "Maybe we should return to the ship. I’m not really sure about going into the forest at night, it could be dangerous."
        [/message]

        [message]
            speaker=Galas
            message= _ "Why are you hesitating now?"
        [/message]

        {FACE_DIRECTION (id=Elynia) nw}

        [message]
            speaker=Elynia
            message= _ "Do you remember when we almost lost you in the caves beneath Wesmere? I don’t want to risk that occurring again. We don’t know why we haven’t found any elves here and..."
        [/message]

        {FACE_DIRECTION (id=Galas) se}

        [delay]
            time=500
        [/delay]

        [message]
            speaker=Galas
            message= _ "Is there something you haven’t told me?"
        [/message]

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

        [redraw][/redraw]

        [delay]
            time=1000
        [/delay]

        {FACE_DIRECTION (id=Elynia) se}

        [message]
            speaker=Elynia
            message= _ "I hear something moving among the trees."
        [/message]

        [redraw][/redraw]

        [delay]
            time=500
        [/delay]

        # wmllint: recognize Nion
        {__UNIT_FROM_THE_TREES 24 3 24 4 (
            type=Quenoth Fighter
            id=Nion
            name= _ "Nion"
            side=2
            random_traits=yes
            facing=sw
        )}

        {FACE_DIRECTION (id=Galas) nw}

        # wmllint: recognize Valad
        {__UNIT_FROM_THE_TREES 17 5 19 5 (
            type=Quenoth Flanker
            id=Valad
            name= _ "Valad"
            side=2
            random_traits=yes
            facing=ne
        )}

        # wmllint: recognize Hara
        {__UNIT_FROM_THE_TREES 20 2 20 3 (
            type=Quenoth Flanker
            id=Hara
            name= _ "Hara"
            side=2
            random_traits=yes
            facing=se
        )}

        # wmllint: recognize Kyara
        {__UNIT_FROM_THE_TREES 27 3 24 5 (
            {CHARACTER_STATS_KYARA}
            overlays=""
            side=2
            facing=sw
        )}

        # wmllint: recognize Yon
        {__UNIT_FROM_THE_TREES 22 8 24 7 (
            type=Quenoth Fighter
            id=Yon
            name= _ "Yon"
            side=2
            random_traits=yes
            facing=nw
        )}

        # wmllint: recognize Ladien
        {__UNIT_FROM_THE_TREES 20 8 20 7 (
            type=Quenoth Scout
            id=Ladien
            name= _ "Ladien"
            side=2
            random_traits=yes
            facing=ne
        )}

        [message]
            speaker=Kyara
            message= _ "Who are you and where do you come from? You don’t seem to be of our kin."
        [/message]

        [message]
            speaker=Galas
            message= _ "We are elves! There’s no need to point at us with those arrows and swords, either; we’re clearly at a disadvantage here."
        [/message]

        [message]
            speaker=Kyara
            message= _ "You do not look or dress like our people. Is this some kind of joke? We are pretty sure we’ve never seen your faces on this island."
        [/message]

        [message]
            speaker=Hara
            message= _ "They are probably impostors sent by Uria to destroy our home!"
        [/message]

        [message]
            speaker=Elynia
            message= _ "Let us explain..."
        [/message]

        [message]
            speaker=Kyara
            message= _ "Seize them!"
        [/message]

        {MOVE_UNIT (id=Hara) (20) (4)}

        [message]
            speaker=Galas
            message= _ "Stop!"
        [/message]

        {MOVE_UNIT (id=Nion) (23) (5)}
        {MOVE_UNIT (id=Yon) (23) (7)}
        {MOVE_UNIT (id=Valad) (20) (5)}

        [redraw][/redraw]

        [fade_out_music]
            duration=750
        [/fade_out_music]

        [message]
            speaker=Elynia
            message= _ "(spreading her wings) How can you not recognize your sylvan ancestors, young girl? Have the Quenoth elves completely forgotten their history after all this time?!"
        [/message]

        [redraw][/redraw]

        [delay]
            time=250
        [/delay]

        [message]
            speaker=Elynia
            message= _ "(in a calm, sad tone) When did you last see the essence of the forest blazing in the dark?"
        [/message]

        # Back up Elynia while we transform her into a different variation

        [store_unit]
            [filter]
                id=Elynia
            [/filter]
            variable=elynia_store
            kill=no
        [/store_unit]

        [object]
            silent=yes
            [filter]
                id=Elynia
            [/filter]
            [effect]
                apply_to=variation
                name=faerie_fire_cutscene
            [/effect]
        [/object]

        [animate_unit]
            [filter]
                id=Elynia
            [/filter]
            flag=cutscene_begin
            with_bars=yes
        [/animate_unit]

        [delay]
            time=750
        [/delay]

        #
        # I'm obviously taking advantage of the desert elves' lack of faerie fire-casters,
        # which is a consequence of their loss of affinity with the world of Faerie.
        #

        {__MOVE_UNIT_KEEP_FACING (id=Yon) 24 7}
        {__MOVE_UNIT_KEEP_FACING (id=Nion) 23 4}
        {__MOVE_UNIT_KEEP_FACING (id=Hara) 19 4}

        {INCIDENTAL_MUSIC "snowfall.ogg"}

        [delay]
            time=500
        [/delay]

        [message]
            speaker=narrator
            image=wesnoth-icon.png
            message= _ "Elynia held a small fire in her hands, illuminating the surroundings with a strong, azure light. The elves stared in awe at her subtle but effective display of the power of Faerie; some of them stepped back, alarmed, uncertain of what to make of the unusual situation."
        [/message]

        [delay]
            time=3000
        [/delay]

        [animate_unit]
            [filter]
                id=Elynia
            [/filter]
            flag=cutscene_end
            with_bars=yes
        [/animate_unit]

        # Restore Elynia's gameplay self

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

        [redraw][/redraw]

        [delay]
            time=750
        [/delay]

        [message]
            speaker=Kyara
            message= _ "Come with me."
        [/message]

        [store_locations]
            [filter]
                id=Galas
            [/filter]
            variable=galas_loc_store
        [/store_locations]

        {PUT_TO_RECALL_LIST (id=Elynia)}

        [hide_unit]
            x=$galas_loc_store.x
            y=$galas_loc_store.y
        [/hide_unit]

        [kill]
            side=2
        [/kill]

        [redraw][/redraw]

        {FADE_TO_BLACK}

        [store_map_dimensions][/store_map_dimensions]

        [terrain]
            terrain=Xv
            x=1-$map_size.width
            y=1-$map_size.height
        [/terrain]

        {CLEAR_VARIABLE map_size,galas_loc_store,elynia_store}

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

#undef __UNIT_FROM_THE_TREES
#undef __MOVE_UNIT_KEEP_FACING
[/scenario]

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