#reset
$tag @e[type=#main:enemies,tag=enemy,tag=$(id)_$(character)_$(type)_projectile_hit] remove $(id)_$(character)_$(type)_projectile_hit
$scoreboard objectives remove $(id)_$(character)_$(type)_hit_cooldown
$scoreboard objectives add $(id)_$(character)_$(type)_hit_cooldown dummy
scoreboard objectives remove pierced
scoreboard objectives add pierced dummy

$data modify storage projectile_data $(id)_$(character)_$(type).id set value '$(id)'
$data modify storage projectile_data $(id)_$(character)_$(type).character set value '$(character)'
$data modify storage projectile_data $(id)_$(character)_$(type).type set value '$(type)'
$data modify storage projectile_data $(id)_$(character)_$(type).translation set value '$(translation)'
$data modify storage projectile_data $(id)_$(character)_$(type).size set value '$(size)'
$data modify storage projectile_data $(id)_$(character)_$(type).texture set value '$(texture)'
$data modify storage projectile_data $(id)_$(character)_$(type).distance set value '$(distance)'
$data modify storage projectile_data $(id)_$(character)_$(type).x set value '$(x)'
$data modify storage projectile_data $(id)_$(character)_$(type).y set value '$(y)'
$data modify storage projectile_data $(id)_$(character)_$(type).angle_1 set value '$(angle_1)'
$data modify storage projectile_data $(id)_$(character)_$(type).angle_2 set value '$(angle_2)'
$data modify storage projectile_data $(id)_$(character)_$(type).pierce set value '$(pierce)'
$data modify storage projectile_data $(id)_$(character)_$(type).tags set value '$(tags)'
$data modify storage projectile_data $(id)_$(character)_$(type).position set value '$(position)'

#summon a projectile
$execute at @s run function main:mechanics/projectile/projectile_summon with storage projectile_data $(id)_$(character)_$(type)

#vfx
execute at @s anchored eyes positioned ^ ^ ^ run particle large_smoke ^-1 ^-0.1 ^3 0.1 0.1 0.1 0 1 force

execute if entity @a[tag=!game_started] run return fail
scoreboard players add .projectiles_shot progression 1