scoreboard players add @e[type=marker,tag=scrubber] catalyst_death 1

execute as @e[type=marker,tag=scrubber] at @s if block ~ ~ ~ kubejs:sculk_scrubber if score @s catalyst_death matches 50.. run setblock ~ ~ ~ kubejs:sculked_sculk_scrubber

execute as @e[type=marker,tag=scrubber] at @s if block ~ ~ ~ kubejs:sculk_scrubber if score @s catalyst_death matches 1 run playsound minecraft:entity.warden.death master @a ~ ~ ~ 1 0
execute as @e[type=marker,tag=scrubber] at @s if block ~ ~ ~ kubejs:sculk_scrubber if score @s catalyst_death matches 1 run playsound minecraft:block.respawn_anchor.charge master @a ~ ~ ~ 1 0
execute as @e[type=marker,tag=scrubber] at @s if block ~ ~ ~ kubejs:sculk_scrubber if score @s catalyst_death matches 1 run particle minecraft:sonic_boom ~ ~ ~ 0 0 0 0.1 1 force

execute as @e[type=marker,tag=scrubber] at @s if block ~ ~ ~ kubejs:sculked_sculk_scrubber if score @s catalyst_death matches 50 run function backrooms:sculk_scrubber_step_1
execute as @e[type=marker,tag=scrubber] at @s if block ~ ~ ~ kubejs:sculked_sculk_scrubber if score @s catalyst_death matches 100 run function backrooms:sculk_scrubber_step_2
execute as @e[type=marker,tag=scrubber] at @s if block ~ ~ ~ kubejs:sculked_sculk_scrubber if score @s catalyst_death matches 150 run function backrooms:sculk_scrubber_step_3
execute as @e[type=marker,tag=scrubber] at @s if block ~ ~ ~ kubejs:sculked_sculk_scrubber if score @s catalyst_death matches 200 run function backrooms:sculk_scrubber_step_4
execute as @e[type=marker,tag=scrubber] at @s if block ~ ~ ~ kubejs:sculked_sculk_scrubber if score @s catalyst_death matches 250 run function backrooms:sculk_scrubber_step_5

execute as @e[type=marker,tag=scrubber] at @s if score @s catalyst_death matches 300.. run playsound minecraft:block.respawn_anchor.deplete master @a ~ ~ ~ 1 0
execute as @e[type=marker,tag=scrubber] at @s if score @s catalyst_death matches 300.. run kill @s

#execute as @e[type=marker,tag=scrubber] at @s if score @s catalyst_death matches ..49 unless block ~ ~ ~ kubejs:sculk_scrubber run playsound minecraft:block.respawn_anchor.deplete master @a ~ ~ ~ 1 0
execute as @e[type=marker,tag=scrubber] at @s if score @s catalyst_death matches ..49 unless block ~ ~ ~ kubejs:sculk_scrubber run kill @s
execute as @e[type=marker,tag=scrubber] at @s if score @s catalyst_death matches 50.. unless block ~ ~ ~ kubejs:sculked_sculk_scrubber run playsound minecraft:block.respawn_anchor.deplete master @a ~ ~ ~ 1 0
execute as @e[type=marker,tag=scrubber] at @s if score @s catalyst_death matches 50.. unless block ~ ~ ~ kubejs:sculked_sculk_scrubber run kill @s