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

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

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

execute if score .weapon_animation gunner matches ..0 if score .shift_animation gunner matches ..0 if score .rc_animation gunner matches ..0 if score .q_animation gunner matches ..0 run function main:mechanics/animation/stop {"frame":8388678}

# execute if score .overclock gunner matches 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/cyan"}] 1
# execute if score .overclock gunner matches 1 run item replace entity @s armor.head with air 1

execute if score .rc_duration gunner matches 1.. run scoreboard players set .gauge_decay gunner 20

execute if score .gauge gunner matches 7.. run scoreboard players set .gauge gunner 6
execute if score .release gunner matches ..0 if score .overclock gunner matches ..0 if score .gauge gunner matches 1.. if score .gauge_decay gunner matches ..0 run scoreboard players remove .gauge gunner 1
execute if score .gauge gunner matches 1.. if score .gauge_decay gunner matches ..0 run scoreboard players set .gauge_decay gunner 20
execute if score .gauge_decay gunner matches 1.. run scoreboard players remove .gauge_decay gunner 1

#overheat
execute if score .overheat gunner matches 1.. at @s anchored eyes run particle dust{color:[1.0,0.5,0.0],scale:0.2} ^-0.25 ^ ^0.25 0.05 0.05 0.05 0.1 1
execute if score .gauge gunner matches ..0 run scoreboard players set .gauge gunner 0

#cd
execute if score .gauge_cd gunner matches 1.. run scoreboard players remove .gauge_cd gunner 1

execute if entity @s[tag=upgrade_9] run function main:characters/gunner/upgrades/id/9/tick