#textdomain wesnoth-Genesis
[scenario]
    id=15_Silent_Night
    name= _ "Silent Night"
    map_data="{~add-ons/Genesis/episode1/maps/15_Silent_Night.map}"
    next_scenario=16_Black_Forest
    victory_when_enemies_defeated=no
    turns=-1
    {ETERNALDARK}

    {SCENARIO_MUSIC silence.ogg}

    [side]
        {PLAYER_FAE}
        side=1
        recruit=
        {GOLD 350 300 200}
        {NO_INCOME_SIDE}
        fog=yes
        shroud=yes
    [/side]

    [side]
        {BLACK_DEMON_SIDE}
        side=2
        fog=no
        shroud=no
        [ai]
            aggression=1
            caution=0
            grouping=false
            [goal]
                [criteria]
                    id=Yumi
                [/criteria]
                value=200
            [/goal]
            [goal]
                [criteria]
                    id=Aryel
                [/criteria]
                value=200
            [/goal]
        [/ai]
    [/side]
    [side]
        {BLACK_DEMON_SIDE}
        side=3
        fog=no
        shroud=no
        hidden=yes
        [ai]
            aggression=1
            caution=0
            grouping=false
            [goal]
                [criteria]
                    id=Aryel
                [/criteria]
                value=200
            [/goal]
        [/ai]
    [/side]
    [side]
        {HUMAN_ENEMY}
        side=4
        no_leader=yes
        fog=no
        shroud=no
        hidden=yes
    [/side]

#define GENERATE_MOUNTAIN
    [store_locations]
        variable=ice_hex
        terrain=Ai,Ha
    [/store_locations]
    [for]
        array=ice_hex
        [do]
            [set_variable]
                name=change_terrain
                rand=1..450
            [/set_variable]
            [if]
                [variable]
                    name=change_terrain
                    numerical_equals=1
                [/variable]
                [then]
                    [terrain]
                         x,y=$ice_hex[$i].x,$ice_hex[$i].y
                        terrain=Xu
                    [/terrain]
                [/then]
            [/if]
            {CLEAR_VARIABLE change_terrain}
        [/do]
    [/for]
    {CLEAR_VARIABLE ice_hex}
    [store_locations]
        variable=ice_hex
        terrain=Ai
        [filter_adjacent_location]
            terrain=Xue
        [/filter_adjacent_location]
    [/store_locations]
    [for]
        array=ice_hex
        [do]
            [set_variable]
                name=change_terrain
                rand=1..9
            [/set_variable]
            [if]
                [variable]
                    name=change_terrain
                    less_than=8
                [/variable]
                [then]
                    [terrain]
                         x,y=$ice_hex[$i].x,$ice_hex[$i].y
                        terrain=Xu
                    [/terrain]
                [/then]
            [/if]
            {CLEAR_VARIABLE change_terrain}
        [/do]
    [/for]
    {CLEAR_VARIABLE ice_hex}
    [store_locations]
        variable=ice_hex
        terrain=Ai
        [filter_adjacent_location]
            terrain=Xu,Xue
            count=1,2
        [/filter_adjacent_location]
    [/store_locations]
    [for]
        array=ice_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=$ice_hex[$i].x,$ice_hex[$i].y
                        terrain=Xu
                    [/terrain]
                [/then]
            [/if]
            {CLEAR_VARIABLE change_terrain}
        [/do]
    [/for]
    {CLEAR_VARIABLE ice_hex}
    [store_locations]
        variable=ice_hex
        terrain=Ai
        [filter_adjacent_location]
            terrain=Xu
            count=3,4
        [/filter_adjacent_location]
    [/store_locations]
    [for]
        array=ice_hex
        [do]
            [set_variable]
                name=change_terrain
                rand=1..10
            [/set_variable]
            [if]
                [variable]
                    name=change_terrain
                    less_than=5
                [/variable]
                [then]
                    [terrain]
                         x,y=$ice_hex[$i].x,$ice_hex[$i].y
                        terrain=Xu
                    [/terrain]
                [/then]
            [/if]
            {CLEAR_VARIABLE change_terrain}
        [/do]
    [/for]
    {CLEAR_VARIABLE ice_hex}
    [store_locations]
        variable=ice_hex
        terrain=Ai
        [filter_adjacent_location]
            terrain=Xu
            count=5,6
        [/filter_adjacent_location]
    [/store_locations]
    [for]
        array=ice_hex
        [do]
            [set_variable]
                name=change_terrain
                rand=1..7
            [/set_variable]
            [if]
                [variable]
                    name=change_terrain
                    numerical_equals=1
                [/variable]
                [then]
                    [terrain]
                         x,y=$ice_hex[$i].x,$ice_hex[$i].y
                        terrain=Xu
                    [/terrain]
                [/then]
            [/if]
            {CLEAR_VARIABLE change_terrain}
        [/do]
    [/for]
    {CLEAR_VARIABLE ice_hex}
#enddef

#define SWAP_TO_WALL
    [store_locations]
        variable=ice_hex
        terrain=Ms
    [/store_locations]
    [for]
        array=ice_hex
        [do]
            [terrain]
                x,y=$ice_hex[$i].x,$ice_hex[$i].y
                terrain=Xu
            [/terrain]
        [/do]
    [/for]
    {CLEAR_VARIABLE ice_hex}
    [store_locations]
        variable=ice_hex
        terrain=Mm^Xm
    [/store_locations]
    [for]
        array=ice_hex
        [do]
            [terrain]
                x,y=$ice_hex[$i].x,$ice_hex[$i].y
                terrain=Xue
            [/terrain]
        [/do]
    [/for]
    {CLEAR_VARIABLE ice_hex}
#enddef
#define SWAP_TO_MOUNTAIN
    [store_locations]
        variable=ice_hex
        terrain=Xu
    [/store_locations]
    [for]
        array=ice_hex
        [do]
            [terrain]
                x,y=$ice_hex[$i].x,$ice_hex[$i].y
                terrain=Ms
            [/terrain]
        [/do]
    [/for]
    {CLEAR_VARIABLE ice_hex}
    [store_locations]
        variable=ice_hex
        terrain=Xue
    [/store_locations]
    [for]
        array=ice_hex
        [do]
            [terrain]
                x,y=$ice_hex[$i].x,$ice_hex[$i].y
                terrain=Mm^Xm
            [/terrain]
        [/do]
    [/for]
    {CLEAR_VARIABLE ice_hex}
#enddef

#define GENERATE_HILL
    [store_locations]
        variable=ice_hex
        terrain=Ai,Aa
        [filter_adjacent_location]
            terrain=Xu
        [/filter_adjacent_location]
    [/store_locations]
    [for]
        array=ice_hex
        [do]
            [set_variable]
                name=change_terrain
                rand=1..7
            [/set_variable]
            [if]
                [variable]
                    name=change_terrain
                    less_than=4
                [/variable]
                [then]
                    [terrain]
                         x,y=$ice_hex[$i].x,$ice_hex[$i].y
                        terrain=Uh
                    [/terrain]
                [/then]
            [/if]
            {CLEAR_VARIABLE change_terrain}
        [/do]
    [/for]
    {CLEAR_VARIABLE ice_hex}
    [store_locations]
        variable=ice_hex
        terrain=Ai,Wwb
    [/store_locations]
    [for]
        array=ice_hex
        [do]
            [set_variable]
                name=change_terrain
                rand=1..25
            [/set_variable]
            [if]
                [variable]
                    name=change_terrain
                    numerical_equals=1
                [/variable]
                [then]
                    [terrain]
                         x,y=$ice_hex[$i].x,$ice_hex[$i].y
                        terrain=Uh
                    [/terrain]
                [/then]
            [/if]
            {CLEAR_VARIABLE change_terrain}
        [/do]
    [/for]
    {CLEAR_VARIABLE ice_hex}
    [store_locations]
        variable=ice_hex
        terrain=Ai,Aa
        [filter_adjacent_location]
            terrain=Uh
        [/filter_adjacent_location]
    [/store_locations]
    [for]
        array=ice_hex
        [do]
            [set_variable]
                name=change_terrain
                rand=1..5
            [/set_variable]
            [if]
                [variable]
                    name=change_terrain
                    numerical_equals=1
                [/variable]
                [then]
                    [terrain]
                         x,y=$ice_hex[$i].x,$ice_hex[$i].y
                        terrain=Uh
                    [/terrain]
                [/then]
            [/if]
            {CLEAR_VARIABLE change_terrain}
        [/do]
    [/for]
    {CLEAR_VARIABLE ice_hex}
#enddef

#define SWAP_TO_HILL
    [store_locations]
        variable=ice_hex
        terrain=Uh
    [/store_locations]
    [for]
        array=ice_hex
        [do]
            [terrain]
                x,y=$ice_hex[$i].x,$ice_hex[$i].y
                terrain=Ha
            [/terrain]
        [/do]
    [/for]
    {CLEAR_VARIABLE ice_hex}
#enddef
#define SWAP_TO_CAVEHILL
    [store_locations]
        variable=ice_hex
        terrain=Ha
    [/store_locations]
    [for]
        array=ice_hex
        [do]
            [terrain]
                x,y=$ice_hex[$i].x,$ice_hex[$i].y
                terrain=Uh
            [/terrain]
        [/do]
    [/for]
    {CLEAR_VARIABLE ice_hex}
#enddef

#define GENERATE_FOREST
    [store_locations]
        variable=ice_hex
        terrain=Ai,Aa
    [/store_locations]
    [for]
        array=ice_hex
        [do]
            [set_variable]
                name=change_terrain
                rand=1..27
            [/set_variable]
            [if]
                [variable]
                    name=change_terrain
                    less_than=4
                [/variable]
                [then]
                    [terrain]
                         x,y=$ice_hex[$i].x,$ice_hex[$i].y
                        terrain=Woby^Edt
                    [/terrain]
                [/then]
            [/if]
            [if]
                [variable]
                    name=change_terrain
                    numerical_equals=5
                [/variable]
                [then]
                    [terrain]
                         x,y=$ice_hex[$i].x,$ice_hex[$i].y
                        terrain=Woby^Edb
                    [/terrain]
                [/then]
            [/if]
            {CLEAR_VARIABLE change_terrain}
        [/do]
    [/for]
    {CLEAR_VARIABLE ice_hex}
    [store_locations]
        variable=ice_hex
        terrain=Ai,Aa
        [filter_adjacent_location]
            terrain=Woby^Edt,Woby^Edb
        [/filter_adjacent_location]
    [/store_locations]
    [for]
        array=ice_hex
        [do]
            [set_variable]
                name=change_terrain
                rand=1..23
            [/set_variable]
            [if]
                [variable]
                    name=change_terrain
                    less_than=4
                [/variable]
                [then]
                    [terrain]
                         x,y=$ice_hex[$i].x,$ice_hex[$i].y
                        terrain=Woby^Edt
                    [/terrain]
                [/then]
            [/if]
            [if]
                [variable]
                    name=change_terrain
                    numerical_equals=4
                [/variable]
                [then]
                    [terrain]
                         x,y=$ice_hex[$i].x,$ice_hex[$i].y
                        terrain=Woby^Edb
                    [/terrain]
                [/then]
            [/if]
            {CLEAR_VARIABLE change_terrain}
        [/do]
    [/for]
    {CLEAR_VARIABLE ice_hex}
    [store_locations]
        variable=hill_hex
        terrain=Uh
    [/store_locations]
    [for]
        array=hill_hex
        [do]
            [set_variable]
                name=change_terrain
                rand=1..15
            [/set_variable]
            [if]
                [variable]
                    name=change_terrain
                    less_than=3
                [/variable]
                [then]
                    [terrain]
                         x,y=$hill_hex[$i].x,$hill_hex[$i].y
                        terrain=Uh^Edt
                    [/terrain]
                [/then]
            [/if]
            [if]
                [variable]
                    name=change_terrain
                    numerical_equals=3
                [/variable]
                [then]
                    [terrain]
                         x,y=$hill_hex[$i].x,$hill_hex[$i].y
                        terrain=Uh^Edb
                    [/terrain]
                [/then]
            [/if]
            {CLEAR_VARIABLE change_terrain}
        [/do]
    [/for]
    {CLEAR_VARIABLE hill_hex}
    [store_locations]
        variable=hill_hex
        terrain=Uh
        [filter_adjacent_location]
            terrain=Woby^Edt,Woby^Edb,Uh^Edt,Uh^Edb
        [/filter_adjacent_location]
    [/store_locations]
    [for]
        array=hill_hex
        [do]
            [set_variable]
                name=change_terrain
                rand=1..7
            [/set_variable]
            [if]
                [variable]
                    name=change_terrain
                    less_than=4
                [/variable]
                [then]
                    [terrain]
                         x,y=$hill_hex[$i].x,$hill_hex[$i].y
                        terrain=Uh^Edt
                    [/terrain]
                [/then]
            [/if]
            [if]
                [variable]
                    name=change_terrain
                    numerical_equals=4
                [/variable]
                [then]
                    [terrain]
                         x,y=$hill_hex[$i].x,$hill_hex[$i].y
                        terrain=Uh^Edb
                    [/terrain]
                [/then]
            [/if]
            {CLEAR_VARIABLE change_terrain}
        [/do]
    [/for]
    {CLEAR_VARIABLE hill_hex}
#enddef
#define SWAP_TO_FOREST
    [store_locations]
        variable=ice_hex
        terrain=Woby^Edt
    [/store_locations]
    [for]
        array=ice_hex
        [do]
            [terrain]
                x,y=$ice_hex[$i].x,$ice_hex[$i].y
                terrain=Aa^Fpa
            [/terrain]
        [/do]
    [/for]
    {CLEAR_VARIABLE ice_hex}
    [store_locations]
        variable=ice_hex
        terrain=Woby^Edb
    [/store_locations]
    [for]
        array=ice_hex
        [do]
            [terrain]
                x,y=$ice_hex[$i].x,$ice_hex[$i].y
                terrain=Aa^Fma
            [/terrain]
        [/do]
    [/for]
    {CLEAR_VARIABLE ice_hex}
    [store_locations]
        variable=ice_hex
        terrain=Uh^Edb
    [/store_locations]
    [for]
        array=ice_hex
        [do]
            [terrain]
                x,y=$ice_hex[$i].x,$ice_hex[$i].y
                terrain=Ha^Fma
            [/terrain]
        [/do]
    [/for]
    {CLEAR_VARIABLE ice_hex}
    [store_locations]
        variable=ice_hex
        terrain=Uh^Edt
    [/store_locations]
    [for]
        array=ice_hex
        [do]
            [terrain]
                x,y=$ice_hex[$i].x,$ice_hex[$i].y
                terrain=Ha^Fpa
            [/terrain]
        [/do]
    [/for]
    {CLEAR_VARIABLE ice_hex}
#enddef
#define SWAP_TO_REMAINS
    [store_locations]
        variable=ice_hex
        terrain=Aa^Fpa
    [/store_locations]
    [for]
        array=ice_hex
        [do]
            [terrain]
                x,y=$ice_hex[$i].x,$ice_hex[$i].y
                terrain=Woby^Edt
            [/terrain]
        [/do]
    [/for]
    {CLEAR_VARIABLE ice_hex}
    [store_locations]
        variable=ice_hex
        terrain=Aa^Fma
    [/store_locations]
    [for]
        array=ice_hex
        [do]
            [terrain]
                x,y=$ice_hex[$i].x,$ice_hex[$i].y
                terrain=Woby^Edb
            [/terrain]
        [/do]
    [/for]
    {CLEAR_VARIABLE ice_hex}
    [store_locations]
        variable=ice_hex
        terrain=Ha^Fma
    [/store_locations]
    [for]
        array=ice_hex
        [do]
            [terrain]
                x,y=$ice_hex[$i].x,$ice_hex[$i].y
                terrain=Uh^Edb
            [/terrain]
        [/do]
    [/for]
    {CLEAR_VARIABLE ice_hex}
    [store_locations]
        variable=ice_hex
        terrain=Ha^Fpa
    [/store_locations]
    [for]
        array=ice_hex
        [do]
            [terrain]
                x,y=$ice_hex[$i].x,$ice_hex[$i].y
                terrain=Uh^Edt
            [/terrain]
        [/do]
    [/for]
    {CLEAR_VARIABLE ice_hex}
#enddef

#define GENERATE_SNOW
    [store_locations]
        variable=ice_hex
        terrain=Ai
    [/store_locations]
    [for]
        array=ice_hex
        [do]
            [set_variable]
                name=change_terrain
                rand=1..11
            [/set_variable]
            [if]
                [variable]
                    name=change_terrain
                    numerical_equals=1
                [/variable]
                [then]
                    [terrain]
                         x,y=$ice_hex[$i].x,$ice_hex[$i].y
                        terrain=Wwb
                    [/terrain]
                [/then]
            [/if]
            {CLEAR_VARIABLE change_terrain}
        [/do]
    [/for]
    {CLEAR_VARIABLE ice_hex}
    [store_locations]
        variable=ice_hex
        terrain=Ai
        [filter_adjacent_location]
            terrain=Wwb
        [/filter_adjacent_location]
    [/store_locations]
    [for]
        array=ice_hex
        [do]
            [set_variable]
                name=change_terrain
                rand=1..3
            [/set_variable]
            [if]
                [variable]
                    name=change_terrain
                    numerical_equals=1
                [/variable]
                [then]
                    [terrain]
                         x,y=$ice_hex[$i].x,$ice_hex[$i].y
                        terrain=Wwb
                    [/terrain]
                [/then]
            [/if]
            {CLEAR_VARIABLE change_terrain}
        [/do]
    [/for]
    {CLEAR_VARIABLE ice_hex}
#enddef
#define SWAP_TO_SNOW
    [store_locations]
        variable=ice_hex
        terrain=Wwb
    [/store_locations]
    [for]
        array=ice_hex
        [do]
            [terrain]
                x,y=$ice_hex[$i].x,$ice_hex[$i].y
                terrain=Aa
            [/terrain]
        [/do]
    [/for]
    {CLEAR_VARIABLE ice_hex}
#enddef
#define SWAP_TO_BLOOD
    [store_locations]
        variable=ice_hex
        terrain=Aa
    [/store_locations]
    [for]
        array=ice_hex
        [do]
            [terrain]
                x,y=$ice_hex[$i].x,$ice_hex[$i].y
                terrain=Wwb
            [/terrain]
        [/do]
    [/for]
    {CLEAR_VARIABLE ice_hex}
#enddef
#define SWAP_TO_ICE
    [store_locations]
        variable=ice_hex
        terrain=Woby
    [/store_locations]
    [for]
        array=ice_hex
        [do]
            [terrain]
                x,y=$ice_hex[$i].x,$ice_hex[$i].y
                terrain=Ai
            [/terrain]
        [/do]
    [/for]
    {CLEAR_VARIABLE ice_hex}
#enddef
#define SWAP_TO_WATER
    [store_locations]
        variable=ice_hex
        terrain=Ai
    [/store_locations]
    [for]
        array=ice_hex
        [do]
            [terrain]
                x,y=$ice_hex[$i].x,$ice_hex[$i].y
                terrain=Woby
            [/terrain]
        [/do]
    [/for]
    {CLEAR_VARIABLE ice_hex}
#enddef
#define REGENERATE_TERRAIN
    [store_locations]
        variable=ice_hex
        [not]
            terrain=Qxu,Qxua,Xue,Gg
        [/not]
        [filter_adjacent_location]
            terrain=Xu,Xue
        [/filter_adjacent_location]
        [and]
            [filter_adjacent_location]
                [filter]
                    side=1
                    id=Yumi
                [/filter]
                radius=11
            [/filter_adjacent_location]
        [/and]
    [/store_locations]
    [for]
        array=ice_hex
        [do]
            [set_variable]
                name=change_terrain
                rand=1..20
            [/set_variable]
            [if]
                [variable]
                    name=change_terrain
                    less_than=6
                [/variable]
                [then]
                    [terrain]
                         x,y=$ice_hex[$i].x,$ice_hex[$i].y
                        terrain=Xu
                    [/terrain]
                [/then]
            [/if]
            {CLEAR_VARIABLE change_terrain}
        [/do]
    [/for]
    {CLEAR_VARIABLE ice_hex}
    [store_locations]
        variable=ice_hex
        [not]
            terrain=Qxu,Qxua,Xue,Gg
        [/not]
        [filter_adjacent_location]
            terrain=Xu,Uh
        [/filter_adjacent_location]
        [and]
            [filter_adjacent_location]
                [filter]
                    side=1
                    id=Yumi
                [/filter]
                radius=11
            [/filter_adjacent_location]
        [/and]
    [/store_locations]
    [for]
        array=ice_hex
        [do]
            [set_variable]
                name=change_terrain
                rand=1..20
            [/set_variable]
            [if]
                [variable]
                    name=change_terrain
                    less_than=4
                [/variable]
                [then]
                    [terrain]
                         x,y=$ice_hex[$i].x,$ice_hex[$i].y
                        terrain=Uh
                    [/terrain]
                [/then]
            [/if]
            {CLEAR_VARIABLE change_terrain}
        [/do]
    [/for]
    {CLEAR_VARIABLE ice_hex}

    [store_locations]
        variable=ice_hex
        [not]
            terrain=Qxu,Qxua,Xue,Gg
        [/not]
        [filter_adjacent_location]
            terrain=Woby^Edt,Woby^Edb
        [/filter_adjacent_location]
        [and]
            [filter_adjacent_location]
                [filter]
                    side=1
                    id=Yumi
                [/filter]
                radius=11
            [/filter_adjacent_location]
        [/and]
    [/store_locations]
    [for]
        array=ice_hex
        [do]
            [set_variable]
                name=change_terrain
                rand=1..25
            [/set_variable]
            [if]
                [variable]
                    name=change_terrain
                    less_than=4
                [/variable]
                [then]
                    [terrain]
                         x,y=$ice_hex[$i].x,$ice_hex[$i].y
                        terrain=Woby^Edt
                    [/terrain]
                [/then]
            [/if]
            [if]
                [variable]
                    name=change_terrain
                    numerical_equals=4
                [/variable]
                [then]
                    [terrain]
                         x,y=$ice_hex[$i].x,$ice_hex[$i].y
                        terrain=Woby^Edb
                    [/terrain]
                [/then]
            [/if]
            {CLEAR_VARIABLE change_terrain}
        [/do]
    [/for]
    {CLEAR_VARIABLE ice_hex}
    [store_locations]
        variable=hill_hex
        terrain=Uh
        [and]
            [filter_adjacent_location]
                [filter]
                    side=1
                    id=Yumi
                [/filter]
                radius=11
            [/filter_adjacent_location]
        [/and]
    [/store_locations]
    [for]
        array=hill_hex
        [do]
            [set_variable]
                name=change_terrain
                rand=1..20
            [/set_variable]
            [if]
                [variable]
                    name=change_terrain
                    less_than=3
                [/variable]
                [then]
                    [terrain]
                         x,y=$hill_hex[$i].x,$hill_hex[$i].y
                        terrain=Uh^Edt
                    [/terrain]
                [/then]
            [/if]
            [if]
                [variable]
                    name=change_terrain
                    numerical_equals=3
                [/variable]
                [then]
                    [terrain]
                         x,y=$hill_hex[$i].x,$hill_hex[$i].y
                        terrain=Uh^Edb
                    [/terrain]
                [/then]
            [/if]
            {CLEAR_VARIABLE change_terrain}
        [/do]
    [/for]
    {CLEAR_VARIABLE hill_hex}
    [store_locations]
        variable=hill_hex
        terrain=Uh
        [filter_adjacent_location]
            terrain=Woby^Edt,Woby^Edb,Uh^Edt,Uh^Edb
        [/filter_adjacent_location]
        [and]
            [filter_adjacent_location]
                [filter]
                    side=1
                    id=Yumi
                [/filter]
                radius=11
            [/filter_adjacent_location]
        [/and]
    [/store_locations]
    [for]
        array=hill_hex
        [do]
            [set_variable]
                name=change_terrain
                rand=1..10
            [/set_variable]
            [if]
                [variable]
                    name=change_terrain
                    less_than=4
                [/variable]
                [then]
                    [terrain]
                         x,y=$hill_hex[$i].x,$hill_hex[$i].y
                        terrain=Uh^Edt
                    [/terrain]
                [/then]
            [/if]
            [if]
                [variable]
                    name=change_terrain
                    numerical_equals=4
                [/variable]
                [then]
                    [terrain]
                         x,y=$hill_hex[$i].x,$hill_hex[$i].y
                        terrain=Uh^Edb
                    [/terrain]
                [/then]
            [/if]
            {CLEAR_VARIABLE change_terrain}
        [/do]
    [/for]
    {CLEAR_VARIABLE hill_hex}
    [store_locations]
        variable=ice_hex
        [not]
            terrain=Qxu,Qxua,Xue,Gg
        [/not]
        [filter_adjacent_location]
            terrain=Woby
        [/filter_adjacent_location]
        [and]
            [filter_adjacent_location]
                [filter]
                    side=1
                    id=Yumi
                [/filter]
                radius=11
            [/filter_adjacent_location]
        [/and]
    [/store_locations]
    [for]
        array=ice_hex
        [do]
            [set_variable]
                name=change_terrain
                rand=1..10
            [/set_variable]
            [if]
                [variable]
                    name=change_terrain
                    numerical_equals=1
                [/variable]
                [then]
                    [terrain]
                         x,y=$ice_hex[$i].x,$ice_hex[$i].y
                        terrain=Woby
                    [/terrain]
                [/then]
            [/if]
            {CLEAR_VARIABLE change_terrain}
        [/do]
    [/for]
    {CLEAR_VARIABLE ice_hex}
    [store_locations]
        variable=ice_hex
        [not]
            terrain=Qxu,Qxua,Xue,Gg
        [/not]
        [filter_adjacent_location]
            terrain=Wwb
        [/filter_adjacent_location]
        [and]
            [filter_adjacent_location]
                [filter]
                    side=1
                    id=Yumi
                [/filter]
                radius=11
            [/filter_adjacent_location]
        [/and]
    [/store_locations]
    [for]
        array=ice_hex
        [do]
            [set_variable]
                name=change_terrain
                rand=1..10
            [/set_variable]
            [if]
                [variable]
                    name=change_terrain
                    numerical_equals=1
                [/variable]
                [then]
                    [terrain]
                         x,y=$ice_hex[$i].x,$ice_hex[$i].y
                        terrain=Wwb
                    [/terrain]
                [/then]
            [/if]
            {CLEAR_VARIABLE change_terrain}
        [/do]
    [/for]
    {CLEAR_VARIABLE ice_hex}
#enddef

#define DRAW_VOID
        [store_locations]
            variable=blood_hex
            [and]
                [not]
                    terrain=Mm^Xm,Qxua
                [/not]
            [/and]
            [and]
                [filter_adjacent_location]
                    terrain=Qxua,Qxu
                    count=1-3
                [/filter_adjacent_location]
            [/and]
        [/store_locations]
        [for]
            array=blood_hex
            [do]
                [set_variable]
                    name=change_terrain
                    rand=1..20
                [/set_variable]
                [if]
                    [variable]
                        name=change_terrain
                        less_than=6
                    [/variable]
                    [then]
                        [terrain]
                             x,y=$blood_hex[$i].x,$blood_hex[$i].y
                            terrain=Qxu
                        [/terrain]
                    [/then]
                [/if]
                {CLEAR_VARIABLE change_terrain}
            [/do]
        [/for]
        {CLEAR_VARIABLE blood_hex}
        [store_locations]
            variable=blood_hex
            [and]
                [not]
                    terrain=Mm^Xm,Qxua
                [/not]
            [/and]
            [and]
                [filter_adjacent_location]
                    terrain=Qxua,Qxu
                    count=4-6
                [/filter_adjacent_location]
            [/and]
        [/store_locations]
        [for]
            array=blood_hex
            [do]
                [set_variable]
                    name=change_terrain
                    rand=1..40
                [/set_variable]
                [if]
                    [variable]
                        name=change_terrain
                        less_than=6
                    [/variable]
                    [then]
                        [terrain]
                            x,y=$blood_hex[$i].x,$blood_hex[$i].y
                            terrain=Qxu
                        [/terrain]
                    [/then]
                [/if]
                {CLEAR_VARIABLE change_terrain}
            [/do]
        [/for]
        {CLEAR_VARIABLE blood_hex}
        [redraw][/redraw]
#enddef

    # regenerate the terrain
    [event]
        name=new turn
        first_time_only=no

        {REGENERATE_TERRAIN}
        [if]
            [variable]
                name=aryel_spawns
                numerical_equals=1
            [/variable]
            [then]
                {DRAW_VOID}
            [/then]
        [/if]
    [/event]

    [event]
        name=prestart

        {FADE_SCREEN}
        {GENERATE_MOUNTAIN}
        {GENERATE_SNOW}
        {GENERATE_MOUNTAIN}
        {GENERATE_HILL}
        {GENERATE_SNOW}
        {GENERATE_HILL}
        {GENERATE_FOREST}
        {GENERATE_FOREST}
        {SWAP_TO_WATER}

        [unstore_unit]
            variable=yumi_tmp
            find_vacant=yes
            x,y=23,4
        [/unstore_unit]

        {CLEAR_VARIABLE yumi_tmp}

        [modify_unit]
            [filter]
                id=Yumi
            [/filter]
            vision=8
        [/modify_unit]

        [if]
            [have_unit]
                id=Yumi
                ability=clairvoyance
            [/have_unit]
            [then]
                [set_variable]
                    name=inc_moves
                    value=0
                [/set_variable]
            [/then]
            [else]
                [modify_unit]
                    [filter]
                        id=Yumi
                    [/filter]
                    max_moves=8
                [/modify_unit]
                [set_variable]
                    name=inc_moves
                    value=1
                [/set_variable]
            [/else]
        [/if]

        [heal_unit]
            [filter]
                id=Yumi
            [/filter]
            amount=full
            moves=full
        [/heal_unit]

        [store_unit]
            [filter]
                id=Esther
            [/filter]
            variable=esther_tmp
        [/store_unit]
        [kill]
            id=Esther
        [/kill]
        [set_variable]
            name=turn_count
            value=0
        [/set_variable]
        [set_variable]
            name=yumi_spawns
            value=0
        [/set_variable]
        [set_variable]
            name=aryel_spawns
            value=0
        [/set_variable]

        [store_locations]
            x=23,21,21,25,25,23
            y=137,138,139,138,139,140
            variable=sound_hex
        [/store_locations]
        # recruiting code for this scenario
        [set_menu_item]
            id=recruit_manifestation
            description= _ "Recruit Manifestation"
            image="attacks/wail.png~SCALE(18,18)"
            [show_if]
                [variable]
                    name=side_number
                    numerical_equals=1
                [/variable]
            [/show_if]
            [filter_location]
                [not]
                    [filter][/filter]
                [/not]
                [filter_adjacent_location]
                    [filter]
                        side=1
                        id=Yumi
                    [/filter]
                [/filter_adjacent_location]
            [/filter_location]
            [command]
                [store_gold]
                    [filter_side]
                        side=1
                    [/filter_side]
                    variable=side1gold
                [/store_gold]
                [if]
                    [variable]
                        name=side1gold
                        less_than=5
                    [/variable]
                    [then]
                        {MESSAGE_NOT_ENOUGH_GOLD}
                    [/then]
                    [else]
                        [unit]
                            side=1
                            type=Manifestation2
                            x,y=$x1,$y1
                            moves,attacks_left=0,0
                            animate=yes
                            upkeep=free
                            [modifications]
                                {TRAIT_LOYAL}
                            [/modifications]
                        [/unit]
                        [redraw]
                            side=1
                            clear_shroud=yes
                        [/redraw]
                        {VARIABLE_OP side1gold sub 5}
                        [modify_side]
                            side=1
                            gold=$side1gold
                        [/modify_side]
                        [store_unit]
                            [filter]
                                id=Yumi
                            [/filter]
                            variable=yumi_tmp
                        [/store_unit]
                        {VARIABLE_OP yumi_tmp.moves sub 1}
                        [unstore_unit]
                            variable=yumi_tmp
                        [/unstore_unit]
                        {CLEAR_VARIABLE yumi_tmp}
                        {CLEAR_VARIABLE side1gold}
                    [/else]
                [/if]
            [/command]
        [/set_menu_item]
        [set_menu_item]
            id=recruit_ethereal_warden
            description= _ "Recruit Ethereal Warden"
            image="attacks/wail.png~SCALE(18,18)"
            [show_if]
                [variable]
                    name=side_number
                    numerical_equals=1
                [/variable]
            [/show_if]
            [filter_location]
                [not]
                    [filter][/filter]
                [/not]
                [filter_adjacent_location]
                    [filter]
                        side=1
                        id=Yumi
                    [/filter]
                [/filter_adjacent_location]
            [/filter_location]
            [command]
                [store_gold]
                    [filter_side]
                        side=1
                    [/filter_side]
                    variable=side1gold
                [/store_gold]
                [if]
                    [variable]
                        name=side1gold
                        less_than=5
                    [/variable]
                    [then]
                        {MESSAGE_NOT_ENOUGH_GOLD}
                    [/then]
                    [else]
                        [unit]
                            side=1
                            type=Ethereal Warden
                            x,y=$x1,$y1
                            moves,attacks_left=0,0
                            animate=yes
                            upkeep=free
                            [modifications]
                                {TRAIT_LOYAL}
                            [/modifications]
                        [/unit]
                        [redraw]
                            side=1
                            clear_shroud=yes
                        [/redraw]
                        {VARIABLE_OP side1gold sub 5}
                        [modify_side]
                            side=1
                            gold=$side1gold
                        [/modify_side]
                        [store_unit]
                            [filter]
                                id=Yumi
                            [/filter]
                            variable=yumi_tmp
                        [/store_unit]
                        {VARIABLE_OP yumi_tmp.moves sub 1}
                        [unstore_unit]
                            variable=yumi_tmp
                        [/unstore_unit]
                        {CLEAR_VARIABLE yumi_tmp}
                        {CLEAR_VARIABLE side1gold}
                    [/else]
                [/if]
            [/command]
        [/set_menu_item]
        [set_menu_item]
            id=recruit_black_spirit
            description= _ "Recruit Black Spirit"
            image="attacks/wail.png~SCALE(18,18)"
            [show_if]
                [variable]
                    name=side_number
                    numerical_equals=1
                [/variable]
            [/show_if]
            [filter_location]
                [not]
                    [filter][/filter]
                [/not]
                [filter_adjacent_location]
                    [filter]
                        side=1
                        id=Yumi
                    [/filter]
                [/filter_adjacent_location]
            [/filter_location]
            [command]
                [store_gold]
                    [filter_side]
                        side=1
                    [/filter_side]
                    variable=side1gold
                [/store_gold]
                [if]
                    [variable]
                        name=side1gold
                        less_than=5
                    [/variable]
                    [then]
                        {MESSAGE_NOT_ENOUGH_GOLD}
                    [/then]
                    [else]
                        [unit]
                            side=1
                            type=Black Spirit
                            x,y=$x1,$y1
                            moves,attacks_left=0,0
                            animate=yes
                            upkeep=free
                            [modifications]
                                {TRAIT_LOYAL}
                            [/modifications]
                        [/unit]
                        [redraw]
                            side=1
                            clear_shroud=yes
                        [/redraw]
                        {VARIABLE_OP side1gold sub 5}
                        [modify_side]
                            side=1
                            gold=$side1gold
                        [/modify_side]
                        [store_unit]
                            [filter]
                                id=Yumi
                            [/filter]
                            variable=yumi_tmp
                        [/store_unit]
                        {VARIABLE_OP yumi_tmp.moves sub 1}
                        [unstore_unit]
                            variable=yumi_tmp
                        [/unstore_unit]
                        {CLEAR_VARIABLE yumi_tmp}
                        {CLEAR_VARIABLE side1gold}
                    [/else]
                [/if]
            [/command]
        [/set_menu_item]
        # yumi abilities
        [set_menu_item]
            id=consume_ghost
            description= _ "Consume Ethereal Warden"
            image="attacks/faerie-fire.png~SCALE(18,18)"
            [show_if]
                [variable]
                    name=side_number
                    numerical_equals=1
                [/variable]
            [/show_if]
            [filter_location]
                [filter]
                    side=1
                    type=Ethereal Warden
                [/filter]
                [filter_adjacent_location]
                    [filter]
                        side=1
                        id=Yumi
                    [/filter]
                    radius=3
                [/filter_adjacent_location]
            [/filter_location]
            [command]
                [kill]
                    x,y=$x1,$y1
                    animate=yes
                [/kill]
                [heal_unit]
                    [filter]
                        id=Yumi
                    [/filter]
                    amount=6
                    animate=yes
                [/heal_unit]
            [/command]
        [/set_menu_item]
        [set_menu_item]
            id=destroy_hex
            description= _ "Annul"
            image="attacks/dark-missile.png~SCALE(18,18)"
            [show_if]
                [variable]
                    name=side_number
                    numerical_equals=1
                [/variable]
            [/show_if]
            [filter_location]
                [filter]
                    side=2
                [/filter]
                [filter_adjacent_location]
                    [filter]
                        side=1
                        id=Yumi
                    [/filter]
                    radius=5
                [/filter_adjacent_location]
            [/filter_location]
            [command]
                [store_unit]
                    [filter]
                        id=Yumi
                    [/filter]
                    variable=yumi_tmp
                [/store_unit]
                [if]
                    [variable]
                        name=yumi_tmp.hitpoints
                        less_than=9
                    [/variable]
                    [then]
                        [message]
                            speaker=narrator
                            message= _ "Yumi is not healthy enough to cast this spell."
                        [/message]
                    [/then]
                    [else]
                        {PLAY_SOUND "magic-dark-big.ogg"}
                        [terrain]
                            x,y=$x1,$y1
                            terrain=Qxu
                        [/terrain]
                        [redraw][/redraw]
                        [kill]
                            x,y=$x1,$y1
                            animate=yes
                        [/kill]
                        {VARIABLE_OP yumi_tmp.experience add 16}
                        [unstore_unit]
                            variable=yumi_tmp
                            find_vacant=no
                            advance=yes
                            fire_event=yes
                        [/unstore_unit]
                        [harm_unit]
                            [filter]
                                id=Yumi
                            [/filter]
                            amount=9
                            kill=no
                        [/harm_unit]
                    [/else]
                [/if]
                {CLEAR_VARIABLE yumi_tmp}
            [/command]
        [/set_menu_item]

        # aryel ability
        [set_menu_item]
            id=possess_ghost
            description= _ "Possess"
            image="attacks/dark-missile.png~SCALE(18,18)"
            [show_if]
                [variable]
                    name=side_number
                    numerical_equals=1
                [/variable]
            [/show_if]
            [filter_location]
                [filter]
                    side=2
                [/filter]
                [filter_adjacent_location]
                    [filter]
                        side=1
                        id=Aryel
                    [/filter]
                    radius=3
                [/filter_adjacent_location]
            [/filter_location]
            [command]
                [store_unit]
                    [filter]
                        id=Aryel
                    [/filter]
                    variable=aryel_tmp
                [/store_unit]
                [if]
                    [variable]
                        name=aryel_tmp.hitpoints
                        less_than=9
                    [/variable]
                    [then]
                        [message]
                            speaker=narrator
                            message= _ "Aryel is not healthy enough to cast this spell."
                        [/message]
                    [/then]
                    [else]
                        {PLAY_SOUND "magic-faeriefire.ogg"}
                        [harm_unit]
                            [filter]
                                id=Aryel
                            [/filter]
                            amount=9
                            kill=no
                        [/harm_unit]
                        [modify_unit]
                            [filter]
                                x,y=$x1,$y1
                            [/filter]
                            side=1
                            attacks_left=1
                            moves=7
                        [/modify_unit]
                    [/else]
                [/if]
                {CLEAR_VARIABLE aryel_tmp}
            [/command]
        [/set_menu_item]

        [sound_source]
            id=s15dark1
            x=14
            y=14
            sounds="dark-2.ogg"
            full_range=1000
            delay=0
            loop=-1
            check_fogged=no
            check_shrouded=no
        [/sound_source]
    [/event]

    [event]
        name=start

        {UNFADE_SCREEN}
        {DELAY 750}
        [message]
            speaker=Yumi
            message= _ "(<i>gasps</i>)"
        [/message]
        {DELAY 300}

        [harm_unit]
            [filter]
                id=Yumi
            [/filter]
            amount=0
            animate=yes
        [/harm_unit]
        {DELAY 100}
        [harm_unit]
            [filter]
                id=Yumi
            [/filter]
            amount=1
            animate=yes
        [/harm_unit]
        {DELAY 750}
        [message]
            speaker=Yumi
            message= _ "(<i>looks up</i>)"
        [/message]
        [message]
            speaker=Yumi
            message= _ "<i>They're coming.</i>"
        [/message]
        {DELAY 1500}
        [message]
            speaker=Yumi
            message= _ "<i>Aryel...</i>"
        [/message]
        [message]
            speaker=Yumi
            message= _ "<i>... where did she go?</i>"
        [/message]
        [message]
            speaker=Yumi
            message= _ "<i>Aryel?</i>"
        [/message]
        {DELAY 750}
        [message]
            speaker=Yumi
            message= _ "<i>I hope she's okay...</i>"
        [/message]

        {DELAY 150}
        [harm_unit]
            [filter]
                id=Yumi
            [/filter]
            amount=1
            animate=yes
        [/harm_unit]
        {DELAY 100}
        [harm_unit]
            [filter]
                id=Yumi
            [/filter]
            amount=0
            animate=yes
        [/harm_unit]
        {DELAY 350}
        [message]
            speaker=Yumi
            message= _ "<i>They're getting closer. I can't stay... but Aryel's still back there! I can't just leave her.</i>"
        [/message]
        [message]
            speaker=Yumi
            message= _ "<i>What do I do?</i>"
        [/message]
        {DELAY 500}
        [harm_unit]
            [filter]
                id=Yumi
            [/filter]
            amount=0
            animate=yes
        [/harm_unit]
        {DELAY 500}
        [message]
            speaker=Yumi
            message= _ "<i>Ugh. Well, I can't just stand here. I can't let them catch me.</i>"
        [/message]

        [objectives]
            {OBJECTIVE_VICTORY  ( _ "Escape to the south")}
            {OBJECTIVE_DEFEAT  ( _ "Death of Yumi")}
            {OBJECTIVE_NOTE ( _ "You may recruit by right clicking on a hex next to Yumi.")}
            {OBJECTIVE_NOTE ( _ "Yumi can regain hitpoints by sacrificing ethereal wardens.")}
            {OBJECTIVE_NOTE ( _ "Yumi can destroy nearby hexes and any units on them at the cost of 9 hp.")}
        [/objectives]
    [/event]

    [event]
        name=new turn
        first_time_only=no
        [filter_condition]
            [variable]
                name=turn_count
                numerical_greater_than=0
            [/variable]
        [/filter_condition]
        {VARIABLE_OP turn_count add 1}
    [/event]

    # swap to Aryel
    [event]
        name=turn end
        first_time_only=no
        [filter_condition]
            [variable]
                name=turn_count
                numerical_equals=5
            [/variable]
        [/filter_condition]

        {FADE_SCREEN}
        {SWAP_TO_HILL}
        {SWAP_TO_FOREST}
        {SWAP_TO_ICE}
        {SWAP_TO_MOUNTAIN}
        {SWAP_TO_SNOW}
        [store_unit]
            [filter]
                side=1
            [/filter]
            variable=yumi_units
            kill=yes
        [/store_unit]
        [store_unit]
            [filter]
                side=2
            [/filter]
            variable=yumi_enemies
            kill=yes
        [/store_unit]
        [set_variable]
            name=aryel_spawns
            value=1
        [/set_variable]
        [set_variable]
            name=yumi_spawns
            value=0
        [/set_variable]
        [remove_sound_source]
            id=s15dark1
        [/remove_sound_source]
        [remove_sound_source]
            id=s15dark2
        [/remove_sound_source]
        [remove_sound_source]
            id=s15dark3
        [/remove_sound_source]
        [objectives]
            {OBJECTIVE_VICTORY  ( _ "Find Yumi")}
            {OBJECTIVE_DEFEAT  ( _ "Death of Aryel")}
            {OBJECTIVE_NOTE ( _ "Aryel can possess nearby enemies at the cost of 9 hp.")}
            silent=yes
        [/objectives]
    [/event]
    [event]
        name=side 1 turn
        first_time_only=no
        [filter_condition]
            [variable]
                name=turn_count
                numerical_equals=6
            [/variable]
        [/filter_condition]
        [for]
            array=aryel_units
            [do]
                [unstore_unit]
                    variable=aryel_units[$i]
                    find_vacant=yes
                [/unstore_unit]
            [/do]
        [/for]
        [for]
            array=aryel_enemies
            [do]
                [unstore_unit]
                    variable=aryel_enemies[$i]
                    find_vacant=yes
                [/unstore_unit]
            [/do]
        [/for]
        {UNFADE_SCREEN}
        [redraw]
            side=1
            clear_shroud=yes
        [/redraw]
    [/event]
    # swap to Yumi
    [event]
        name=turn end
        first_time_only=no
        [filter_condition]
            [variable]
                name=turn_count
                numerical_equals=10
            [/variable]
        [/filter_condition]

        {FADE_SCREEN}
        {SWAP_TO_CAVEHILL}
        {SWAP_TO_REMAINS}
        {SWAP_TO_WATER}
        {SWAP_TO_WALL}
        {SWAP_TO_BLOOD}
        [store_unit]
            [filter]
                side=1
            [/filter]
            variable=aryel_units
            kill=yes
        [/store_unit]
        [store_unit]
            [filter]
                side=2,3
            [/filter]
            variable=aryel_enemies
            kill=yes
        [/store_unit]
        [set_variable]
            name=aryel_spawns
            value=0
        [/set_variable]
        [set_variable]
            name=yumi_spawns
            value=1
        [/set_variable]
        [sound_source]
            id=s15dark1
            x=14
            y=14
            sounds="dark-2.ogg"
            full_range=1000
            delay=0
            loop=-1
            check_fogged=no
            check_shrouded=no
        [/sound_source]
        [sound_source]
            id=s15dark2
            x=15
            y=15
            sounds="dark-1.ogg"
            full_range=1000
            delay=0
            loop=-1
            check_fogged=no
            check_shrouded=no
        [/sound_source]
        [sound_source]
            id=s15dark3
            x=16
            y=16
            sounds="dark-3.ogg"
            full_range=1000
            delay=0
            loop=-1
            check_fogged=no
            check_shrouded=no
        [/sound_source]

        [objectives]
            {OBJECTIVE_VICTORY  ( _ "Escape to the south")}
            {OBJECTIVE_DEFEAT  ( _ "Death of Yumi")}
            {OBJECTIVE_NOTE ( _ "You may recruit by right clicking on a hex next to Yumi.")}
            {OBJECTIVE_NOTE ( _ "Yumi can regain hitpoints by sacrificing ethereal wardens.")}
            {OBJECTIVE_NOTE ( _ "Yumi can destroy nearby hexes and any units on them at the cost of 9 hp.")}
            silent=yes
        [/objectives]
    [/event]
    [event]
        name=side 1 turn
        first_time_only=no
        [filter_condition]
            [variable]
                name=turn_count
                numerical_equals=11
            [/variable]
        [/filter_condition]

        [for]
            array=yumi_units
            [do]
                [unstore_unit]
                    variable=yumi_units[$i]
                    find_vacant=yes
                [/unstore_unit]
            [/do]
        [/for]
        [for]
            array=yumi_enemies
            [do]
                [unstore_unit]
                    variable=yumi_enemies[$i]
                    find_vacant=yes
                [/unstore_unit]
            [/do]
        [/for]
        [redraw]
            side=1
            clear_shroud=yes
        [/redraw]
        [set_variable]
            name=turn_count
            value=1
        [/set_variable]
        {UNFADE_SCREEN}
    [/event]

    [event]
        name=side 1 turn 6

        [unstore_unit]
            variable=aryel_tmp
            find_vacant=yes
            x,y=23,4
        [/unstore_unit]
        [reset_fog]
            [filter_side]
                side=1
            [/filter_side]
        [/reset_fog]
        [redraw]
            side=1
            clear_shroud=yes
        [/redraw]
        {SCROLL_TO 23 4}
        {CLEAR_VARIABLE aryel_tmp}

        [heal_unit]
            [filter]
                id=Aryel
            [/filter]
            amount=full
            moves=full
        [/heal_unit]
        {DELAY 500}
        {TURN_UNIT5 "Aryel"}
        {DELAY 500}

        [message]
            speaker=Aryel
            message= _ "I swear I just heard her voice. Where is she?"
        [/message]
        [message]
            speaker=Aryel
            message= _ "..."
        [/message]
        [message]
            speaker=Aryel
            message= _ "Yumi? Hello? You there?"
        [/message]
        [message]
            speaker=Aryel
            message= _ "..."
        [/message]
        [message]
            speaker=Aryel
            message= _ "Looks like I have go search for her."
        [/message]
        [objectives]
            {OBJECTIVE_VICTORY  ( _ "Find Yumi")}
            {OBJECTIVE_DEFEAT  ( _ "Death of Aryel")}
            {OBJECTIVE_NOTE ( _ "Aryel can possess nearby enemies at the cost of 9 hp.")}
        [/objectives]
    [/event]

    [event]
        name=turn 1 end

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

    # yumi's spawns
    [event]
        name=new turn
        first_time_only=no
        [filter_condition]
            [variable]
                name=yumi_spawns
                numerical_equals=1
            [/variable]
        [/filter_condition]
        [store_unit]
            [filter]
                id=Yumi
            [/filter]
            variable=yumi_loc
        [/store_unit]
        [set_variable]
            name=yumi_loc2
            value=$yumi_loc.y
        [/set_variable]
        {VARIABLE_OP yumi_loc.y sub 12}
        {VARIABLE_OP yumi_loc2 add 15}
        [store_locations]
            variable=hex
            y=$yumi_loc.y-$yumi_loc2
            [not]
                terrain=Xu,Xue,Qxua
            [/not]
            [and]
                [filter_adjacent_location]
                    [filter]
                        side=1
                        id=Yumi
                    [/filter]
                    radius=14
                [/filter_adjacent_location]
            [/and]
            [and]
                [not]
                    [filter_adjacent_location]
                        [filter]
                            side=1
                            id=Yumi
                        [/filter]
                        radius=11
                    [/filter_adjacent_location]
                [/not]
            [/and]
            [and]
                [not]
                    [filter][/filter]
                [/not]
            [/and]
        [/store_locations]
        [for]
            array=hex
            [do]
                #ifdef HARD
                [set_variable]
                    name=spawn_val
                    rand=1..65
                [/set_variable]
                #endif
                #ifdef NORMAL
                [set_variable]
                    name=spawn_val
                    rand=1..100
                [/set_variable]
                #endif
                #ifdef EASY
                [set_variable]
                    name=spawn_val
                    rand=1..120
                [/set_variable]
                #endif
                [if]
                    [variable]
                        name=spawn_val
                        numerical_equals=4
                    [/variable]
                    [then]
                        {SPAWN_NOID_NONAME ("Demon Reaper") 2 $hex[$i].x $hex[$i].y}
                    [/then]
                [/if]
                {CLEAR_VARIABLE spawn_val}
            [/do]
        [/for]
        {CLEAR_VARIABLE hex}
        {CLEAR_VARIABLE yumi_loc}
        {CLEAR_VARIABLE yumi_loc2}
    [/event]

    # aryel's spawns
    [event]
        name=new turn
        first_time_only=no
        [filter_condition]
            [variable]
                name=aryel_spawns
                numerical_equals=1
            [/variable]
        [/filter_condition]
        [store_locations]
            variable=hex
            [not]
                terrain=Mm^Xm
            [/not]
            [and]
                [filter_adjacent_location]
                    [filter]
                        side=1
                        id=Aryel
                    [/filter]
                    radius=15
                [/filter_adjacent_location]
            [/and]
            [and]
                [not]
                    [filter_adjacent_location]
                        [filter]
                            side=1
                            id=Aryel
                        [/filter]
                        radius=10
                    [/filter_adjacent_location]
                [/not]
            [/and]
            [and]
                [not]
                    [filter][/filter]
                [/not]
            [/and]
        [/store_locations]
        [for]
            array=hex
            [do]
                #ifdef HARD
                [set_variable]
                    name=spawn_val
                    rand=1..550
                [/set_variable]
                #endif
                #ifdef NORMAL
                [set_variable]
                    name=spawn_val
                    rand=1..700
                [/set_variable]
                #endif
                #ifdef EASY
                [set_variable]
                    name=spawn_val
                    rand=1..850
                [/set_variable]
                #endif
                [if]
                    [variable]
                        name=spawn_val
                        numerical_equals=4
                    [/variable]
                    [then]
                        {SPAWN_NOID_NONAME ("Spectre") 2 $hex[$i].x $hex[$i].y}
                    [/then]
                [/if]
                [if]
                    [variable]
                        name=spawn_val
                        numerical_equals=3
                    [/variable]
                    [then]
                        {SPAWN_NOID_NONAME ("Wraith") 2 $hex[$i].x $hex[$i].y}
                    [/then]
                [/if]
                {CLEAR_VARIABLE spawn_val}
            [/do]
        [/for]
        {CLEAR_VARIABLE hex}
        [store_locations]
            variable=hex
            terrain=Qxu
        [/store_locations]
        [for]
            array=hex
            [do]
                #ifdef HARD
                [set_variable]
                    name=spawn_val
                    rand=1..100
                [/set_variable]
                #endif
                #ifdef NORMAL
                [set_variable]
                    name=spawn_val
                    rand=1..170
                [/set_variable]
                #endif
                #ifdef EASY
                [set_variable]
                    name=spawn_val
                    rand=1..200
                [/set_variable]
                #endif
                [if]
                    [variable]
                        name=spawn_val
                        numerical_equals=4
                    [/variable]
                    [then]
                        {SPAWN_NOID_NONAME ("Demon Void Stalker") 3 $hex[$i].x $hex[$i].y}
                    [/then]
                [/if]
                {CLEAR_VARIABLE spawn_val}
            [/do]
        [/for]
        {CLEAR_VARIABLE hex}
    [/event]

    [event]
        name=sighted
        first_time_only=yes
        [filter]
            side=2
        [/filter]
        [filter_second]
            side=1
            type=Manifestation2,Ethereal Warden,Shadow Fae
        [/filter_second]

        [message]
            speaker=Yumi
            message= _ "<i>They're here!</i>"
        [/message]
        [sound_source]
            id=s15dark2
            x=15
            y=15
            sounds="dark-1.ogg"
            full_range=1000
            delay=0
            loop=-1
            check_fogged=no
            check_shrouded=no
        [/sound_source]
        {DELAY 750}
        [message]
            speaker=Yumi
            message= _ "(<i>holds head</i>) <i>Their voices... it hurts...</i>"
        [/message]
        [message]
            speaker=Yumi
            message= _ "<i>I don't think I can fight them, but...</i>"
        [/message]
        {DELAY 500}
        [message]
            speaker=narrator
            message= _ "<i>You must flee!</i>"
        [/message]
        [message]
            speaker=Yumi
            message= _ "<i>But what about Aryel?</i>"
        [/message]
        [message]
            speaker=narrator
            message= _ "<i>You're no match for those things.</i>"
        [/message]
        {DELAY 750}
        [message]
            speaker=Yumi
            message= _ "<i>I know, but ah-</i>"
        [/message]
        {DELAY 750}
        [message]
            speaker=Yumi
            message= _ "<i>I don't care if they chase me. Just-</i>"
        [/message]
        [message]
            speaker=Yumi
            message= _ "<i>They're after me, right? So please, don't hurt Aryel...</i>"
        [/message]
        {DELAY 1500}
        [message]
            speaker=Yumi
            message= _ "<i>I have to run.</i>"
        [/message]
        [sound_source]
            id=s15dark3
            x=16
            y=16
            sounds="dark-3.ogg"
            full_range=1000
            delay=0
            loop=-1
            check_fogged=no
            check_shrouded=no
        [/sound_source]
    [/event]
    [event]
        name=attack
        first_time_only=yes
        [filter]
            side=2
        [/filter]
        [filter_second]
            id=Yumi
        [/filter_second]
        [message]
            speaker=Yumi
            message= _ "(<i>gasps</i>)"
        [/message]
        [message]
            speaker=Yumi
            message= _ "Stay away!"
        [/message]
        {PLAY_SOUND "magic-dark.ogg"}
        {DELAY 150}
        {PLAY_SOUND "magic-faeriefire.ogg"}
        [terrain]
            x,y=$x1,$y1
            terrain=Qxua
        [/terrain]
        [redraw][/redraw]
        {DELAY 500}
        [kill]
            x,y=$x1,$y1
            animate=yes
        [/kill]

        [message]
            speaker=Yumi
            message= _ "(<i>breathes heavily</i>)"
        [/message]
        [message]
            speaker=Yumi
            message= _ "(<i>shudders</i>)"
        [/message]
        [message]
            speaker=narrator
            message= _ "<i>Shh... shh... it's okay. There's no need to panic. Just focus on getting away from them.</i>"
        [/message]
    [/event]
    [event]
        name=sighted
        first_time_only=yes
        [filter]
            side=2
        [/filter]
        [filter_second]
            side=1
            type=Ghost,Blood Fae
        [/filter_second]

        [message]
            speaker=Aryel
            message= _ "That's weird, why are there spirits here?"
        [/message]
    [/event]
    [event]
        name=sighted
        first_time_only=yes
        [filter]
            side=3
        [/filter]
        [filter_second]
            side=1
        [/filter_second]

        [message]
            speaker=Aryel
            message= _ "What is that thing?"
        [/message]
    [/event]
    [event]
        name=die
        first_time_only=yes
        [filter]
            side=3
        [/filter]
        [message]
            speaker=Aryel
            message= _ "Somehow, I get the feeling that fighting these things isn't a good idea."
        [/message]
    [/event]

    [event]
        name=side 4 turn 5 end

        [message]
            speaker=Yumi
            message= _ "Aryel, where are you..?"
        [/message]
    [/event]
    [event]
        name=side 4 turn 10 end

        [message]
            speaker=Aryel
            message= _ "Where is she? I'm sure I can feel her nearby, but for some reason I can't find her. Hmm."
        [/message]
    [/event]
    [event]
        name=side 1 turn 11

        [message]
            speaker=Yumi
            message= _ "<i>More of them are coming. I can't stay.</i>"
        [/message]
    [/event]
    [event]
        name=side 4 turn 15 end

        [message]
            speaker=Yumi
            message= _ "I wish Aryel was here."
        [/message]
    [/event]
    [event]
        name=side 1 turn 16

        [message]
            speaker=Aryel
            message= _ "(<i>looks up</i>) She just called out for me. Yumi? Yumi, can you hear me?"
        [/message]
        [message]
            speaker=narrator
            message= _ "(<i>silence</i>)"
        [/message]
        [message]
            speaker=Aryel
            message= _ "Geez, why is this girl always so hard to find?"
        [/message]
    [/event]
    [event]
        name=side 4 turn 20 end

        [message]
            speaker=Aryel
            message= _ "She's getting farther away. She must be running from something. But I don't sense anything that could be a threat to her. What is she fleeing from?"
        [/message]
        [message]
            speaker=Aryel
            message= _ "She doesn't think I'm going to hurt her... does she?"
        [/message]
    [/event]
    [event]
        name=side 4 turn 25 end

        [message]
            speaker=Yumi
            message= _ "Aryel... please help..."
        [/message]
        [message]
            speaker=Yumi
            message= _ "(<i>whispers</i>) I don't want to be alone."
        [/message]
    [/event]
    [event]
        name=side 1 turn 26

        [message]
            speaker=Aryel
            message= _ "That was definitely her voice. She needs me. I'm coming, Yumi!"
        [/message]
    [/event]
    [event]
        name=side 4 turn 30 end

        [message]
            speaker=Aryel
            message= _ "Ugh. Her voice is gone again. I really hope she's okay. I just wonder why I can't find her."
        [/message]
    [/event]
    [event]
        name=side 1 turn 31

        [message]
            speaker=Yumi
            message= _ "(<i>looks up</i>) <i>That's Aryel! She's coming toward me. Or is she running from something?</i>"
        [/message]
        [message]
            speaker=Yumi
            message= _ "<i>Maybe if I wait a little, she'll catch up-</i>"
        [/message]
        [message]
            speaker=narrator
            message= _ "<i>You'll never make it. Those things will tear you to shreds.</i>"
        [/message]
        [message]
            speaker=Yumi
            message= _ "(<i>looks back</i>) <i>I guess... but what if they're after Aryel too?</i>"
        [/message]
        [message]
            speaker=narrator
            message= _ "(<i>silence</i>)"
        [/message]
        [message]
            speaker=Yumi
            message= _ "Hello?"
        [/message]
        {DELAY 750}
        [message]
            speaker=Yumi
            message= _ "(<i>frowns</i>)"
        [/message]
    [/event]
    [event]
        name=side 4 turn 35 end

        [message]
            speaker=Yumi
            message= _ "(<i>flutters wings</i>) <i>So tired...</i>"
        [/message]
    [/event]
    [event]
        name=side 1 turn 36

        [message]
            speaker=Aryel
            message= _ "(<i>jumps</i>) Huh? I thought I felt something brush against me. Something cold. Really, really cold."
        [/message]
    [/event]
    [event]
        name=side 4 turn 40 end

        [message]
            speaker=Aryel
            message= _ "Is it just me or has it gotten colder?"
        [/message]
    [/event]
    [event]
        name=side 1 turn 41

        [message]
            speaker=Yumi
            message= _ "<i>They just keep coming...</i>"
        [/message]
    [/event]

    [event]
        name=moveto
        first_time_only=yes
        [filter]
            side=1
            [filter_location]
                x,y=23,131
                radius=2
            [/filter_location]
            [and]
                id=Yumi
            [/and]
        [/filter]

        {FADE_SCREEN}

        [set_variable]
            name=turn_count
            value=-100
        [/set_variable]

        [store_unit]
            [filter]
                id=Yumi
            [/filter]
            variable=yumi_tmp
        [/store_unit]
        [kill]
            id=Yumi
        [/kill]

        {DELAY 750}

        {UNFADE_SCREEN}
        [redraw]
            side=1
            clear_shroud=yes
        [/redraw]
        [remove_shroud]
            side=1
            x,y=23,138
            radius=5
        [/remove_shroud]
        [lift_fog]
            [filter_side]
                side=1
            [/filter_side]
            x,y=23,138
            radius=5
            multiturn=no
        [/lift_fog]

        [unstore_unit]
            variable=yumi_tmp
            x,y=23,136
        [/unstore_unit]
        {CLEAR_VARIABLE yumi_tmp}
        [unhide_unit]
            [filter][/filter]
        [/unhide_unit]

        {SCROLL_TO 23 136}
        [sound_source]
            id=s15drum
            x=20
            y=20
            sounds="drums.ogg"
            full_range=1000
            delay=0
            loop=-1
            check_fogged=no
            check_shrouded=no
        [/sound_source]

        {PLACE_IMAGE items/crystal-glyph.png 23 135}
        {PLACE_IMAGE items/crystal-glyph-message.png 23 137}
        {PLACE_IMAGE items/crystal-glyph-message.png 21 138}
        {PLACE_IMAGE items/crystal-glyph-message.png 21 139}
        {PLACE_IMAGE items/crystal-glyph-message.png 25 138}
        {PLACE_IMAGE items/crystal-glyph-message.png 25 139}
        {PLACE_IMAGE items/crystal-glyph-message.png 23 140}

        # randomize puzzle

        [set_variable]
            name=swap1
            rand=0..2
        [/set_variable]
        [set_variable]
            name=swap2
            rand=3..5
        [/set_variable]
        [set_variable]
            name=x_tmp
            value=$sound_hex[$swap1].x
        [/set_variable]
        [set_variable]
            name=y_tmp
            value=$sound_hex[$swap1].y
        [/set_variable]
        [set_variable]
            name=sound_hex[$swap1].x
            value=$sound_hex[$swap2].x
        [/set_variable]
        [set_variable]
            name=sound_hex[$swap1].y
            value=$sound_hex[$swap2].y
        [/set_variable]
        [set_variable]
            name=sound_hex[$swap2].x
            value=$x_tmp
        [/set_variable]
        [set_variable]
            name=sound_hex[$swap2].y
            value=$y_tmp
        [/set_variable]

        [set_variable]
            name=swap1
            rand=0..2
        [/set_variable]
        [set_variable]
            name=swap2
            rand=3..5
        [/set_variable]
        [set_variable]
            name=x_tmp
            value=$sound_hex[$swap1].x
        [/set_variable]
        [set_variable]
            name=y_tmp
            value=$sound_hex[$swap1].y
        [/set_variable]
        [set_variable]
            name=sound_hex[$swap1].x
            value=$sound_hex[$swap2].x
        [/set_variable]
        [set_variable]
            name=sound_hex[$swap1].y
            value=$sound_hex[$swap2].y
        [/set_variable]
        [set_variable]
            name=sound_hex[$swap2].x
            value=$x_tmp
        [/set_variable]
        [set_variable]
            name=sound_hex[$swap2].y
            value=$y_tmp
        [/set_variable]

        [set_variable]
            name=swap1
            rand=0..2
        [/set_variable]
        [set_variable]
            name=swap2
            rand=3..5
        [/set_variable]
        [set_variable]
            name=x_tmp
            value=$sound_hex[$swap1].x
        [/set_variable]
        [set_variable]
            name=y_tmp
            value=$sound_hex[$swap1].y
        [/set_variable]
        [set_variable]
            name=sound_hex[$swap1].x
            value=$sound_hex[$swap2].x
        [/set_variable]
        [set_variable]
            name=sound_hex[$swap1].y
            value=$sound_hex[$swap2].y
        [/set_variable]
        [set_variable]
            name=sound_hex[$swap2].x
            value=$x_tmp
        [/set_variable]
        [set_variable]
            name=sound_hex[$swap2].y
            value=$y_tmp
        [/set_variable]

        [set_variable]
            name=swap1
            rand=0..2
        [/set_variable]
        [set_variable]
            name=swap2
            rand=3..5
        [/set_variable]
        [set_variable]
            name=x_tmp
            value=$sound_hex[$swap1].x
        [/set_variable]
        [set_variable]
            name=y_tmp
            value=$sound_hex[$swap1].y
        [/set_variable]
        [set_variable]
            name=sound_hex[$swap1].x
            value=$sound_hex[$swap2].x
        [/set_variable]
        [set_variable]
            name=sound_hex[$swap1].y
            value=$sound_hex[$swap2].y
        [/set_variable]
        [set_variable]
            name=sound_hex[$swap2].x
            value=$x_tmp
        [/set_variable]
        [set_variable]
            name=sound_hex[$swap2].y
            value=$y_tmp
        [/set_variable]
        [set_variable]
            name=swap1
            rand=0..2
        [/set_variable]
        [set_variable]
            name=swap2
            rand=3..5
        [/set_variable]
        [set_variable]
            name=x_tmp
            value=$sound_hex[$swap1].x
        [/set_variable]
        [set_variable]
            name=y_tmp
            value=$sound_hex[$swap1].y
        [/set_variable]
        [set_variable]
            name=sound_hex[$swap1].x
            value=$sound_hex[$swap2].x
        [/set_variable]
        [set_variable]
            name=sound_hex[$swap1].y
            value=$sound_hex[$swap2].y
        [/set_variable]
        [set_variable]
            name=sound_hex[$swap2].x
            value=$x_tmp
        [/set_variable]
        [set_variable]
            name=sound_hex[$swap2].y
            value=$y_tmp
        [/set_variable]

        {CLEAR_VARIABLE swap1}
        {CLEAR_VARIABLE swap2}
        {CLEAR_VARIABLE x_tmp}
        {CLEAR_VARIABLE y_tmp}

        {DELAY 300}
        {TURN_UNIT5 "Yumi"}
        {DELAY 500}

        [message]
            speaker=Yumi
            message= _ "(<i>heart pounds</i>)"
        [/message]
        [message]
            speaker=Yumi
            message= _ "<i>I'm trapped.</i>"
        [/message]
        [message]
            speaker=Yumi
            message= _ "(<i>holds head</i>)"
        [/message]
        [message]
            speaker=Yumi
            message= _ "<i>There has to be a way out. There has to. Don't panic... don't panic...</i>"
        [/message]
        [message]
            speaker=Yumi
            message= _ "(<i>breathes rapidly</i>)"
        [/message]

        {PLAY_SOUND "wail.wav"}
        {DELAY 150}
        {PLAY_SOUND "wail-long.wav"}
        {DELAY 150}
        {PLAY_SOUND "wail.wav"}

        {DELAY 500}
        [message]
            speaker=Yumi
            message= _ "<i>I have to hurry.</i>"
        [/message]

        [set_variable]
            name=puzzle_counter
            value=0
        [/set_variable]
        [kill]
            side=2
        [/kill]

        [objectives]
            {OBJECTIVE_VICTORY  ( _ "Solve the puzzle")}
            {OBJECTIVE_DEFEAT  ( _ "Death of Yumi")}
            {OBJECTIVE_NOTE ( _ "Sound effects will help you solve the puzzle.")}
            {OBJECTIVE_NOTE ( _ "You may recruit by right clicking on a hex next to Yumi.")}
            {OBJECTIVE_NOTE ( _ "Yumi can regain hitpoints by sacrificing ethereal wardens.")}
            {OBJECTIVE_NOTE ( _ "Yumi can destroy nearby hexes and any units on them at the cost of 9 hp.")}
        [/objectives]
    [/event]
    ################################################################################
    #################################### PUZZLE ####################################
    [event]
        name=moveto
        first_time_only=no
        [filter]
            side=1
            [filter_location]
                x,y=23,135
            [/filter_location]
        [/filter]

        [message]
            speaker=narrator
            message= _ "The hellish screams pierced the silent night. Through eternal darkness, death hunted her in ceaseless, tireless pursuit. They hounded her at every corner, their ghastly wails tearing through blood and flesh alike, ripping through physical matter with the scythes of the void. She fled blindly into opaque darkness, hoping that she could escape."
        [/message]
        [message]
            speaker=narrator
            message= _ "Hearing her pleas, it granted her wish. In a rising arpeggio of plucked strings, the climbing strum of the harp broke the eerie darkness. And, like a mirror, the spell was shattered."
        [/message]
    [/event]

    [event]
        name=moveto
        first_time_only=no
        [filter]
            side=1
            [filter_location]
                x,y=$sound_hex[0].x,$sound_hex[0].y
            [/filter_location]
        [/filter]

        {DELAY 150}
        {PLAY_SOUND "harp_g#.ogg"}
        {PLACE_IMAGE items/crystal-glyph-message-dark.png $sound_hex[0].x $sound_hex[0].y}

        [set_variable]
            name=puzzle_counter
            value=1
        [/set_variable]
    [/event]
    [event]
        name=moveto
        first_time_only=no
        [filter]
            side=1
            [filter_location]
                x,y=$sound_hex[1].x,$sound_hex[1].y
            [/filter_location]
        [/filter]

        {DELAY 150}
        {PLAY_SOUND "harp_b.ogg"}
        {PLACE_IMAGE items/crystal-glyph-message-dark-1.png $sound_hex[1].x $sound_hex[1].y}

        [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=$sound_hex[2].x,$sound_hex[2].y
            [/filter_location]
        [/filter]

        {DELAY 150}
        {PLAY_SOUND "harp_d#.ogg"}

        [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=$sound_hex[3].x,$sound_hex[3].y
            [/filter_location]
        [/filter]

        {DELAY 150}
        {PLAY_SOUND "harp_f#.ogg"}
        {PLACE_IMAGE items/crystal-glyph.png $sound_hex[3].x $sound_hex[3].y}

        [if]
            [variable]
                name=puzzle_counter
                numerical_equals=3
            [/variable]
            [then]
                [set_variable]
                    name=puzzle_counter
                    value=4
                [/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=$sound_hex[4].x,$sound_hex[4].y
            [/filter_location]
        [/filter]

        {DELAY 150}
        {PLAY_SOUND "harp_a#.ogg"}
        {PLACE_IMAGE items/crystal-glyph-light.png $sound_hex[4].x $sound_hex[4].y}

        [if]
            [variable]
                name=puzzle_counter
                numerical_equals=4
            [/variable]
            [then]
                [set_variable]
                    name=puzzle_counter
                    value=5
                [/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=$sound_hex[5].x,$sound_hex[5].y
            [/filter_location]
        [/filter]

        {DELAY 150}
        {PLAY_SOUND "harp_c#.ogg"}
        {PLACE_IMAGE items/crystal-glyph-light-1.png $sound_hex[5].x $sound_hex[5].y}

        [if]
            [variable]
                name=puzzle_counter
                numerical_equals=5
            [/variable]
            [then]
                {CLEAR_VARIABLE puzzle_counter}

                {DELAY 500}

                [store_unit]
                    [filter]
                        id=Yumi
                    [/filter]
                    variable=yumi
                [/store_unit]

                #ifdef EASY
                {VARIABLE_OP yumi.experience add 240}

                [unstore_unit]
                    variable=yumi
                    find_vacant=no
                    text= _ "+240 XP"
                    red,green,blue=255,0,255
                    advance=no
                [/unstore_unit]
                #endif
                #ifdef NORMAL
                {VARIABLE_OP yumi.experience add 200}
                [unstore_unit]
                    variable=yumi
                    find_vacant=no
                    text= _ "+200 XP"
                    red,green,blue=255,0,255
                    advance=no
                [/unstore_unit]
                #endif
                #ifdef HARD
                {VARIABLE_OP yumi.experience add 100}

                [unstore_unit]
                    variable=yumi
                    find_vacant=no
                    text= _ "+100 XP"
                    red,green,blue=255,0,255
                    advance=no
                [/unstore_unit]
                #endif

                {CLEAR_VARIABLE yumi}

                {DELAY 750}
                {REMOVE_IMAGE 23 135}
                {REMOVE_IMAGE 23 137}
                {REMOVE_IMAGE 21 138}
                {REMOVE_IMAGE 21 139}
                {REMOVE_IMAGE 25 138}
                {REMOVE_IMAGE 25 139}
                {REMOVE_IMAGE 23 140}
                [redraw][/redraw]

                {DELAY 350}

                [kill]
                    side=1
                    type=Manifestation,Manifestation2,Ethereal Warden,Black Spirit
                [/kill]
                [kill]
                    side=2
                [/kill]

                {DELAY 350}

                {TURN_UNIT5 "Yumi"}
                [move_unit]
                    id=Yumi
                    to_x,to_y=23,141
                [/move_unit]
                [fire_event]
                    name=endscene
                [/fire_event]
            [/then]
            [else]
                [set_variable]
                    name=puzzle_counter
                    value=0
                [/set_variable]
            [/else]
        [/if]
    [/event]
    ################################################################
    ################################################################

#define GENERATE_GRASS_HILL
    [store_locations]
        variable=grass_hex
        terrain=Gg
        [filter_adjacent_location]
            terrain=Mm
        [/filter_adjacent_location]
    [/store_locations]
    [for]
        array=grass_hex
        [do]
            [set_variable]
                name=change_terrain
                rand=1..2
            [/set_variable]
            [if]
                [variable]
                    name=change_terrain
                    numerical_equals=1
                [/variable]
                [then]
                    [terrain]
                         x,y=$grass_hex[$i].x,$grass_hex[$i].y
                        terrain=Hh
                    [/terrain]
                [/then]
            [/if]
            {CLEAR_VARIABLE change_terrain}
        [/do]
    [/for]
    {CLEAR_VARIABLE grass_hex}
    [store_locations]
        variable=grass_hex
        terrain=Gg
        [filter_adjacent_location]
            terrain=Hh
        [/filter_adjacent_location]
    [/store_locations]
    [for]
        array=grass_hex
        [do]
            [set_variable]
                name=change_terrain
                rand=1..4
            [/set_variable]
            [if]
                [variable]
                    name=change_terrain
                    numerical_equals=1
                [/variable]
                [then]
                    [terrain]
                         x,y=$grass_hex[$i].x,$grass_hex[$i].y
                        terrain=Hh
                    [/terrain]
                [/then]
            [/if]
            {CLEAR_VARIABLE change_terrain}
        [/do]
    [/for]
    {CLEAR_VARIABLE grass_hex}
#enddef

#define GENERATE_GRASS_FOREST
    [store_locations]
        variable=grass_hex
        terrain=Gg
    [/store_locations]
    [for]
        array=grass_hex
        [do]
            [set_variable]
                name=change_terrain
                rand=1..1500
            [/set_variable]
            [if]
                [variable]
                    name=change_terrain
                    less_than=40
                [/variable]
                [then]
                    [terrain]
                         x,y=$grass_hex[$i].x,$grass_hex[$i].y
                        terrain=Gs^Fp
                    [/terrain]
                [/then]
            [/if]
            [if]
                [variable]
                    name=change_terrain
                    less_than=43
                [/variable]
                [and]
                    [variable]
                        name=change_terrain
                        greater_than=40
                    [/variable]
                [/and]
                [then]
                    [terrain]
                         x,y=$grass_hex[$i].x,$grass_hex[$i].y
                        terrain=Gs^Fds
                    [/terrain]
                [/then]
            [/if]
            [if]
                [variable]
                    name=change_terrain
                    less_than=49
                [/variable]
                [and]
                    [variable]
                        name=change_terrain
                        greater_than=46
                    [/variable]
                [/and]
                [then]
                    [terrain]
                         x,y=$grass_hex[$i].x,$grass_hex[$i].y
                        terrain=Gs^Fms
                    [/terrain]
                [/then]
            [/if]
            [if]
                [variable]
                    name=change_terrain
                    less_than=70
                [/variable]
                [and]
                    [variable]
                        name=change_terrain
                        greater_than=50
                    [/variable]
                [/and]
                [then]
                    [terrain]
                         x,y=$grass_hex[$i].x,$grass_hex[$i].y
                        terrain=Gg^Fp
                    [/terrain]
                [/then]
            [/if]
            [if]
                [variable]
                    name=change_terrain
                    numerical_equals=71
                [/variable]
                [then]
                    [terrain]
                         x,y=$grass_hex[$i].x,$grass_hex[$i].y
                        terrain=Gg^Fds
                    [/terrain]
                [/then]
            [/if]
            [if]
                [variable]
                    name=change_terrain
                    numerical_equals=72
                [/variable]
                [then]
                    [terrain]
                         x,y=$grass_hex[$i].x,$grass_hex[$i].y
                        terrain=Gg^Fms
                    [/terrain]
                [/then]
            [/if]
            {CLEAR_VARIABLE change_terrain}
        [/do]
    [/for]
    {CLEAR_VARIABLE grass_hex}
    [store_locations]
        variable=grass_hex
        terrain=Gg
        [filter_adjacent_location]
            terrain=G*^F*,Hh^F*
        [/filter_adjacent_location]
    [/store_locations]
    [for]
        array=grass_hex
        [do]
            [set_variable]
                name=change_terrain
                rand=1..400
            [/set_variable]
            [if]
                [variable]
                    name=change_terrain
                    less_than=40
                [/variable]
                [then]
                    [terrain]
                         x,y=$grass_hex[$i].x,$grass_hex[$i].y
                        terrain=Gs^Fp
                    [/terrain]
                [/then]
            [/if]
            [if]
                [variable]
                    name=change_terrain
                    less_than=53
                [/variable]
                [and]
                    [variable]
                        name=change_terrain
                        greater_than=40
                    [/variable]
                [/and]
                [then]
                    [terrain]
                         x,y=$grass_hex[$i].x,$grass_hex[$i].y
                        terrain=Gs^Fds
                    [/terrain]
                [/then]
            [/if]
            [if]
                [variable]
                    name=change_terrain
                    less_than=66
                [/variable]
                [and]
                    [variable]
                        name=change_terrain
                        greater_than=53
                    [/variable]
                [/and]
                [then]
                    [terrain]
                         x,y=$grass_hex[$i].x,$grass_hex[$i].y
                        terrain=Gs^Fms
                    [/terrain]
                [/then]
            [/if]
            [if]
                [variable]
                    name=change_terrain
                    less_than=75
                [/variable]
                [and]
                    [variable]
                        name=change_terrain
                        greater_than=66
                    [/variable]
                [/and]
                [then]
                    [terrain]
                         x,y=$grass_hex[$i].x,$grass_hex[$i].y
                        terrain=Gs^Fdf
                    [/terrain]
                [/then]
            [/if]
            [if]
                [variable]
                    name=change_terrain
                    less_than=84
                [/variable]
                [and]
                    [variable]
                        name=change_terrain
                        greater_than=75
                    [/variable]
                [/and]
                [then]
                    [terrain]
                         x,y=$grass_hex[$i].x,$grass_hex[$i].y
                        terrain=Gs^Fmf
                    [/terrain]
                [/then]
            [/if]
            [if]
                [variable]
                    name=change_terrain
                    less_than=95
                [/variable]
                [and]
                    [variable]
                        name=change_terrain
                        greater_than=85
                    [/variable]
                [/and]
                [then]
                    [terrain]
                         x,y=$grass_hex[$i].x,$grass_hex[$i].y
                        terrain=Gg^Fp
                    [/terrain]
                [/then]
            [/if]
            [if]
                [variable]
                    name=change_terrain
                    less_than=99
                [/variable]
                [and]
                    [variable]
                        name=change_terrain
                        greater_than=95
                    [/variable]
                [/and]
                [then]
                    [terrain]
                         x,y=$grass_hex[$i].x,$grass_hex[$i].y
                        terrain=Gg^Fds
                    [/terrain]
                [/then]
            [/if]
            [if]
                [variable]
                    name=change_terrain
                    less_than=103
                [/variable]
                [and]
                    [variable]
                        name=change_terrain
                        greater_than=99
                    [/variable]
                [/and]
                [then]
                    [terrain]
                         x,y=$grass_hex[$i].x,$grass_hex[$i].y
                        terrain=Gg^Fms
                    [/terrain]
                [/then]
            [/if]
            [if]
                [variable]
                    name=change_terrain
                    less_than=106
                [/variable]
                [and]
                    [variable]
                        name=change_terrain
                        greater_than=103
                    [/variable]
                [/and]
                [then]
                    [terrain]
                         x,y=$grass_hex[$i].x,$grass_hex[$i].y
                        terrain=Gg^Fdf
                    [/terrain]
                [/then]
            [/if]
            [if]
                [variable]
                    name=change_terrain
                    less_than=109
                [/variable]
                [and]
                    [variable]
                        name=change_terrain
                        greater_than=106
                    [/variable]
                [/and]
                [then]
                    [terrain]
                         x,y=$grass_hex[$i].x,$grass_hex[$i].y
                        terrain=Gg^Fmf
                    [/terrain]
                [/then]
            [/if]
            {CLEAR_VARIABLE change_terrain}
        [/do]
    [/for]
    {CLEAR_VARIABLE grass_hex}
    [store_locations]
        variable=hill_hex
        terrain=Hh
    [/store_locations]
    [for]
        array=hill_hex
        [do]
            [set_variable]
                name=change_terrain
                rand=1..75
            [/set_variable]
            [if]
                [variable]
                    name=change_terrain
                    less_than=10
                [/variable]
                [then]
                    [terrain]
                         x,y=$hill_hex[$i].x,$hill_hex[$i].y
                        terrain=Hh^Fp
                    [/terrain]
                [/then]
            [/if]
            [if]
                [variable]
                    name=change_terrain
                    numerical_equals=11
                [/variable]
                [then]
                    [terrain]
                         x,y=$hill_hex[$i].x,$hill_hex[$i].y
                        terrain=Hh^Fds
                    [/terrain]
                [/then]
            [/if]
            [if]
                [variable]
                    name=change_terrain
                    numerical_equals=12
                [/variable]
                [then]
                    [terrain]
                         x,y=$hill_hex[$i].x,$hill_hex[$i].y
                        terrain=Hh^Fms
                    [/terrain]
                [/then]
            [/if]
            {CLEAR_VARIABLE change_terrain}
        [/do]
    [/for]
    {CLEAR_VARIABLE hill_hex}
    [store_locations]
        variable=hill_hex
        terrain=Hh
        [filter_adjacent_location]
            terrain=Hh^Fms,Hh^Fda,Hh^Fp
        [/filter_adjacent_location]
    [/store_locations]
    [for]
        array=hill_hex
        [do]
            [set_variable]
                name=change_terrain
                rand=1..50
            [/set_variable]
            [if]
                [variable]
                    name=change_terrain
                    less_than=4
                [/variable]
                [then]
                    [terrain]
                         x,y=$hill_hex[$i].x,$hill_hex[$i].y
                        terrain=Hh^Fp
                    [/terrain]
                [/then]
            [/if]
            [if]
                [variable]
                    name=change_terrain
                    numerical_equals=5
                [/variable]
                [then]
                    [terrain]
                         x,y=$hill_hex[$i].x,$hill_hex[$i].y
                        terrain=Hh^Fds
                    [/terrain]
                [/then]
            [/if]
            [if]
                [variable]
                    name=change_terrain
                    numerical_equals=6
                [/variable]
                [then]
                    [terrain]
                         x,y=$hill_hex[$i].x,$hill_hex[$i].y
                        terrain=Hh^Fms
                    [/terrain]
                [/then]
            [/if]
            {CLEAR_VARIABLE change_terrain}
        [/do]
    [/for]
    {CLEAR_VARIABLE hill_hex}
#enddef

    [event]
        name=endscene

        [for]
            array=aryel_units
            [do]
                [unstore_unit]
                    variable=aryel_units[$i]
                    find_vacant=yes
                [/unstore_unit]
            [/do]
        [/for]

        [store_unit]
            [filter]
                id=Aryel
            [/filter]
            variable=aryel_tmp
        [/store_unit]

        [modify_unit]
            [filter]
                id=Yumi
            [/filter]
            vision=6
        [/modify_unit]

        [if]
            [variable]
                name=inc_moves
                numerical_equals=1
            [/variable]
            [then]
                [store_unit]
                    [filter]
                        id=Yumi
                    [/filter]
                    variable=yumi_tmp
                [/store_unit]

                {VARIABLE_OP yumi_tmp.max_moves sub 2}

                [modify_unit]
                    [filter]
                        id=Yumi
                    [/filter]
                    max_moves=$yumi_tmp.max_moves
                [/modify_unit]

                {CLEAR_VARIABLE yumi_tmp}
            [/then]
        [/if]

        [store_unit]
            [filter]
                id=Yumi
            [/filter]
            variable=yumi_tmp
        [/store_unit]

        [store_unit]
            [filter]
                side=1
                [not]
                    id=Yumi,Aryel
                [/not]
            [/filter]
            variable=aryel_units
        [/store_unit]

        [kill]
            side=1
            [not]
                id=Yumi
            [/not]
        [/kill]

        {DELAY 500}

        {SPAWN_ID ("Demon Reaper") 2 20 139 ("Reaper1") ("male")}
        {SPAWN_ID ("Demon Reaper") 2 23 138 ("Reaper2") ("male")}
        {SPAWN_ID ("Demon Reaper") 2 26 139 ("Reaper3") ("male")}
        [redraw][/redraw]
        {DELAY 250}
        [message]
            speaker=Yumi
            message= _ "!"
        [/message]
        [move_unit]
            id=Yumi
            to_x,to_y=23,142
        [/move_unit]
        {DELAY 350}
        {TURN_UNIT5 "Yumi"}
        {DELAY 350}
        [move_unit]
            id=Reaper1
            to_x,to_y=21,140
        [/move_unit]
        {DELAY 100}
        [move_unit]
            id=Reaper2
            to_x,to_y=23,139
        [/move_unit]
        {DELAY 100}
        [move_unit]
            id=Reaper3
            to_x,to_y=25,140
        [/move_unit]
        {DELAY 100}
        [move_unit]
            id=Reaper1
            to_x,to_y=22,140
        [/move_unit]
        {DELAY 100}
        [move_unit]
            id=Reaper2
            to_x,to_y=23,140
        [/move_unit]
        {DELAY 100}
        [move_unit]
            id=Reaper3
            to_x,to_y=24,140
        [/move_unit]
        {DELAY 500}
        [message]
            speaker=Yumi
            message= _ "(<i>gasps</i>)"
        [/message]
        {DELAY 100}
        [move_unit]
            id=Reaper1
            to_x,to_y=22,141
        [/move_unit]
        {DELAY 100}
        [move_unit]
            id=Reaper2
            to_x,to_y=23,141
        [/move_unit]
        {DELAY 100}
        [move_unit]
            id=Reaper3
            to_x,to_y=24,141
        [/move_unit]
        {DELAY 300}
        {CLEAR_VARIABLE aryel_enemies}
        {CLEAR_VARIABLE yumi_enemies}
        {CLEAR_VARIABLE yumi_units}

        {FADE_SCREEN}
        {DELAY 250}
        {PLAY_SOUND "human-female-hit-2.ogg"}
        {DELAY 500}
        {PLAY_SOUND "human-female-hit-3.ogg"}
        {DELAY 650}
        {PLAY_SOUND "human-female-hit-1.ogg"}
        {DELAY 650}
        {SWAP_TO_HILL}
        {SWAP_TO_FOREST}
        {SWAP_TO_ICE}
        {SWAP_TO_MOUNTAIN}
        [kill]
            side=1,2
        [/kill]
        [terrain]
            [and]
                terrain=Mm^Xm
            [/and]
            terrain=Mm
        [/terrain]
        {DELAY 350}
        {SWAP_TO_SNOW}
        {GENERATE_GRASS_HILL}
        {GENERATE_GRASS_HILL}
        {GENERATE_GRASS_FOREST}
        {GENERATE_GRASS_HILL}
        {GENERATE_GRASS_FOREST}
        {GENERATE_GRASS_FOREST}
        {UNFADE_SCREEN}
        [remove_sound_source]
            id=s15dark2
        [/remove_sound_source]
        [remove_sound_source]
            id=s15dark3
        [/remove_sound_source]
        [remove_sound_source]
            id=s15drum
        [/remove_sound_source]

        [set_variable]
            name=yumi_tmp.hitpoints
            value=1
        [/set_variable]

        [unstore_unit]
            variable=yumi_tmp
            x,y=23,146
        [/unstore_unit]

        [redraw]
            side=1
            clear_shroud=yes
        [/redraw]
        [remove_shroud]
            side=1
            x,y=23,147
            radius=8
        [/remove_shroud]
        [lift_fog]
            [filter_side]
                side=1
            [/filter_side]
            x,y=23,147
            radius=8
            multiturn=no
        [/lift_fog]
        [redraw][/redraw]
        {DELAY 750}
        [message]
            speaker=Yumi
            message= _ "<i>I'm... bleeding? But I don't bleed..?</i>"
        [/message]
        {DELAY 750}
        [move_unit]
            id=Yumi
            to_x,to_y=23,147
        [/move_unit]
        [redraw][/redraw]
        {DELAY 400}
        [move_unit]
            id=Yumi
            to_x,to_y=23,148
        [/move_unit]
        [redraw][/redraw]
        {DELAY 600}
        [move_unit]
            id=Yumi
            to_x,to_y=23,149
        [/move_unit]
        [redraw][/redraw]
        {DELAY 350}

        [message]
            speaker=Yumi
            message= _ "<i>It... hurts...</i>"
        [/message]
        {DELAY 600}
        [message]
            speaker=Yumi
            message= _ "<i>I can't... it's getting... so dark... ah...</i>"
        [/message]
        {DELAY 500}
        {COLOR_ADJUST -33 -33 -33}
        {DELAY 500}

        {SPAWN_ID ("Royal Guard") 4 26 150 ("Guard1") ("male")}
        {SPAWN_ID ("Iron Mauler") 4 27 150 ("Guard2") ("male")}
        [redraw][/redraw]
        {DELAY 550}

        [message]
            speaker=Guard1
            message= _ "Hey, isn't that one of those faeries we were ordered to capture?"
        [/message]
        [message]
            speaker=Guard2
            message= _ "The ones that attacked Fort Helemoor, you mean."
        [/message]
        [message]
            speaker=Guard1
            message= _ "Yes, them. I'm going to go take a look."
        [/message]
        {DELAY 350}
        [move_unit]
            id=Guard1
            to_x,to_y=24,149
        [/move_unit]
        {DELAY 350}
        [message]
            speaker=Guard1
            message= _ "She's unconscious. It seems like she's injured somehow. We ought to do something."
        [/message]
        [message]
            speaker=Guard2
            message= _ "And what are we supposed to do about it? Neither of us knows anything about healing."
        [/message]
        [message]
            speaker=Guard1
            message= _ "Our orders were to capture as many faerie as we could. Alive. Especially the girl with dark hair. Along with the other two-"
        [/message]
        [message]
            speaker=Guard2
            message= _ "Well she's still breathing, isn't she?"
        [/message]
        [message]
            speaker=Guard1
            message= _ "Yes."
        [/message]
        [message]
            speaker=Guard2
            message= _ "Then let's hurry up and get out of here. This place is making me uncomfortable. We can get her fixed up at the camp."
        [/message]
        [message]
            speaker=Guard1
            message= _ "Sure thing."
        [/message]

        {DELAY 1000}
        {SCROLL_TO 23 139}
        [unstore_unit]
            variable=aryel_tmp
            x,y=23,139
        [/unstore_unit]
        [unhide_unit]
            [filter][/filter]
        [/unhide_unit]
        [redraw][/redraw]
        {CLEAR_VARIABLE aryel_tmp}
        [redraw]
            side=1
            clear_shroud=yes
        [/redraw]
        [remove_shroud]
            side=1
            x,y=23,141
            radius=8
        [/remove_shroud]
        [lift_fog]
            [filter_side]
                side=1
            [/filter_side]
            x,y=23,141
            radius=8
            multiturn=no
        [/lift_fog]

        {DELAY 250}
        [message]
            speaker=Aryel
            message= _ "Yumi!"
        [/message]
        [move_unit]
            id=Aryel
            to_x,to_y=23,140
        [/move_unit]
        {DELAY 150}
        {PLAY_SOUND "wail.wav"}

        {SPAWN_ID ("Demon Reaper") 2 21 140 ("Reaper4") ("male")}
        {SPAWN_ID ("Demon Reaper") 2 21 142 ("Reaper5") ("male")}
        {SPAWN_ID ("Demon Reaper") 2 25 140 ("Reaper6") ("male")}
        {SPAWN_ID ("Demon Reaper") 2 25 142 ("Reaper7") ("male")}
        [redraw][/redraw]
        [message]
            speaker=Aryel
            message= _ "Damn it, Yumi, wake up..."
        [/message]
        [move_unit]
            id=Aryel
            to_x,to_y=23,141
        [/move_unit]
        {DELAY 350}
        [move_unit]
            id=Reaper4
            to_x,to_y=22,140
        [/move_unit]
        {DELAY 100}
        [move_unit]
            id=Reaper5
            to_x,to_y=22,141
        [/move_unit]
        {DELAY 100}
        [move_unit]
            id=Reaper6
            to_x,to_y=24,140
        [/move_unit]
        {DELAY 100}
        [move_unit]
            id=Reaper7
            to_x,to_y=24,141
        [/move_unit]
        {DELAY 250}
        [message]
            speaker=Aryel
            message= _ "Rrrgh, get out of the way! I've got to stop those humans!"
        [/message]
        [harm_unit]
            [filter]
                id=Reaper7
            [/filter]
            [filter_second]
                id=Aryel
            [/filter_second]
            [primary_attack]
                name=blood boil
            [/primary_attack]
            [secondary_attack]
                name=blood boil
            [/secondary_attack]
            animate=yes
            amount=5
        [/harm_unit]
        {DELAY 100}
        [harm_unit]
            [filter]
                id=Reaper7
            [/filter]
            [filter_second]
                id=Aryel
            [/filter_second]
            [primary_attack]
                name=blood boil
            [/primary_attack]
            [secondary_attack]
                name=blood boil
            [/secondary_attack]
            animate=yes
            amount=5
        [/harm_unit]

        [message]
            speaker=Aryel
            message= _ "Move!"
        [/message]
        {DELAY 350}
        {PLAY_SOUND "wail.wav"}
        {DELAY 150}
        {PLAY_SOUND "wail-sml.wav"}
        {DELAY 150}
        {PLAY_SOUND "wail-long.wav"}
        {DELAY 150}
        {PLAY_SOUND "wail.wav"}
        {DELAY 350}
        {SPAWN_ID ("Demon Reaper") 2 23 139 ("Reaper8") ("male")}
        {SPAWN_ID ("Demon Reaper") 2 23 143 ("Reaper9") ("male")}
        [redraw][/redraw]
        {DELAY 350}
        [message]
            speaker=Aryel
            message= _ "Oh..."
        [/message]
        {DELAY 150}
        [move_unit]
            id=Reaper8
            to_x,to_y=23,140
        [/move_unit]
        {DELAY 100}
        [move_unit]
            id=Reaper9
            to_x,to_y=23,142
        [/move_unit]
        {DELAY 250}
        {SPAWN ("Demon Reaper") 2 21 140}
        {SPAWN ("Demon Reaper") 2 25 140}
        {SPAWN ("Demon Reaper") 2 21 142}
        {SPAWN ("Demon Reaper") 2 25 142}
        {SPAWN ("Demon Reaper") 2 23 139}
        {SPAWN ("Demon Reaper") 2 23 143}
        {DELAY 750}
        [message]
            speaker=Aryel
            message= _ "Uh oh."
        [/message]
        {DELAY 500}
        {FADE_SCREEN}
        [kill]
            side=1-4
            [not]
                id=Aryel
            [/not]
        [/kill]
        [for]
            array=aryel_units
            [do]
                [unstore_unit]
                    variable=aryel_units[$i]
                    find_vacant=yes
                [/unstore_unit]
            [/do]
        [/for]
        {CLEAR_VARIABLE aryel_units}

        [endlevel]
            result=victory
            bonus=yes
            {NEW_GOLD_CARRYOVER 100}
            replay_save=no
            carryover_report=no
            linger_mode=no
            next_scenario=16_Black_Forest
        [/endlevel]

    [/event]

    # clean up variables
    [event]
        name=victory

        [unstore_unit]
            variable=esther_tmp
            find_vacant=yes
        [/unstore_unit]
        [clear_menu_item]
            id=recruit_manifestation,recruit_black_spirit,recruit_ethereal_warden,consume_ghost,destroy_hex,possess_ghost
        [/clear_menu_item]

        {CLEAR_VARIABLE esther_tmp}
        {CLEAR_VARIABLE yumi_spawns}
        {CLEAR_VARIABLE aryel_spawns}
        {CLEAR_VARIABLE turn_count}
        {CLEAR_VARIABLE sound_hex}
        {CLEAR_VARIABLE inc_moves}
    [/event]

    [event]
        name=last breath
        [filter]
            id=Yumi
        [/filter]
        [message]
            speaker=Yumi
            message= _ "(<i>gasps</i>)"
        [/message]
        [endlevel]
            result=defeat
        [/endlevel]
    [/event]
    [event]
        name=last breath
        [filter]
            id=Aryel
        [/filter]
        [message]
            speaker=Aryel
            message= _ "Ugh..."
        [/message]
        [endlevel]
            result=defeat
        [/endlevel]
    [/event]
[/scenario]

#undef GENERATE_MOUNTAIN
#undef SWAP_TO_WALL
#undef SWAP_TO_MOUNTAIN
#undef GENERATE_HILL
#undef SWAP_TO_HILL
#undef SWAP_TO_CAVEHILL
#undef GENERATE_FOREST
#undef SWAP_TO_FOREST
#undef SWAP_TO_REMAINS
#undef GENERATE_SNOW
#undef SWAP_TO_SNOW
#undef SWAP_TO_BLOOD
#undef SWAP_TO_ICE
#undef SWAP_TO_WATER
#undef REGENERATE_TERRAIN
#undef DRAW_VOID
#undef GENERATE_GRASS_HILL
#undef GENERATE_GRASS_FOREST