#textdomain wesnoth-Genesis
[scenario]
    id=14_Iron_Crescent
    name= _ "Iron Crescent"
    map_data="{~add-ons/Genesis/episode1/maps/12_Siege_of_Fort_Helemoor.map}"
    next_scenario=15_Silent_Night
    victory_when_enemies_defeated=no
    turns=-1

    {BLOODMOON}

    {SCENARIO_MUSIC heroes_rite.ogg}
    {EXTRA_SCENARIO_MUSIC casualties_of_war.ogg}
    {EXTRA_SCENARIO_MUSIC the_king_is_dead.ogg}
    {EXTRA_SCENARIO_MUSIC weight_of_revenge.ogg}

    [side]
        {PLAYER_FAE}
        side=1
        recruit=
        {GOLD 200 150 100}
        village_gold=0
        village_support=1
        income=-2
        facing=sw
        fog=yes
    [/side]

    [side]
        side=2
        no_leader=yes
        team_name=demons
        controller=ai
        color=black
        fog=no
        shroud=no
        hidden=yes
        [ai]
            aggression=2
            caution=0
        [/ai]
    [/side]

    [side]
        {HUMAN_ENEMY}
        {AGGRESSIVE_SIDE}
        side=3
        no_leader=yes
        hidden=yes
    [/side]

    [event]
        name=prestart

        [store_locations]
            terrain=*
            variable=tmp_map
        [/store_locations]

        [for]
            array=tmp_map
            [do]
                [terrain]
                    x,y=$tmp_map[$i].x,$tmp_map[$i].y
                    terrain=$siege_map[$i].terrain
                [/terrain]
            [/do]
        [/for]
        {CLEAR_VARIABLE tmp_map}
        [redraw][/redraw]
        {CLEAR_VARIABLE siege_map}
        [move_unit]
            id=Esther
            to_x,to_y=35,45
        [/move_unit]

        [store_locations]
            terrain=Ke
            variable=swap
        [/store_locations]
        [for]
            array=swap
            [do]
                [terrain]
                    x,y=$swap[$i].x,$swap[$i].y
                    terrain=Wwb
                [/terrain]
            [/do]
        [/for]
        {CLEAR_VARIABLE swap}

        {FADE_SCREEN}
    [/event]
#define DRAW_DARKNESS
        [store_locations]
            variable=blood_hex
            terrain=*
            [not]
                terrain=Gd^Fetd,Xu
            [/not]
            [filter_adjacent_location]
                terrain=Woby
                count=1-3
            [/filter_adjacent_location]
        [/store_locations]
        [for]
            array=blood_hex
            [do]
                [set_variable]
                    name=change_terrain
                    rand=1..8
                [/set_variable]
                [if]
                    [variable]
                        name=change_terrain
                        less_than=6
                    [/variable]
                    [then]
                        [terrain]
                             x,y=$blood_hex[$i].x,$blood_hex[$i].y
                            terrain=Woby
                        [/terrain]
                    [/then]
                [/if]
                {CLEAR_VARIABLE change_terrain}
            [/do]
        [/for]
        {CLEAR_VARIABLE blood_hex}
        [store_locations]
            variable=blood_hex
            terrain=*
            [not]
                terrain=Gd^Fetd,Xu
            [/not]
            [filter_adjacent_location]
                terrain=Woby
                count=4-6
            [/filter_adjacent_location]
        [/store_locations]
        [for]
            array=blood_hex
            [do]
                [set_variable]
                    name=change_terrain
                    rand=1..30
                [/set_variable]
                [if]
                    [variable]
                        name=change_terrain
                        less_than=6
                    [/variable]
                    [then]
                        [terrain]
                             x,y=$blood_hex[$i].x,$blood_hex[$i].y
                            terrain=Woby
                        [/terrain]
                    [/then]
                [/if]
                {CLEAR_VARIABLE change_terrain}
            [/do]
        [/for]
        {CLEAR_VARIABLE blood_hex}
        [redraw][/redraw]
#enddef
#define DRAW_BLOOD_NO_REDRAW
        [store_locations]
            variable=blood_hex
            terrain=*
            [not]
                terrain=Aa^Fyak,Woby,Xu
            [/not]
            [filter_adjacent_location]
                terrain=Wwb
                count=1-2
            [/filter_adjacent_location]
        [/store_locations]
        [for]
            array=blood_hex
            [do]
                [set_variable]
                    name=change_terrain
                    rand=1..10
                [/set_variable]
                [if]
                    [variable]
                        name=change_terrain
                        less_than=8
                    [/variable]
                    [then]
                        [terrain]
                             x,y=$blood_hex[$i].x,$blood_hex[$i].y
                            terrain=Wwb
                        [/terrain]
                    [/then]
                [/if]
                {CLEAR_VARIABLE change_terrain}
            [/do]
        [/for]
        {CLEAR_VARIABLE blood_hex}
        [redraw][/redraw]
#enddef
#define DRAW_VOID
        [store_locations]
            variable=blood_hex
            terrain=*
            [filter_adjacent_location]
                terrain=Qxua
            [/filter_adjacent_location]
        [/store_locations]
        [for]
            array=blood_hex
            [do]
                [set_variable]
                    name=change_terrain
                    rand=1..17
                [/set_variable]
                [if]
                    [variable]
                        name=change_terrain
                        less_than=6
                    [/variable]
                    [then]
                        [terrain]
                             x,y=$blood_hex[$i].x,$blood_hex[$i].y
                            terrain=Qxua
                        [/terrain]
                    [/then]
                [/if]
                {CLEAR_VARIABLE change_terrain}
            [/do]
        [/for]
        {CLEAR_VARIABLE blood_hex}
        [redraw][/redraw]
#enddef

    #ifdef HARD
        {RESPAWN_POINT_CONDITIONAL_RANDOM ("Demon Void Shambler") 2 3 14 3 13 12 ("stage")}
        {RESPAWN_POINT_CONDITIONAL_RANDOM ("Demon Void Shambler") 2 3 14 3 13 12 ("stage")}
        {RESPAWN_POINT_CONDITIONAL_RANDOM ("Demon Void Shambler") 2 3 14 3 13 12 ("stage")}
        {RESPAWN_POINT_CONDITIONAL_RANDOM ("Demon Void Shambler") 2 3 14 3 13 12 ("stage")}
        {RESPAWN_POINT_CONDITIONAL_RANDOM ("Demon Void Shambler") 2 3 14 3 13 12 ("stage")}
        {RESPAWN_POINT_CONDITIONAL_RANDOM ("Demon Void Shambler") 2 3 14 3 13 12 ("stage")}
    #endif
    #ifdef NORMAL
        {RESPAWN_POINT_CONDITIONAL_RANDOM ("Demon Void Shambler") 2 3 14 3 13 12 ("stage")}
        {RESPAWN_POINT_CONDITIONAL_RANDOM ("Demon Void Shambler") 2 3 14 3 13 12 ("stage")}
        {RESPAWN_POINT_CONDITIONAL_RANDOM ("Demon Void Shambler") 2 3 14 3 13 12 ("stage")}
        {RESPAWN_POINT_CONDITIONAL_RANDOM ("Demon Void Shambler") 2 3 14 3 13 12 ("stage")}
    #endif
    #ifdef EASY
        {RESPAWN_POINT_CONDITIONAL_RANDOM ("Demon Void Shambler") 2 3 14 3 13 12 ("stage")}
        {RESPAWN_POINT_CONDITIONAL_RANDOM ("Demon Void Shambler") 2 3 14 3 13 12 ("stage")}
        {RESPAWN_POINT_CONDITIONAL_RANDOM ("Demon Void Shambler") 2 3 14 3 13 12 ("stage")}
    #endif

    [event]
        name=start

        {UNFADE_SCREEN}
        {DELAY 500}

        [move_unit]
            id=Esther
            to_x,to_y=34,43
        [/move_unit]
        [redraw]
            side=1
            clear_shroud=yes
        [/redraw]
        {DELAY 750}
        [move_unit]
            id=Esther
            to_x,to_y=34,41
        [/move_unit]
        [redraw]
            side=1
            clear_shroud=yes
        [/redraw]
        [message]
            speaker=Esther
            message= _ "What a disaster."
        [/message]
        {DELAY 500}
        [move_unit]
            id=Esther
            to_x,to_y=33,39
        [/move_unit]
        [redraw]
            side=1
            clear_shroud=yes
        [/redraw]
        [message]
            speaker=Esther
            message= _ "(whispers) I really hope Yumi and Aryel are okay."
        [/message]
        {DELAY 350}
        {PLAY_SOUND "rumble.ogg"}
        {DRAW_BLOOD_NO_REDRAW}
        {DRAW_DARKNESS}
        {DELAY 350}
        {PLAY_SOUND "rumble.ogg"}
        {DRAW_BLOOD_NO_REDRAW}
        {DRAW_DARKNESS}
        {DELAY 500}
        {DRAW_BLOOD_NO_REDRAW}
        {DRAW_DARKNESS}
        {DELAY 750}

        [message]
            speaker=Esther
            message= _ "The blood's still spreading."
        [/message]

        {DELAY 750}

        {RECALL_TALYA 34 39}
        [redraw]
            side=1
            clear_shroud=yes
        [/redraw]
        {DELAY 500}

        [message]
            speaker=Talya
            message= _ "Whew. Finally caught up."
        [/message]
        {DELAY 1000}
        [message]
            speaker=Talya
            message= _ "... you okay?"
        [/message]
        [message]
            speaker=Esther
            message= _ "(sighs)"
        [/message]
        [message]
            speaker=Esther
            message= _ "Yes. Just distracted."
        [/message]
        [message]
            speaker=Esther
            message= _ "(shakes head) Anyway, what are you doing here? I thought you were going to take the other humans to somewhere safe."
        [/message]
        [message]
            speaker=Talya
            message= _ "Safest place right now is with you faerie. It's not like we have anywhere else to go. Not with the leadership in Caerleon suddenly going insane."
        [/message]
        [message]
            speaker=Esther
            message= _ "I understand. Even so, this isn't exactly the place for you to be. It's dangerous."
        [/message]
        [message]
            speaker=Talya
            message= _ "Same to you. Why'd you come back here?"
        [/message]
        [message]
            speaker=Esther
            message= _ "I need to try to find Yumi and Aryel. Knowing them, they're still around here somewhere."
        [/message]
        [message]
            speaker=Talya
            message= _ "Uh huh. Well, looking for them in this mess has to be kind of hard. I'll give you a hand."
        [/message]
        [message]
            speaker=Esther
            message= _ "I don't think-"
        [/message]
        [message]
            speaker=Talya
            message= _ "You're not going to tell me to leave, are you? Even some of the other faeries came back to help. Right, girls?"
        [/message]

        {DELAY 500}

        [unit]
            side=1
            generate_name=yes
            type=Faerie Intermediary
            random_traits=no
            animate=yes
            [modifications]
                {TRAIT_LOYAL}
                {TRAIT_INTELLIGENT}
                {TRAIT_RESILIENT}
            [/modifications]
            x,y=34,42
            experience=97
        [/unit]
        [unit]
            side=1
            generate_name=yes
            type=Forest Nymph
            random_traits=no
            animate=yes
            [modifications]
                {TRAIT_LOYAL}
                {TRAIT_RESILIENT}
                {TRAIT_INTELLIGENT}
            [/modifications]
            x,y=35,42
            experience=22
        [/unit]
        [unit]
            side=1
            generate_name=yes
            type=Yousei Bristler
            random_traits=no
            animate=yes
            [modifications]
                {TRAIT_LOYAL}
                {TRAIT_QUICK}
                {TRAIT_STRONG}
            [/modifications]
            x,y=35,43
            experience=67
        [/unit]
        [unit]
            side=1
            generate_name=yes
            type=Night Nymph
            random_traits=no
            animate=yes
            [modifications]
                {TRAIT_LOYAL}
                {TRAIT_INTELLIGENT}
                {TRAIT_DEXTROUS}
            [/modifications]
            x,y=34,43
            experience=55
        [/unit]
        [unit]
            side=1
            generate_name=yes
            type=Fire Faerie
            random_traits=no
            animate=yes
            [modifications]
                {TRAIT_LOYAL}
                {TRAIT_RESILIENT}
                {TRAIT_QUICK}
            [/modifications]
            x,y=35,44
            experience=70
        [/unit]
        [redraw]
            side=1
            clear_shroud=yes
        [/redraw]
        [message]
            type=Faerie Guardian
            message= _ "Sorry, Esther. I know you told us to wait back with the others, but we were worried and thought you could use the help."
        [/message]
        [message]
            x,y=34,43
            message= _ "The human girl's right. We're in this together! We have to look out for each other in times like these."
        [/message]
        [message]
            speaker=Talya
            message= _ "The name's Talya, by the way. But, I agree. When you say we should stick together, that includes you too. You can't just fight everything alone."
        [/message]
        {DELAY 750}
        [message]
            speaker=Esther
            message= _ "You have a point. I suppose I just got too used to looking after those two misfits."
        [/message]
        [message]
            speaker=Esther
            message= _ "In that case, follow me and stay close. I have a hunch as to where they are."
        [/message]

        [objectives]
            {OBJECTIVE_VICTORY  ( _ "Reach the dead tree (2,2)")}
            {OBJECTIVE_DEFEAT  ( _ "Death of Esther")}
            {OBJECTIVE_DEFEAT  ( _ "Death of Talya")}
        [/objectives]

        {SPAWN_NOID ("Demon Void Shambler") 2 4 5}
        #ifdef NORMAL
            {SPAWN_NOID ("Demon Void Shambler") 2 3 6}
        #endif
        #ifdef HARD
            {SPAWN_NOID ("Demon Void Shambler") 2 3 6}
            {SPAWN_NOID ("Demon Void Shambler") 2 8 3}
        #endif
        [set_variable]
            name=stage
            value=1
        [/set_variable]
    [/event]

    [event]
        name=turn 4

        [message]
            speaker=Talya
            message= _ "It's so quiet. After all that ruckus earlier, it's kind of eerie, actually."
        [/message]
        [message]
            speaker=Esther
            message= _ "Yes, something's not quite right. We should be on guard."
        [/message]
    [/event]

    [event]
        name=sighted
        first_time_only=yes
        [filter]
            side=2
        [/filter]
        [filter_second]
            side=1
        [/filter_second]
        [message]
            speaker=Talya
            message= _ "What the devil are these things?"
        [/message]
    [/event]

    [event]
        name=defender hits
        first_time_only=yes
        [filter]
            side=1
            [not]
                id=Esther
            [/not]
        [/filter]
        [filter_second]
            side=2
        [/filter_second]
        [filter_second_attack]
            name=shambler void assault
        [/filter_second_attack]
        [message]
            speaker=unit
            message= _ "Ow! I-it feels like it's eating away at my mind!"
        [/message]
    [/event]
    [event]
        name=defender hits
        first_time_only=yes
        [filter]
            side=1
            id=Esther
        [/filter]
        [filter_second]
            side=2
        [/filter_second]
        [filter_second_attack]
            name=shambler void assault
        [/filter_second_attack]
        [message]
            speaker=Esther
            message= _ "This power reminds me of Yumi..!"
        [/message]
    [/event]

    [event]
        name=die
        first_time_only=yes
        [filter]
            side=2
            type=Demon Void Shambler
        [/filter]
        [filter_second]
            side=1
            [not]
                id=Esther
            [/not]
        [/filter_second]
        [harm_unit]
            [filter]
                x,y=$x2,$y2
            [/filter]
            amount=0
            animate=yes
            kill=no
            slowed=yes
            fire_event=no
        [/harm_unit]
        {DELAY 250}
        [message]
            speaker=second_unit
            message= _ "Ack- it's... so cold..."
        [/message]
        [message]
            speaker=Esther
            message= _ "(grimaces) Whatever these things are, we can't fight them. We've got to keep moving and find a way around them."
        [/message]
    [/event]

    [event]
        name=moveto
        first_time_only=no
        [filter]
            side=1
            [not]
                id=Esther
            [/not]
            [filter_location]
                x,y=2,2
            [/filter_location]
        [/filter]
        [filter_condition]
            [variable]
                name=stage
                numerical_equals=1
            [/variable]
        [/filter_condition]
        [message]
            speaker=unit
            message= _ "Esther should be the one to look at this."
        [/message]
    [/event]
    [event]
        name=moveto
        first_time_only=yes
        [filter]
            side=1
            id=Esther
            [filter_location]
                x,y=2,2
            [/filter_location]
        [/filter]
        [filter_condition]
            [variable]
                name=stage
                numerical_equals=1
            [/variable]
        [/filter_condition]
        [message]
            speaker=Esther
            message= _ "Hmm."
        [/message]
        {DELAY 750}
        [move_unit]
            id=Talya
            to_x,to_y=2,2
        [/move_unit]
        [message]
            speaker=Talya
            message= _ "Is something happening..?"
        [/message]
        [store_unit]
            [filter]
                side=1
                [not]
                    id=Talya,Esther
                [/not]
            [/filter]
            variable=units
        [/store_unit]
        [for]
            array=units
            [do]
                [move_unit]
                    x,y=$units[$i].x,$units[$i].y
                    to_x,to_y=2,2
                [/move_unit]
            [/do]
        [/for]
        {CLEAR_VARIABLE units}
        [kill]
            side=2
        [/kill]
        [set_variable]
            name=stage
            value=0
        [/set_variable]

        {FADE_SCREEN}

        [heal_unit]
            [filter]
                side=1
            [/filter]
            amount=full
            moves=full
            restore_attacks=yes
            restore_statues=yes
        [/heal_unit]

        [terrain]
            x,y=7,5
            radius=8
            terrain=Xu
        [/terrain]
        [terrain]
            x,y=7,5
            radius=6
            terrain=Woby
        [/terrain]
        {DELAY 1000}
        [modify_side]
            side=1
            shroud=yes
        [/modify_side]
        [reset_fog]
            [filter_side]
                side=1
            [/filter_side]
        [/reset_fog]
        [place_shroud]
            side=1
        [/place_shroud]
        [redraw]
            side=1
            clear_shroud=yes
        [/redraw]
        {DRAW_BLOOD_NO_REDRAW}
        {DRAW_BLOOD_NO_REDRAW}
        {DRAW_BLOOD_NO_REDRAW}
        {DRAW_DARKNESS}
        {DRAW_DARKNESS}
        {DRAW_DARKNESS}

        [unit]
            id=Statue
            side=3
            generate_name=no
            type=Fake Blood Fae
            random_traits=no
            animate=no
            [status]
                petrified=yes
            [/status]
            x,y=7,5
        [/unit]
        {UNFADE_SCREEN}

        {PLACE_IMAGE items/crystal-glyph-message.png 13 8}

        {DELAY 500}
        [message]
            speaker=Esther
            message= _ "Oh my."
        [/message]
        [move_unit]
            id=Esther
            to_x,to_y=7,5
        [/move_unit]
        [redraw]
            side=1
            clear_shroud=yes
        [/redraw]
        [message]
            speaker=Esther
            message= _ "This looks like... Aryel?"
        [/message]
        [message]
            speaker=Esther
            message= _ "(touches stone)"
        [/message]
        [message]
            speaker=Esther
            message= _ "No... it's just a statue. Strange."
        [/message]
        [move_unit]
            id=Talya
            to_x,to_y=7,5
        [/move_unit]
        [redraw]
            side=1
            clear_shroud=yes
        [/redraw]
        [message]
            speaker=Talya
            message= _ "Uhm. I don't know about you, but this is creeping me out."
        [/message]
        [message]
            speaker=Esther
            message= _ "It's making me a bit unsettled too. Why is there a statue here, and why does it look exactly like Aryel?"
        [/message]
        [message]
            speaker=Talya
            message= _ "You're sure it's not actually her, right? I've heard stories of horrible beasts that can turn people to stone. Even demons and faerie."
        [/message]
        [message]
            speaker=Esther
            message= _ "That's a type of magic that can be reversed. No, I'm pretty sure that this is just a statue. It doesn't feel like something that was ever living."
        [/message]
        [message]
            speaker=Esther
            message= _ "...I hope."
        [/message]
        [message]
            speaker=Esther
            message= _ "Hmm."
        [/message]
        [message]
            speaker=Esther
            message= _ "I guess we should have a look around."
        [/message]

        [objectives]
            {OBJECTIVE_VICTORY  ( _ "Solve the puzzle")}
            {OBJECTIVE_DEFEAT  ( _ "Death of Esther")}
            {OBJECTIVE_DEFEAT  ( _ "Death of Talya")}
            {OBJECTIVE_NOTE ( _ "Objects and glyphs must be activated in a specific order.")}
            {OBJECTIVE_NOTE ( _ "Text from the glyph at (13,8) provides clues.")}
        [/objectives]

        [set_variable]
            name=puzzle
            value=0
        [/set_variable]
    [/event]

    [event]
        name=moveto
        first_time_only=no
        [filter]
            side=1
        [/filter]
        [filter_condition]
            [variable]
                name=stage
                numerical_equals=0
            [/variable]
        [/filter_condition]
        {MODIFY_UNIT (x,y=$x1,$y1) moves 6}
    [/event]

#define PUZZLE_TEXT1
        [message]
            speaker=narrator
            message= _ "She was the daughter of a now deceased demon lord."
        [/message]
        [message]
            speaker=narrator
            message= _ "The youngest, and weakest of four, she was attended to the least and spurned the most. On a world where might made right, the feeble, fledgling offspring of a supposedly powerful overlord was nothing but an eyesore."
        [/message]
        [message]
            speaker=narrator
            message= _ "They kept her locked in a small room, in utter isolation. It was considered an act of kindness, given that it would have been much easier to just kill her."
        [/message]
#enddef
    [event]
        name=moveto
        first_time_only=yes
        [filter]
            side=1
            [filter_location]
                x,y=13,8
            [/filter_location]
        [/filter]
        [filter_condition]
            [variable]
                name=stage
                numerical_equals=0
            [/variable]
            [and]
                [variable]
                    name=puzzle
                    numerical_equals=0
                [/variable]
            [/and]
        [/filter_condition]

        [move_unit]
            x,y=$x1,$y1
            to_x,to_y=12,7
        [/move_unit]

        {PUZZLE_TEXT1}

        {DELAY 500}
        {PLACE_IMAGE items/cage.png 5 8}
        {PLACE_IMAGE items/coffin-closed.png 9 2}
        {PLACE_IMAGE items/bones.png 3 6}
        {PLACE_IMAGE items/ankh-necklace.png 4 3}
        {PLACE_IMAGE items/anvil.png 10 5}
        {DELAY 500}
        [message]
            speaker=Talya
            message= _ "Huh, a lot of objects just appeared out of nowhere."
        [/message]
        [message]
            speaker=Esther
            message= _ "Maybe they have something to do with the statue."
        [/message]
        [set_variable]
            name=puzzle
            value=1
        [/set_variable]
    [/event]
    ################################################################################
    ################################ PUZZLE STAGE 1 ################################
    [event]
        name=moveto
        first_time_only=no
        [filter]
            side=1
            [filter_location]
                x,y=13,8
            [/filter_location]
        [/filter]
        [filter_condition]
            [variable]
                name=stage
                numerical_equals=0
            [/variable]
            [and]
                [variable]
                    name=puzzle
                    numerical_equals=1
                [/variable]
            [/and]
        [/filter_condition]

        {PUZZLE_TEXT1}
    [/event]
    [event]
        name=moveto
        first_time_only=no
        [filter]
            side=1
            [filter_location]
                x,y=9,2
                [or]
                    x,y=3,6
                [/or]
            [/filter_location]
        [/filter]
        [filter_condition]
            [variable]
                name=stage
                numerical_equals=0
            [/variable]
            [and]
                [variable]
                    name=puzzle
                    numerical_equals=1
                [/variable]
            [/and]
        [/filter_condition]

        [message]
            speaker=unit
            message= _ "This doesn't seem to be doing anything."
        [/message]
    [/event]
    [event]
        name=moveto
        first_time_only=no
        [filter]
            side=1
            [filter_location]
                x,y=4,3
                [or]
                    x,y=10,5
                [/or]
            [/filter_location]
        [/filter]
        [filter_condition]
            [variable]
                name=stage
                numerical_equals=0
            [/variable]
            [and]
                [variable]
                    name=puzzle
                    numerical_equals=1
                [/variable]
            [/and]
        [/filter_condition]

        [message]
            speaker=unit
            message= _ "Nothing's happening."
        [/message]
    [/event]
    [event]
        name=moveto
        first_time_only=no
        [filter]
            side=1
            [filter_location]
                x,y=5,8
            [/filter_location]
        [/filter]
        [filter_condition]
            [variable]
                name=stage
                numerical_equals=0
            [/variable]
            [and]
                [variable]
                    name=puzzle
                    numerical_equals=1
                [/variable]
            [/and]
        [/filter_condition]
        {DELAY 750}
        [modify_unit]
            [filter]
                id=Statue
            [/filter]
            max_hitpoints=46
            hitpoints=46
        [/modify_unit]

        {DELAY 500}

        {REMOVE_IMAGE 5 8}
        {REMOVE_IMAGE 9 2}
        {REMOVE_IMAGE 3 6}
        {REMOVE_IMAGE 4 3}
        {REMOVE_IMAGE 10 5}

        {DELAY 500}

        [message]
            speaker=Talya
            message= _ "The statue... moved? Well not moved, but it's different now."
        [/message]

        [message]
            speaker=Esther
            message= _ "Hmm. You're right. That's odd. I suppose this means we should keep going."
        [/message]

        [store_unit]
            [filter]
                id=Esther
            [/filter]
            variable=esther
        [/store_unit]
        [store_unit]
            [filter]
                id=Talya
            [/filter]
            variable=talya
        [/store_unit]

        #ifdef EASY
        {VARIABLE_OP esther.experience add 25}
        {VARIABLE_OP talya.experience add 25}

        [unstore_unit]
            variable=esther
            find_vacant=no
            text= _ "+25 XP"
            red,green,blue=255,0,255
        [/unstore_unit]
        [unstore_unit]
            variable=talya
            find_vacant=no
            text= _ "+25 XP"
            red,green,blue=255,0,255
        [/unstore_unit]
        #endif
        #ifdef NORMAL
        {VARIABLE_OP esther.experience add 20}
        {VARIABLE_OP talya.experience add 20}

        [unstore_unit]
            variable=esther
            find_vacant=no
            text= _ "+20 XP"
            red,green,blue=255,0,255
        [/unstore_unit]
        [unstore_unit]
            variable=talya
            find_vacant=no
            text= _ "+20 XP"
            red,green,blue=255,0,255
        [/unstore_unit]
        #endif
        #ifdef HARD
        {VARIABLE_OP esther.experience add 15}
        {VARIABLE_OP talya.experience add 15}

        [unstore_unit]
            variable=esther
            find_vacant=no
            text= _ "+15 XP"
            red,green,blue=255,0,255
        [/unstore_unit]
        [unstore_unit]
            variable=talya
            find_vacant=no
            text= _ "+15 XP"
            red,green,blue=255,0,255
        [/unstore_unit]
        #endif

        {CLEAR_VARIABLE esther}
        {CLEAR_VARIABLE talya}

        [set_variable]
            name=puzzle
            value=2
        [/set_variable]
    [/event]
    ################################################################
    ################################################################

#define PUZZLE_TEXT2
        [message]
            speaker=narrator
            message= _ "She had only a few things in her room. A bed, a closet, and a mirror. And a window."
        [/message]
        [message]
            speaker=narrator
            message= _ "Through the glassy pane, she could see a flower garden a little ways away. Their petals bloomed everlasting through sunlight and rain, fire and snow, bright colors illuminating the monochromatic limbo of her prison."
        [/message]
        [message]
            speaker=narrator
            message= _ "Not too far off, there was a windmill where they milled bread to be served to the demon lord and the other inhabitants of his stronghold. This was also the only thing they ever gave to her to eat."
        [/message]
#enddef

    [event]
        name=moveto
        first_time_only=yes
        [filter]
            side=1
            [filter_location]
                x,y=13,8
            [/filter_location]
        [/filter]
        [filter_condition]
            [variable]
                name=stage
                numerical_equals=0
            [/variable]
            [and]
                [variable]
                    name=puzzle
                    numerical_equals=2
                [/variable]
            [/and]
        [/filter_condition]

        [move_unit]
            x,y=$x1,$y1
            to_x,to_y=12,7
        [/move_unit]

        {PUZZLE_TEXT2}

        {DELAY 500}
        {PLACE_IMAGE items/chest.png 7 7}
        {PLACE_IMAGE items/flower1.png 2 4}
        {PLACE_IMAGE items/bones.png 3 8}
        {PLACE_IMAGE items/ankh-necklace.png 10 3}
        {PLACE_IMAGE items/burial.png 6 2}
        {PLACE_IMAGE items/grain-sheaf.png 10 7}
        {DELAY 500}
        [message]
            speaker=Esther
            message= _ "I guess we have to do it again."
        [/message]
        [set_variable]
            name=puzzle
            value=3
        [/set_variable]
    [/event]
    ################################################################################
    ################################ PUZZLE STAGE 2 ################################
    [event]
        name=moveto
        first_time_only=no
        [filter]
            side=1
            [filter_location]
                x,y=13,8
            [/filter_location]
        [/filter]
        [filter_condition]
            [variable]
                name=stage
                numerical_equals=0
            [/variable]
            [and]
                [variable]
                    name=puzzle
                    numerical_equals=3
                [/variable]
            [/and]
        [/filter_condition]

        {PUZZLE_TEXT2}
    [/event]
    [event]
        name=moveto
        first_time_only=no
        [filter]
            side=1
            [filter_location]
                x,y=7,7
                [or]
                    x,y=3,8
                [/or]
            [/filter_location]
        [/filter]
        [filter_condition]
            [variable]
                name=stage
                numerical_equals=0
            [/variable]
            [and]
                [variable]
                    name=puzzle
                    numerical_equals=3
                [/variable]
            [/and]
        [/filter_condition]

        [message]
            speaker=unit
            message= _ "This doesn't seem useful."
        [/message]
        [set_variable]
            name=puzzle_counter
            value=0
        [/set_variable]
    [/event]
    [event]
        name=moveto
        first_time_only=no
        [filter]
            side=1
            [filter_location]
                x,y=10,3
                [or]
                    x,y=6,2
                [/or]
            [/filter_location]
        [/filter]
        [filter_condition]
            [variable]
                name=stage
                numerical_equals=0
            [/variable]
            [and]
                [variable]
                    name=puzzle
                    numerical_equals=3
                [/variable]
            [/and]
        [/filter_condition]

        [message]
            speaker=unit
            message= _ "It's not doing anything."
        [/message]
        [set_variable]
            name=puzzle_counter
            value=0
        [/set_variable]
    [/event]

    [event]
        name=moveto
        first_time_only=no
        [filter]
            side=1
            [filter_location]
                x,y=2,4
            [/filter_location]
        [/filter]
        [filter_condition]
            [variable]
                name=stage
                numerical_equals=0
            [/variable]
            [and]
                [variable]
                    name=puzzle
                    numerical_equals=3
                [/variable]
            [/and]
        [/filter_condition]

        [message]
            speaker=unit
            message= _ "It's so colorful. It feels like it's still alive!"
        [/message]

        [set_variable]
            name=puzzle_counter
            value=1
        [/set_variable]
    [/event]

    [event]
        name=moveto
        first_time_only=no
        [filter]
            side=1
            [filter_location]
                x,y=10,7
            [/filter_location]
        [/filter]
        [filter_condition]
            [variable]
                name=stage
                numerical_equals=0
            [/variable]
            [and]
                [variable]
                    name=puzzle
                    numerical_equals=3
                [/variable]
            [/and]
        [/filter_condition]

        [if]
            [variable]
                name=puzzle_counter
                numerical_equals=1
            [/variable]
            [then]

                {DELAY 750}
                [modify_unit]
                    [filter]
                        id=Statue
                    [/filter]
                    max_hitpoints=37
                    hitpoints=37
                [/modify_unit]

                {DELAY 500}

                {REMOVE_IMAGE 7 7}
                {REMOVE_IMAGE 2 4}
                {REMOVE_IMAGE 3 8}
                {REMOVE_IMAGE 10 3}
                {REMOVE_IMAGE 6 2}
                {REMOVE_IMAGE 10 7}

                {DELAY 750}

                [message]
                    speaker=Talya
                    message= _ "So... are we making progress?"
                [/message]

                [message]
                    speaker=Esther
                    message= _ "Something's happening for sure."
                [/message]

                [store_unit]
                    [filter]
                        id=Esther
                    [/filter]
                    variable=esther
                [/store_unit]
                [store_unit]
                    [filter]
                        id=Talya
                    [/filter]
                    variable=talya
                [/store_unit]

                #ifdef EASY
                {VARIABLE_OP esther.experience add 30}
                {VARIABLE_OP talya.experience add 30}

                [unstore_unit]
                    variable=esther
                    find_vacant=no
                    text= _ "+30 XP"
                    red,green,blue=255,0,255
                [/unstore_unit]
                [unstore_unit]
                    variable=talya
                    find_vacant=no
                    text= _ "+30 XP"
                    red,green,blue=255,0,255
                [/unstore_unit]
                #endif
                #ifdef NORMAL
                {VARIABLE_OP esther.experience add 25}
                {VARIABLE_OP talya.experience add 25}

                [unstore_unit]
                    variable=esther
                    find_vacant=no
                    text= _ "+25 XP"
                    red,green,blue=255,0,255
                [/unstore_unit]
                [unstore_unit]
                    variable=talya
                    find_vacant=no
                    text= _ "+25 XP"
                    red,green,blue=255,0,255
                [/unstore_unit]
                #endif
                #ifdef HARD
                {VARIABLE_OP esther.experience add 20}
                {VARIABLE_OP talya.experience add 20}

                [unstore_unit]
                    variable=esther
                    find_vacant=no
                    text= _ "+20 XP"
                    red,green,blue=255,0,255
                [/unstore_unit]
                [unstore_unit]
                    variable=talya
                    find_vacant=no
                    text= _ "+20 XP"
                    red,green,blue=255,0,255
                [/unstore_unit]
                #endif

                {CLEAR_VARIABLE esther}
                {CLEAR_VARIABLE talya}

                [set_variable]
                    name=puzzle
                    value=4
                [/set_variable]
                [set_variable]
                    name=puzzle_counter
                    value=0
                [/set_variable]
            [/then]
            [else]
                [set_variable]
                    name=puzzle_counter
                    value=0
                [/set_variable]
                [message]
                    speaker=Esther
                    message= _ "Grain. Hmm. The glyph did say something about this. Perhaps we're just not using the objects in the right order."
                [/message]
            [/else]
        [/if]
    [/event]
    ################################################################
    ################################################################

#define PUZZLE_TEXT3
        [message]
            speaker=narrator
            message= _ "They kept her emaciated and weak, trapped no matter how much she roiled and raged at the bars. Perhaps it was just an outlet for their sadistic nature. Perhaps it was a result of their own insecurities, knowing that as she was weaker than they, they were also weaker than those above them. Maybe this was why they tormented her so - their own flesh and blood - as a way to prove to themselves their own superiority."
        [/message]
        [message]
            speaker=narrator
            message= _ "She prayed to the Guardians to set her free, but they could not, would not help her. She wept at the door, crying for her sisters to free her, but they turned a blind eye to her plight. Shunned and tormented by all, she could only wait as time went by in endless isolation."
        [/message]
#enddef

    [event]
        name=moveto
        first_time_only=yes
        [filter]
            side=1
            [filter_location]
                x,y=13,8
            [/filter_location]
        [/filter]
        [filter_condition]
            [variable]
                name=stage
                numerical_equals=0
            [/variable]
            [and]
                [variable]
                    name=puzzle
                    numerical_equals=4
                [/variable]
            [/and]
        [/filter_condition]

        [move_unit]
            x,y=$x1,$y1
            to_x,to_y=12,7
        [/move_unit]

        {PUZZLE_TEXT3}

        {DELAY 500}
        {PLACE_IMAGE items/altar.png 3 6}
        {PLACE_IMAGE items/eye.png 10 3}
        {PLACE_IMAGE items/hourglass.png 7 2}
        {PLACE_IMAGE items/bonestack.png 4 3}
        {PLACE_IMAGE items/book1.png 6 8}
        {PLACE_IMAGE items/book2.png 9 8}
        {DELAY 500}

        [set_variable]
            name=puzzle
            value=5
        [/set_variable]
    [/event]
    ################################################################################
    ################################ PUZZLE STAGE 3 ################################
    [event]
        name=moveto
        first_time_only=no
        [filter]
            side=1
            [filter_location]
                x,y=13,8
            [/filter_location]
        [/filter]
        [filter_condition]
            [variable]
                name=stage
                numerical_equals=0
            [/variable]
            [and]
                [variable]
                    name=puzzle
                    numerical_equals=5
                [/variable]
            [/and]
        [/filter_condition]

        {PUZZLE_TEXT3}
    [/event]
    [event]
        name=moveto
        first_time_only=no
        [filter]
            side=1
            [filter_location]
                x,y=4,3
            [/filter_location]
        [/filter]
        [filter_condition]
            [variable]
                name=stage
                numerical_equals=0
            [/variable]
            [and]
                [variable]
                    name=puzzle
                    numerical_equals=5
                [/variable]
            [/and]
        [/filter_condition]

        [message]
            speaker=unit
            message= _ "Nope, this isn't working."
        [/message]
        [set_variable]
            name=puzzle_counter
            value=0
        [/set_variable]
    [/event]
    [event]
        name=moveto
        first_time_only=no
        [filter]
            side=1
            [filter_location]
                x,y=6,8
                [or]
                    x,y=9,8
                [/or]
            [/filter_location]
        [/filter]
        [filter_condition]
            [variable]
                name=stage
                numerical_equals=0
            [/variable]
            [and]
                [variable]
                    name=puzzle
                    numerical_equals=5
                [/variable]
            [/and]
        [/filter_condition]

        [message]
            speaker=unit
            message= _ "Not this one."
        [/message]
        [set_variable]
            name=puzzle_counter
            value=0
        [/set_variable]
    [/event]

    [event]
        name=moveto
        first_time_only=no
        [filter]
            side=1
            [filter_location]
                x,y=3,6
            [/filter_location]
        [/filter]
        [filter_condition]
            [variable]
                name=stage
                numerical_equals=0
            [/variable]
            [and]
                [variable]
                    name=puzzle
                    numerical_equals=5
                [/variable]
            [/and]
        [/filter_condition]

        [message]
            speaker=unit
            message= _ "This altar's warm for some reason. Maybe it's important somehow."
        [/message]

        [set_variable]
            name=puzzle_counter
            value=1
        [/set_variable]
    [/event]
    [event]
        name=moveto
        first_time_only=no
        [filter]
            side=1
            [filter_location]
                x,y=10,3
            [/filter_location]
        [/filter]
        [filter_condition]
            [variable]
                name=stage
                numerical_equals=0
            [/variable]
            [and]
                [variable]
                    name=puzzle
                    numerical_equals=5
                [/variable]
            [/and]
        [/filter_condition]

        [message]
            speaker=unit
            message= _ "Ick, an eye. Something like this couldn't possibly be useful... could it?"
        [/message]

        [if]
            [variable]
                name=puzzle_counter
                numerical_equals=1
            [/variable]
            [then]
                [set_variable]
                    name=puzzle_counter
                    value=2
                [/set_variable]
            [/then]
            [else]
                [set_variable]
                    name=puzzle_counter
                    value=0
                [/set_variable]
            [/else]
        [/if]
    [/event]
    [event]
        name=moveto
        first_time_only=no
        [filter]
            side=1
            [filter_location]
                x,y=7,2
            [/filter_location]
        [/filter]
        [filter_condition]
            [variable]
                name=stage
                numerical_equals=0
            [/variable]
            [and]
                [variable]
                    name=puzzle
                    numerical_equals=5
                [/variable]
            [/and]
        [/filter_condition]

        [if]
            [variable]
                name=puzzle_counter
                numerical_equals=2
            [/variable]
            [then]

                {DELAY 750}
                [modify_unit]
                    [filter]
                        id=Statue
                    [/filter]
                    max_hitpoints=28
                    hitpoints=28
                [/modify_unit]

                {DELAY 500}

                {REMOVE_IMAGE 3 6}
                {REMOVE_IMAGE 10 3}
                {REMOVE_IMAGE 7 2}
                {REMOVE_IMAGE 4 3}
                {REMOVE_IMAGE 6 8}
                {REMOVE_IMAGE 9 8}

                {DELAY 500}

                [message]
                    speaker=Talya
                    message= _ "I think the statue's crumbling a little."
                [/message]

                [message]
                    speaker=Esther
                    message= _ "Looks like it."
                [/message]

                [store_unit]
                    [filter]
                        id=Esther
                    [/filter]
                    variable=esther
                [/store_unit]
                [store_unit]
                    [filter]
                        id=Talya
                    [/filter]
                    variable=talya
                [/store_unit]

                #ifdef EASY
                {VARIABLE_OP esther.experience add 30}
                {VARIABLE_OP talya.experience add 30}

                [unstore_unit]
                    variable=esther
                    find_vacant=no
                    text= _ "+30 XP"
                    red,green,blue=255,0,255
                [/unstore_unit]
                [unstore_unit]
                    variable=talya
                    find_vacant=no
                    text= _ "+30 XP"
                    red,green,blue=255,0,255
                [/unstore_unit]
                #endif
                #ifdef NORMAL
                {VARIABLE_OP esther.experience add 25}
                {VARIABLE_OP talya.experience add 25}

                [unstore_unit]
                    variable=esther
                    find_vacant=no
                    text= _ "+25 XP"
                    red,green,blue=255,0,255
                [/unstore_unit]
                [unstore_unit]
                    variable=talya
                    find_vacant=no
                    text= _ "+25 XP"
                    red,green,blue=255,0,255
                [/unstore_unit]
                #endif
                #ifdef HARD
                {VARIABLE_OP esther.experience add 20}
                {VARIABLE_OP talya.experience add 20}

                [unstore_unit]
                    variable=esther
                    find_vacant=no
                    text= _ "+20 XP"
                    red,green,blue=255,0,255
                [/unstore_unit]
                [unstore_unit]
                    variable=talya
                    find_vacant=no
                    text= _ "+20 XP"
                    red,green,blue=255,0,255
                [/unstore_unit]
                #endif

                {CLEAR_VARIABLE esther}
                {CLEAR_VARIABLE talya}

                [set_variable]
                    name=puzzle
                    value=6
                [/set_variable]
            [/then]
            [else]
                [set_variable]
                    name=puzzle_counter
                    value=0
                [/set_variable]
                [message]
                    speaker=Esther
                    message= _ "I think this hourglass is useful somehow. We ought to try touching the objects in a different order."
                [/message]
            [/else]
        [/if]
    [/event]
    ################################################################
    ################################################################

#define PUZZLE_TEXT4
        [message]
            speaker=narrator
            message= _ "Then, one day, she heard a voice in her head. At first, it was a whisper so quiet that no discernable words could be heard, but over time, the voice grew in volume until she could make it out distinctly from the other voices ravaging her mind."
        [/message]
        [message]
            speaker=narrator
            message= _ "'Serve me, and I will grant you untold power. Listen, and I shall wreak vengeance on those who have wronged you. Obey, and I will set you free.'"
        [/message]
        [message]
            speaker=narrator
            message= _ "That was what it told her. What did she have to lose?"
        [/message]
        [message]
            speaker=narrator
            message= _ "Then again, it wasn't that simple. There had to be a price. There was always a price, especially when dealing with demon lords or Guardians. It must have been, right? Who else would be able to peer into her prison and observe her plight from afar? That made it all the more threatening."
        [/message]
        [message]
            speaker=narrator
            message= _ "'You have never tasted freedom. You have always been entombed within the unending darkness of your prison. Every moment in your waking life is torment and every moment spent asleep is a nightmare. But I am giving you a chance to change that. You have the power to alter the course of your own fate.'"
        [/message]
        [message]
            speaker=narrator
            message= _ "'Rise, rise and drive the spear of vengeance through their bodies. Raze your prison to the ground. I will grant you the power to do whatever you desire, as long as you pledge yourself to me. Listen to your heart. You can trust me.'"
        [/message]
#enddef

    [event]
        name=moveto
        first_time_only=yes
        [filter]
            side=1
            [filter_location]
                x,y=13,8
            [/filter_location]
        [/filter]
        [filter_condition]
            [variable]
                name=stage
                numerical_equals=0
            [/variable]
            [and]
                [variable]
                    name=puzzle
                    numerical_equals=6
                [/variable]
            [/and]
        [/filter_condition]

        [move_unit]
            x,y=$x1,$y1
            to_x,to_y=12,7
        [/move_unit]

        {PUZZLE_TEXT4}

        {DELAY 500}
        {PLACE_IMAGE items/key.png 7 8}
        {PLACE_IMAGE items/book5.png 10 6}
        {PLACE_IMAGE items/spear-fancy.png 12 3}
        {PLACE_IMAGE items/heart.png 9 2}
        {PLACE_IMAGE items/brazier-lit1.png 6 1}
        {PLACE_IMAGE items/axe.png 3 3}
        {PLACE_IMAGE items/box.png 4 7}
        {DELAY 500}

        [set_variable]
            name=puzzle
            value=7
        [/set_variable]
        [set_variable]
            name=puzzle_counter
            value=0
        [/set_variable]
    [/event]
    ################################################################################
    ################################ PUZZLE STAGE 4 ################################
    [event]
        name=moveto
        first_time_only=no
        [filter]
            side=1
            [filter_location]
                x,y=13,8
            [/filter_location]
        [/filter]
        [filter_condition]
            [variable]
                name=stage
                numerical_equals=0
            [/variable]
            [and]
                [variable]
                    name=puzzle
                    numerical_equals=7
                [/variable]
            [/and]
        [/filter_condition]

        {PUZZLE_TEXT4}
    [/event]
    [event]
        name=moveto
        first_time_only=no
        [filter]
            side=1
            [filter_location]
                x,y=7,8
                [or]
                    x,y=10,6
                [/or]
            [/filter_location]
        [/filter]
        [filter_condition]
            [variable]
                name=stage
                numerical_equals=0
            [/variable]
            [and]
                [variable]
                    name=puzzle
                    numerical_equals=7
                [/variable]
            [/and]
        [/filter_condition]

        [message]
            speaker=unit
            message= _ "It's not doing anything."
        [/message]
        [set_variable]
            name=puzzle_counter
            value=0
        [/set_variable]
    [/event]
    [event]
        name=moveto
        first_time_only=no
        [filter]
            side=1
            [filter_location]
                x,y=3,3
                [or]
                    x,y=4,7
                [/or]
            [/filter_location]
        [/filter]
        [filter_condition]
            [variable]
                name=stage
                numerical_equals=0
            [/variable]
            [and]
                [variable]
                    name=puzzle
                    numerical_equals=7
                [/variable]
            [/and]
        [/filter_condition]

        [message]
            speaker=unit
            message= _ "This isn't what we're looking for."
        [/message]
        [set_variable]
            name=puzzle_counter
            value=0
        [/set_variable]
    [/event]

    [event]
        name=moveto
        first_time_only=no
        [filter]
            side=1
            [filter_location]
                x,y=12,3
            [/filter_location]
        [/filter]
        [filter_condition]
            [variable]
                name=stage
                numerical_equals=0
            [/variable]
            [and]
                [variable]
                    name=puzzle
                    numerical_equals=7
                [/variable]
            [/and]
        [/filter_condition]

        [message]
            speaker=unit
            message= _ "Hmm, a pointy spear."
        [/message]

        [set_variable]
            name=puzzle_counter
            value=1
        [/set_variable]
    [/event]
    [event]
        name=moveto
        first_time_only=no
        [filter]
            side=1
            [filter_location]
                x,y=6,1
            [/filter_location]
        [/filter]
        [filter_condition]
            [variable]
                name=stage
                numerical_equals=0
            [/variable]
            [and]
                [variable]
                    name=puzzle
                    numerical_equals=7
                [/variable]
            [/and]
        [/filter_condition]

        [message]
            speaker=unit
            message= _ "Ouch, it's really hot!"
        [/message]

        [if]
            [variable]
                name=puzzle_counter
                numerical_equals=1
            [/variable]
            [then]
                [set_variable]
                    name=puzzle_counter
                    value=2
                [/set_variable]
            [/then]
            [else]
                [set_variable]
                    name=puzzle_counter
                    value=0
                [/set_variable]
            [/else]
        [/if]
    [/event]
    [event]
        name=moveto
        first_time_only=no
        [filter]
            side=1
            [filter_location]
                x,y=9,2
            [/filter_location]
        [/filter]
        [filter_condition]
            [variable]
                name=stage
                numerical_equals=0
            [/variable]
            [and]
                [variable]
                    name=puzzle
                    numerical_equals=7
                [/variable]
            [/and]
        [/filter_condition]

        [if]
            [variable]
                name=puzzle_counter
                numerical_equals=2
            [/variable]
            [then]

                {DELAY 750}
                [modify_unit]
                    [filter]
                        id=Statue
                    [/filter]
                    max_hitpoints=19
                    hitpoints=19
                [/modify_unit]

                {DELAY 500}

                {REMOVE_IMAGE 7 8}
                {REMOVE_IMAGE 10 6}
                {REMOVE_IMAGE 12 3}
                {REMOVE_IMAGE 9 2}
                {REMOVE_IMAGE 6 1}
                {REMOVE_IMAGE 3 3}
                {REMOVE_IMAGE 4 7}

                {DELAY 500}

                [message]
                    speaker=Esther
                    message= _ "We're getting somewhere..."
                [/message]

                [store_unit]
                    [filter]
                        id=Esther
                    [/filter]
                    variable=esther
                [/store_unit]
                [store_unit]
                    [filter]
                        id=Talya
                    [/filter]
                    variable=talya
                [/store_unit]

                #ifdef EASY
                {VARIABLE_OP esther.experience add 35}
                {VARIABLE_OP talya.experience add 35}

                [unstore_unit]
                    variable=esther
                    find_vacant=no
                    text= _ "+35 XP"
                    red,green,blue=255,0,255
                [/unstore_unit]
                [unstore_unit]
                    variable=talya
                    find_vacant=no
                    text= _ "+35 XP"
                    red,green,blue=255,0,255
                [/unstore_unit]
                #endif
                #ifdef NORMAL
                {VARIABLE_OP esther.experience add 30}
                {VARIABLE_OP talya.experience add 30}

                [unstore_unit]
                    variable=esther
                    find_vacant=no
                    text= _ "+30 XP"
                    red,green,blue=255,0,255
                [/unstore_unit]
                [unstore_unit]
                    variable=talya
                    find_vacant=no
                    text= _ "+30 XP"
                    red,green,blue=255,0,255
                [/unstore_unit]
                #endif
                #ifdef HARD
                {VARIABLE_OP esther.experience add 25}
                {VARIABLE_OP talya.experience add 25}

                [unstore_unit]
                    variable=esther
                    find_vacant=no
                    text= _ "+25 XP"
                    red,green,blue=255,0,255
                [/unstore_unit]
                [unstore_unit]
                    variable=talya
                    find_vacant=no
                    text= _ "+25 XP"
                    red,green,blue=255,0,255
                [/unstore_unit]
                #endif

                {CLEAR_VARIABLE esther}
                {CLEAR_VARIABLE talya}

                [set_variable]
                    name=puzzle
                    value=8
                [/set_variable]
            [/then]
            [else]
                [set_variable]
                    name=puzzle_counter
                    value=0
                [/set_variable]
                [message]
                    speaker=Talya
                    message= _ "It's beating. Creeeeepy."
                [/message]
            [/else]
        [/if]
    [/event]
    ################################################################
    ################################################################

#define PUZZLE_TEXT5
        [message]
            speaker=narrator
            message= _ "She looked at herself in the mirror. Her appearance was pale and weak, pasty and ill-looking from being oppressed for years. The shadows sculpting her gaunt face blended with the dusky hue of her skin, a ghostly, faded visage replacing what flesh and blood once was."
        [/message]
        [message]
            speaker=narrator
            message= _ "Outside, in the sky, the moon irradiated its faded hue onto the ashen world below. It was a pale reflection of the golden warmth of day, a mirror casting its illusory glow into the night."
        [/message]
        [message]
            speaker=narrator
            message= _ "Ivory light cascaded onto azure flowers, soft petals wilted slightly with the onset of snow. She clasped her hands around the charm adorning her neck - a cheap, metallic thing that had been the only trinket her sisters had given her - and murmured a quiet, mourning song."
        [/message]
        [message]
            speaker=narrator
            message= _ "What was to be the price of her freedom? It could have been a hell worse than the one she was in... but it also might not have been. Was it worth taking the risk and pledging herself to a force of unknown power and possibly malevolent intent, or could she continue to bear her miserable existence alone? Both sounded horrible."
        [/message]
        [message]
            speaker=narrator
            message= _ "'You hold the key to your own fate. I shall not make the decision for you. I only ask that you look into yourself and find what you truly desire. You may loathe the idea of willingly selling yourself to me as a servant, but surely you don't believe that it can be worse than the state you are in now, hmm?'"
        [/message]
        [message]
            speaker=narrator
            message= _ "'Still, in the end, it's your choice.'"
        [/message]
#enddef

    [event]
        name=moveto
        first_time_only=yes
        [filter]
            side=1
            [filter_location]
                x,y=13,8
            [/filter_location]
        [/filter]
        [filter_condition]
            [variable]
                name=stage
                numerical_equals=0
            [/variable]
            [and]
                [variable]
                    name=puzzle
                    numerical_equals=8
                [/variable]
            [/and]
        [/filter_condition]

        [move_unit]
            x,y=$x1,$y1
            to_x,to_y=12,7
        [/move_unit]

        {PUZZLE_TEXT5}

        {DELAY 500}
        {PLACE_IMAGE items/mirror.png 11 7}
        {PLACE_IMAGE items/flower2.png 6 6}
        {PLACE_IMAGE items/ankh-necklace.png 4 5}
        {PLACE_IMAGE items/key.png 7 3}
        {PLACE_IMAGE items/potion-red.png 7 9}
        {PLACE_IMAGE items/holy-water.png 5 4}
        {PLACE_IMAGE items/hammer-runic.png 10 2}
        {PLACE_IMAGE items/armor-golden.png 12 3}
        {DELAY 500}

        [set_variable]
            name=puzzle
            value=9
        [/set_variable]
        [set_variable]
            name=puzzle_counter
            value=0
        [/set_variable]
    [/event]
    ################################################################################
    ################################ PUZZLE STAGE 5 ################################
    [event]
        name=moveto
        first_time_only=no
        [filter]
            side=1
            [filter_location]
                x,y=13,8
            [/filter_location]
        [/filter]
        [filter_condition]
            [variable]
                name=stage
                numerical_equals=0
            [/variable]
            [and]
                [variable]
                    name=puzzle
                    numerical_equals=9
                [/variable]
            [/and]
        [/filter_condition]

        {PUZZLE_TEXT5}
    [/event]

    [event]
        name=moveto
        first_time_only=no
        [filter]
            side=1
            [filter_location]
                x,y=7,9
                [or]
                    x,y=5,4
                [/or]
            [/filter_location]
        [/filter]
        [filter_condition]
            [variable]
                name=stage
                numerical_equals=0
            [/variable]
            [and]
                [variable]
                    name=puzzle
                    numerical_equals=9
                [/variable]
            [/and]
        [/filter_condition]

        [message]
            speaker=unit
            message= _ "Not this one."
        [/message]
        [set_variable]
            name=puzzle_counter
            value=0
        [/set_variable]
    [/event]
    [event]
        name=moveto
        first_time_only=no
        [filter]
            side=1
            [filter_location]
                x,y=12,3
                [or]
                    x,y=10,2
                [/or]
            [/filter_location]
        [/filter]
        [filter_condition]
            [variable]
                name=stage
                numerical_equals=0
            [/variable]
            [and]
                [variable]
                    name=puzzle
                    numerical_equals=9
                [/variable]
            [/and]
        [/filter_condition]

        [message]
            speaker=unit
            message= _ "We should look for something else."
        [/message]
        [set_variable]
            name=puzzle_counter
            value=0
        [/set_variable]
    [/event]

    [event]
        name=moveto
        first_time_only=no
        [filter]
            side=1
            [filter_location]
                x,y=11,7
            [/filter_location]
        [/filter]
        [filter_condition]
            [variable]
                name=stage
                numerical_equals=0
            [/variable]
            [and]
                [variable]
                    name=puzzle
                    numerical_equals=9
                [/variable]
            [/and]
        [/filter_condition]

        [message]
            speaker=unit
            message= _ "It's... shiny..."
        [/message]

        [set_variable]
            name=puzzle_counter
            value=1
        [/set_variable]
    [/event]
    [event]
        name=moveto
        first_time_only=no
        [filter]
            side=1
            [filter_location]
                x,y=6,6
            [/filter_location]
        [/filter]
        [filter_condition]
            [variable]
                name=stage
                numerical_equals=0
            [/variable]
            [and]
                [variable]
                    name=puzzle
                    numerical_equals=9
                [/variable]
            [/and]
        [/filter_condition]

        [message]
            speaker=unit
            message= _ "The petals are falling off of this flower."
        [/message]

        [if]
            [variable]
                name=puzzle_counter
                numerical_equals=1
            [/variable]
            [then]
                [set_variable]
                    name=puzzle_counter
                    value=2
                [/set_variable]
            [/then]
            [else]
                [set_variable]
                    name=puzzle_counter
                    value=0
                [/set_variable]
            [/else]
        [/if]
    [/event]
    [event]
        name=moveto
        first_time_only=no
        [filter]
            side=1
            [filter_location]
                x,y=4,5
            [/filter_location]
        [/filter]
        [filter_condition]
            [variable]
                name=stage
                numerical_equals=0
            [/variable]
            [and]
                [variable]
                    name=puzzle
                    numerical_equals=9
                [/variable]
            [/and]
        [/filter_condition]

        [message]
            speaker=unit
            message= _ "This amulet's really cold."
        [/message]

        [if]
            [variable]
                name=puzzle_counter
                numerical_equals=2
            [/variable]
            [then]
                [set_variable]
                    name=puzzle_counter
                    value=3
                [/set_variable]
            [/then]
            [else]
                [set_variable]
                    name=puzzle_counter
                    value=0
                [/set_variable]
            [/else]
        [/if]
    [/event]
    [event]
        name=moveto
        first_time_only=no
        [filter]
            side=1
            [filter_location]
                x,y=7,3
            [/filter_location]
        [/filter]
        [filter_condition]
            [variable]
                name=stage
                numerical_equals=0
            [/variable]
            [and]
                [variable]
                    name=puzzle
                    numerical_equals=9
                [/variable]
            [/and]
        [/filter_condition]

        [if]
            [variable]
                name=puzzle_counter
                numerical_equals=3
            [/variable]
            [then]

                {DELAY 750}
                [modify_unit]
                    [filter]
                        id=Statue
                    [/filter]
                    max_hitpoints=10
                    hitpoints=10
                [/modify_unit]

                {DELAY 500}

                {REMOVE_IMAGE 11 7}
                {REMOVE_IMAGE 6 6}
                {REMOVE_IMAGE 4 5}
                {REMOVE_IMAGE 7 3}
                {REMOVE_IMAGE 7 9}
                {REMOVE_IMAGE 5 4}
                {REMOVE_IMAGE 10 2}
                {REMOVE_IMAGE 12 3}

                {DELAY 500}

                [message]
                    speaker=narrator
                    message= _ "In the glass pane, her reflection was a little distorted, a faux imitation of herself, an imperfect illusion staring with eyes the color of midnight."
                [/message]
                [message]
                    speaker=narrator
                    message= _ "Then, it flickered."
                [/message]
                [message]
                    speaker=narrator
                    message= _ "It flashed between the eerie, disfigured version of herself, and a shadowy form garbed in utter darkness. It flashed back and forth, back and forth more and more rapidly until the two images were nearly blended into one. She knew what it meant. Despite its probably immortality, the being's patience was running out."
                [/message]

                [store_unit]
                    [filter]
                        id=Esther
                    [/filter]
                    variable=esther
                [/store_unit]
                [store_unit]
                    [filter]
                        id=Talya
                    [/filter]
                    variable=talya
                [/store_unit]

                #ifdef EASY
                {VARIABLE_OP esther.experience add 40}
                {VARIABLE_OP talya.experience add 40}

                [unstore_unit]
                    variable=esther
                    find_vacant=no
                    text= _ "+40 XP"
                    red,green,blue=255,0,255
                [/unstore_unit]
                [unstore_unit]
                    variable=talya
                    find_vacant=no
                    text= _ "+40 XP"
                    red,green,blue=255,0,255
                [/unstore_unit]
                #endif
                #ifdef NORMAL
                {VARIABLE_OP esther.experience add 35}
                {VARIABLE_OP talya.experience add 35}

                [unstore_unit]
                    variable=esther
                    find_vacant=no
                    text= _ "+35 XP"
                    red,green,blue=255,0,255
                [/unstore_unit]
                [unstore_unit]
                    variable=talya
                    find_vacant=no
                    text= _ "+35 XP"
                    red,green,blue=255,0,255
                [/unstore_unit]
                #endif
                #ifdef HARD
                {VARIABLE_OP esther.experience add 30}
                {VARIABLE_OP talya.experience add 30}

                [unstore_unit]
                    variable=esther
                    find_vacant=no
                    text= _ "+30 XP"
                    red,green,blue=255,0,255
                [/unstore_unit]
                [unstore_unit]
                    variable=talya
                    find_vacant=no
                    text= _ "+30 XP"
                    red,green,blue=255,0,255
                [/unstore_unit]
                #endif

                {CLEAR_VARIABLE esther}
                {CLEAR_VARIABLE talya}

                [set_variable]
                    name=puzzle
                    value=10
                [/set_variable]
            [/then]
            [else]
                [set_variable]
                    name=puzzle_counter
                    value=0
                [/set_variable]
                [message]
                    speaker=unit
                    message= _ "A key! But what's it for?"
                [/message]
            [/else]
        [/if]
    [/event]
    ################################################################
    ################################################################

#define PUZZLE_TEXT6
        [message]
            speaker=narrator
            message= _ "Her voice was breathy and soft as she spoke, evoking her thoughts more so than actual speech."
        [/message]
        [message]
            speaker=narrator
            message= _ "Mirror, mirror on the wall..."
        [/message]
        [message]
            speaker=narrator
            message= _ "She made up her mind. No matter the price, living like this wasn't worth living. Anything would have been better, she thought. Still, her hands trembled as she gripped the mirror."
        [/message]
        [message]
            speaker=narrator
            message= _ "I hear your summons and heed your call."
        [/message]
        [message]
            speaker=narrator
            message= _ "In the darkness of night and the moon's blue hue..."
        [/message]
        [message]
            speaker=narrator
            message= _ "I pledge my soul to forever serve you."
        [/message]
        [message]
            speaker=narrator
            message= _ "..."
        [/message]
        [message]
            speaker=narrator
            message= _ "'Good girl. Hold still.'"
        [/message]
        [message]
            speaker=narrator
            message= _ "She felt a tingle. It was the faintest sensation, totally belying the jarring transformation she saw in the mirror. She gasped and cried, and those were the last two things she did in that form."
        [/message]
        [message]
            speaker=narrator
            message= _ "'Shhh... shhh. It will be okay.'"
        [/message]
        [message]
            speaker=narrator
            message= _ "The eerie thing about it was that she felt nothing. It changed and changed, flesh and blood warped into something beyond recognition, a distorted form that was only vaguely humanoid, otherwise composed of impossible geometries and nightmarish color. The gaunt features of her face disappeared, faded into a pale cerulean, leaving nothing but a stark pane masking the thing trapped within."
        [/message]
#enddef

    [event]
        name=moveto
        first_time_only=yes
        [filter]
            side=1
            [filter_location]
                x,y=13,8
            [/filter_location]
        [/filter]
        [filter_condition]
            [variable]
                name=stage
                numerical_equals=0
            [/variable]
            [and]
                [variable]
                    name=puzzle
                    numerical_equals=10
                [/variable]
            [/and]
        [/filter_condition]

        [move_unit]
            x,y=$x1,$y1
            to_x,to_y=12,7
        [/move_unit]

        {PUZZLE_TEXT6}

        {DELAY 500}
        {PLACE_IMAGE items/crystal-glyph-message.png 11 5}
        {PLACE_IMAGE items/crystal-glyph-message.png 3 5}
        {PLACE_IMAGE items/crystal-glyph-message.png 7 2}
        {PLACE_IMAGE items/crystal-glyph-message.png 7 8}
        {DELAY 500}

        [set_variable]
            name=puzzle
            value=11
        [/set_variable]
        [set_variable]
            name=puzzle_counter
            value=0
        [/set_variable]
    [/event]
    ################################################################################
    ################################ PUZZLE STAGE 6 ################################
    [event]
        name=moveto
        first_time_only=no
        [filter]
            side=1
            [filter_location]
                x,y=13,8
            [/filter_location]
        [/filter]
        [filter_condition]
            [variable]
                name=stage
                numerical_equals=0
            [/variable]
            [and]
                [variable]
                    name=puzzle
                    numerical_equals=11
                [/variable]
            [/and]
        [/filter_condition]

        {PUZZLE_TEXT6}
    [/event]
    [event]
        name=moveto
        first_time_only=no
        [filter]
            side=1
            [filter_location]
                x,y=7,2
            [/filter_location]
        [/filter]
        [filter_condition]
            [variable]
                name=stage
                numerical_equals=0
            [/variable]
            [and]
                [variable]
                    name=puzzle
                    numerical_equals=11
                [/variable]
            [/and]
        [/filter_condition]

        [message]
            speaker=narrator
            message= _ "She had no nose so she could not breathe. The scent of flowers and the breath of air were lost in the murky depths of deep, crepuscular water. In time, even the memory of the fragrance from her beloved flowers would be lost in the endless seas of frozen dreams."
        [/message]

        [set_variable]
            name=puzzle_counter
            value=1
        [/set_variable]
    [/event]
    [event]
        name=moveto
        first_time_only=no
        [filter]
            side=1
            [filter_location]
                x,y=3,5
            [/filter_location]
        [/filter]
        [filter_condition]
            [variable]
                name=stage
                numerical_equals=0
            [/variable]
            [and]
                [variable]
                    name=puzzle
                    numerical_equals=11
                [/variable]
            [/and]
        [/filter_condition]

        [message]
            speaker=narrator
            message= _ "She had no arms, so she could not act. She was left as a silent observer, infesting the nightmares of restless dreamers, tainting and warping their minds so long as they slept. But beyond that, she could no longer do anything, except wait, and watch."
        [/message]

        [if]
            [variable]
                name=puzzle_counter
                numerical_equals=1
            [/variable]
            [then]
                [set_variable]
                    name=puzzle_counter
                    value=2
                [/set_variable]
            [/then]
            [else]
                [set_variable]
                    name=puzzle_counter
                    value=0
                [/set_variable]
            [/else]
        [/if]
    [/event]
    [event]
        name=moveto
        first_time_only=no
        [filter]
            side=1
            [filter_location]
                x,y=11,5
            [/filter_location]
        [/filter]
        [filter_condition]
            [variable]
                name=stage
                numerical_equals=0
            [/variable]
            [and]
                [variable]
                    name=puzzle
                    numerical_equals=11
                [/variable]
            [/and]
        [/filter_condition]

        [message]
            speaker=narrator
            message= _ "She had no mouth so she could not speak. She would have screamed - at the unfairness of the world, at the freedom she was not granted, at the very fact that she had ever been born - but that was an impossibility. Even so much as a single word was no longer feasible."
        [/message]

        [if]
            [variable]
                name=puzzle_counter
                numerical_equals=2
            [/variable]
            [then]
                [set_variable]
                    name=puzzle_counter
                    value=3
                [/set_variable]
            [/then]
            [else]
                [set_variable]
                    name=puzzle_counter
                    value=0
                [/set_variable]
            [/else]
        [/if]
    [/event]
    [event]
        name=moveto
        first_time_only=no
        [filter]
            side=1
            [filter_location]
                x,y=7,8
            [/filter_location]
        [/filter]
        [filter_condition]
            [variable]
                name=stage
                numerical_equals=0
            [/variable]
            [and]
                [variable]
                    name=puzzle
                    numerical_equals=11
                [/variable]
            [/and]
        [/filter_condition]

        [message]
            speaker=narrator
            message= _ "She had no eyes, so she could not cry. Tears of blood rained from the sky as the castle of her father and her sisters came tumbling down to the ground, but she felt nothing, not even when they knelt and begged for their lives, not even when they were smouldering ruins. She could not even see them, for the only place she had vision was in the world of dreams."
        [/message]

        [if]
            [variable]
                name=puzzle_counter
                numerical_equals=3
            [/variable]
            [then]

                [store_unit]
                    [filter]
                        id=Esther
                    [/filter]
                    variable=esther
                [/store_unit]
                [store_unit]
                    [filter]
                        id=Talya
                    [/filter]
                    variable=talya
                [/store_unit]

                #ifdef EASY
                {VARIABLE_OP esther.experience add 360}
                {VARIABLE_OP talya.experience add 120}

                [unstore_unit]
                    variable=esther
                    find_vacant=no
                    text= _ "+300 XP"
                    red,green,blue=255,0,255
                [/unstore_unit]
                [unstore_unit]
                    variable=talya
                    find_vacant=no
                    text= _ "+100 XP"
                    red,green,blue=255,0,255
                [/unstore_unit]
                #endif
                #ifdef NORMAL
                {VARIABLE_OP esther.experience add 300}
                {VARIABLE_OP talya.experience add 100}

                [unstore_unit]
                    variable=esther
                    find_vacant=no
                    text= _ "+225 XP"
                    red,green,blue=255,0,255
                [/unstore_unit]
                [unstore_unit]
                    variable=talya
                    find_vacant=no
                    text= _ "+75 XP"
                    red,green,blue=255,0,255
                [/unstore_unit]
                #endif
                #ifdef HARD
                {VARIABLE_OP esther.experience add 150}
                {VARIABLE_OP talya.experience add 50}

                [unstore_unit]
                    variable=esther
                    find_vacant=no
                    text= _ "150 XP"
                    red,green,blue=255,0,255
                [/unstore_unit]
                [unstore_unit]
                    variable=talya
                    find_vacant=no
                    text= _ "+50 XP"
                    red,green,blue=255,0,255
                [/unstore_unit]
                #endif

                {CLEAR_VARIABLE esther}
                {CLEAR_VARIABLE talya}

                {DELAY 750}
                [modify_unit]
                    [filter]
                        id=Statue
                    [/filter]
                    max_hitpoints=1
                    hitpoints=1
                [/modify_unit]

                {DELAY 750}

                {REMOVE_IMAGE 11 5}
                {REMOVE_IMAGE 3 5}
                {REMOVE_IMAGE 7 2}
                {REMOVE_IMAGE 7 8}
                {PLAY_SOUND "magic-dark-miss.ogg"}
                {DELAY 1000}
                [kill]
                    x,y=7,5
                [/kill]
                {DELAY 750}
                {FADE_SCREEN}

                [store_unit]
                    [filter]
                        side=1
                        [not]
                            x,y=recall,recall
                        [/not]
                    [/filter]
                    variable=units
                [/store_unit]
                [kill]
                    side=1
                    [not]
                        x,y=recall,recall
                    [/not]
                [/kill]

                {REMOVE_IMAGE 13 8}

                [terrain]
                    x,y=7,5
                    radius=10
                    terrain=Qxua
                [/terrain]
                {DELAY 500}
                {REPEAT 2 ({QUAKE_FIXED "rumble.ogg"})}
                {PLAY_SOUND "magic-dark.ogg"}
                {DELAY 250}
                {PLAY_SOUND "magic-dark.ogg"}
                {REPEAT 2 ({QUAKE_FIXED "rumble.ogg"})}
                {DELAY 250}
                {PLAY_SOUND "magic-dark.ogg"}
                {DELAY 500}
                {PLAY_SOUND "magic-dark.ogg"}
                {REPEAT 2 ({QUAKE_FIXED "rumble.ogg"})}
                {DELAY 500}

                [set_variable]
                    name=aryel_tmp.hitpoints
                    value=1
                [/set_variable]
                {UNFADE_SCREEN}

                [unstore_unit]
                    variable=aryel_tmp
                    x,y=7,5
                [/unstore_unit]

                [petrify]
                    id=Aryel
                [/petrify]
                {DELAY 400}
                [unpetrify]
                    id=Aryel
                [/unpetrify]
                {DELAY 750}
                [message]
                    speaker=Aryel
                    message= _ "(gasps)"
                [/message]
                {DELAY 550}
                [petrify]
                    id=Aryel
                [/petrify]
                {DELAY 400}
                [unpetrify]
                    id=Aryel
                [/unpetrify]
                {DELAY 400}
                [petrify]
                    id=Aryel
                [/petrify]
                {DELAY 400}
                [unpetrify]
                    id=Aryel
                [/unpetrify]
                {DELAY 750}
                [message]
                    speaker=Aryel
                    message= _ "Yumi!"
                [/message]
                {DELAY 550}
                [petrify]
                    id=Aryel
                [/petrify]
                {DELAY 400}
                [unpetrify]
                    id=Aryel
                [/unpetrify]
                {DELAY 400}
                [petrify]
                    id=Aryel
                [/petrify]
                {DELAY 400}
                [unpetrify]
                    id=Aryel
                [/unpetrify]
                {DELAY 400}
                [petrify]
                    id=Aryel
                [/petrify]
                {DELAY 400}
                [unpetrify]
                    id=Aryel
                [/unpetrify]

                {DELAY 1000}
                [message]
                    speaker=Aryel
                    message= _ "(clutches chest)"
                [/message]
                [message]
                    speaker=Aryel
                    message= _ "(winces)"
                [/message]
                [message]
                    speaker=Aryel
                    message= _ "Ugh, it hurts... I can't... ow..."
                [/message]
                [message]
                    speaker=Aryel
                    message= _ "... agh... but I can't just let them take Yumi away like that..."
                [/message]
                [message]
                    speaker=Aryel
                    message= _ "... I've got to..."
                [/message]
                [move_unit]
                    id=Aryel
                    to_x,to_y=8,5
                [/move_unit]
                {DELAY 750}
                [message]
                    speaker=Aryel
                    message= _ "Move, Aryel, move!"
                [/message]
                {DELAY 500}
                [move_unit]
                    id=Aryel
                    to_x,to_y=9,6
                [/move_unit]
                {DELAY 500}
                [move_unit]
                    id=Aryel
                    to_x,to_y=10,6
                [/move_unit]
                {DELAY 250}
                [move_unit]
                    id=Aryel
                    to_x,to_y=11,7
                [/move_unit]
                {DELAY 750}
                [message]
                    speaker=Aryel
                    message= _ "Ah... this is bad..."
                [/message]
                {DELAY 500}
                [kill]
                    id=Aryel
                [/kill]
                {FADE_SCREEN}

                [terrain]
                    x,y=7,5
                    radius=10
                    terrain=Woby
                [/terrain]

                {DRAW_BLOOD_NO_REDRAW}
                {DRAW_BLOOD_NO_REDRAW}
                {DRAW_BLOOD_NO_REDRAW}
                {DRAW_DARKNESS}
                {DRAW_DARKNESS}
                {DRAW_BLOOD_NO_REDRAW}
                {DRAW_BLOOD_NO_REDRAW}
                {DRAW_DARKNESS}
                {DRAW_DARKNESS}
                {DRAW_DARKNESS}

                [modify_side]
                    side=1
                    shroud=no
                [/modify_side]
                [reset_fog]
                    [filter_side]
                        side=1
                    [/filter_side]
                [/reset_fog]
                [redraw]
                    side=1
                    clear_shroud=yes
                [/redraw]

                {UNFADE_SCREEN}

                [for]
                    array=units
                    [do]
                        [unstore_unit]
                            variable=units[$i]
                            x,y=14,7
                            find_vacant=yes
                        [/unstore_unit]
                    [/do]
                [/for]
                {CLEAR_VARIABLE units}
                [redraw]
                    side=1
                    clear_shroud=yes
                [/redraw]
                [unhide_unit]
                    [filter]
                        side=1
                    [/filter]
                [/unhide_unit]
                {DELAY 750}

                [message]
                    speaker=Esther
                    message= _ "Uhm..."
                [/message]

                {PLAY_SOUND "magic-faeriefire.ogg"}

                {DELAY 500}
                [terrain]
                    x,y=7,5
                    terrain=Qxua
                [/terrain]
                [redraw][/redraw]
                {DELAY 400}
                {PLAY_SOUND "shaxthal-roam-1.ogg"}
                {DELAY 350}
                {PLAY_SOUND "shaxthal-roam-2.ogg"}
                {DELAY 400}
                {DRAW_VOID}
                {DELAY 400}
                {PLAY_SOUND "shaxthal-roam-1.ogg"}
                {DRAW_VOID}
                {DELAY 750}

                [message]
                    speaker=Talya
                    message= _ "What is that?"
                [/message]
                [message]
                    speaker=Esther
                    message= _ "I'm... not really sure."
                [/message]
                {DELAY 300}
                {DRAW_VOID}
                {DELAY 300}
                [message]
                    speaker=Talya
                    message= _ "Well, in that case, let's get out of here!"
                [/message]
                [message]
                    speaker=Esther
                    message= _ "But Aryel and Yumi-"
                [/message]
                {DELAY 300}
                {DRAW_VOID}
                {DELAY 300}
                [message]
                    speaker=Talya
                    message= _ "They're obviously not here. Come on, let's go before we get caught in that stuff!"
                [/message]
                [message]
                    speaker=Esther
                    message= _ "But-"
                [/message]
                {DELAY 300}
                {DRAW_VOID}
                {DELAY 300}

                {SCROLL_TO 39 47}
                [lift_fog]
                    [filter_side]
                        side=1
                    [/filter_side]
                    x=39
                    y=48
                    radius=5
                    multiturn=no
                [/lift_fog]
                [redraw]
                    side=1
                    clear_shroud=yes
                [/redraw]
                [unit]
                    side=3
                    generate_name=yes
                    id=cavalryleader14
                    type=Cavalier
                    random_traits=yes
                    animate=yes
                    upkeep=loyal
                    x,y=40,47
                [/unit]
                [unit]
                    side=3
                    generate_name=yes
                    type=Cavalier
                    random_traits=yes
                    animate=yes
                    upkeep=loyal
                    x,y=40,48
                [/unit]
                [unit]
                    side=3
                    generate_name=yes
                    type=Cavalier
                    random_traits=yes
                    animate=yes
                    upkeep=loyal
                    x,y=41,48
                [/unit]
                [unit]
                    side=3
                    generate_name=yes
                    type=Cavalier
                    random_traits=yes
                    animate=yes
                    upkeep=loyal
                    x,y=40,49
                [/unit]
                [unit]
                    side=3
                    generate_name=yes
                    type=Cavalier
                    random_traits=yes
                    animate=yes
                    upkeep=loyal
                    x,y=41,49
                [/unit]
                [unit]
                    side=3
                    generate_name=yes
                    type=Cavalier
                    random_traits=yes
                    animate=yes
                    upkeep=loyal
                    x,y=40,50
                [/unit]
                [unit]
                    side=3
                    generate_name=yes
                    type=Cavalier
                    random_traits=yes
                    animate=yes
                    upkeep=loyal
                    x,y=41,50
                [/unit]
                {DELAY 500}
                [message]
                    speaker=cavalryleader14
                    message= _ "By the gods! We were too late... I had heard of reports that the faerie came to turn the tides of this battle, but to think that they would cause this much bloodshed..."
                [/message]
                [message]
                    speaker=cavalryleader14
                    message= _ "(grits teeth)"
                [/message]
                [message]
                    speaker=cavalryleader14
                    message= _ "They will pay for this atrocity! Search for survivors! If you encounter any of those accursed faerie, give no quarter. We cannot let them upset the order of our kingdom any longer. And send a messenger back to Caerleon with a detailed report of our findings."
                [/message]
                [reset_fog]
                    [filter_side]
                        side=1
                    [/filter_side]
                [/reset_fog]
                [redraw]
                    side=1
                    clear_shroud=yes
                [/redraw]
                {DELAY 500}
                [message]
                    speaker=Talya
                    message= _ "Esther, we reaaaally should get out of here. Especially now that more people are showing up. There's nothing you can do for those two anyway just by sitting here."
                [/message]
                {DELAY 500}
                [message]
                    speaker=Talya
                    message= _ "(panicking) And that stuff is getting even closer to us now! Come onnnn!"
                [/message]
                [message]
                    speaker=Esther
                    message= _ "... I guess you're right. Us being here poses a problem as well, since it seems these riders believe we caused this calamity."
                [/message]
                [message]
                    speaker=Talya
                    message= _ "(fidgeting) Yeah, right, that's really bad. I mean, even you have no clue what happened, so it's not like we can explain ourselves."
                [/message]
                [message]
                    speaker=Esther
                    message= _ "(sighs) I doubt they would listen to explanation I could come up with anyway. I mean no offense - but lately, all these people have done is persecute us on what seems to be a whim. It's getting frustrating."
                [/message]
                [message]
                    speaker=Talya
                    message= _ "(antsy) Yup, it's annoying for me too. That Marshal Briggs didn't even want to listen to me at all even though I'm pretty high ranked in the Magi Council. Well, probably was at this point."
                [/message]
                [message]
                    speaker=Esther
                    message= _ "Oh, you are?"
                [/message]
                {DELAY 350}
                {PLAY_SOUND "shaxthal-roam-1.ogg"}
                {DELAY 350}
                {DRAW_VOID}
                {PLAY_SOUND "shaxthal-roam-2.ogg"}
                {DELAY 500}
                [message]
                    speaker=Esther
                    message= _ "Ah, you'll have to tell me about that later. I think more of those demons are coming too."
                [/message]
                [message]
                    speaker=Talya
                    message= _ "Yeah, let's get moving."
                [/message]

                [objectives]
                    {OBJECTIVE_VICTORY  ( _ "Escape to the bottom right corner of the map with Esther or Talya")}
                    {OBJECTIVE_DEFEAT  ( _ "Death of Esther")}
                    {OBJECTIVE_DEFEAT  ( _ "Death of Talya")}
                    {OBJECTIVE_NOTE ( _ "Do not let the void tiles catch up to you.")}
                [/objectives]

                [set_variable]
                    name=stage
                    value=2
                [/set_variable]
                [set_variable]
                    name=turn_counter
                    value=0
                [/set_variable]
                [set_variable]
                    name=puzzle
                    value=99
                [/set_variable]
                {CLEAR_VARIABLE puzzle_counter}
            [/then]
            [else]
                [set_variable]
                    name=puzzle_counter
                    value=0
                [/set_variable]
            [/else]
        [/if]
    [/event]
    ################################################################
    ################################################################

    #define KILL_UNITS_ON_VOID
    [store_locations]
        variable=hex
        terrain=Qxua
    [/store_locations]
    [for]
        array=hex
        [do]
            [if]
                [have_unit]
                    x,y=$hex[$i].x,$hex[$i].y
                    [not]
                        type=Fire Fae, Demon Void Shambler, Demon Voidhunter, Demon Voidreaver, Black Demon
                    [/not]
                [/have_unit]
                [then]
                    [kill]
                        x,y=$hex[$i].x,$hex[$i].y
                        animate=yes
                        fire_event=yes
                    [/kill]
                [/then]
            [/if]
            [if]
                [have_unit]
                    x,y=$hex[$i].x,$hex[$i].y
                    id=Esther
                [/have_unit]
                [then]
                    [harm_unit]
                        [filter]
                            x,y=$hex[$i].x,$hex[$i].y
                        [/filter]
                        amount=5
                        animate=yes
                        kill=no
                        slowed=yes
                        fire_event=yes
                    [/harm_unit]
                [/then]
            [/if]
        [/do]
    [/for]
    {CLEAR_VARIABLE hex}
    #enddef

    [event]
        name=new turn
        first_time_only=no
        [filter_condition]
            [variable]
                name=stage
                numerical_equals=2
            [/variable]
        [/filter_condition]

        {VARIABLE_OP turn_counter add 1}

        {DRAW_VOID}
        {DRAW_VOID}
        {DRAW_VOID}

        [if]
            [variable]
                name=turn_counter
                greater_than=3
            [/variable]
            [then]
                {DRAW_VOID}
                {DRAW_VOID}
                {DRAW_VOID}
            [/then]
        [/if]
        [if]
            [variable]
                name=turn_counter
                greater_than=7
            [/variable]
            [then]
                {DRAW_VOID}
                {DRAW_VOID}
            [/then]
        [/if]
        [if]
            [variable]
                name=turn_counter
                greater_than=11
            [/variable]
            [then]
                {DRAW_VOID}
                {DRAW_VOID}
                {DRAW_VOID}
            [/then]
        [/if]

        {KILL_UNITS_ON_VOID}

        [switch]
            variable=turn_counter
            [case]
                value=1
                [message]
                    speaker=Esther
                    message= _ "I really shouldn't have let those two run off alone... ugh. I'll have to figure out a way to find them later."
                [/message]
            [/case]
            [case]
                value=2
                [message]
                    speaker=Esther
                    message= _ "It's just so hard to be responsible sometimes."
                [/message]
                [message]
                    speaker=Esther
                    message= _ "In times like these, when there's so much death and destruction everywhere, what am I supposed to do?"
                [/message]
                [message]
                    speaker=Esther
                    message= _ "I can't just stand by and watch while everyone else dies. It wouldn't be right."
                [/message]
            [/case]
            [case]
                value=3
                [message]
                    speaker=Esther
                    message= _ "... but I can't just let Aryel and Yumi go off by themselves. They're like a couple of children, those two, always getting into trouble the moment I look away."
                [/message]
                [message]
                    speaker=Esther
                    message= _ "They're a pain sometimes, but I ought to do my best to look after them."
                [/message]
            [/case]
            [case]
                value=5
                [message]
                    speaker=Esther
                    message= _ "Those two are all that I really have..."
                [/message]
            [/case]
            [case]
                value=7
                [message]
                    speaker=Esther
                    message= _ "... I really hope they're okay."
                [/message]
            [/case]
            [case]
                value=9
                [message]
                    speaker=Esther
                    message= _ "If I could just catch a little break, I could try to sense where they are. It's just that all this ruckus is making it really hard."
                [/message]
            [/case]
            [case]
                value=10
                [message]
                    speaker=Esther
                    message= _ "Please don't be hurt."
                [/message]
            [/case]
        [/switch]
    [/event]

    [event]
        name=sighted
        first_time_only=yes
        [filter]
            side=3
        [/filter]
        [filter_second]
            side=1
        [/filter_second]
        [filter_condition]
            [variable]
                name=stage
                numerical_equals=2
            [/variable]
        [/filter_condition]
        [message]
            speaker=unit
            message= _ "There they are! Those filthy faerie, they're here!"
        [/message]
        [message]
            speaker=Talya
            message= _ "Yo, don't call them filthy..."
        [/message]
        [message]
            speaker=unit
            message= _ "It's the traitor, too! Slay them all!"
        [/message]
        [message]
            speaker=Talya
            message= _ "Right, like that's happening."
        [/message]
    [/event]

    #spawns
    [event]
        name=side 2 turn
        first_time_only=no
        [filter_condition]
            [variable]
                name=stage
                numerical_equals=2
            [/variable]
        [/filter_condition]
        [store_locations]
            variable=hex
            terrain=Qxua
        [/store_locations]
        [for]
            array=hex
            [do]
                #ifdef HARD
                [set_variable]
                    name=spawn_val
                    rand=1..300
                [/set_variable]
                #endif
                #ifdef NORMAL
                [set_variable]
                    name=spawn_val
                    rand=1..450
                [/set_variable]
                #endif
                #ifdef EASY
                [set_variable]
                    name=spawn_val
                    rand=1..500
                [/set_variable]
                #endif
                [if]
                    [variable]
                        name=spawn_val
                        numerical_equals=3
                    [/variable]
                    [then]
                        {SPAWN_NOID ("Demon Voidhunter","Demon Voidreaver") 2 $hex[$i].x $hex[$i].y}
                    [/then]
                [/if]
                [if]
                    [variable]
                        name=spawn_val
                        less_than=3
                    [/variable]
                    [then]
                        {SPAWN_NOID ("Black Demon") 2 $hex[$i].x $hex[$i].y}
                    [/then]
                [/if]
                {CLEAR_VARIABLE spawn_val}
            [/do]
        [/for]
        {CLEAR_VARIABLE hex}
    [/event]

    [event]
        name=moveto
        first_time_only=no
        [filter]
            side=1
            id=Esther,Talya
            [filter_location]
                x,y=42,47
                radius=3
            [/filter_location]
        [/filter]
        [filter_condition]
            [variable]
                name=stage
                numerical_equals=2
            [/variable]
        [/filter_condition]
        [message]
            speaker=Talya
            message= _ "Let's go!"
        [/message]
        [message]
            speaker=Esther
            message= _ "(breathes deeply)"
        [/message]
        [message]
            speaker=Esther
            message= _ "Aryel, Yumi... ah, they're not here. They're..."
        [/message]
        [message]
            speaker=Talya
            message= _ "Esther! Stop staring, you're going to get caught!"
        [/message]
        [message]
            speaker=Esther
            message= _ "Maybe I can sense where they are. Aryel's... somewhere south of here, but I can't sense Yumi at all. She's usually hard to track, though..."
        [/message]
        [message]
            speaker=Esther
            message= _ "Maybe it's okay. Maybe I'm worrying about nothing. It's just... at least Aryel's fine, by the looks of it. I just need to get to her and see if Yumi's with her. Everything else can come later. I hope."
        [/message]

        [message]
            speaker=Talya
            message= _ "Estherrrr..."
        [/message]
        [message]
            speaker=Esther
            message= _ "(shakes head) Right. Let's go."
        [/message]

        {FADE_SCREEN}

        {CLEAR_VARIABLE stage}
        {CLEAR_VARIABLE puzzle}
        {CLEAR_VARIABLE turn_counter}

        [endlevel]
            result=victory
            bonus=yes
            {NEW_GOLD_CARRYOVER 100}
            replay_save=no
            carryover_report=no
            linger_mode=no
            next_scenario=15_Silent_Night
        [/endlevel]
    [/event]

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

        [message]
            speaker=Talya
            message= _ "I-I can't..."
        [/message]
        [endlevel]
            result=defeat
        [/endlevel]
    [/event]

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

        [message]
            speaker=Esther
            message= _ "Aryel... Yumi... I'm sorry..."
        [/message]
        [endlevel]
            result=defeat
        [/endlevel]
    [/event]

    [event]
        name=last breath
        first_time_only=no
        [filter]
            id=cavalryleader14
        [/filter]
        [message]
            speaker=unit
            message= _ "I... always knew... the faerie... were evil..."
        [/message]
        [message]
            speaker=Talya
            message= _ "You know, you brought this upon yourself."
        [/message]
        [message]
            speaker=unit
            message= _ "You will pay... miserable turncoat..."
        [/message]
        [message]
            speaker=Talya
            message= _ "Hey! That's rude!"
        [/message]
    [/event]
[/scenario]

#undef DRAW_DARKNESS
#undef DRAW_BLOOD_NO_REDRAW
#undef DRAW_VOID
#undef KILL_UNITS_ON_VOID
#undef PUZZLE_TEXT1
#undef PUZZLE_TEXT2
#undef PUZZLE_TEXT3
#undef PUZZLE_TEXT4
#undef PUZZLE_TEXT5
#undef PUZZLE_TEXT6