### Actual upgrade
scoreboard players operation @s es.scavepspent += @s es.epmath
scoreboard players operation @s es.essence_scav -= @s es.epmath
scoreboard players operation @s es.potential -= @s es.epmath
execute if score @s es.upstate matches 1 run scoreboard players set @s es.scav1owned 1
execute if score @s es.upstate matches 2 run scoreboard players set @s es.scav1owned 5
execute if score @s es.upstate matches 3 run scoreboard players set @s es.scav1owned 10
execute if score @s es.upstate matches 4 run scoreboard players set @s es.scav1owned 20
execute if score @s es.upstate matches 5 run scoreboard players set @s es.scav1owned 35
execute if score @s es.upstate matches 6 run scoreboard players set @s es.scav1owned 50

### Chat Menu
#tellraw @s {"text":" "}
#tellraw @s ["",{"text":"----------[Upgrade Progress]----------\nYou have "},{"score":{"name":"@s","objective":"es.scav1owned"},"bold":true,"italic":true,"color":"green"},{"text":"00 points","bold":true,"italic":true,"color":"green"},{"text":" in this imbuement."}]
#tellraw @s[scores={es.potential=1..}] ["",{"text":"You can spend "},{"score":{"name":"@s","objective":"es.potential"},"bold":true,"italic":true,"color":"gold"},{"text":" more EP","bold":true,"italic":true,"color":"gold"},{"text":" before reaching your potential."}]
#tellraw @s ["",{"text":"[Imbue more Speed]","bold":true,"italic":true,"color":"gold","clickEvent":{"action":"run_command","value":"/trigger es.epbuy set 7"}},{"text":" ("},{"score":{"name":"@s","objective":"es.essence_scav"},"bold":true,"italic":true,"color":"scav"},{"text":" EP left)"}]

### Audiovisual
execute at @s run particle dust 0.1 1.0 0.1 3 ~ ~1 ~
execute at @s run playsound minecraft:block.end_portal_frame.fill master @a
execute at @s run particle minecraft:witch ~ ~ ~ 0 0 0 0.001 1000 normal
execute at @s run playsound minecraft:entity.player.levelup player @a ~ ~ ~ 2 0.5