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

# -> Add to counter
scoreboard players add @s OverlyRealistic.Player.WisdomSpecialized.FoodCrafted 1

# -> If non-passable then return
execute unless score @s OverlyRealistic.Player.WisdomSpecialized.FoodCrafted matches 10.. run \
    return fail

# -> Add to skill XP
scoreboard players add @s OverlyRealistic.Player.WisdomStats.Cookery_XP 12

# -> Reset counter
scoreboard players reset @s OverlyRealistic.Player.WisdomSpecialized.FoodCrafted

# -> 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.Cookery_XP += #or.intelligence_level OverlyRealistic.General.ArbitraryData

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

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