
# -> Set advancements
function overly_realistic:players/wisdom/healthcare/set_advancements

# -> If current skill level = 0 then return
execute if score @s OverlyRealistic.Player.WisdomStats.Healthcare matches ..0 run \
    return run \
        scoreboard players set @s OverlyRealistic.Player.WisdomStats.Healthcare_XP 0

# -> Reduce level
scoreboard players remove @s OverlyRealistic.Player.WisdomStats.Healthcare 1

# -> Set XP cap
scoreboard players operation @s[scores={OverlyRealistic.Player.WisdomStats.Healthcare=0}] OverlyRealistic.Player.WisdomStats.Healthcare_XP_Max = #or.wisdom_max_xp_level_0 OverlyRealistic.General.ArbitraryData
scoreboard players operation @s[scores={OverlyRealistic.Player.WisdomStats.Healthcare=1}] OverlyRealistic.Player.WisdomStats.Healthcare_XP_Max = #or.wisdom_max_xp_level_1 OverlyRealistic.General.ArbitraryData
scoreboard players operation @s[scores={OverlyRealistic.Player.WisdomStats.Healthcare=2}] OverlyRealistic.Player.WisdomStats.Healthcare_XP_Max = #or.wisdom_max_xp_level_2 OverlyRealistic.General.ArbitraryData
scoreboard players operation @s[scores={OverlyRealistic.Player.WisdomStats.Healthcare=3}] OverlyRealistic.Player.WisdomStats.Healthcare_XP_Max = #or.wisdom_max_xp_level_3 OverlyRealistic.General.ArbitraryData
scoreboard players operation @s[scores={OverlyRealistic.Player.WisdomStats.Healthcare=4}] OverlyRealistic.Player.WisdomStats.Healthcare_XP_Max = #or.wisdom_max_xp_level_4 OverlyRealistic.General.ArbitraryData

# -> Reset XP level
scoreboard players operation #or.XpLevelReset OverlyRealistic.General.ArbitraryData = @s OverlyRealistic.Player.WisdomStats.Healthcare_XP_Max
scoreboard players operation #or.XpLevelReset OverlyRealistic.General.ArbitraryData /= #or.static_num_2 OverlyRealistic.General.ArbitraryData

scoreboard players operation @s OverlyRealistic.Player.WisdomStats.Healthcare_XP = #or.XpLevelReset OverlyRealistic.General.ArbitraryData
