execute as @e[tag=shade] run scoreboard players add @s time 1

execute as @e[tag=shade,scores={time=14..}] at @s if score @n sanity matches 20.. positioned ~-.5 ~-.5 ~-.5 run damage @n[type=#survivalplus:sentrytarget,dx=0] 3 indirect_magic
execute as @e[tag=shade,scores={time=14..}] at @s if score @n sanity matches -19..-1 positioned ~-.5 ~-.5 ~-.5 run damage @n[type=#survivalplus:sentrytarget,dx=0] 5 indirect_magic
execute as @e[tag=shade,scores={time=14..}] at @s if score @n sanity matches -49..-20 positioned ~-.5 ~-.5 ~-.5 run damage @n[type=#survivalplus:sentrytarget,dx=0] 8 indirect_magic
execute as @e[tag=shade,scores={time=14..}] at @s if score @n sanity matches -75..-50 positioned ~-.5 ~-.5 ~-.5 run damage @n[type=#survivalplus:sentrytarget,dx=0] 12 indirect_magic
execute as @e[tag=shade,scores={time=14..}] at @s if score @n sanity matches -100..-76 positioned ~-.5 ~-.5 ~-.5 run damage @n[type=#survivalplus:sentrytarget,dx=0] 15 indirect_magic
execute as @e[tag=shade,scores={time=14..}] at @s if score @n sanity matches ..-101 positioned ~-.5 ~-.5 ~-.5 run damage @n[type=#survivalplus:sentrytarget,dx=0] 18 indirect_magic

execute as @e[tag=shade,scores={time=14..}] at @s positioned ~-.5 ~-.5 ~-.5 at @n[type=#survivalplus:sentrytarget,dx=0] run particle minecraft:entity_effect{color:[0,0,0,1]} ~ ~ ~ .25 0 .25 0 1
execute as @e[tag=shade,scores={time=14}] run data merge entity @s {shadow_radius:.5f,shadow_strength:1f}
execute as @e[tag=shade,scores={time=15}] run data merge entity @s {shadow_radius:0f,shadow_strength:0f}
execute as @e[tag=shade,scores={time=16..}] run kill @s