#textdomain wesnoth-Genesis
[scenario]
    id=12_Siege_of_Fort_Helemoor
    name= _ "Siege of Fort Helemoor"
    map_data="{~add-ons/Genesis/episode1/maps/12_Siege_of_Fort_Helemoor.map}"
    next_scenario=13_Blood_Sea
    victory_when_enemies_defeated=no
    turns=-1

    {DAWN}
    {DAWN_NO_SOUND}
    {MORNING}
    {MORNING}
    {MORNING}
    {MIDDAY}
    {MIDDAY}
    {MIDDAY}
    {AFTERNOON}
    {AFTERNOON}
    {AFTERNOON}
    {DUSK}
    {DUSK_NO_SOUND}
    {DUSK_NO_SOUND}
    {FIRST_WATCH}
    {FIRST_WATCH}
    {FIRST_WATCH}
    {MIDNIGHT}
    {MIDNIGHT}
    {MIDNIGHT}

    {SCENARIO_MUSIC loyalists.ogg}
    {EXTRA_SCENARIO_MUSIC battle.ogg}
    {EXTRA_SCENARIO_MUSIC battle-epic.ogg}
    {EXTRA_SCENARIO_MUSIC knalgan_theme.ogg}
    {FAE_DEATHS2}
    {STORYTXT_SIEGE_OF_HELEMOOR}
    [side]
        {PLAYER_FAE}
        {FULL_RECRUIT_LIST}
        side=1
        {GOLD 350 300 200}
        village_gold=2
        village_support=1
        income=4
        facing=sw
    [/side]

    [side]
        {DEFENSIVE_SIDE}
        type=General
        id=humanleader122
        generate_name=yes
        canrecruit=yes
        side=2
        controller=ai
        recruit=Swordsman,Pikeman,Javelineer,Longbowman,Dragoon
        {GOLD 300 250 150}
        {INCOME 15 10 5}
        facing=e
        team_name=fae
        color=grey
        village_support=2
        user_team_name= _ "team_name^Northern Humans"
    [/side]

    [side]
        {DEFENSIVE_SIDE}
        type=General
        id=humanleader123
        generate_name=yes
        canrecruit=yes
        side=3
        controller=ai
        recruit=Swordsman,Pikeman,Javelineer,Longbowman,Dragoon
        {GOLD 300 250 150}
        {INCOME 10 8 5}
        facing=ne
        team_name=fae
        color=grey
        village_support=2
        user_team_name= _ "team_name^Northern Humans"
    [/side]

    [side]
        {HUMAN_ENEMY}
        type=Grand Marshal
        id=humanleader124
        name= _ "Marshal Briggs"
        canrecruit=yes
        side=4
        recruit=Swordsman,Pikeman,Javelineer,Longbowman,Dragoon,Red Mage,Shock Trooper
        {GOLD 300 350 500}
        {INCOME 20 25 30}
        facing=ne
        village_gold=3
        village_support=2
        [ai]
            aggression=0.1
            caution=0.9
        [/ai]
    [/side]

    [side]
        {HUMAN_ENEMY}
        type=General
        id=humanleader125
        generate_name=yes
        canrecruit=yes
        side=5
        recruit=Swordsman,Pikeman,Javelineer,Longbowman,Dragoon
        {GOLD 175 225 350}
        {INCOME 15 20 25}
        facing=ne
        village_gold=2
        village_support=2
        [ai]
            aggression=0.25
            caution=0.75
        [/ai]
    [/side]

    [side]
        {HUMAN_ENEMY}
        type=General
        id=humanleader126
        generate_name=yes
        canrecruit=yes
        side=6
        recruit=Swordsman,Pikeman,Javelineer,Longbowman,Dragoon
        {GOLD 175 225 350}
        {INCOME 15 20 25}
        facing=ne
        village_gold=2
        village_support=2
        [ai]
            aggression=0.25
            caution=0.75
        [/ai]
    [/side]

    {STARTING_VILLAGES 4 3}
    {STARTING_VILLAGES 5 3}
    {STARTING_VILLAGES 6 3}

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

#define GENERATE_FOREST
    [store_locations]
        variable=ice_hex
        terrain=Ai
    [/store_locations]
    [for]
        array=ice_hex
        [do]
            [set_variable]
                name=change_terrain
                rand=1..30
            [/set_variable]
            [if]
                [variable]
                    name=change_terrain
                    less_than=5
                [/variable]
                [then]
                    [terrain]
                         x,y=$ice_hex[$i].x,$ice_hex[$i].y
                        terrain=Aa^Fpa
                    [/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=Aa^Fma
                    [/terrain]
                [/then]
            [/if]
            {CLEAR_VARIABLE change_terrain}
        [/do]
    [/for]
    {CLEAR_VARIABLE ice_hex}
    [store_locations]
        variable=ice_hex
        terrain=Ai
        [filter_adjacent_location]
            terrain=Aa^Fpa,Aa^Fma
        [/filter_adjacent_location]
    [/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=Aa^Fpa
                    [/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=Aa^Fma
                    [/terrain]
                [/then]
            [/if]
            {CLEAR_VARIABLE change_terrain}
        [/do]
    [/for]
    {CLEAR_VARIABLE ice_hex}
    [store_locations]
        variable=hill_hex
        terrain=Ha
    [/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=Ha^Fpa
                    [/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=Ha^Fma
                    [/terrain]
                [/then]
            [/if]
            {CLEAR_VARIABLE change_terrain}
        [/do]
    [/for]
    {CLEAR_VARIABLE hill_hex}
    [store_locations]
        variable=hill_hex
        terrain=Ha
        [filter_adjacent_location]
            terrain=Aa^Fpa,Aa^Fma,Ha^Fpa,Ha^Fma
        [/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=Ha^Fpa
                    [/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=Ha^Fma
                    [/terrain]
                [/then]
            [/if]
            {CLEAR_VARIABLE change_terrain}
        [/do]
    [/for]
    {CLEAR_VARIABLE hill_hex}
#enddef

#define GENERATE_SNOW
    [store_locations]
        variable=road_hex
        terrain=Rrc
    [/store_locations]
    [for]
        array=road_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=$road_hex[$i].x,$road_hex[$i].y
                        terrain=Aa
                    [/terrain]
                [/then]
            [/if]
            {CLEAR_VARIABLE change_terrain}
        [/do]
    [/for]
    {CLEAR_VARIABLE road_hex}
    [store_locations]
        variable=road_hex
        terrain=Rrc
        [filter_adjacent_location]
            terrain=Aa,Ai
        [/filter_adjacent_location]
    [/store_locations]
    [for]
        array=road_hex
        [do]
            [set_variable]
                name=change_terrain
                rand=1..12
            [/set_variable]
            [if]
                [variable]
                    name=change_terrain
                    less_than=3
                [/variable]
                [then]
                    [terrain]
                         x,y=$road_hex[$i].x,$road_hex[$i].y
                        terrain=Aa
                    [/terrain]
                [/then]
            [/if]
            {CLEAR_VARIABLE change_terrain}
        [/do]
    [/for]
    {CLEAR_VARIABLE road_hex}
    [store_locations]
        variable=ice_hex
        terrain=Ai
    [/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=Aa
                    [/terrain]
                [/then]
            [/if]
            {CLEAR_VARIABLE change_terrain}
        [/do]
    [/for]
    {CLEAR_VARIABLE ice_hex}
    [store_locations]
        variable=ice_hex
        terrain=Ai
    [/store_locations]
    [for]
        array=ice_hex
        [do]
            [set_variable]
                name=change_terrain
                rand=1..21
            [/set_variable]
            [if]
                [variable]
                    name=change_terrain
                    numerical_equals=1
                [/variable]
                [then]
                    [terrain]
                         x,y=$ice_hex[$i].x,$ice_hex[$i].y
                        terrain=Spay
                    [/terrain]
                [/then]
            [/if]
            {CLEAR_VARIABLE change_terrain}
        [/do]
    [/for]
    {CLEAR_VARIABLE ice_hex}
    [store_locations]
        variable=ice_hex
        terrain=Ai
        [filter_adjacent_location]
            terrain=Aa
        [/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=Aa
                    [/terrain]
                [/then]
            [/if]
            {CLEAR_VARIABLE change_terrain}
        [/do]
    [/for]
    {CLEAR_VARIABLE ice_hex}
    [store_locations]
        variable=ice_hex
        terrain=Ai
        [filter_adjacent_location]
            terrain=Spay
        [/filter_adjacent_location]
    [/store_locations]
    [for]
        array=ice_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=$ice_hex[$i].x,$ice_hex[$i].y
                        terrain=Spay
                    [/terrain]
                [/then]
            [/if]
            {CLEAR_VARIABLE change_terrain}
        [/do]
    [/for]
    {CLEAR_VARIABLE ice_hex}
#enddef
#define GENERATE_VILLAGE
    [store_locations]
        variable=ice_hex
        terrain=Ai,Aa
        [not]
            [filter_adjacent_location]
                terrain=Xu,Ai^V*a,Aa^V*a
            [/filter_adjacent_location]
        [/not]
        [not]
            x=0,46
            [or]
                y=0,51
            [/or]
        [/not]
    [/store_locations]
    [for]
        array=ice_hex
        [do]
            [set_variable]
                name=change_terrain
                rand=1..400
            [/set_variable]
            [if]
                [variable]
                    name=change_terrain
                    numerical_equals=1
                [/variable]
                [then]
                    [terrain]
                         x,y=$ice_hex[$i].x,$ice_hex[$i].y
                        terrain=Ai^Vea
                    [/terrain]
                [/then]
            [/if]
            [if]
                [variable]
                    name=change_terrain
                    numerical_equals=2
                [/variable]
                [then]
                    [terrain]
                         x,y=$ice_hex[$i].x,$ice_hex[$i].y
                        terrain=Ai^Vha
                    [/terrain]
                [/then]
            [/if]
            [if]
                [variable]
                    name=change_terrain
                    numerical_equals=3
                [/variable]
                [then]
                    [terrain]
                         x,y=$ice_hex[$i].x,$ice_hex[$i].y
                        terrain=Ai^Vca
                    [/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=Ai^Vla
                    [/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=Aa^Vea
                    [/terrain]
                [/then]
            [/if]
            [if]
                [variable]
                    name=change_terrain
                    numerical_equals=6
                [/variable]
                [then]
                    [terrain]
                         x,y=$ice_hex[$i].x,$ice_hex[$i].y
                        terrain=Aa^Vha
                    [/terrain]
                [/then]
            [/if]
            [if]
                [variable]
                    name=change_terrain
                    numerical_equals=7
                [/variable]
                [then]
                    [terrain]
                         x,y=$ice_hex[$i].x,$ice_hex[$i].y
                        terrain=Aa^Vca
                    [/terrain]
                [/then]
            [/if]
            [if]
                [variable]
                    name=change_terrain
                    numerical_equals=8
                [/variable]
                [then]
                    [terrain]
                         x,y=$ice_hex[$i].x,$ice_hex[$i].y
                        terrain=Aa^Vla
                    [/terrain]
                [/then]
            [/if]
            {CLEAR_VARIABLE change_terrain}
        [/do]
    [/for]
    {CLEAR_VARIABLE ice_hex}
    [store_locations]
        variable=hill_hex
        terrain=Ha
        [not]
            [filter_adjacent_location]
                terrain=Ai^V*a,Aa^V*a,Ha^Vhha
            [/filter_adjacent_location]
        [/not]
    [/store_locations]
    [for]
        array=hill_hex
        [do]
            [set_variable]
                name=change_terrain
                rand=1..50
            [/set_variable]
            [if]
                [variable]
                    name=change_terrain
                    numerical_equals=1
                [/variable]
                [then]
                    [terrain]
                         x,y=$hill_hex[$i].x,$hill_hex[$i].y
                        terrain=Ha^Vhha
                    [/terrain]
                [/then]
            [/if]
            {CLEAR_VARIABLE change_terrain}
        [/do]
    [/for]
    {CLEAR_VARIABLE hill_hex}
    [store_locations]
        variable=road_hex
        terrain=Rrc
        [not]
            x=0,46
            [or]
                y=0,51
            [/or]
        [/not]
        [not]
            [filter_adjacent_location]
                terrain=Aa^Fyak
            [/filter_adjacent_location]
        [/not]
    [/store_locations]
    [for]
        array=road_hex
        [do]
            [set_variable]
                name=change_terrain
                rand=1..35
            [/set_variable]
            [if]
                [variable]
                    name=change_terrain
                    less_than=5
                [/variable]
                [then]
                    [terrain]
                         x,y=$road_hex[$i].x,$road_hex[$i].y
                        terrain=Rrc^Vhca
                    [/terrain]
                [/then]
            [/if]
            [if]
                [variable]
                    name=change_terrain
                    numerical_equals=5
                [/variable]
                [then]
                    [terrain]
                         x,y=$road_hex[$i].x,$road_hex[$i].y
                        terrain=Rrc^Vhc
                    [/terrain]
                [/then]
            [/if]
            {CLEAR_VARIABLE change_terrain}
        [/do]
    [/for]
    {CLEAR_VARIABLE road_hex}
#enddef

#define GENERATE_TEXTURE
    [store_locations]
        variable=floor_hex
        terrain=A*,H*
        [and]
            [filter_adjacent_location]
                terrain=*^F*
            [/filter_adjacent_location]
        [/and]
    [/store_locations]
    [for]
        array=floor_hex
        [do]
        [set_variable]
            name=change_terrain
            rand=1..20
        [/set_variable]
        [if]
            [variable]
                name=change_terrain
                numerical_equals=1
            [/variable]
            [then]
                [terrain]
                    x,y=$floor_hex[$i].x,$floor_hex[$i].y
                    layer=overlay
                    terrain=^Em
                [/terrain]
            [/then]
        [/if]
        {CLEAR_VARIABLE change_terrain}
        [/do]
    [/for]
    {CLEAR_VARIABLE floor_hex}
    [store_locations]
        variable=floor_hex
        terrain=A*,H*
        [and]
            [filter_adjacent_location]
                terrain=*^F*
                count=3-6
            [/filter_adjacent_location]
        [/and]
    [/store_locations]
    [for]
        array=floor_hex
        [do]
        [set_variable]
            name=change_terrain
            rand=1..100
        [/set_variable]
        [if]
            [variable]
                name=change_terrain
                numerical_equals=1
            [/variable]
            [then]
                [terrain]
                    x,y=$floor_hex[$i].x,$floor_hex[$i].y
                    layer=overlay
                    terrain=^Emf
                [/terrain]
            [/then]
        [/if]
        {CLEAR_VARIABLE change_terrain}
        [/do]
    [/for]
    {CLEAR_VARIABLE floor_hex}
    [store_locations]
        variable=floor_hex
        terrain=A*,H*,S*
    [/store_locations]
    [for]
        array=floor_hex
        [do]
        [set_variable]
            name=change_terrain
            rand=1..20
        [/set_variable]
        [if]
            [variable]
                name=change_terrain
                numerical_equals=1
            [/variable]
            [then]
                [terrain]
                    x,y=$floor_hex[$i].x,$floor_hex[$i].y
                    layer=overlay
                    terrain=^Es
                [/terrain]
            [/then]
        [/if]
        {CLEAR_VARIABLE change_terrain}
        [/do]
    [/for]
    {CLEAR_VARIABLE floor_hex}
#enddef

    [event]
        name=prestart
        {REPEAT 5 ({GENERATE_MOUNTAIN})}
        {REPEAT 3 ({GENERATE_HILL})}
        {GENERATE_FOREST}
        {GENERATE_SNOW}
        {GENERATE_SNOW}
        {GENERATE_VILLAGE}
        {GENERATE_TEXTURE}

        {CAPTURE_VILLAGES 2 8 3 4}
        {CAPTURE_VILLAGES 3 3 6 4}
        {CAPTURE_VILLAGES 2 8 3 3}
        {RECALL_ARYEL_NOLOC}

        [unit]
            side=4
            generate_name=yes
            type=Royal Guard
            random_traits=yes
            upkeep=loyal
            x,y=27,32
            ai_special=guardian
        [/unit]
        [unit]
            side=4
            generate_name=yes
            type=Royal Guard
            random_traits=yes
            upkeep=loyal
            x,y=24,33
            ai_special=guardian
        [/unit]
        [unit]
            side=4
            generate_name=yes
            type=Royal Guard
            random_traits=yes
            upkeep=loyal
            x,y=24,30
            ai_special=guardian
        [/unit]
        [unit]
            side=5
            generate_name=yes
            type=Royal Guard
            random_traits=yes
            upkeep=loyal
            x,y=29,18
            ai_special=guardian
        [/unit]
        [unit]
            side=5
            generate_name=yes
            type=Royal Guard
            random_traits=yes
            upkeep=loyal
            x,y=29,21
            ai_special=guardian
        [/unit]
        [unit]
            side=5
            generate_name=yes
            type=Royal Guard
            random_traits=yes
            upkeep=loyal
            x,y=32,19
            ai_special=guardian
        [/unit]
        [unit]
            side=6
            generate_name=yes
            type=Royal Guard
            random_traits=yes
            upkeep=loyal
            x,y=12,24
            ai_special=guardian
        [/unit]
        [unit]
            side=6
            generate_name=yes
            type=Royal Guard
            random_traits=yes
            upkeep=loyal
            x,y=12,27
            ai_special=guardian
        [/unit]
        [unit]
            side=6
            generate_name=yes
            type=Royal Guard
            random_traits=yes
            upkeep=loyal
            x,y=15,26
            ai_special=guardian
        [/unit]
        [unit]
            side=2
            generate_name=yes
            type=Shock Trooper
            random_traits=yes
            upkeep=loyal
            x,y=12,12
            ai_special=guardian
        [/unit]
        [unit]
            side=2
            generate_name=yes
            type=Iron Mauler
            random_traits=yes
            upkeep=loyal
            x,y=14,11
            ai_special=guardian
        [/unit]
        [unit]
            side=2
            generate_name=yes
            type=Shock Trooper
            random_traits=yes
            upkeep=loyal
            x,y=16,10
            ai_special=guardian
        [/unit]
        [unit]
            side=2
            generate_name=yes
            type=Shock Trooper
            random_traits=yes
            upkeep=loyal
            x,y=16,8
            ai_special=guardian
        [/unit]
        [unit]
            side=2
            generate_name=yes
            type=Shock Trooper
            random_traits=yes
            upkeep=loyal
            x,y=9,13
            ai_special=guardian
        [/unit]
        [unit]
            side=2
            generate_name=yes
            type=Shock Trooper
            random_traits=yes
            upkeep=loyal
            x,y=16,6
            ai_special=guardian
        [/unit]
        [unit]
            side=2
            generate_name=yes
            type=Shock Trooper
            random_traits=yes
            upkeep=loyal
            x,y=6,13
            ai_special=guardian
        [/unit]
        [unit]
            side=2
            generate_name=yes
            type=Iron Mauler
            random_traits=yes
            upkeep=loyal
            x,y=9,11
            ai_special=guardian
        [/unit]
        [unit]
            side=2
            generate_name=yes
            type=Iron Mauler
            random_traits=yes
            upkeep=loyal
            x,y=14,7
            ai_special=guardian
        [/unit]
    [/event]

    [event]
        name=start

        [modify_unit]
            [filter]
                race=human
                side=2,3,4,5,6
            [/filter]
            [object]
                silent=yes
                [filter]
                    x,y=humanunits[$i].x,humanunits[$i].y
                [/filter]
                [effect]
                    apply_to=movement_costs
                    replace=yes
                    [movement_costs]
                        frozen=2
                    [/movement_costs]
                [/effect]
                [effect]
                    apply_to=defense
                    replace=yes
                    [defense]
                        frozen=70
                    [/defense]
                [/effect]
            [/object]
        [/modify_unit]

        {DELAY 500}
        {SCROLL_TO 13 26}
        {DELAY 500}
        {SCROLL_TO 30 19}
        {DELAY 500}
        {SCROLL_TO 25 32}
        {DELAY 750}

        {SCROLL_TO 11 8}
        {DELAY 500}
        [unit]
            side=1
            type=Mistral Maiden
            variation=MM2
            canrecruit=no
            x,y=3,3
            [modifications]
                {TRAIT_LOYAL}
            [/modifications]
            name= _ "Talya"
            id=Talya
            unrenamable=yes
            canrecruit=yes
            random_traits=no
            # profile=portraits/talya.png
            animate=yes
            facing=se
        [/unit]
        [unit]
            side=1
            type=Mage
            canrecruit=no
            [modifications]
                {TRAIT_LOYAL}
                {TRAIT_RESILIENT}
            [/modifications]
            x,y=2,3
            animate=yes
            facing=se
            random_gender=yes
        [/unit]
        [unit]
            side=1
            type=Mage
            canrecruit=no
            [modifications]
                {TRAIT_LOYAL}
                {TRAIT_INTELLIGENT}
            [/modifications]
            x,y=3,2
            animate=yes
            facing=se
            random_gender=yes
        [/unit]
        {DELAY 500}
        [message]
            speaker=Esther
            message= _ "(<i>whispers</i>) Looks like we made it just in time."
        [/message]
        [message]
            speaker=Aryel
            message= _ "(<i>whispers</i>) Yeah. Doesn't look like anything good is about to happen."
        [/message]
        {DELAY 500}
        [message]
            speaker=Talya
            message= _ "Marshal Briggs, what a surprise. We were unaware that you would be visiting us today. How can we help you?"
        [/message]
        [message]
            speaker=humanleader124
            message= _ "It has come to our attention that you have been aiding the faerie in their wicked endeavors. The King and the other members of the Council of Magi have ordered for your immediate presence in Caerleon where the status of your rank shall be reviewed and possibly withdrawn. Come quietly and no blood has to be shed."
        [/message]
        [message]
            speaker=Talya
            message= _ "... aiding faerie? Since when have we been forbidden to help the faerie? They have only ever been helpful to us. We most certainly were not notified of any such order."
        [/message]
        [message]
            speaker=humanleader124
            message= _ "You may tell that to the Council during your hearing. Come quietly."
        [/message]
        [message]
            speaker=humanleader123
            message= _ "With all due respect, sir, have you gone mad? There was no such order, and besides, the faerie are our friends-"
        [/message]
        [message]
            speaker=humanleader124
            message= _ "Come now, generals, do you think I am stupid? You may feign ignorance all you like, but fact of the matter is, your faerie allies are arriving right now to help you resist us!"
        [/message]
        [message]
            speaker=humanleader122
            message= _ "They are here of their own volition, not because we called them here!"
        [/message]
        [message]
            speaker=humanleader124
            message= _ "My patience is not endless. I will repeat one more time. Will you come quietly, or will we have to take you in by force?"
        [/message]
        [message]
            speaker=Talya
            message= _ "..."
        [/message]
        [message]
            speaker=humanleader122
            message= _ "..."
        [/message]
        [message]
            speaker=humanleader123
            message= _ "..."
        [/message]
        [message]
            speaker=humanleader124
            message= _ "Then I have my answer."
        [/message]
        [message]
            speaker=Esther
            message= _ "(<i>whispers</i>) Something fishy is going on in Caerleon. Let's try to subdue their leaders and see if we can get any information out of them."
        [/message]
        [message]
            speaker=Aryel
            message= _ "(<i>whispers</i>) Sure, but..."
        [/message]
        [message]
            speaker=Esther
            message= _ "(<i>whispers</i>) Hmmm?"
        [/message]
        [message]
            speaker=Aryel
            message= _ "(<i>looks around</i>) Where's Yumi?"
        [/message]
        [message]
            speaker=Esther
            message= _ "(<i>shrugs</i>) I went to check on her an hour ago - she was sleeping. And she's seemed very tired lately, so I didn't really want to disturb her. I don't think we really need her for this battle, anyway. We can probably handle this ourselves."
        [/message]
        [message]
            speaker=Aryel
            message= _ "(<i>frowns</i>) Maybe, but that's a lot of humans. You sure they won't overrun the fort before we can stop them?"
        [/message]
        [message]
            speaker=Esther
            message= _ "If you're so worried about that, then go distract them by charging into them like you always do."
        [/message]
        [message]
            speaker=Aryel
            message= _ "Hah, you got it."
        [/message]

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

        [objectives]
            {OBJECTIVE_VICTORY  ( _ "Defend Fort Helemoor")}
            {OBJECTIVE_DEFEAT  ( _ "Death of Esther")}
            {OBJECTIVE_DEFEAT  ( _ "Death of Aryel")}
            {OBJECTIVE_DEFEAT  ( _ "Death of Talya")}
            {OBJECTIVE_DEFEAT  ( _ "Death of allied human leaders")}
        [/objectives]
    [/event]

    [event]
        name=recruit
        first_time_only=no
        [filter]
            race=human
            side=2,3,4,5,6
        [/filter]
        [object]
            silent=yes
            [filter]
                x,y=$x1,$y1
            [/filter]
            [effect]
                apply_to=movement_costs
                replace=yes
                [movement_costs]
                    frozen=2
                [/movement_costs]
            [/effect]
            [effect]
                apply_to=defense
                replace=yes
                [defense]
                    frozen=70
                [/defense]
            [/effect]
        [/object]
    [/event]

    [event]
        name=last breath
        [filter]
            id=humanleader123
        [/filter]
        [message]
            speaker=humanleader123
            message= _ "Argh- you fool-"
        [/message]
        [message]
            speaker=humanleader124
            message= _ "You, the fool, die a fool's death for something so meaningless."
        [/message]
        [kill]
            x,y=$x1,$y1
            animate=yes
        [/kill]
        {DELAY 500}
        [if]
            [have_unit]
                id=humanleader122
            [/have_unit]
            [then]
                [message]
                    speaker=Esther
                    message= _ "Not good. We don't want the fort to fall, otherwise we'll have no human allies on our side."
                [/message]
                [message]
                    speaker=Aryel
                    message= _ "Pah, I'm beginning to think the humans are useless anyway. They're dropping dead like flies out there."
                [/message]
                [message]
                    speaker=Esther
                    message= _ "So you'd like to be hounded by both the demons and humans at the same time?"
                [/message]
                [message]
                    speaker=Aryel
                    message= _ "... well, no, that would be unpleasant."
                [/message]
            [/then]
            [else]
                [message]
                    speaker=humanleader124
                    message= _ "Good. That's the last of the traitors. Round up the others. Generals, you will be in charge of their punishment. I must return to Caerleon to report to the Council."
                [/message]
                [message]
                    speaker=humanleader125
                    message= _ "As you order, sir."
                [/message]
                [message]
                    speaker=Aryel
                    message= _ "Rest in pieces, poor meatbags."
                [/message]
                [message]
                    speaker=Esther
                    message= _ "Somehow I feel like this could have gone better..."
                [/message]
                [endlevel]
                    result=defeat
                [/endlevel]
            [/else]
        [/if]
    [/event]

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

        [message]
            speaker=Talya
            message= _ "Wait, I- augh!"
        [/message]
        [message]
            speaker=Esther
            message= _ "Somehow I feel like this could have gone better..."
        [/message]
        [endlevel]
            result=defeat
        [/endlevel]
    [/event]

    [event]
        name=last breath
        [filter]
            id=humanleader122
        [/filter]
        [message]
            speaker=humanleader122
            message= _ "Ugh- I'll never go- alive-"
        [/message]
        [message]
            speaker=humanleader124
            message= _ "Then we'll take you dead."
        [/message]
        [kill]
            x,y=$x1,$y1
            animate=yes
        [/kill]
        {DELAY 500}
        [if]
            [have_unit]
                id=humanleader123
            [/have_unit]
            [then]
                [message]
                    speaker=Esther
                    message= _ "Not good. We don't want the fort to fall, otherwise we'll have no human allies on our side."
                [/message]
                [message]
                    speaker=Aryel
                    message= _ "Pah, I'm beginning to think the humans are useless anyway. They're dropping dead like flies out there."
                [/message]
                [message]
                    speaker=Esther
                    message= _ "So you'd like to be hounded by both the demons and humans at the same time?"
                [/message]
                [message]
                    speaker=Aryel
                    message= _ "... well, no, that would be unpleasant."
                [/message]
            [/then]
            [else]
                [message]
                    speaker=humanleader124
                    message= _ "Good. That's the last of the traitors. Round up the others. Generals, you will be in charge of their punishment. I must return to Caerleon to report to the Council."
                [/message]
                [message]
                    speaker=humanleader125
                    message= _ "As you order, sir."
                [/message]
                [message]
                    speaker=Aryel
                    message= _ "Rest in pieces, poor meatbags."
                [/message]
                [message]
                    speaker=Esther
                    message= _ "Somehow I feel like this could have gone better..."
                [/message]
                [endlevel]
                    result=defeat
                [/endlevel]
            [/else]
        [/if]
    [/event]
    [event]
        name=last breath
        first_time_only=no
        [filter]
            id=humanleader124
        [/filter]
        [filter_condition]
            [variable]
                name=turn_number
                less_than=21
            [/variable]
        [/filter_condition]
        [store_unit]
            [filter]
                x,y=$x1,$y1
            [/filter]
            variable=tmp
        [/store_unit]
        [message]
            speaker=unit
            message= _ "Argh- you treacherous fools- do not think you can... defeat me- so easily."
        [/message]
        [store_gold]
            side=4
            variable=side4gold
        [/store_gold]
        {VARIABLE_OP side4gold add 50}
        [modify_side]
            side=4
            gold=$side4gold
        [/modify_side]
        {CLEAR_VARIABLE side4gold}
        [set_variable]
            name=tmp.hitpoints
            rand=5..10
        [/set_variable]
        [unstore_unit]
            variable=tmp
        [/unstore_unit]
        {CLEAR_VARIABLE tmp}
    [/event]
    [event]
        name=die
        first_time_only=no
        [filter]
            id=humanleader124
        [/filter]
        [filter_condition]
            [variable]
                name=turn_number
                less_than=21
            [/variable]
        [/filter_condition]
        [store_unit]
            [filter]
                x,y=$x1,$y1
            [/filter]
            variable=tmp
        [/store_unit]
        [set_variable]
            name=tmp.hitpoints
            rand=5..10
        [/set_variable]
        [unstore_unit]
            variable=tmp
            find_vacant=yes
        [/unstore_unit]
        [redraw][/redraw]
        {CLEAR_VARIABLE tmp}
    [/event]
    [event]
        name=attack
        first_time_only=yes
        [filter]
            side=2,3
        [/filter]

        [message]
            speaker=humanleader124
            message= _ "You are condemning yourselves to a fate worse than death."
        [/message]
    [/event]
    [event]
        name=attack
        first_time_only=yes
        [filter]
            side=1
            [not]
                id=Aryel
            [/not]
            [and]
                [not]
                    type=Mage
                [/not]
            [/and]
            [and]
                [not]
                    type=Mistral Maiden
                [/not]
            [/and]
        [/filter]

        [message]
            speaker=Talya
            message= _ "You're getting yourselves into our mess, you know."
        [/message]
        [message]
            speaker=Esther
            message= _ "We are aware."
        [/message]
    [/event]
    [event]
        name=attack
        first_time_only=yes
        [filter]
            id=Aryel
        [/filter]

        [message]
            speaker=Aryel
            message= _ "Before we fight, I want to let you know that when you die, I'll make sure to keep your corpse as intact as possible. Makes for prettier servants."
        [/message]
        [message]
            speaker=Esther
            message= _ "Aryel! My goodness."
        [/message]
        [message]
            speaker=Aryel
            message= _ "Haha, just kidding."
        [/message]
    [/event]
    [event]
        name=attack
        first_time_only=yes
        [filter_second]
            id=Aryel
        [/filter_second]

        [message]
            speaker=Aryel
            message= _ "You've got quite the nerve."
        [/message]
    [/event]
    [event]
        name=attack
        first_time_only=yes
        [filter]
            side=2,3
        [/filter]
        [filter_second]
            id=humanleader124
        [/filter_second]

        [message]
            speaker=humanleader124
            message= _ "Good, my blade could use a drink from the blood of traitors."
        [/message]
    [/event]
    [event]
        name=attack
        first_time_only=yes
        [filter]
            side=1
        [/filter]
        [filter_second]
            id=humanleader124
        [/filter_second]

        [message]
            speaker=humanleader124
            message= _ "No matter what power you wield, flesh is flesh. And my sword shall cleave it in two."
        [/message]
        [message]
            speaker=Aryel
            message= _ "Try it."
        [/message]
    [/event]
    [event]
        name=last breath
        first_time_only=yes
        [filter]
            side=4,5,6
            [not]
                id=humanleader124,humanleader125,humanleader126
            [/not]
        [/filter]
        [filter_second]
            id=Aryel
        [/filter_second]

        [message]
            speaker=unit
            message= _ "Arrgh, noooo! It- it burns!"
        [/message]
        [message]
            speaker=Aryel
            message= _ "It does? Great."
        [/message]
        [message]
            speaker=unit
            message= _ "Please! It hurts! It-"
        [/message]
        [message]
            speaker=Aryel
            message= _ "Yes, I'm sure it does."
        [/message]
        [message]
            speaker=Esther
            message= _ "(<i>sighs</i>) Must we go through this every time? Aryel, there's a limit to the fun you can have."
        [/message]
        [message]
            speaker=Aryel
            message= _ "Is there?"
        [/message]
        [message]
            speaker=Esther
            message= _ "I don't understand how you can feed on the pain of others like that. Stop it."
        [/message]
        [message]
            speaker=Aryel
            message= _ "Mkay."
        [/message]
        {DELAY 500}
        [kill]
            x,y=$x1,$y1
            animate=yes
        [/kill]
        {DELAY 500}
        [message]
            speaker=Aryel
            message= _ "Besides, it's not really feeding on their pain. It's more... you know, showing them the error of their ways. For attacking us."
        [/message]
        [message]
            speaker=Esther
            message= _ "Whatever you want to call it."
        [/message]
    [/event]

    [event]
        name=last breath
        first_time_only=yes
        [filter]
            side=4,5,6
            [not]
                id=humanleader124,humanleader125,humanleader126
            [/not]
        [/filter]
        [filter_second]
            id=Talya
        [/filter_second]

        [message]
            speaker=humanleader124
            message= _ "Traitor!"
        [/message]
        [message]
            speaker=Talya
            message= _ "I'm only defending myself!"
        [/message]
    [/event]

    [event]
        name=last breath
        first_time_only=yes
        [filter]
            side=4,5,6
            [not]
                id=humanleader124,humanleader125,humanleader126
            [/not]
        [/filter]
        [filter_second]
            id=Esther
        [/filter_second]

        [message]
            speaker=unit
            message= _ "N-nooo! Spare me!"
        [/message]
        [message]
            speaker=Esther
            message= _ "As much as I would like to, one has to be decisive some times."
        [/message]
        [message]
            speaker=unit
            message= _ "B-but-"
        [/message]
        [kill]
            x,y=$x1,$y1
            animate=yes
        [/kill]
        [message]
            speaker=Aryel
            message= _ "Wow, that was surprisingly cruel, coming from Miss Sunshine."
        [/message]
        [message]
            speaker=Esther
            message= _ "Says you."
        [/message]
        [message]
            speaker=Aryel
            message= _ "(<i>grins</i>)"
        [/message]
    [/event]
    [event]
        name=last breath
        first_time_only=yes
        [filter]
            id=humanleader125
        [/filter]
        [message]
            speaker=unit
            message= _ "I... have failed."
        [/message]
        [message]
            speaker=Aryel
            message= _ "Sure, buddy. Well, now that you've failed so miserably, care to talk? Who's giving these orders? You guys wouldn't be so shamelessly charging into these suicide missions if it was just your king telling you to do it. There's someone or something else behind it."
        [/message]
        [message]
            speaker=unit
            message= _ "As if... I'd tell you anything."
        [/message]
        [message]
            speaker=Aryel
            message= _ "You want to do this the hard way? Fine."
        [/message]
        {FLASH_RED_EXTREME ({DELAY 250})}
        [message]
            speaker=humanleader124
            message= _ "The fool! Kill him quickly!"
        [/message]
        {PLAY_SOUND "throwing-knife.ogg"}
        [harm_unit]
            [filter]
                id=humanleader125
            [/filter]
            amount=0
            animate=yes
        [/harm_unit]
        [kill]
            x,y=$x1,$y1
            animate=yes
        [/kill]
        [message]
            speaker=Aryel
            message= _ "Tch. Annoying pests."
        [/message]
    [/event]
    [event]
        name=last breath
        first_time_only=yes
        [filter]
            id=humanleader126
        [/filter]
        [message]
            speaker=unit
            message= _ "You got me. Congratulations"
        [/message]
        [message]
            speaker=Aryel
            message= _ "Why thank you-"
        [/message]
        [message]
            speaker=unit
            message= _ "But don't think you'll get anything out of me."
        [/message]
        {PLAY_SOUND "throwing-knife.ogg"}
        [harm_unit]
            [filter]
                id=humanleader125
            [/filter]
            amount=0
            animate=yes
        [/harm_unit]
        [kill]
            x,y=$x1,$y1
            animate=yes
        [/kill]
        [message]
            speaker=Aryel
            message= _ "Hmph. Okay then."
        [/message]
    [/event]

    [event]
        name=turn 4
        [message]
            speaker=humanleader124
            message= _ "It seems that they truly intend to resist us. Generals, press the assault."
        [/message]
        [message]
            speaker=humanleader125
            message= _ "Aye."
        [/message]
        [message]
            speaker=humanleader126
            message= _ "Yes, sir!"
        [/message]
        [modify_ai]
            side=4,5,6
            [ai]
                aggression=1
                caution=0
            [/ai]
        [/modify_ai]
        [unit]
            side=4
            generate_name=yes
            type=Iron Mauler
            random_traits=yes
            animate=yes
            upkeep=loyal
            x,y=27,32
        [/unit]
        [unit]
            side=4
            generate_name=yes
            type=Iron Mauler
            random_traits=yes
            animate=yes
            upkeep=loyal
            x,y=24,33
        [/unit]
        [unit]
            side=4
            generate_name=yes
            type=Iron Mauler
            random_traits=yes
            animate=yes
            upkeep=loyal
            x,y=24,30
        [/unit]
        [unit]
            side=5
            generate_name=yes
            type=Iron Mauler
            random_traits=yes
            animate=yes
            upkeep=loyal
            x,y=29,18
        [/unit]
        [unit]
            side=5
            generate_name=yes
            type=Iron Mauler
            random_traits=yes
            animate=yes
            upkeep=loyal
            x,y=29,21
        [/unit]
        [unit]
            side=5
            generate_name=yes
            type=Iron Mauler
            random_traits=yes
            animate=yes
            upkeep=loyal
            x,y=32,19
        [/unit]
        [unit]
            side=6
            generate_name=yes
            type=Iron Mauler
            random_traits=yes
            animate=yes
            upkeep=loyal
            x,y=12,24
        [/unit]
        [unit]
            side=6
            generate_name=yes
            type=Iron Mauler
            random_traits=yes
            animate=yes
            upkeep=loyal
            x,y=12,27
        [/unit]
        [unit]
            side=6
            generate_name=yes
            type=Iron Mauler
            random_traits=yes
            animate=yes
            upkeep=loyal
            x,y=15,26
        [/unit]
        [modify_unit]
            [filter]
                race=human
                side=2,3,4,5,6
            [/filter]
            [object]
                silent=yes
                [filter]
                    x,y=humanunits[$i].x,humanunits[$i].y
                [/filter]
                [effect]
                    apply_to=movement_costs
                    replace=yes
                    [movement_costs]
                        frozen=2
                    [/movement_costs]
                [/effect]
                [effect]
                    apply_to=defense
                    replace=yes
                    [defense]
                        frozen=70
                    [/defense]
                [/effect]
            [/object]
        [/modify_unit]
    [/event]

    [event]
        name=turn 8
        [unit]
            side=4
            generate_name=yes
            id=cavalryleader12
            type=Cavalier
            random_traits=yes
            animate=yes
            upkeep=loyal
            x,y=40,47
        [/unit]
        [unit]
            side=4
            generate_name=yes
            type=Dragoon
            random_traits=yes
            animate=yes
            upkeep=loyal
            x,y=40,48
        [/unit]
        [unit]
            side=4
            generate_name=yes
            type=Dragoon
            random_traits=yes
            animate=yes
            upkeep=loyal
            x,y=41,48
        [/unit]
        [unit]
            side=4
            generate_name=yes
            type=Dragoon
            random_traits=yes
            animate=yes
            upkeep=loyal
            x,y=40,49
        [/unit]
        [unit]
            side=4
            generate_name=yes
            type=Dragoon
            random_traits=yes
            animate=yes
            upkeep=loyal
            x,y=41,49
        [/unit]
        [unit]
            side=4
            generate_name=yes
            type=Dragoon
            random_traits=yes
            animate=yes
            upkeep=loyal
            x,y=40,50
        [/unit]
        [unit]
            side=4
            generate_name=yes
            type=Dragoon
            random_traits=yes
            animate=yes
            upkeep=loyal
            x,y=41,50
        [/unit]
        [modify_unit]
            [filter]
                race=human
                side=2,3,4,5,6
            [/filter]
            [object]
                silent=yes
                [filter]
                    x,y=humanunits[$i].x,humanunits[$i].y
                [/filter]
                [effect]
                    apply_to=movement_costs
                    replace=yes
                    [movement_costs]
                        frozen=2
                    [/movement_costs]
                [/effect]
                [effect]
                    apply_to=defense
                    replace=yes
                    [defense]
                        frozen=70
                    [/defense]
                [/effect]
            [/object]
        [/modify_unit]
        [message]
            speaker=cavalryleader12
            message= _ "At your order, sir."
        [/message]
        [message]
            speaker=humanleader124
            message= _ "Fight to kill. However, take the generals and the mage alive if possible."
        [/message]
        [message]
            speaker=cavalryleader12
            message= _ "As you wish."
        [/message]
        [store_gold]
            side=4
            variable=side4gold
        [/store_gold]
        {VARIABLE_OP side4gold add 75}
        [modify_side]
            side=4
            gold=$side4gold
        [/modify_side]
        {CLEAR_VARIABLE side4gold}
        [store_gold]
            side=5
            variable=side5gold
        [/store_gold]
        {VARIABLE_OP side5gold add 75}
        [modify_side]
            side=5
            gold=$side5gold
        [/modify_side]
        {CLEAR_VARIABLE side5gold}
        [store_gold]
            side=6
            variable=side6gold
        [/store_gold]
        {VARIABLE_OP side6gold add 75}
        [modify_side]
            side=6
            gold=$side6gold
        [/modify_side]
        {CLEAR_VARIABLE side6gold}
    [/event]

    [event]
        name=turn 12
        [unstore_unit]
            variable=yumi
            x,y=41,43
            find_vacant=yes
        [/unstore_unit]
        {CLEAR_VARIABLE yumi}
        [message]
            speaker=Yumi
            message= _ "(<i>blinks sleepily</i>)"
        [/message]
        [message]
            speaker=Aryel
            message= _ "(<i>turns</i>) Yumi! You're awake! What are you doing?"
        [/message]
        [message]
            speaker=Yumi
            message= _ "... helping?"
        [/message]
        [message]
            speaker=Aryel
            message= _ "Well, we're doing fine on our own. You can go back to sleep."
        [/message]
        [message]
            speaker=Yumi
            message= _ "(<i>shudders</i>)"
        [/message]
        [message]
            speaker=Yumi
            message= _ "(<i>whispers</i>) No thank you."
        [/message]
        [message]
            speaker=Aryel
            message= _ "Did you say something?"
        [/message]
        [message]
            speaker=Yumi
            message= _ "No. You don't need to baby me, Aryel. I can fight too."
        [/message]
        [message]
            speaker=Aryel
            message= _ "I don't doubt that, but... <i>hmm, what should I say</i>..?"
        [/message]
        [message]
            speaker=Aryel
            message= _ "Well you don't hold back when you fight so you cause a lot of destruction and- <i>ah that's a terrible excuse</i>... well, nevermind..."
        [/message]
        [message]
            speaker=Yumi
            message= _ "(<i>bites lip</i>) <i>I'm... destructive</i>?"
        [/message]
        [message]
            speaker=narrator
            message= _ "<i>Yes, you are.</i>"
        [/message]
    [/event]

    [event]
        name=turn 13
        [unit]
            side=4
            generate_name=yes
            id=horseleader12
            type=Grand Knight
            random_traits=yes
            animate=yes
            upkeep=loyal
            x,y=40,47
        [/unit]
        [unit]
            side=4
            generate_name=yes
            type=Knight
            random_traits=yes
            animate=yes
            upkeep=loyal
            x,y=40,48
        [/unit]
        [unit]
            side=4
            generate_name=yes
            type=Knight
            random_traits=yes
            animate=yes
            upkeep=loyal
            x,y=41,48
        [/unit]
        [unit]
            side=4
            generate_name=yes
            type=Lancer
            random_traits=yes
            animate=yes
            upkeep=loyal
            x,y=40,49
        [/unit]
        [unit]
            side=4
            generate_name=yes
            type=Lancer
            random_traits=yes
            animate=yes
            upkeep=loyal
            x,y=41,49
        [/unit]
        [unit]
            side=4
            generate_name=yes
            type=Lancer
            random_traits=yes
            animate=yes
            upkeep=loyal
            x,y=40,50
        [/unit]
        [unit]
            side=4
            generate_name=yes
            type=Lancer
            random_traits=yes
            animate=yes
            upkeep=loyal
            x,y=41,50
        [/unit]
        [modify_unit]
            [filter]
                race=human
                side=2,3,4,5,6
            [/filter]
            [object]
                silent=yes
                [filter]
                    x,y=humanunits[$i].x,humanunits[$i].y
                [/filter]
                [effect]
                    apply_to=movement_costs
                    replace=yes
                    [movement_costs]
                        frozen=2
                    [/movement_costs]
                [/effect]
                [effect]
                    apply_to=defense
                    replace=yes
                    [defense]
                        frozen=70
                    [/defense]
                [/effect]
            [/object]
        [/modify_unit]
        [message]
            speaker=horseleader12
            message= _ "At your call."
        [/message]
        [message]
            speaker=humanleader124
            message= _ "Leave none alive."
        [/message]
        [store_gold]
            side=4
            variable=side4gold
        [/store_gold]
        {VARIABLE_OP side4gold add 75}
        [modify_side]
            side=4
            gold=$side4gold
        [/modify_side]
        {CLEAR_VARIABLE side4gold}
        [store_gold]
            side=5
            variable=side5gold
        [/store_gold]
        {VARIABLE_OP side5gold add 75}
        [modify_side]
            side=5
            gold=$side5gold
        [/modify_side]
        {CLEAR_VARIABLE side5gold}
        [store_gold]
            side=6
            variable=side6gold
        [/store_gold]
        {VARIABLE_OP side6gold add 75}
        [modify_side]
            side=6
            gold=$side6gold
        [/modify_side]
        {CLEAR_VARIABLE side6gold}
    [/event]
    [event]
        name=attack
        first_time_only=yes
        [filter]
            id=Yumi
        [/filter]
        [filter_second]
            [not]
                id=humanleader124,humanleader125,humanleader126
            [/not]
        [/filter_second]
        [filter_condition]
            [variable]
                name=turn_number
                greater_than=15
            [/variable]
        [/filter_condition]
        [store_locations]
            x,y=$x2,$y2
            radius=3
            variable=blastradius
        [/store_locations]
        [harm_unit]
            [filter]
                x,y=$x2,$y2
            [/filter]
            [filter_second]
                id=Yumi
            [/filter_second]
            [primary_attack]
                range=ranged
                name=faerie fire
            [/primary_attack]
            [secondary_attack]
                range=ranged
                name=faerie fire
            [/secondary_attack]
            amount=999
            animate=yes
            kill=yes
            fire_event=yes
        [/harm_unit]
        {PLAY_SOUND "magic-dark.ogg"}
        {DELAY 500}
        [message]
            speaker=Yumi
            message= _ "(<i>shudders</i>)"
        [/message]
        {DELAY 750}
        {PLAY_SOUND "magic-dark.ogg"}
        {DELAY 500}
        {PLAY_SOUND "magic-dark-miss.ogg"}
        {DELAY 500}
        {PLAY_SOUND "magic-dark.ogg"}
        {PLAY_SOUND "magic-dark-miss.ogg"}
        {DELAY 250}
        {PLAY_SOUND "magic-dark.ogg"}
        {PLAY_SOUND "magic-dark-big.ogg"}
        {DELAY 250}
        {PLAY_SOUND "magic-dark.ogg"}
        {PLAY_SOUND "magic-dark-big.ogg"}
        {DELAY 250}
        {PLAY_SOUND "magic-dark.ogg"}
        {PLAY_SOUND "magic-dark-miss.ogg"}
        {DELAY 250}
        {PLAY_SOUND "magic-dark.ogg"}
        {PLAY_SOUND "magic-dark-big.ogg"}
        {PLAY_SOUND "magic-faeriefire.ogg"}
        {PLAY_SOUND "magic-faeriefire.ogg"}
        {PLAY_SOUND "fire.ogg"}
        [terrain]
            x,y=$x2,$y2
            radius=3
            terrain=Wwb
        [/terrain]
        [redraw][/redraw]

        [for]
            array=blastradius
            [do]
                [if]
                    [have_unit]
                        x,y=$blastradius[$i].x,$blastradius[$i].y
                        [not]
                            side=1
                        [/not]
                        [and]
                            [not]
                                id=humanleader124,humanleader123,humanleader122,humanleader125,humanleader126
                            [/not]
                        [/and]
                    [/have_unit]
                    [then]
                        [harm_unit]
                            [filter]
                                x,y=$blastradius[$i].x,$blastradius[$i].y
                            [/filter]
                            amount=999
                            animate=yes
                            kill=yes
                            delay=0
                            fire_event=yes
                        [/harm_unit]
                    [/then]
                [/if]
            [/do]
        [/for]
        {CLEAR_VARIABLE blastradius}

        [message]
            speaker=Yumi
            message= _ "(<i>gasps</i>)"
        [/message]
        [message]
            speaker=Aryel
            message= _ "Yumi! What happened?"
        [/message]
        [message]
            speaker=Yumi
            message= _ "(<i>covers face</i>) I-I didn't mean-"
        [/message]
        [message]
            speaker=Aryel
            message= _ "Are you okay?"
        [/message]
        [message]
            speaker=Yumi
            message= _ "I-I couldn't c-control-"
        [/message]
        [message]
            speaker=narrator
            message= _ "<i>You have made that power your own. Are you afraid of it?</i>"
        [/message]
        [message]
            speaker=humanleader124
            message= _ "Form ranks, men! She may just look like a girl, but she's clearly a monster in disguise! These faerie are wicked and deceptive. We will need to employ our full strength to bring them down."
        [/message]
        [message]
            speaker=Yumi
            message= _ "S-sorry-"
        [/message]
        [message]
            speaker=narrator
            message= _ "<i>But truthfully, you are not really sorry about killing them. Otherwise, you wouldn't have used that power.</i>"
        [/message]
        [message]
            speaker=Yumi
            message= _ "(<i>shakes</i>)"
        [/message]
        [message]
            speaker=Esther
            message= _ "Yumi, relax, it's okay. Don't freak out. There's no need to make a big deal out of it. It was a mistake."
        [/message]
        [message]
            speaker=Yumi
            message= _ "(<i>bites lip</i>) <i>It wasn't really...</i>"
        [/message]
        [store_gold]
            side=4
            variable=side4gold
        [/store_gold]
        {VARIABLE_OP side4gold add 100}
        [modify_side]
            side=4
            gold=$side4gold
        [/modify_side]
        {CLEAR_VARIABLE side4gold}
    [/event]
#define DRAW_DARKNESS
        [store_locations]
            variable=blood_hex
            terrain=*
            [not]
                terrain=Gd^Fetd
            [/not]
            [filter_adjacent_location]
                terrain=Woby
                count=1-3
            [/filter_adjacent_location]
        [/store_locations]
        [for]
            array=blood_hex
            [do]
                [set_variable]
                    name=change_terrain
                    rand=1..8
                [/set_variable]
                [if]
                    [variable]
                        name=change_terrain
                        less_than=6
                    [/variable]
                    [then]
                        [terrain]
                             x,y=$blood_hex[$i].x,$blood_hex[$i].y
                            terrain=Woby
                        [/terrain]
                    [/then]
                [/if]
                {CLEAR_VARIABLE change_terrain}
            [/do]
        [/for]
        {CLEAR_VARIABLE blood_hex}
        [store_locations]
            variable=blood_hex
            terrain=*
            [not]
                terrain=Gd^Fetd
            [/not]
            [filter_adjacent_location]
                terrain=Woby
                count=4-6
            [/filter_adjacent_location]
        [/store_locations]
        [for]
            array=blood_hex
            [do]
                [set_variable]
                    name=change_terrain
                    rand=1..30
                [/set_variable]
                [if]
                    [variable]
                        name=change_terrain
                        less_than=6
                    [/variable]
                    [then]
                        [terrain]
                             x,y=$blood_hex[$i].x,$blood_hex[$i].y
                            terrain=Woby
                        [/terrain]
                    [/then]
                [/if]
                {CLEAR_VARIABLE change_terrain}
            [/do]
        [/for]
        {CLEAR_VARIABLE blood_hex}
        [redraw][/redraw]
#enddef
#define DRAW_BLOOD
        [store_locations]
            variable=blood_hex
            terrain=*
            [not]
                terrain=Aa^Fyak,Woby
            [/not]
            [filter_adjacent_location]
                terrain=Wwb
                count=1-2
            [/filter_adjacent_location]
        [/store_locations]
        [for]
            array=blood_hex
            [do]
                [set_variable]
                    name=change_terrain
                    rand=1..10
                [/set_variable]
                [if]
                    [variable]
                        name=change_terrain
                        less_than=6
                    [/variable]
                    [then]
                        [terrain]
                             x,y=$blood_hex[$i].x,$blood_hex[$i].y
                            terrain=Wwb
                        [/terrain]
                        [redraw][/redraw]
                    [/then]
                [/if]
                {CLEAR_VARIABLE change_terrain}
            [/do]
        [/for]
        {CLEAR_VARIABLE blood_hex}
#enddef
#define DRAW_BLOOD_NO_REDRAW
        [store_locations]
            variable=blood_hex
            terrain=*
            [not]
                terrain=Aa^Fyak,Woby
            [/not]
            [filter_adjacent_location]
                terrain=Wwb
                count=1-2
            [/filter_adjacent_location]
        [/store_locations]
        [for]
            array=blood_hex
            [do]
                [set_variable]
                    name=change_terrain
                    rand=1..10
                [/set_variable]
                [if]
                    [variable]
                        name=change_terrain
                        less_than=8
                    [/variable]
                    [then]
                        [terrain]
                             x,y=$blood_hex[$i].x,$blood_hex[$i].y
                            terrain=Wwb
                        [/terrain]
                    [/then]
                [/if]
                {CLEAR_VARIABLE change_terrain}
            [/do]
        [/for]
        {CLEAR_VARIABLE blood_hex}
        [redraw][/redraw]
#enddef
#define DRAW_BLOOD_KILL
        [store_locations]
            variable=blood_hex
            terrain=*
            [not]
                terrain=Aa^Fyak,Woby
            [/not]
            [filter_adjacent_location]
                terrain=Wwb
                count=1-3
            [/filter_adjacent_location]
        [/store_locations]
        [for]
            array=blood_hex
            [do]
                [set_variable]
                    name=change_terrain
                    rand=1..10
                [/set_variable]
                [if]
                    [variable]
                        name=change_terrain
                        less_than=6
                    [/variable]
                    [then]
                        [terrain]
                             x,y=$blood_hex[$i].x,$blood_hex[$i].y
                            terrain=Wwb
                        [/terrain]
                    [/then]
                [/if]
                [if]
                    [have_unit]
                        x,y=$blood_hex[$i].x,$blood_hex[$i].y
                        [not]
                            id=humanleader124,humanleader125,humanleader126,humanleader122,humanleader123
                        [/not]
                        [and]
                            [not]
                                side=1
                            [/not]
                        [/and]
                    [/have_unit]
                    [then]
                        [kill]
                            x,y=$blood_hex[$i].x,$blood_hex[$i].y
                            animate=no
                        [/kill]
                    [/then]
                [/if]
                {CLEAR_VARIABLE change_terrain}
            [/do]
        [/for]
        {CLEAR_VARIABLE blood_hex}
        [redraw][/redraw]
#enddef

    [event]
        name=turn 18

        {INCIDENTAL_MUSIC vengeful.ogg}
        {REPEAT 3 ({QUAKE_FIXED "rumble.ogg"})}
        {DELAY 250}
        [message]
            speaker=Aryel
            message= _ "Uh."
        [/message]
        {REPEAT 2 ({QUAKE_FIXED "rumble.ogg"})}
        {PLAY_SOUND "magic-dark.ogg"}
        {PLAY_SOUND "magic-dark-big.ogg"}
        {REPEAT 2 ({QUAKE_FIXED "rumble.ogg"})}
        {PLAY_SOUND "magic-dark-miss.ogg"}
        {PLAY_SOUND "magic-dark.ogg"}
        {REPEAT 2 ({QUAKE_FIXED "rumble.ogg"})}

        [store_unit]
            [filter]
                side=4-6
                [not]
                    id=humanleader124
                [/not]
            [/filter]
            variable=enemies
        [/store_unit]
        [for]
            array=enemies
            [do]
                [set_variable]
                    name=die
                    rand=1..3
                [/set_variable]
                [if]
                    [variable]
                        name=die
                        numerical_equals=1
                    [/variable]
                    [then]
                        [kill]
                            x,y=$enemies[$i].x,$enemies[$i].y
                            animate=yes
                        [/kill]
                        [terrain]
                            x,y=$enemies[$i].x,$enemies[$i].y
                            terrain=Wwb
                        [/terrain]
                        [redraw][/redraw]
                    [/then]
                [/if]
                {CLEAR_VARIABLE die}
            [/do]
        [/for]
        {CLEAR_VARIABLE enemies}

        [message]
            speaker=Esther
            message= _ "What in the world-"
        [/message]

        {REPEAT 2 ({QUAKE_FIXED "rumble.ogg"})}
        {PLAY_SOUND "magic-dark.ogg"}
        {PLAY_SOUND "magic-dark-big.ogg"}
        {REPEAT 2 ({QUAKE_FIXED "rumble.ogg"})}
        {PLAY_SOUND "magic-dark-miss.ogg"}
        {PLAY_SOUND "magic-dark.ogg"}
        {REPEAT 2 ({QUAKE_FIXED "rumble.ogg"})}

        [store_unit]
            [filter]
                side=4-6
                [not]
                    id=humanleader124,humanleader125,humanleader126
                [/not]
            [/filter]
            variable=enemies
        [/store_unit]
        [for]
            array=enemies
            [do]
                [set_variable]
                    name=die
                    rand=1..3
                [/set_variable]
                [if]
                    [variable]
                        name=die
                        numerical_equals=1
                    [/variable]
                    [then]
                        [terrain]
                            x,y=$enemies[$i].x,$enemies[$i].y
                            terrain=Wwb
                        [/terrain]
                        [redraw][/redraw]
                        [kill]
                            x,y=$enemies[$i].x,$enemies[$i].y
                            animate=yes
                        [/kill]
                    [/then]
                [/if]
                {CLEAR_VARIABLE die}
            [/do]
        [/for]
        {CLEAR_VARIABLE enemies}

        {REPEAT 3 ({QUAKE_FIXED "rumble.ogg"})}
        [message]
            speaker=Yumi
            message= _ "(<i>covers eyes</i>) <i>It's happening...</i>"
        [/message]
        [message]
            speaker=narrator
            message= _ "<i>And there's nothing you can do to stop it.</i>"
        [/message]
        {REPEAT 2 ({QUAKE_FIXED "rumble.ogg"})}
        {REPEAT 2 ({PLAY_SOUND "dragonstick.ogg"})}
        {SCROLL_TO 13 10}
        [store_locations]
            variable=castle_hex
            terrain=Cha,Kha
        [/store_locations]
        [for]
            array=castle_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=$castle_hex[$i].x,$castle_hex[$i].y
                            terrain=Chr
                        [/terrain]
                    [/then]
                [/if]
                {CLEAR_VARIABLE change_terrain}
            [/do]
        [/for]
        {CLEAR_VARIABLE castle_hex}
        [redraw][/redraw]

        [message]
            speaker=Talya
            message= _ "Oh gods! Stay close, I'm going to get us out of here! Let's regroup with the faerie."
        [/message]

        {DELAY 500}

        [hide_unit]
            side=1
            type=Mage
        [/hide_unit]

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

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

        [kill]
            id=Talya
        [/kill]

        [scroll_to]
            x,y=$esther.x,$esther.y
        [/scroll_to]

        [unstore_unit]
            variable=talya
            find_vacant=yes
            x,y=$esther.x,$esther.y
        [/unstore_unit]
        {CLEAR_VARIABLE esther}
        {CLEAR_VARIABLE talya}

        {DELAY 500}
        {DRAW_BLOOD_KILL}
        {DELAY 250}
        {REPEAT 2 ({QUAKE_FIXED "rumble.ogg"})}
        [message]
            speaker=Aryel
            message= _ "Uh, Esther, what do we do?"
        [/message]
        [message]
            speaker=Esther
            message= _ "How should I know?"
        [/message]
        {REPEAT 2 ({PLAY_SOUND "dragonstick.ogg"})}
        [store_unit]
            [filter]
                side=2,3,4,5,6
                [not]
                    id=humanleader122,humanleader123,humanleader124,humanleader125,humanleader126
                [/not]
            [/filter]
            variable=enemies
        [/store_unit]
        [for]
            array=enemies
            [do]
                [set_variable]
                    name=die
                    rand=1..3
                [/set_variable]
                [if]
                    [variable]
                        name=die
                        numerical_equals=1
                    [/variable]
                    [then]
                        [terrain]
                            x,y=$enemies[$i].x,$enemies[$i].y
                            terrain=Wwb
                        [/terrain]
                        [kill]
                            x,y=$enemies[$i].x,$enemies[$i].y
                            animate=no
                        [/kill]
                    [/then]
                [/if]
                {CLEAR_VARIABLE die}
            [/do]
        [/for]
        {CLEAR_VARIABLE enemies}
        [redraw][/redraw]
        {DELAY 250}
        {SCROLL_TO 13 10}
        [store_locations]
            variable=castle_hex
            terrain=Cha,Kha
        [/store_locations]
        [for]
            array=castle_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=$castle_hex[$i].x,$castle_hex[$i].y
                            terrain=Chr
                        [/terrain]
                    [/then]
                [/if]
                {CLEAR_VARIABLE change_terrain}
            [/do]
        [/for]
        {CLEAR_VARIABLE castle_hex}
        [redraw][/redraw]
        {DELAY 500}
        [store_locations]
            variable=castle_hex
            terrain=Chr
        [/store_locations]
        [for]
            array=castle_hex
            [do]
                [terrain]
                     x,y=$castle_hex[$i].x,$castle_hex[$i].y
                    terrain=Wwb
                [/terrain]
            [/do]
        [/for]
        {CLEAR_VARIABLE castle_hex}
        [redraw][/redraw]
        {DELAY 500}

        [message]
            speaker=Yumi
            message= _ "<i>It... hurts...</i>"
        [/message]
        [message]
            speaker=narrator
            message= _ "<i>Such pitiful creatures.</i>"
        [/message]
        {DRAW_BLOOD_KILL}
        {DELAY 250}

        {REPEAT 1 ({QUAKE_FIXED "rumble.ogg"})}
        {PLAY_SOUND "magic-dark.ogg"}
        {PLAY_SOUND "magic-faeriefire.ogg"}
        {PLAY_SOUND "magic-dark-miss.ogg"}
        {PLAY_SOUND "magic-dark-big.ogg"}
        {REPEAT 2 ({QUAKE_FIXED "rumble.ogg"})}
        [message]
            speaker=humanleader125
            message= _ "Oh gods..."
        [/message]
        [message]
            speaker=humanleader123
            message= _ "Ack-"
        [/message]
        [kill]
            id=humanleader123
            animate=yes
        [/kill]
        [kill]
            id=humanleader125
            animate=yes
        [/kill]
        [message]
            speaker=humanleader126
            message= _ "What in blazes-"
        [/message]
        [message]
            speaker=humanleader122
            message= _ "Lords of Light save us..."
        [/message]
        [kill]
            id=humanleader122
            animate=yes
        [/kill]
        [kill]
            id=humanleader126
            animate=yes
        [/kill]
        {DELAY 500}
        [message]
            speaker=Talya
            message= _ "My god. They're all going to die! Can't you two do something about this?"
        [/message]
        {DELAY 300}
        [modify_unit]
            [filter]
                id=Aryel
            [/filter]
            facing=sw
        [/modify_unit]
        {DELAY 300}
        [message]
            speaker=Aryel
            message= _ "I don't know! Esther, do you have any ideas? We can't just sit back and watch them implode."
        [/message]
        {REPEAT 2 ({PLAY_SOUND "dragonstick.ogg"})}
        [message]
            speaker=Esther
            message= _ "Let's focus on staying alive for the moment. Everyone, retreat back to the forests!"
        [/message]
        {REPEAT 2 ({PLAY_SOUND "dragonstick.ogg"})}
        [store_unit]
            [filter]
                side=2,3,4,5,6
                [not]
                    id=humanleader124
                [/not]
            [/filter]
            variable=enemies
        [/store_unit]
        [for]
            array=enemies
            [do]
                [set_variable]
                    name=die
                    rand=1..5
                [/set_variable]
                [if]
                    [variable]
                        name=die
                        less_than=4
                    [/variable]
                    [then]
                        [terrain]
                            x,y=$enemies[$i].x,$enemies[$i].y
                            terrain=Wwb
                        [/terrain]
                        [kill]
                            x,y=$enemies[$i].x,$enemies[$i].y
                            animate=no
                        [/kill]
                    [/then]
                [/if]
                {CLEAR_VARIABLE die}
            [/do]
        [/for]
        {CLEAR_VARIABLE enemies}
        [redraw][/redraw]
        {DELAY 300}
        {REPEAT 2 ({PLAY_SOUND "dragonstick.ogg"})}
        [store_locations]
            variable=castle_hex
            terrain=Chr,Cha,Kha
        [/store_locations]
        [for]
            array=castle_hex
            [do]
                [terrain]
                     x,y=$castle_hex[$i].x,$castle_hex[$i].y
                    terrain=Wwb
                [/terrain]
            [/do]
        [/for]
        {CLEAR_VARIABLE castle_hex}
        [redraw][/redraw]

        {DRAW_BLOOD_NO_REDRAW}
        {DELAY 300}

        [message]
            speaker=humanleader124
            message= _ "You fools! You won't get away with this- I will- I'll-"
        [/message]
        [kill]
            id=humanleader124
            animate=yes
        [/kill]
        [message]
            speaker=Yumi
            message= _ "<i>I can't... stop it.</i>"
        [/message]

        {REPEAT 2 ({PLAY_SOUND "dragonstick.ogg"})}
        [store_unit]
            [filter]
                side=2,3,4,5,6
            [/filter]
            variable=enemies
        [/store_unit]
        [for]
            array=enemies
            [do]
                [set_variable]
                    name=die
                    rand=1..10
                [/set_variable]
                [if]
                    [variable]
                        name=die
                        less_than=8
                    [/variable]
                    [then]
                        [terrain]
                            x,y=$enemies[$i].x,$enemies[$i].y
                            terrain=Wwb
                        [/terrain]
                        [kill]
                            x,y=$enemies[$i].x,$enemies[$i].y
                            animate=no
                        [/kill]
                    [/then]
                [/if]
                {CLEAR_VARIABLE die}
            [/do]
        [/for]
        {CLEAR_VARIABLE enemies}
        {DRAW_BLOOD_NO_REDRAW}
        {DELAY 300}

        [message]
            speaker=Yumi
            message= _ "<i>Everyone's going to die...</i>"
        [/message]
        [message]
            speaker=narrator
            message= _ "<i>It is not picky about its victims.</i>"
        [/message]
        [message]
            speaker=Yumi
            message= _ "<i>Why is this even happening...</i>"
        [/message]
        [message]
            speaker=narrator
            message= _ "<i>Don't you understand? This is your fault.</i>"
        [/message]
        [message]
            speaker=Yumi
            message= _ "..."
        [/message]
        [message]
            speaker=Yumi
            message= _ "<i>I know... so I have to figure out a way to fix this...</i>"
        [/message]
        [message]
            speaker=narrator
            message= _ "<i>It is a pointless effort.</i>"
        [/message]
        [store_unit]
            [filter]
                side=2,3,4,5,6
            [/filter]
            variable=enemies
        [/store_unit]
        [for]
            array=enemies
            [do]
                [terrain]
                    x,y=$enemies[$i].x,$enemies[$i].y
                    terrain=Wwb
                [/terrain]
                [redraw][/redraw]
                [kill]
                    x,y=$enemies[$i].x,$enemies[$i].y
                    animate=yes
                [/kill]
            [/do]
        [/for]
        {CLEAR_VARIABLE enemies}

        [message]
            speaker=Yumi
            message= _ "<i>I need to do something...</i>"
        [/message]
        [message]
            speaker=Aryel
            message= _ "Yumi?"
        [/message]

        [message]
            speaker=Yumi
            message= _ "(<i>eyes glow</i>)"
        [/message]
        [message]
            speaker=Aryel
            message= _ "Yumi, what are you doing?"
        [/message]
        [message]
            speaker=Esther
            message= _ "Yumi, come on! We need to get out of here."
        [/message]
        {REPEAT 2 ({QUAKE_FIXED "magic-faeriefire.ogg"})}
        {SCROLL_TO 2 2}
        [terrain]
            x,y=2,2
            radius=1
            terrain=Woby
        [/terrain]
        [terrain]
            x,y=2,2
            terrain=Gd^Fetd
        [/terrain]
        [redraw][/redraw]
        {DELAY 500}
        {QUAKE_FIXED "magic-faeriefire.ogg"}
        {DRAW_BLOOD_NO_REDRAW}
        {DELAY 300}
        {DRAW_BLOOD_NO_REDRAW}
        {DELAY 300}
        {DRAW_DARKNESS}
        {DELAY 500}
        [message]
            speaker=Talya
            message= _ "Ladies? Everyone else is leaving. Are you two just going to stand there, or..."
        [/message]
        [message]
            speaker=Aryel
            message= _ "I don't know. If we just leave, is this going to keep spreading? There's a chance that if we don't stop it now, we won't be able to later."
        [/message]
        [message]
            speaker=Esther
            message= _ "And do you have any idea how to do that?"
        [/message]
        [message]
            speaker=Aryel
            message= _ "Not really..."
        [/message]
        [message]
            speaker=Esther
            message= _ "Exactly. Our first priority should be making sure that the others - yes, the humans too - are in a safe place. Then, we can come back here and see if we can figure something out."
        [/message]
        {DELAY 500}
        [message]
            speaker=Aryel
            message= _ "But Esther-"
        [/message]
        {DELAY 500}
        [message]
            speaker=Esther
            message= _ "Come on, let's go! Yumi, that means you too!"
        [/message]
        [message]
            speaker=Yumi
            message= _ "(<i>eyes glow brighter</i>)"
        [/message]
        [message]
            speaker=narrator
            message= _ "<i>Yes, let the energy flow through you.</i>"
        [/message]
        {SCROLL_TO 2 2}
        {REPEAT 2 ({QUAKE_FIXED "magic-faeriefire.ogg"})}
        {DRAW_DARKNESS}
        {DELAY 300}
        {DRAW_DARKNESS}
        {DELAY 300}
        [hide_unit]
            side=1
            [not]
                id=Esther,Aryel,Yumi
            [/not]
        [/hide_unit]
        {REPEAT 1 ({QUAKE_FIXED "magic-faeriefire.ogg"})}
        {DRAW_DARKNESS}
        {DELAY 300}
        {DRAW_DARKNESS}
        {DELAY 300}
        {REPEAT 2 ({QUAKE_FIXED "magic-faeriefire.ogg"})}
        [message]
            speaker=Esther
            message= _ "Aryel, come on."
        [/message]
        [message]
            speaker=Aryel
            message= _ "But what about Yumi?"
        [/message]
        {SCROLL_TO 2 2}
        {REPEAT 1 ({QUAKE_FIXED "magic-faeriefire.ogg"})}
        {DRAW_DARKNESS}
        {DELAY 300}
        {DRAW_DARKNESS}
        {DELAY 300}
        {DRAW_DARKNESS}
        {DELAY 300}
        {REPEAT 1 ({QUAKE_FIXED "magic-faeriefire.ogg"})}
        [message]
            speaker=Esther
            message= _ "You don't know what'll happen if that blackness touches you."
        [/message]
        [message]
            speaker=Aryel
            message= _ "But Yumi-"
        [/message]
        [message]
            speaker=Esther
            message= _ "-is usually fine around these kinds of weird things, and she looks like she knows what she's doing. We don't, so let's go back and regroup!"
        [/message]
        [message]
            speaker=Aryel
            message= _ "I mean, yes, but, well... <i>Esther's probably right, but I don't really want to just leave her...</i>"
        [/message]
        [message]
            speaker=Esther
            message= _ "We'll be back to help her in a few minutes, once we get everyone to safety and have a better idea of what's going on, okay?"
        [/message]
        {SCROLL_TO 2 2}
        {REPEAT 1 ({QUAKE_FIXED "magic-faeriefire.ogg"})}
        {DRAW_DARKNESS}
        {DELAY 300}
        {DRAW_DARKNESS}
        {DELAY 300}
        {DRAW_DARKNESS}
        {DELAY 300}
        {REPEAT 1 ({QUAKE_FIXED "magic-faeriefire.ogg"})}
        [message]
            speaker=Aryel
            message= _ "It's fine. You lead everyone away. I'll stay behind."
        [/message]
        [message]
            speaker=Esther
            message= _ "... that's-"
        [/message]
        [message]
            speaker=Esther
            message= _ "Damn it, Aryel. You two are my whole world. You're making it really hard to be responsible right now."
        [/message]
        {SCROLL_TO 2 2}
        {REPEAT 1 ({QUAKE_FIXED "magic-faeriefire.ogg"})}
        {DRAW_DARKNESS}
        {DELAY 300}
        {DRAW_DARKNESS}
        {DELAY 300}
        {REPEAT 1 ({QUAKE_FIXED "magic-faeriefire.ogg"})}
        [move_unit]
            id=Yumi
            to_x,to_y=2,2
        [/move_unit]
        [message]
            speaker=Aryel
            message= _ "... I know. I'm sorry, Esther, but I'm going after her. You take care of the others."
        [/message]
        {SCROLL_TO 2 2}
        {DELAY 500}
        [store_unit]
            [filter]
                id=Yumi
            [/filter]
            variable=yumi_tmp
        [/store_unit]
        [kill]
            id=Yumi
        [/kill]
        {DELAY 500}
        [message]
            speaker=Esther
            message= _ "(<i>takes a deep breath</i>)"
        [/message]
        [message]
            speaker=Esther
            message= _ "I'll be back as quickly as I can. Stay safe. And make sure Yumi does too."
        [/message]
        [message]
            speaker=Aryel
            message= _ "Alright. I'll do my best."
        [/message]
        [hide_unit]
            [filter]
                id=Esther
            [/filter]
        [/hide_unit]
        [move_unit]
            id=Aryel
            to_x,to_y=2,2
        [/move_unit]
        {DELAY 500}
        [hide_unit]
            [filter]
                id=Aryel
            [/filter]
        [/hide_unit]
        {DELAY 500}
        {FADE_SCREEN}
        [unstore_unit]
            variable=yumi_tmp
            find_vacant=yes
        [/unstore_unit]
        [hide_unit]
            [filter]
                id=Yumi
            [/filter]
        [/hide_unit]
        {CLEAR_VARIABLE yumi_tmp}

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

        {DELAY 1000}

        [endlevel]
            result=victory
            {NEW_GOLD_CARRYOVER 100}
            replay_save=no
            carryover_report=no
            linger_mode=no
            next_scenario=13_Blood_Sea
        [/endlevel]
    [/event]
[/scenario]

#undef GENERATE_HILL
#undef GENERATE_FOREST
#undef GENERATE_VILLAGE
#undef GENERATE_MOUNTAIN
#undef GENERATE_SNOW
#undef GENERATE_TEXTURE
#undef DRAW_DARKNESS
#undef DRAW_BLOOD
#undef DRAW_BLOOD_KILL
#undef DRAW_BLOOD_NO_REDRAW