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

# -> Reset XP level
scoreboard players set @s OverlyRealistic.Player.WisdomStats.Healthcare_XP 150

# -> Increase level
scoreboard players add @s OverlyRealistic.Player.WisdomStats.Healthcare 1

# -> Increase XP cap
scoreboard players add @s OverlyRealistic.Player.WisdomStats.Healthcare_XP_Max 1200

# -> Scribe check
tag @s add OverlyRealistic.Player.CurrentPlayer
execute if entity @p[tag=!OverlyRealistic.Player.CurrentPlayer,scores={OverlyRealistic.Player.WisdomStats.Scribing=4..},distance=..32,sort=arbitrary] run \
    scoreboard players set @s OverlyRealistic.Player.WisdomStats.Scribing_XP 1000
tag @s remove OverlyRealistic.Player.CurrentPlayer

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

# --> Buffs

# -> Reset buffs
attribute @s max_health modifier remove overly_realistic:wisdom_healthcare_skill_buff

# -> Level 3 buff
execute if score @s OverlyRealistic.Player.WisdomStats.Combat matches 3 run \
    attribute @s max_health modifier add overly_realistic:wisdom_healthcare_skill_buff 4.0 add_value

# -> Level 4 buff
execute if score @s OverlyRealistic.Player.WisdomStats.Combat matches 4 run \
    attribute @s max_health modifier add overly_realistic:wisdom_healthcare_skill_buff 6.0 add_value

# -> Level 5 buff
execute if score @s OverlyRealistic.Player.WisdomStats.Combat matches 5 run \
    attribute @s max_health modifier add overly_realistic:wisdom_healthcare_skill_buff 8.0 add_value
