#textdomain wesnoth-low

#define LOW_MAP NAME
    map_data="{campaigns/Legend_of_Wesmere/maps/{NAME}}"
#enddef

#define LOW_MASK_IN_EVENT NAME X Y
    [terrain_mask]
        x={X}
        y={Y}
        mask="{campaigns/Legend_of_Wesmere/masks/{NAME}}"
    [/terrain_mask]
    [redraw]
    [/redraw]
#enddef

#define LOW_MASK NAME X Y
    [event]
        name=prestart
        {LOW_MASK_IN_EVENT {NAME} {X} {Y}}
    [/event]
#enddef

#define WINTER_MASK MASK_NAME
    [event]
        name=prestart
        [terrain_mask]
            x,y=1,1
            mask="{campaigns/Legend_of_Wesmere/masks/{MASK_NAME}}"
            border=yes

            #seems not to work
            #Windmill
            [rule]
                old=Gg^Wm
                new=Aa
                terrain=Aa^Wm
            [/rule]

            #Encampment
            [rule]
                old=Ce
                new=Aa
                terrain=Cea
            [/rule]
            [rule]
                use_old=no
                new=Cea
            [/rule]

            #Encampment Keep
            [rule]
                old=Ke
                new=Aa
                terrain=Kea
            [/rule]
            [rule]
                use_old=no
                new=Kea
            [/rule]

            #human Village
            [rule]
                old=G*^Vh
                new=Aa
                terrain=Aa^Vha
            [/rule]
            [rule]
                old=G*^Vl
                new=Aa
                terrain=Aa^Vla
            [/rule]

            #Orc Village
            [rule]
                old=G*^Vo
                new=Aa
                terrain=Aa^Voa
            [/rule]
            [rule]
                old=H*^Vo
                new=Aa
                terrain=Ha^Voa
            [/rule]

            #   #dessert mountain
            #   [rule]
            #       old=M
            #   [/rule]

            #Orc Castle
            [rule]
                old=Co
                new=Aa
                terrain=Coa
            [/rule]

            #Orc Keep
            [rule]
                old=Ko
                new=Aa
                terrain=Koa
            [/rule]

            #dwarf Village
            [rule]
                old=H*^Vhh
                new=Aa
                terrain=Ha^Vhha
            [/rule]
            [rule]
                old=M*^Vhh
                new=Aa
                terrain=Ms^Vhha
            [/rule]

            #elvish Village
            [rule]
                old=G*^Ve
                new=Aa
                terrain=Aa^Vea
            [/rule]
            #flat hut Village
            [rule]
                old=G*^Vc
                new=Aa
                terrain=Aa^Vca
            [/rule]
            #hill hut Village
            [rule]
                old=H*^Vc
                new=Aa
                terrain=Ha^Vca
            [/rule]
            #forest
            [rule]
                old=G*^Fp
                new=Aa
                terrain=Aa^Fpa
            [/rule]
            #hills
            [rule]
                old=H*
                new=Aa
                terrain=Ha
            [/rule]
            #forested hills
            [rule]
                old=H*^Fp
                new=Aa
                terrain=Ha^Fpa
            [/rule]
            #deciduous forest
            [rule]
                old=G*^Fds
                new=Aa
                terrain=Aa^Fda
            [/rule]
            #deciduous forested hills
            [rule]
                old=H*^Fds
                new=Aa
                terrain=Ha^Fda
            [/rule]

            #water
            [rule]
                old=Ww*^*
                new=Aa
                terrain=Ai
                layer=base
            [/rule]

            # that would brake the balance of S19
            #swamp
            #[rule]
            #    old=Ss
            #    new=Aa
            #    terrain=Ai
            #[/rule]
            #castle
            [rule]
                new=Ce,Ke
            [/rule]
            [rule]
                old=Ce,Ke
                new=Aa^Fpa
            [/rule]
            #mountains
            [rule]
                old=M*
                new=Aa
                terrain=Ms
            [/rule]
            #mountain village
            [rule]
                old=M*^Vhh
                new=Aa
                terrain=Ms^Vhha
            [/rule]

            #Grass
            [rule]
                old=G*,Re,Rd,G*^Efm,Re^Gvs,G*^Em
                new=Aa
                #don't specify terrain and it just uses the new terrain
            [/rule]
            #Grass with obstacles
            [rule]
                old=G*^Es
                new=Aa
                terrain=Aa^Es
            [/rule]

            #Mushroom lichtung
            [rule]
                old=Gs^Uf
                new=Aa
                terrain=Aa
            [/rule]

            #default: Will match everything, since 'old' and 'new' aren't
            #specified. Set 'use_old=yes' to signal no change.
            [rule]
                use_old=yes
            [/rule]
        [/terrain_mask]
    [/event]
#enddef

#define RIVER_FORD X Y
    [event]
        name=prestart
        [sound_source]
            id=river_ford_{X}_{Y}
            #sounds=ambient/river/ford.ogg
            delay=0
            chance=100
            check_fogged=false
            loop=-1
            x={X}
            y={Y}
            full_range=1
            fade_range=4
        [/sound_source]
    [/event]
#enddef

#define RIVER_SLOW X Y
    [event]
        name=prestart
        [sound_source]
            id=river_slow_{X}_{Y}
            #sounds=ambient/river/slow.ogg
            delay=0
            chance=100
            check_fogged=false
            loop=-1
            x={X}
            y={Y}
            full_range=3
            fade_range=5
        [/sound_source]
    [/event]
#enddef

#define RIVER_FAST X Y
    [event]
        name=prestart
        [sound_source]
            id=river_fast_{X}_{Y}
            #sounds=ambient/river/fast.ogg
            delay=0
            chance=100
            check_fogged=false
            loop=-1
            x={X}
            y={Y}
            full_range=2
            fade_range=4
        [/sound_source]
    [/event]
#enddef

#define BIRD_SOUND X Y
    [event]
        name=new turn
        first_time_only=no
        [store_time_of_day]
            variable=time_of_day
        [/store_time_of_day]

        [if]
            [not]
                [variable]
                    name=time_of_day.id
                    equals=first_watch
                [/variable]
                [or]
                    [variable]
                        name=time_of_day.id
                        equals=second_watch
                    [/variable]
                [/or]
            [/not]
            [then]
                [sound_source]
                    id=birds_{X}_{Y}
                    sounds=ambient/birds1.ogg,ambient/birds2.ogg,ambient/birds3.ogg
                    delay=0
                    chance=100
                    check_fogged=false
                    loop=-1
                    x={X}
                    y={Y}
                    full_range=5
                    fade_range=7
                [/sound_source]
            [/then]
            [else]
                [remove_sound_source]
                    id=birds_{X}_{Y}
                [/remove_sound_source]
            [/else]
        [/if]
        {CLEAR_VARIABLE time_of_day}
    [/event]
#enddef
