execute unless entity @s[scores={svm_ep.p.harpie_movement=1}] run clear @s minecraft:elytra[minecraft:custom_data={svm_ep.harpie_wings:1b}]


#SELECTED ABILITY
execute store result score @s svm_ep.selected_ability run data get entity @s SelectedItemSlot
execute as @s[nbt={SelectedItemSlot:0}] run scoreboard players operation @s svm_ep.selected_ability = @s svm_ep.ability0
execute as @s[nbt={SelectedItemSlot:1}] run scoreboard players operation @s svm_ep.selected_ability = @s svm_ep.ability1
execute as @s[nbt={SelectedItemSlot:2}] run scoreboard players operation @s svm_ep.selected_ability = @s svm_ep.ability2
execute as @s[nbt={SelectedItemSlot:3}] run scoreboard players operation @s svm_ep.selected_ability = @s svm_ep.ability3
execute as @s[nbt={SelectedItemSlot:4}] run scoreboard players operation @s svm_ep.selected_ability = @s svm_ep.ability4
execute as @s[nbt={SelectedItemSlot:5}] run scoreboard players operation @s svm_ep.selected_ability = @s svm_ep.ability5
execute as @s[nbt={SelectedItemSlot:6}] run scoreboard players operation @s svm_ep.selected_ability = @s svm_ep.ability6
execute as @s[nbt={SelectedItemSlot:7}] run scoreboard players operation @s svm_ep.selected_ability = @s svm_ep.ability7
execute as @s[nbt={SelectedItemSlot:8}] run scoreboard players operation @s svm_ep.selected_ability = @s svm_ep.ability8


#ITEMS
execute as @s[tag=!svm_ep.power_user,nbt={Inventory:[{Slot:-106b,components:{"minecraft:custom_data":{svm_ep.power_scroll:1b}}}]}] run function svm_ep:items/scroll/held_offhand
execute as @s[tag=svm_ep.power_user,nbt={Inventory:[{Slot:-106b,components:{"minecraft:custom_data":{svm_ep.power_reseter:1b}}}]}] run function svm_ep:items/scroll/held_offhand_reseter
execute as @s[nbt={Inventory:[{Slot:-106b,components:{"minecraft:custom_data":{svm_ep.style_scroll:1b}}}]}] unless entity @s[scores={svm_ep.fighting_style=1..}] run function svm_ep:items/scroll/held_offhand_style
scoreboard players remove @s svm_ep.checked_click 1

execute as @s[nbt={Inventory:[{Slot:-106b,components:{"minecraft:custom_data":{svm_ep.chooser:1b}}}]}] run function svm_ep:items/chooser/choose
execute as @s[nbt={SelectedItem:{components:{"minecraft:custom_data":{svm_ep.chooser:1b}}}}] run function svm_ep:items/chooser/held

execute as @s[scores={svm_ep.jump=1..}] at @s run function svm_ep:player/jump
execute as @s[scores={svm_ep.r.click=1..}] at @s run function svm_ep:player/right_click
execute as @s[scores={svm_ep.shaking=1..}] at @s run function svm_ep:system/shake
execute as @s[scores={svm_ep.fogged=1..}] at @s run function svm_ep:system/fogged_tick
execute as @s[scores={svm_ep.bamblock=1..}] run function svm_ep:items/bamboo/blocking
execute as @s[scores={svm_ep.golden_beetroot_boost=1..}] run function svm_ep:items/golden/beetroot_boost
execute as @s[scores={svm_ep.golden_bone_boost=1..}] run function svm_ep:items/golden/bone_boost
execute as @s[scores={svm_ep.health_boost=1..}] run function svm_ep:items/golden/health_boost
execute as @s[scores={svm_ep.p.flora_junglification=1..}] run function svm_ep:power/flora/junglification/tick
execute if predicate svm_ep:chance/10_percent at @s if dimension svm_ep:pocket positioned ~ ~-0.25 ~ run particle minecraft:dust{color:[1f,0.5f,1f],scale:3f} ~ ~ ~ 1.6 0.05 1.6 0 10

function svm_ep:items/katana/tick
function svm_ep:items/gauntlet/tick
function svm_ep:items/nunchucks/tick
function svm_ep:items/jungle_staff/tick
scoreboard players remove @s[scores={svm_ep.hammer_delay=1..}] svm_ep.hammer_delay 1
scoreboard players remove @s[scores={svm_ep.tengu_delay=1..}] svm_ep.tengu_delay 1
execute as @s[scores={svm_ep.charged_tengu=1..}] at @s run function svm_ep:items/tengu/charged
execute as @s[scores={svm_ep.charged_hammer=1..}] at @s run function svm_ep:items/hammer/charged
execute as @s[scores={svm_ep.check_click=1..}] at @s run function svm_ep:system/click_check/tick

execute at @s as @e[type=item_display,tag=svm_ep.block,distance=..15,tag=!svm_ep.block_ticked] at @s run function svm_ep:block/tick
execute as @s[scores={svm_ep.used_non_power_ability=1..}] run function svm_ep:non_power/cd
execute as @s[scores={svm_ep.using_move=100000..}] run function svm_ep:non_power/using_tick

#UIs
execute as @s[nbt={SelectedItem:{components:{"minecraft:custom_data":{svm_ep.has_power_ability:1b}}}}] run function svm_ep:items/power_ability/held
execute as @s[scores={svm_ep.selected_ability=9998..}] run function svm_ep:non_power/ui
execute unless entity @s[scores={svm_ep.p.silenced=1}] as @s[scores={svm_ep.selected_ability=9900..}] run function svm_ep:non_power/ui
execute unless entity @s[scores={svm_ep.show_mana=1}] unless entity @s[scores={svm_ep.selected_ability=0..9999}] run function svm_ep:power/show_mana
execute as @s[scores={svm_ep.show_mana=1}] unless entity @s[scores={svm_ep.selected_ability=9998..}] run function svm_ep:power/show_mana

#GOLDEN FOOD
execute unless entity @s[scores={svm_ep.golden_hunger_delay=1..}] unless entity @s[nbt={SelectedItem:{components:{"minecraft:custom_data":{svm_ep.golden_steak:1b}}}}] as @s[scores={svm_ep.food=20..},nbt={SelectedItem:{components:{"minecraft:custom_data":{svm_ep.golden_food:1b}}}}] run effect give @s minecraft:hunger 1 125 true

#SHIFTING+SHIFT CLICK
execute unless predicate svm_ep:shift run scoreboard players reset @s svm_ep.shift_time
execute if predicate svm_ep:shift run function svm_ep:player/shifting
scoreboard players remove @s[scores={svm_ep.shifted=1..}] svm_ep.shifted 1


#QUICK EFFECTS
scoreboard players remove @s[scores={svm_ep.clear_slowness=1..}] svm_ep.clear_slowness 1
scoreboard players remove @s[scores={svm_ep.clear_levitation=1..}] svm_ep.clear_levitation 1
scoreboard players remove @s[scores={svm_ep.clear_speed=1..}] svm_ep.clear_speed 1
scoreboard players remove @s[scores={svm_ep.clear_blindness=1..}] svm_ep.clear_blindness 1
scoreboard players remove @s[scores={svm_ep.clear_strength=1..}] svm_ep.clear_strength 1
scoreboard players remove @s[scores={svm_ep.golden_hunger_delay=1..}] svm_ep.golden_hunger_delay 1
effect clear @s[scores={svm_ep.clear_slowness=1}] slowness
effect clear @s[scores={svm_ep.clear_levitation=1}] levitation
effect clear @s[scores={svm_ep.clear_speed=1}] speed
effect clear @s[scores={svm_ep.clear_blindness=1}] blindness
effect clear @s[scores={svm_ep.clear_strength=1}] strength

#MANA
function svm_ep:power/mana_tick

#MANA SLOWER REGEN
scoreboard players remove @s[scores={svm_ep.food=10..,svm_ep.used_move=1..}] svm_ep.used_move 1
scoreboard players set @s[scores={svm_ep.used_move=1200..}] svm_ep.used_move 1200

#DIED
execute as @s[scores={svm_ep.died=1..}] run function svm_ep:player/died



#ATTACKED
execute as @s[tag=player_hurt_entity] run function svm_ep:player/hurt_entity2
