give @s echo_shard[custom_data={class_ability_item:1b},custom_name='{"color":"red","italic":false,"text":"Class Ability: Hunter Stance"}',consumable={consume_seconds:0,sound:"block.vault.insert_item_fail",has_consume_particles:false,on_consume_effects:[{type:"minecraft:play_sound",sound:"minecraft:block.vault.insert_item"}]},use_cooldown={seconds:1},enchantment_glint_override=true]

# Exit Hunter Stance
execute if entity @s[tag=hunter_stance_active] run tag @s add hunter_stance_was_active
execute if entity @s[tag=hunter_quick_shot_active] run kill @e[type=interaction,tag=hunter_stance_interaction,limit=1,sort=nearest]
execute run tag @s[tag=hunter_stance_was_active] remove hunter_stance_active
execute run tag @s[tag=hunter_stance_was_active] remove hunter_power_shot_active
execute run tag @s[tag=hunter_stance_was_active] remove hunter_quick_shot_active
execute if entity @s[tag=hunter_stance_was_active] run particle dust_plume ~ ~1 ~ 0.7 0.8 0.7 0 80
execute if entity @s[tag=hunter_stance_was_active] run playsound minecraft:block.vault.insert_item master @a[distance=..24] ~ ~ ~ 1 2
execute if entity @s[tag=hunter_stance_was_active] run attribute @s movement_speed modifier remove hunter_power_shot_mov_speed
execute if entity @s[tag=hunter_stance_was_active] run attribute @s jump_strength modifier remove hunter_power_shot_jump_strength

# Enter Hunter Stance
execute run tag @s[tag=!hunter_stance_was_active] add hunter_stance_active
execute if predicate kiwi3:player_sneak run tag @s[tag=!hunter_stance_was_active] add hunter_power_shot_active
execute unless predicate kiwi3:player_sneak run tag @s[tag=!hunter_stance_was_active] add hunter_quick_shot_active
execute store result storage kiwi:hunter_mastery_level_current x int 1 run scoreboard players get @s hunters_mastery_level_current
execute if entity @s[tag=!hunter_stance_was_active] run function kiwi2:upgrades/classes/hunter/hunter_class_ability_kill_current_arrows with storage kiwi:hunter_mastery_level_current

# Power Shot
execute if entity @s[tag=!hunter_stance_was_active,tag=hunter_power_shot_active] run particle dust_color_transition{from_color:[1, 0, 0],to_color:[0.5, 0.0, 0.0],scale:1} ~ ~1 ~ 0.7 0.8 0.7 0 80
execute if entity @s[tag=!hunter_stance_was_active,tag=hunter_power_shot_active] run playsound minecraft:item.mace.smash_air master @a[distance=..24] ~ ~ ~ 1 2
execute if entity @s[tag=!hunter_stance_was_active,tag=hunter_power_shot_active] run particle dust_pillar{block_state:dirt} ~ ~1 ~ 2 1 2 0 80
execute if entity @s[tag=!hunter_stance_was_active,tag=hunter_power_shot_active] run attribute @s movement_speed modifier add hunter_power_shot_mov_speed -1 add_multiplied_total
execute if entity @s[tag=!hunter_stance_was_active,tag=hunter_power_shot_active] run attribute @s jump_strength modifier add hunter_power_shot_jump_strength -1 add_multiplied_total

# Quick Shot
execute if entity @s[tag=!hunter_stance_was_active,tag=hunter_quick_shot_active] run particle dust_color_transition{from_color:[1, 1, 0],to_color:[0.5, 0.5, 0.0],scale:1} ~ ~1 ~ 0.7 0.8 0.7 0 80
execute if entity @s[tag=!hunter_stance_was_active,tag=hunter_quick_shot_active] run playsound minecraft:block.vault.open_shutter master @a[distance=..24] ~ ~ ~ 1 2
execute if entity @s[tag=!hunter_stance_was_active,tag=hunter_quick_shot_active] run particle cloud ~ ~0.1 ~ 0 0 0 0.5 80
execute if entity @s[tag=!hunter_stance_was_active,tag=hunter_quick_shot_active] run scoreboard players add world hunter_stance_identifier 1
execute if entity @s[tag=!hunter_stance_was_active,tag=hunter_quick_shot_active] run summon interaction ~ ~ ~ {height:3,width:3,Tags:["hunter_stance_interaction"]}
execute store result score @s[tag=!hunter_stance_was_active,tag=hunter_quick_shot_active] hunter_stance_identifier run scoreboard players get world hunter_stance_identifier
execute store result score @n[type=interaction,tag=hunter_stance_interaction,limit=1,sort=nearest] hunter_stance_identifier run scoreboard players get world hunter_stance_identifier
execute run tag @s remove hunter_stance_was_active