execute if score #TestStart function_run_count matches 0.. run scoreboard players add osp:powers/energy-infusion/upgrade_conditions function_run_count 1


resource set @s osp:eldritch/energy-infusion_a 0
resource set @s osp:eldritch/energy-infusion_b 0
resource set @s osp:eldritch/energy-infusion_c 0
resource set @s osp:eldritch/energy-infusion_d 0
resource set @s osp:eldritch/energy-infusion_e 0
resource set @s osp:eldritch/energy-infusion_f 0
resource set @s osp:eldritch/energy-infusion_g 0
resource set @s osp:eldritch/energy-infusion_h 0
resource set @s osp:eldritch/energy-infusion_i 0
resource set @s osp:eldritch/energy-infusion_j 0
resource set @s osp:eldritch/energy-infusion_k 0
resource set @s osp:eldritch/energy-infusion_l 0
resource set @s osp:eldritch/energy-infusion_m 0
resource set @s osp:eldritch/energy-infusion_n 0
resource set @s osp:eldritch/energy-infusion_o 0
resource set @s osp:eldritch/energy-infusion_r 0

execute if predicate osp:energy-infusion/menu/reset_repair run resource set @s osp:eldritch/energy-infusion_a 1
execute if predicate osp:energy-infusion/menu/name run resource set @s osp:eldritch/energy-infusion_b 1
execute if predicate osp:energy-infusion/menu/gold_name run resource set @s osp:eldritch/energy-infusion_c 1
execute if predicate osp:energy-infusion/menu/lore run resource set @s osp:eldritch/energy-infusion_d 1
execute if predicate osp:energy-infusion/menu/infinity run resource set @s osp:eldritch/energy-infusion_e 1
execute if predicate osp:energy-infusion/menu/multishot run resource set @s osp:eldritch/energy-infusion_f 1
execute if predicate osp:energy-infusion/menu/ench_buff run resource set @s osp:eldritch/energy-infusion_g 1
execute if predicate osp:energy-infusion/menu/water_breathing run resource set @s osp:eldritch/energy-infusion_h 1
execute if predicate osp:energy-infusion/menu/conduit_power run resource set @s osp:eldritch/energy-infusion_i 1
execute if predicate osp:energy-infusion/menu/dolphins_grace run resource set @s osp:eldritch/energy-infusion_j 1
execute if predicate osp:energy-infusion/menu/jump_boots run resource set @s osp:eldritch/energy-infusion_k 1
execute if predicate osp:energy-infusion/menu/totem_regen run resource set @s osp:eldritch/energy-infusion_l 1
execute if predicate osp:energy-infusion/menu/invisiblity run resource set @s osp:eldritch/energy-infusion_m 1
execute if predicate osp:energy-infusion/menu/0grav run resource set @s osp:eldritch/energy-infusion_n 1
execute if predicate osp:energy-infusion/menu/nether_star run resource set @s osp:eldritch/energy-infusion_o 1
execute if predicate osp:energy-infusion/menu/make_artifact run resource set @s osp:eldritch/energy-infusion_r 1

# haste
resource set @s osp:eldritch/energy-infusion_p 0
execute store result score Level num run data get entity @s SelectedItem.tag.energy-infusion.haste
scoreboard players set Energy1D num 24
scoreboard players operation Level+ num = Level num
scoreboard players operation Level+ num *= 24 num
scoreboard players operation Energy1D num += Level+ num

execute if score Energy1 num >= Energy1D num if score Level num matches 0..10 if predicate osp:energy-infusion/menu/haste run resource set @s osp:eldritch/energy-infusion_p 1

resource set @s osp:eldritch/energy-infusion_q 0
execute if predicate osp:energy-infusion/menu/minning_level run resource set @s osp:eldritch/energy-infusion_q 1
