scoreboard players set .rc_animation sniper 0
scoreboard players set .shift_animation sniper 0
scoreboard players set .q_animation sniper 0
scoreboard players set .weapon_animation sniper 0
scoreboard players set .q_scoped sniper 125
execute if entity @s[tag=upgrade_6] run function main:characters/sniper/upgrades/id/6/calculation
tag @s add headshot_raycast
scoreboard players remove .shots sniper 1
execute if score .shots sniper matches ..0 run scoreboard players set .reload sniper 20
execute if score .shots sniper matches ..0 run function main:characters/sniper/rc/id1/unscope

execute store result storage sniper damage int 1 run scoreboard players get .q_scoped sniper
#normal
function main:characters/sniper/weapon/id1/damage with storage sniper
playsound minecraft:block.note_block.basedrum master @a ~ ~ ~ 10 0
playsound minecraft:block.note_block.snare master @a ~ ~ ~ 10 0
playsound entity.ender_dragon.hurt master @a ~ ~ ~ 10 0
playsound atmos:cannon_1 master @a ~ ~ ~ 10 1.2 1
playsound atmos:air_release_2 master @a ~ ~ ~ 10 1 1

execute at @s run function main:mechanics/raycast/raycast {"folder_location":"characters/sniper/rc/id1","radius":"~ ~-0.15 ~ 0.1 0.1 0.1 0 2 force","id":id1,"particle_1":ash,"particle_2":"dust{color:[0.0,1.0,0.0],scale:0.5}","distance":600,"type":weapon_scoped,"positioned":"as @e[type=#main:gunner,tag=enemy,dx=0,limit=1] positioned ~-0.05 ~-0.05 ~-0.05 as @s[dx=0] positioned ~-0.9 ~-0.9 ~-0.9 if entity @s[dx=0] positioned ~0.95 ~0.95 ~0.95","character":sniper,"x":"~","y":"~","offset":"","offset_2":"","pierce":1}

execute unless entity @e[type=#main:enemies,tag=enemy,tag=sniper_scoped_hit] at @s run function main:mechanics/raycast/raycast {"folder_location":"characters/sniper/rc/id1","radius":"~ ~-0.15 ~ 0.1 0.1 0.1 0 2 force","id":id1,"particle_1":ash,"particle_2":"dust{color:[0.0,1.0,0.0],scale:0.5}","distance":600,"type":weapon_scoped,"positioned":"positioned ~-0.5 ~-.25 ~-0.5 as @e[type=#main:gunner,tag=enemy,dx=0,limit=1]","character":sniper,"x":"~","y":"~","offset":"","offset_2":"","pierce":1}

execute at @s anchored eyes run function main:mechanics/particles/start {"start":"^ ^ ^","id":id1,"character":sniper,"type":weapon,"transformation":",transformation:[-2.0000f,0.0000f,-0.0000f,0.0000f,0.0000f,2.0000f,0.0000f,1.0000f,0.0000f,0.0000f,-0.1000f,0.9375f,0.0000f,0.0000f,0.0000f,1.0000f]","frames":6}
execute at @s positioned ^ ^0.25 ^2 run function main:particles/circle_small_green {particle:smoke}

#attack speed
function main:settings/stats/attack_speed/calculation {"max":5}
scoreboard players set @s weapon_combo_reset 20
scoreboard players operation @s attack_speed = @s attack_speed_max

function main:mechanics/effects/screenshake/start {duration:4,strength:350}

