# Ambient

execute if score ambient map matches 1..2 if score ambient_ticks map matches 2 run playsound ambient_hum1 master @a ~ ~ ~ 99999999999999999

execute if score ambient map matches 3 if score ambient_ticks map matches 2 run playsound ambient_hum2 master @a ~ ~ ~ 99999999999999999

execute if score ambient map matches 1..2 if score ambient_ticks map matches 2 if score randomizer map matches 15 run playsound ambient1 master @a ~ ~ ~ 99999999999999999

execute if score ambient map matches 4 if score ambient_ticks map matches 3 run playsound ap_ambient master @a 266 74 22 1

execute if score ambient map matches 5 if score ambient_ticks map matches 3 run playsound office_ambient master @a ~ ~ ~ 9999999999

execute if score ambient map matches 0 run stopsound @a master ambient_hum1
execute if score ambient map matches 0 run stopsound @a master ambient_hum2
execute if score ambient map matches 0 run stopsound @a master ambient1
execute if score ambient map matches 0 run stopsound @a master ap_ambient
execute if score ambient map matches 0 run stopsound @a master office_ambient


execute if score ambient map matches 2 if score ambient_ticks map matches 2 as @e[type=marker,tag=ambient_weather] at @s run playsound minecraft:weather.rain master @a ~ ~ ~ 0.1 0.0

# Thunder

execute if score ambient map matches 2 if score ambient_ticks map matches 2 if score randomizer map matches 10 at @p if entity @e[type=marker,tag=ambient_weather,distance=..15] run scoreboard players set ambient_thunder map 1

execute if score ambient map matches 2 if score ambient_ticks map matches 2 if score randomizer map matches 20 run playsound minecraft:entity.lightning_bolt.thunder master @a ~ ~ ~ 999999999 0

# Ticks reset
execute if score ambient map matches 5 if score ambient_ticks map matches 80.. run scoreboard players set ambient_ticks map 1
execute if score ambient map matches 4 if score ambient_ticks map matches 80.. run scoreboard players set ambient_ticks map 1
execute if score ambient map matches 3 if score ambient_ticks map matches 30.. run scoreboard players set ambient_ticks map 1
execute if score ambient map matches 1..2 if score ambient_ticks map matches 8.. run scoreboard players set ambient_ticks map 1
execute if score ambient map matches 1..5 run scoreboard players add ambient_ticks map 1


#Randomizer Ambient

execute if score randomizer map matches 0..250 run scoreboard players add randomizer map 1
execute if score randomizer map matches 250.. run scoreboard players set randomizer map 0

# Cleaning Guy
execute if score cleaning_guy ambient matches 7 run playsound minecraft:mop1 master @a 14.3 61 -62.6 0.8 1
execute if score cleaning_guy ambient matches 27 run playsound minecraft:mop2 master @a 14.3 61 -62.6 0.8 1

execute if score cleaning_guy ambient matches 1..68 run scoreboard players add cleaning_guy ambient 1
execute if score cleaning_guy ambient matches 69.. run scoreboard players set cleaning_guy ambient 1

# Photocopier

execute if score photocopier ambient matches 2 run playsound photocopier master @a 26 43 -103 1

execute if score photocopier ambient matches 30 run scoreboard players set photocopier ambient 1
execute if score photocopier ambient matches 1..30 run scoreboard players add photocopier ambient 1

# Ambient Elevator
execute if score elevator_ride ambient matches 1..16 run scoreboard players add elevator_ride ambient 1

execute if score elevator_ride ambient matches 2 run playsound elevator_ride master @a ~ ~ ~ 9999999999
execute if score elevator_ride ambient matches 7 run playsound elevator_ride master @a ~ ~ ~ 9999999999
execute if score elevator_ride ambient matches 13 run playsound elevator_ride master @a ~ ~ ~ 9999999999

execute if score elevator_ride ambient matches 2 as @p at @s run tp @s ~ ~ ~ ~0.5 ~0.5
execute if score elevator_ride ambient matches 4 as @p at @s run tp @s ~ ~ ~ ~-0.5 ~-0.5
execute if score elevator_ride ambient matches 6 as @p at @s run tp @s ~ ~ ~ ~0.5 ~0.5
execute if score elevator_ride ambient matches 8 as @p at @s run tp @s ~ ~ ~ ~0.5 ~0.5
execute if score elevator_ride ambient matches 10 as @p at @s run tp @s ~ ~ ~ ~-0.5 ~-0.5
execute if score elevator_ride ambient matches 12 as @p at @s run tp @s ~ ~ ~ ~-0.5 ~-0.5
execute if score elevator_ride ambient matches 14 as @p at @s run tp @s ~ ~ ~ ~0.5 ~0.5
execute if score elevator_ride ambient matches 16 as @p at @s run tp @s ~ ~ ~ ~-0.5 ~-0.5

execute if score elevator_ride ambient matches 16 run scoreboard players set elevator_ride ambient 1
execute if score elevator_ride ambient matches 0 run stopsound @a master elevator_ride

execute if score elevator_ride ambient matches 20..40 run scoreboard players add elevator_ride ambient 1

execute if score elevator_ride ambient matches 22 run playsound elevator_ride master @a ~ ~ ~ 9999999999
execute if score elevator_ride ambient matches 27 run playsound elevator_ride master @a ~ ~ ~ 9999999999
execute if score elevator_ride ambient matches 33 run playsound elevator_ride master @a ~ ~ ~ 9999999999
execute if score elevator_ride ambient matches 38 run playsound elevator_ride master @a ~ ~ ~ 9999999999

execute if score elevator_ride ambient matches 22 as @p at @s run tp @s ~ ~ ~ ~2.5 ~2.5
execute if score elevator_ride ambient matches 24 as @p at @s run tp @s ~ ~ ~ ~-2.5 ~-2.5
execute if score elevator_ride ambient matches 26 as @p at @s run tp @s ~ ~ ~ ~2.5 ~2.5
execute if score elevator_ride ambient matches 28 as @p at @s run tp @s ~ ~ ~ ~2.5 ~2.5
execute if score elevator_ride ambient matches 30 as @p at @s run tp @s ~ ~ ~ ~-2.5 ~-2.5
execute if score elevator_ride ambient matches 32 as @p at @s run tp @s ~ ~ ~ ~-2.5 ~-2.5
execute if score elevator_ride ambient matches 34 as @p at @s run tp @s ~ ~ ~ ~2.5 ~2.5
execute if score elevator_ride ambient matches 36 as @p at @s run tp @s ~ ~ ~ ~-2.5 ~-2.5
execute if score elevator_ride ambient matches 38 as @p at @s run tp @s ~ ~ ~ ~2.5 ~2.5
execute if score elevator_ride ambient matches 40 as @p at @s run tp @s ~ ~ ~ ~-2.5 ~-2.5

execute if score elevator_ride ambient matches 40 run scoreboard players set elevator_ride ambient 20

# Chase Theme (BGM 3)


execute if score chase_music map matches 365 run scoreboard players set chase_music map 1
execute if score chase_music map matches 1 run playsound bgm3 master @a ~ ~ ~ 99999999999999999999

execute if score chase_music map matches 1..365 run scoreboard players add chase_music map 1

execute if score chase_music map matches 0 run stopsound @a master bgm3

# Footsteps Laura/Random steps

execute if score footsteps map matches 1..5 run scoreboard players add footsteps map 1
execute if score footsteps map matches 5 as @e[tag=laura] at @s run playsound minecraft:block.stone.step master @a ~ ~ ~ 1.85
execute if score footsteps map matches 5 run scoreboard players set footsteps map 1

execute if score footsteps map matches 10..20 run scoreboard players add footsteps map 1
execute if score footsteps map matches 10 as @e[tag=laura] at @s run playsound minecraft:block.stone.step master @a ~ ~ ~ 1.2
execute if score footsteps map matches 20 run scoreboard players set footsteps map 10

# Head hitting Laura
execute if score head_hit map matches 1..46 run scoreboard players add head_hit map 1
execute if score head_hit map matches 10 as @e[tag=laura] at @s run playsound minecraft:head_hit master @a ~ ~ ~ 1.25
execute if score head_hit map matches 47 run scoreboard players set head_hit map 1


# Mass rustle
execute if score mass_rustle map matches 1 as @e[type=item_display,tag=mass] at @s run playsound mass1 master @a ~ ~ ~ 0.25 1
execute if score mass_rustle map matches 1 as @e[type=marker,tag=mass] at @s run playsound mass2 master @a ~ ~ ~ 1.25 1

execute if score mass_rustle map matches 1..40 run scoreboard players add mass_rustle map 1
execute if score mass_rustle map matches 40 run scoreboard players set mass_rustle map 1

# Phone Vibrates in the morning

execute if score phone_wakey map matches 1 as @e[tag=phone_wakey] at @s run playsound phone_vibration master @a ~ ~ ~ 1
execute if score phone_wakey map matches 1 as @e[tag=phone_wakey] at @s run tp @s ~ ~ ~ 165 ~
execute if score phone_wakey map matches 3 as @e[tag=phone_wakey] at @s run tp @s ~ ~ ~ 168 ~
execute if score phone_wakey map matches 5 as @e[tag=phone_wakey] at @s run tp @s ~ ~ ~ 165 ~
execute if score phone_wakey map matches 7 as @e[tag=phone_wakey] at @s run tp @s ~ ~ ~ 168 ~
execute if score phone_wakey map matches 9 as @e[tag=phone_wakey] at @s run tp @s ~ ~ ~ 165 ~
execute if score phone_wakey map matches 11 as @e[tag=phone_wakey] at @s run tp @s ~ ~ ~ 168 ~
execute if score phone_wakey map matches 13 as @e[tag=phone_wakey] at @s run tp @s ~ ~ ~ 165 ~
execute if score phone_wakey map matches 15 as @e[tag=phone_wakey] at @s run tp @s ~ ~ ~ 168 ~
execute if score phone_wakey map matches 18 as @e[tag=phone_wakey] at @s run tp @s ~ ~ ~ 165 ~

execute if score phone_wakey map matches 1..50 run scoreboard players add phone_wakey map 1
execute if score phone_wakey map matches 36 run scoreboard players set phone_wakey map 1


# Banging Door

execute if score banging_door scenes matches 1 run playsound minecraft:entity.zombie.attack_wooden_door master @a 5 43 -79 1.2 0.8
execute if score banging_door scenes matches 15 run playsound minecraft:entity.zombie.attack_wooden_door master @a 5 43 -79 1.2 0.8
execute if score banging_door scenes matches 30 run playsound minecraft:entity.zombie.attack_wooden_door master @a 5 43 -79 1.2 0.8

execute if score banging_door scenes matches 45 run scoreboard players set banging_door scenes 1
execute if score banging_door scenes matches 1..45 run scoreboard players add banging_door scenes 1

# Time

execute if score time map matches 1 run time set 12500
execute if score time map matches 2 run time set 15500

# Stairwell Electric Water

    execute if score electric_water ambient matches 2 run particle crit 14 43.2 -57 0 0 0 0.2 10 force
    execute if score electric_water ambient matches 2 run playsound minecraft:entity.player.hurt_on_fire master @a 14 43.2 -57 0.025 0
    execute if score electric_water ambient matches 2 run setblock 14 43 -57 light[level=5]
    execute if score electric_water ambient matches 2 run data merge entity @e[tag=stairwell_water,limit=1] {item:{id:"minecraft:coal",Count:1b,tag:{CustomModelData:97}}}
    execute if score electric_water ambient matches 7 run setblock 14 43 -57 air
    execute if score electric_water ambient matches 7 run data merge entity @e[tag=stairwell_water,limit=1] {item:{id:"minecraft:coal",Count:1b,tag:{CustomModelData:96}}}
    execute if score electric_water ambient matches 14 run setblock 14 43 -57 light[level=5]
    execute if score electric_water ambient matches 14 run data merge entity @e[tag=stairwell_water,limit=1] {item:{id:"minecraft:coal",Count:1b,tag:{CustomModelData:97}}}
    execute if score electric_water ambient matches 15 run setblock 14 43 -57 air
    execute if score electric_water ambient matches 15 run data merge entity @e[tag=stairwell_water,limit=1] {item:{id:"minecraft:coal",Count:1b,tag:{CustomModelData:96}}}

    execute if score electric_water ambient matches 0 run data merge entity @e[tag=stairwell_water,limit=1] {item:{id:"minecraft:coal",Count:1b,tag:{CustomModelData:96}}}
    execute if score electric_water ambient matches 0 run setblock 14 43 -57 air

    execute if score electric_water ambient matches 16 run scoreboard players set electric_water ambient 1
    execute if score electric_water ambient matches 1..16 run scoreboard players add electric_water ambient 1