execute as @a[predicate=colosseum_of_fools:survive,tag=jjc_p] at @s store result score @s jjc_y0 run data get entity @s Pos[1] 10
execute as @e[type=ghast,tag=jjc_ghast,tag=!jjc_ob,predicate=!colosseum_of_fools:ss/target,nbt=!{active_effects:[{id:"minecraft:unluck",amplifier:97b}]},nbt=!{OnGround:1b}] at @s store result score @s jjc_y0 run data get entity @s Pos[1] 10
execute as @e[type=ghast,tag=jjc_ghast,tag=!jjc_ob,predicate=!colosseum_of_fools:ss/target,nbt=!{active_effects:[{id:"minecraft:unluck",amplifier:97b}]},nbt=!{OnGround:1b}] at @s store result entity @s Motion[1] double -0.005 run scoreboard players operation @s jjc_y0 -= @p[predicate=colosseum_of_fools:survive,tag=jjc_p,distance=..60] jjc_y0

execute if entity @e[type=ghast,tag=jjc_ob] run function colosseum_of_fools:ss/ghast/obbie/1
execute if entity @e[type=ghast,tag=jjc_oblb] run function colosseum_of_fools:ss/ghast/oblobble/1
execute if entity @e[type=ghast,tag=jjc_primal_aspid] run function colosseum_of_fools:ss/ghast/primal_aspid/1
execute if entity @e[type=ghast,tag=jjc_ghast_bomber] run function colosseum_of_fools:ss/ghast/bomber/1
execute if entity @e[type=ghast,tag=jjc_ghast_gunship] run function colosseum_of_fools:ss/ghast/gunship/1

execute as @e[type=ghast,tag=jjc_ghast,predicate=colosseum_of_fools:ss/target] at @s anchored eyes positioned ^ ^ ^ as @n[type=fireball,tag=!jjc_ghast_j_detected,distance=..5] at @s on origin run tag @s[type=ghast,tag=jjc_ghast,predicate=colosseum_of_fools:ss/target] add jjc_ghast_s
execute as @e[type=ghast,tag=jjc_ghast_s] at @s run tag @n[distance=..200,type=fireball,tag=!jjc_ghast_j_detected] add jjc_ghast_j1
execute as @e[type=ghast,tag=jjc_ghast_s] at @s as @n[distance=..200,type=fireball,tag=jjc_ghast_j1] at @s run summon fireball ^ ^ ^ {Fire:10000s,NoGravity:1b,acceleration_power:0.05d,LeftOwner:0b,Tags:["jjc","jjc_ghast_j0","jjc_ghast_j_detected"],acceleration_power:0.1d,Passengers:[{id:"marker",Tags:["jjc_ghast_fireball_m","jjc_ghast_fireball_m0","jjc_nov"]}]}
execute as @e[type=ghast,tag=jjc_ghast_s] at @s run scoreboard players operation @n[distance=..200,type=marker,tag=jjc_ghast_fireball_m0] jjc_damage = @s jjc_damage
execute as @e[type=fireball,tag=jjc_ghast_j0] at @s run data modify entity @s Motion set from entity @n[distance=..200,type=fireball,tag=jjc_ghast_j1] Motion
execute as @e[type=fireball,tag=jjc_ghast_j0] at @s run data modify entity @s Owner set from entity @n[distance=..200,type=fireball,tag=jjc_ghast_j1] Owner
tag @e[type=ghast,tag=jjc_ghast_s] remove jjc_ghast_s
tag @e[type=fireball,tag=jjc_ghast_j0] remove jjc_ghast_j0
tag @e[type=marker,tag=jjc_ghast_fireball_m0] remove jjc_ghast_fireball_m0
kill @e[type=fireball,tag=jjc_ghast_j1]
execute as @e[type=ghast,tag=jjc_ghast,predicate=colosseum_of_fools:ss/target] at @s anchored eyes positioned ^ ^ ^ run tag @n[type=fireball,tag=!jjc_ghast_j_detected,distance=..5] add jjc_ghast_j_detected

execute if entity @e[type=marker,tag=jjc_ob_j_m,predicate=colosseum_of_fools:nov] run function colosseum_of_fools:ss/ghast/obbie/fireball
execute if entity @e[type=marker,tag=jjc_ghast_fireball_m,predicate=colosseum_of_fools:nov] run function colosseum_of_fools:ss/ghast/fireball