# Order matters
execute as @s at @s run function olink:ch1/find_linked
# Disable/enable attack
tag @s remove can_attack
execute at @a[gamemode=!spectator,distance=4..,limit=1] if block ~ ~ ~ #0_enemy_boss:can_tp run tag @s add can_attack

execute if entity @s[tag=!can_attack] run kill @e[tag=sm_point,tag=ch1_olinked]

# Preset score if lower and can't attack
execute if entity @s[tag=can_attack] if score @s EB_next_attack matches ..-1 run scoreboard players set @s EB_next_attack 35
execute if entity @s[tag=!can_attack] if score @s EB_next_attack matches ..34 run scoreboard players set @s EB_next_attack 35


# Smoke Bomb
execute if score @s EB_next_attack matches 1 at @a[gamemode=!spectator,distance=4..,limit=1] run function enemies:elf_assassin/set_sm_point
execute if score @s EB_next_attack matches 0 run function enemies:elf_assassin/disapper
execute if entity @s[nbt=!{ActiveEffects:[{Id:14b}]}] if entity @s[nbt=!{HandItems:[{id:"minecraft:wooden_sword"}]}] run function enemies:elf_assassin/appear
