execute at @s run fill ~-5 ~-3 ~-5 ~5 ~3 ~5 air replace basalt

execute at @s run tag @a[limit=1,sort=random,distance=..100,tag=CadeyrnFightTag,gamemode=!spectator,tag=!ShotAtFBall] add ShootAtMeFBall

execute store result score @s PosX run data get entity @s Pos[0]
execute store result score @s PosY run data get entity @s Pos[1]
execute store result score @s PosZ run data get entity @s Pos[2]

execute store result score @s PosXTemp run data get entity @p[tag=ShootAtMeFBall,tag=!ShotAtFBall] Pos[0]
execute store result score @s PosYTemp run data get entity @p[tag=ShootAtMeFBall,tag=!ShotAtFBall] Pos[1]
execute store result score @s PosZTemp run data get entity @p[tag=ShootAtMeFBall,tag=!ShotAtFBall] Pos[2]

scoreboard players operation @s PosXTemp -= @s PosX
scoreboard players operation @s PosYTemp -= @s PosY
scoreboard players operation @s PosZTemp -= @s PosZ


execute at @s run execute if entity @p[tag=ShootAtMeFBall,distance=..15] run execute store result entity @s direction[0] double 0.013 run scoreboard players get @s PosXTemp
execute at @s run execute if entity @p[tag=ShootAtMeFBall,distance=..15] run execute store result entity @s direction[1] double 0.013 run scoreboard players get @s PosYTemp
execute at @s run execute if entity @p[tag=ShootAtMeFBall,distance=..15] run execute store result entity @s direction[2] double 0.013 run scoreboard players get @s PosZTemp

execute at @s run execute if entity @p[tag=ShootAtMeFBall,distance=15..25] run execute store result entity @s direction[0] double 0.011 run scoreboard players get @s PosXTemp
execute at @s run execute if entity @p[tag=ShootAtMeFBall,distance=15..25] run execute store result entity @s direction[1] double 0.011 run scoreboard players get @s PosYTemp
execute at @s run execute if entity @p[tag=ShootAtMeFBall,distance=15..25] run execute store result entity @s direction[2] double 0.011 run scoreboard players get @s PosZTemp

execute at @s run execute if entity @p[tag=ShootAtMeFBall,distance=25..35] run execute store result entity @s direction[0] double 0.009 run scoreboard players get @s PosXTemp
execute at @s run execute if entity @p[tag=ShootAtMeFBall,distance=25..35] run execute store result entity @s direction[1] double 0.009 run scoreboard players get @s PosYTemp
execute at @s run execute if entity @p[tag=ShootAtMeFBall,distance=25..35] run execute store result entity @s direction[2] double 0.009 run scoreboard players get @s PosZTemp

execute at @s run execute if entity @p[tag=ShootAtMeFBall,distance=35..] run execute store result entity @s direction[0] double 0.007 run scoreboard players get @s PosXTemp
execute at @s run execute if entity @p[tag=ShootAtMeFBall,distance=35..] run execute store result entity @s direction[1] double 0.007 run scoreboard players get @s PosYTemp
execute at @s run execute if entity @p[tag=ShootAtMeFBall,distance=35..] run execute store result entity @s direction[2] double 0.007 run scoreboard players get @s PosZTemp
#scoreboard players set @s PosXTemp 30
#scoreboard players set @s PosYTemp 30
#scoreboard players set @s PosZTemp 30

execute at @s run execute if entity @p[tag=ShootAtMeFBall,distance=..15] run execute store result entity @s power[0] double 0.013 run scoreboard players get @s PosXTemp
execute at @s run execute if entity @p[tag=ShootAtMeFBall,distance=..15] run execute store result entity @s power[1] double 0.013 run scoreboard players get @s PosYTemp
execute at @s run execute if entity @p[tag=ShootAtMeFBall,distance=..15] run execute store result entity @s power[2] double 0.013 run scoreboard players get @s PosZTemp

execute at @s run execute if entity @p[tag=ShootAtMeFBall,distance=15..25] run execute store result entity @s power[0] double 0.011 run scoreboard players get @s PosXTemp
execute at @s run execute if entity @p[tag=ShootAtMeFBall,distance=15..25] run execute store result entity @s power[1] double 0.011 run scoreboard players get @s PosYTemp
execute at @s run execute if entity @p[tag=ShootAtMeFBall,distance=15..25] run execute store result entity @s power[2] double 0.011 run scoreboard players get @s PosZTemp

execute at @s run execute if entity @p[tag=ShootAtMeFBall,distance=25..35] run execute store result entity @s power[0] double 0.009 run scoreboard players get @s PosXTemp
execute at @s run execute if entity @p[tag=ShootAtMeFBall,distance=25..35] run execute store result entity @s power[1] double 0.009 run scoreboard players get @s PosYTemp
execute at @s run execute if entity @p[tag=ShootAtMeFBall,distance=25..35] run execute store result entity @s power[2] double 0.009 run scoreboard players get @s PosZTemp

execute at @s run execute if entity @p[tag=ShootAtMeFBall,distance=35..] run execute store result entity @s power[0] double 0.007 run scoreboard players get @s PosXTemp
execute at @s run execute if entity @p[tag=ShootAtMeFBall,distance=35..] run execute store result entity @s power[1] double 0.007 run scoreboard players get @s PosYTemp
execute at @s run execute if entity @p[tag=ShootAtMeFBall,distance=35..] run execute store result entity @s power[2] double 0.007 run scoreboard players get @s PosZTemp



#execute at @e[type=wither_skeleton,tag=MovingSkele,limit=1,sort=nearest,tag=LaunchMe,tag=!Launched] run playsound minecraft:entity.player.breath hostile @a ~ ~ ~ 10 1 1
tag @a[tag=ShootAtMeFBall] add ShotAtFBall

tag @s add FBallLaunched


