
# -> Reset adv
advancement revoke @s only overly_realistic:player/wisdom_specific/player_smelt_iron

# -> Add to smelt count
scoreboard players add @s OverlyRealistic.Player.WisdomSpecialized.CopperIngotsSmelt 1

# -> If not above 5 then return
execute unless score @s OverlyRealistic.Player.WisdomSpecialized.CopperIngotsSmelt matches 5.. run \
    return fail

# -> Reset count
scoreboard players reset @s OverlyRealistic.Player.WisdomSpecialized.CopperIngotsSmelt

# -> Add to skill XP
scoreboard players add @s OverlyRealistic.Player.WisdomStats.Mining_XP 40
scoreboard players add @s OverlyRealistic.Player.WisdomStats.Blacksmithing 55

# -> Intelligence buff
scoreboard players operation #or.intelligence_level OverlyRealistic.General.ArbitraryData = @s OverlyRealistic.Player.Stats.Intelligence
scoreboard players operation #or.intelligence_level OverlyRealistic.General.ArbitraryData /= #or.static_num_2 OverlyRealistic.General.ArbitraryData
scoreboard players operation @s OverlyRealistic.Player.WisdomStats.Mining_XP += #or.intelligence_level OverlyRealistic.General.ArbitraryData
scoreboard players operation @s OverlyRealistic.Player.WisdomStats.Blacksmithing_XP += #or.intelligence_level OverlyRealistic.General.ArbitraryData

# -> Remove other skills' xp
function overly_realistic:players/wisdom/conjoined/mining_and_blacksmithing/remove_from_others_xp

# -> If current XP is greater than the cap then increase level
execute if score @s OverlyRealistic.Player.WisdomStats.Mining_XP >= @s OverlyRealistic.Player.WisdomStats.Mining_XP_Max run \
    function overly_realistic:players/wisdom/mining/increase_level

# -> If current XP is greater than the cap then increase level
execute if score @s OverlyRealistic.Player.WisdomStats.Blacksmithing_XP >= @s OverlyRealistic.Player.WisdomStats.Blacksmithing_XP_Max run \
    function overly_realistic:players/wisdom/blacksmithing/increase_level
