function main:characters/archer/rc/id1/tick
function main:characters/archer/q/id1/tick
function main:characters/archer/weapon/id1/tick
function main:characters/archer/shift/id1/tick
execute unless predicate main:holding/stroke_glove run function main:characters/archer/indicator

function main:settings/stats/attack_speed/calculation {"max":"20"}

#effects
$function main:characters/effects {"character":$(character)}

#weapon
#weapon
execute if score @s first_person matches 1 as @s[predicate=main:holding/firework_star] run function main:characters/archer/weapon
execute as @s[predicate=main:holding/rod,predicate=!main:holding/firework_star] run function main:characters/archer/weapon
execute as @s[predicate=main:holding/nothing] unless entity @e[type=item,nbt={Item:{components:{"minecraft:custom_data":{character:archer}}}}] run function main:characters/archer/weapon
execute as @s[predicate=!main:holding/rod] unless entity @e[type=item,nbt={Item:{components:{"minecraft:custom_data":{character:archer}}}}] run clear @s firework_star
execute if score @s first_person matches 1 run function main:characters/archer/weapon

execute if score .weapon_animation archer matches ..0 if score .rc_animation archer matches ..0 if score .q_animation archer matches ..0 if score .rc_release_animation archer matches ..0 if score .rc_hold_animation archer matches ..0 run function main:characters/archer/animation_stop

execute if score .weapon_animation archer matches 1.. run scoreboard players remove .weapon_animation archer 1
execute if score .rc_animation archer matches 1.. run scoreboard players remove .rc_animation archer 1
execute if score .rc_release_animation archer matches 1.. run scoreboard players remove .rc_release_animation archer 1
execute if score .rc_hold_animation archer matches 1.. run scoreboard players remove .rc_hold_animation archer 1

#hud
execute as @s[scores={q_duration_t=1..}] run item replace entity @s armor.head with leather_helmet[enchantments={levels:{"minecraft:binding_curse":1},show_in_tooltip:false},equippable={asset_id:barrier,equip_sound:"item.armor.equip_leather",slot:"head",camera_overlay:"custom/overlay/pink_crosshair"}] 1

execute as @s[scores={q_duration_t=..0}] run item replace entity @s armor.head with air

#upgrades
execute if entity @s[tag=upgrade_4] run function main:characters/archer/upgrades/id/4/tick

execute if entity @s[tag=upgrade_5] run function main:characters/archer/upgrades/id/5/tick