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

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

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

# -> Reduce counter
scoreboard players reset @s OverlyRealistic.Player.WisdomSpecialized.PaperCrafted

# -> Extra paper check
execute if score @s OverlyRealistic.Player.WisdomStats.Scribing matches 1.. run \
    give @s paper
execute if score @s OverlyRealistic.Player.WisdomStats.Scribing matches 4.. run \
    give @s paper


# -> Set skill XP increase
scoreboard players set #or.skill_xp_increase OverlyRealistic.General.ArbitraryData 12

# -> If player is low on sanity then decrease XP change
execute if score @s OverlyRealistic.Player.IsFeelingDull matches 1 run \
    scoreboard players operation #or.skill_xp_increase OverlyRealistic.General.ArbitraryData /= #or.static_num_2 OverlyRealistic.General.ArbitraryData

# -> Add to skill XP
scoreboard players operation @s OverlyRealistic.Player.WisdomStats.Scribing_XP += #or.skill_xp_increase OverlyRealistic.General.ArbitraryData


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

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

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