scoreboard players remove @s generic_timer2 1

tag @s add collide_temp
execute at @s as @e[type=player,tag=!spectator,distance=..16] unless score @s real_ID = @n[type=marker,tag=collide_temp] real_ID unless score @s ctf_ID = @n[type=marker,tag=collide_temp] ctf_ID run tag @s add magic_missile_target
execute at @s anchored eyes facing entity @e[tag=magic_missile_target,tag=!spectator,distance=..16,sort=nearest,limit=1] eyes positioned ^ ^ ^0.04 rotated as @s positioned ^ ^ ^5 facing entity @s eyes facing ^ ^ ^-1 positioned as @s run tp @s ^ ^ ^0.001 ~ ~
execute at @s run tp @s ^ ^ ^0.035
execute at @s positioned ~ ~-1 ~ as @e[type=!#pctf:cannot_be_hit,distance=..2] unless score @s ctf_ID = @n[type=marker,tag=collide_temp] ctf_ID as @n[type=marker,tag=collide_temp] at @s run function pctf:logic/items/scrolls/magic_missile/detonate
tag @s remove collide_temp
tag @e[tag=magic_missile_target] remove magic_missile_target

execute at @s unless block ~ ~ ~ #pctf:projectile_pass run function pctf:logic/items/scrolls/magic_missile/detonate
execute at @s run function pctf:logic/items/scrolls/magic_missile/fx

function pctf:logic/items/scrolls/collide_check

execute if score @s generic_timer2 matches 1.. run function pctf:logic/items/scrolls/magic_missile/loop