scoreboard players add @e[type=ghast,tag=jjc_ghast_gunship_s] jjc_303 1
execute if entity @e[type=ghast,tag=jjc_ghast_gunship_s,scores={jjc_303=1}] run function colosseum_of_fools:ss/ghast/gunship/3

scoreboard players add @e[type=ghast,tag=jjc_ghast_gunship_s] jjc_404 1
execute as @e[type=ghast,tag=jjc_ghast_gunship_s,scores={jjc_404=5}] at @s run summon small_fireball ^4.75 ^1 ^ {Fire:10000s,NoGravity:1b,acceleration_power:0.05d,LeftOwner:0b,Tags:["jjc","jjc_ghast_gunship_j","jjc_ghast_gunship_j0","jjc_ghast_gunship_j_dectected"],acceleration_power:0.1d,Passengers:[{id:"marker",Tags:["jjc_ob_j_m","jjc_ghast_gunship_j_m0","jjc_nov"]}]}
execute as @e[type=ghast,tag=jjc_ghast_gunship_s,scores={jjc_404=5}] at @s run summon small_fireball ^-4.75 ^1 ^ {Fire:10000s,NoGravity:1b,acceleration_power:0.05d,LeftOwner:0b,Tags:["jjc","jjc_ghast_gunship_j","jjc_ghast_gunship_j0","jjc_ghast_gunship_j_dectected"],acceleration_power:0.1d,Passengers:[{id:"marker",Tags:["jjc_ob_j_m","jjc_ghast_gunship_j_m0","jjc_nov"]}]}
execute as @e[type=ghast,tag=jjc_ghast_gunship_s,scores={jjc_404=10}] at @s run summon small_fireball ^3.25 ^1 ^ {Fire:10000s,NoGravity:1b,acceleration_power:0.05d,LeftOwner:0b,Tags:["jjc","jjc_ghast_gunship_j","jjc_ghast_gunship_j0","jjc_ghast_gunship_j_dectected"],acceleration_power:0.1d,Passengers:[{id:"marker",Tags:["jjc_ob_j_m","jjc_ghast_gunship_j_m0","jjc_nov"]}]}
execute as @e[type=ghast,tag=jjc_ghast_gunship_s,scores={jjc_404=10}] at @s run summon small_fireball ^-3.25 ^1 ^ {Fire:10000s,NoGravity:1b,acceleration_power:0.05d,LeftOwner:0b,Tags:["jjc","jjc_ghast_gunship_j","jjc_ghast_gunship_j0","jjc_ghast_gunship_j_dectected"],acceleration_power:0.1d,Passengers:[{id:"marker",Tags:["jjc_ob_j_m","jjc_ghast_gunship_j_m0","jjc_nov"]}]}
scoreboard players reset @e[type=ghast,tag=jjc_ghast_gunship_s,scores={jjc_404=10..}] jjc_404

execute as @e[type=small_fireball,tag=jjc_ghast_gunship_j0] at @s run scoreboard players operation @s jjc_x1 = @n[distance=..200,type=ghast,tag=jjc_ghast_gunship] jjc_x1
execute as @e[type=small_fireball,tag=jjc_ghast_gunship_j0] at @s run scoreboard players operation @s jjc_y1 = @n[distance=..200,type=ghast,tag=jjc_ghast_gunship] jjc_y1
execute as @e[type=small_fireball,tag=jjc_ghast_gunship_j0] at @s run scoreboard players operation @s jjc_z1 = @n[distance=..200,type=ghast,tag=jjc_ghast_gunship] jjc_z1

execute as @e[type=small_fireball,tag=jjc_ghast_gunship_j0] at @s store result score @s jjc_random run random value -15..15
execute as @e[type=small_fireball,tag=jjc_ghast_gunship_j0] at @s store result entity @s Motion[0] double 0.001 run scoreboard players operation @s jjc_x1 += @s jjc_random
execute as @e[type=small_fireball,tag=jjc_ghast_gunship_j0] at @s store result score @s jjc_random run random value -15..15
execute as @e[type=small_fireball,tag=jjc_ghast_gunship_j0] at @s store result entity @s Motion[1] double 0.001 run scoreboard players operation @s jjc_y1 += @s jjc_random
execute as @e[type=small_fireball,tag=jjc_ghast_gunship_j0] at @s store result score @s jjc_random run random value -15..15
execute as @e[type=small_fireball,tag=jjc_ghast_gunship_j0] at @s store result entity @s Motion[2] double 0.001 run scoreboard players operation @s jjc_z1 += @s jjc_random

execute as @e[type=marker,tag=jjc_ghast_gunship_j_m0] at @s run scoreboard players operation @s jjc_damage = @n[distance=..200,type=ghast,tag=jjc_ghast_gunship] jjc_damage
execute as @e[type=small_fireball,tag=jjc_ghast_gunship_j0] at @s run data modify entity @s Owner set from entity @n[distance=..200,type=ghast,tag=jjc_ghast_gunship_s]
execute as @e[type=small_fireball,tag=jjc_ghast_gunship_j0] at @s run playsound entity.ghast.shoot hostile @a[distance=..200] ~ ~ ~ 2 1
tag @e[type=small_fireball,tag=jjc_ghast_gunship_j0] remove jjc_ghast_gunship_j0
tag @e[type=marker,tag=jjc_ghast_gunship_j_m0] remove jjc_ghast_gunship_j_m0
tag @e[type=ghast,tag=jjc_ghast_gunship_s,scores={jjc_303=40..}] remove jjc_ghast_gunship_s
scoreboard players reset @e[type=ghast,tag=jjc_ghast_gunship,scores={jjc_303=40..}] jjc_303