# Create marker
summon area_effect_cloud ^ ^ ^.22 {Tags:["ic_ray","obj","init","unspellable","mrcd_bullet"],Duration:10}

# Save speed and direction
execute as @e[tag=ic_ray,tag=init,limit=1] store result score @s mrcd_x0 run data get entity @s Pos[0] 1000
execute as @e[tag=ic_ray,tag=init,limit=1] store result score @s mrcd_y0 run data get entity @s Pos[1] 1000
execute as @e[tag=ic_ray,tag=init,limit=1] store result score @s mrcd_z0 run data get entity @s Pos[2] 1000

execute store result score #var0 mrcd_system run data get entity @s Pos[0] 1000
execute store result score #var1 mrcd_system run data get entity @s Pos[1] 1000
execute store result score #var2 mrcd_system run data get entity @s Pos[2] 1000

scoreboard players operation @e[tag=ic_ray,tag=init,limit=1] mrcd_x0 -= #var0 mrcd_system
scoreboard players operation @e[tag=ic_ray,tag=init,limit=1] mrcd_y0 -= #var1 mrcd_system
scoreboard players operation @e[tag=ic_ray,tag=init,limit=1] mrcd_z0 -= #var2 mrcd_system

tp @e[tag=ic_ray,tag=init,limit=1] ~ ~ ~ ~ ~

# Clear tag
tag @e[tag=ic_ray,tag=init,limit=1] remove init


scoreboard players remove p_circle tmp 1
execute if score p_circle tmp matches 0.. rotated ~18 0 run function items:obj/ice_circle/summon_loop
