function main:characters/knight/rc/id1/tick
function main:characters/knight/q/id1/tick
function main:characters/knight/weapon/id1/tick
function main:characters/knight/shift/id1/tick

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

#weapon
execute as @s[predicate=main:holding/nothing] run function main:characters/knight/weapon

#energy
execute if score @s knight matches ..-1 run scoreboard players set @s knight 0
execute if score .cooldown knight matches 1.. run scoreboard players remove .cooldown knight 1

execute if score .cooldown knight matches ..0 if score .cooldown_1 knight matches 4.. run scoreboard players set .cooldown_1 knight 0
execute if score .cooldown knight matches ..0 if score .cooldown_1 knight matches ..4 run scoreboard players add .cooldown_1 knight 1
execute if score .cooldown knight matches ..0 if score .cooldown_1 knight matches 4.. if score @s knight matches 1.. run scoreboard players remove @s knight 1

execute if score @s knight matches 101.. run scoreboard players set @s knight 100
execute as @s[scores={knight=..24},predicate=main:holding/rod] run function main:settings/indicator {"font":"minecraft:ui","indicator":"\\uE075","color":"#4e5c24"}
execute as @s[scores={knight=25..},predicate=main:holding/rod] run function main:settings/indicator {"font":"minecraft:ui","indicator":"\\uE076","color":"#4e5c24"}
execute as @s[scores={knight=50..},predicate=main:holding/rod] run function main:settings/indicator {"font":"minecraft:ui","indicator":"\\uE077","color":"#4e5c24"}
execute as @s[scores={knight=75..},predicate=main:holding/rod] run function main:settings/indicator {"font":"minecraft:ui","indicator":"\\uE078","color":"#4e5c24"}
execute as @s[scores={knight=100..},predicate=main:holding/rod] run function main:settings/indicator {"font":"minecraft:ui","indicator":"\\uE079","color":"#4e5c24"}

#hud
execute as @s[scores={knight=100..}] 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/yellow"}] 1

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