
# -> Reset adv trigger
advancement revoke @s only overly_realistic:items/use_tool_durability_change

# -> Durability change RNG
execute unless predicate overly_realistic:player/actions/durability_removal_from_intelligence_rng run \
    return fail

# -> Change item durability
item replace entity 00000001-0000-002b-0000-00010000002b contents from entity @s weapon.mainhand
execute store result score #or.global OverlyRealistic.General.ArbitraryData run \
    data get entity 00000001-0000-002b-0000-00010000002b item.components.minecraft:damage
execute store result score #or.equation_part_1 OverlyRealistic.General.ArbitraryData run \
    random value 1..3
execute store result entity 00000001-0000-002b-0000-00010000002b item.components.minecraft:damage int 1 run \
    scoreboard players operation #or.global OverlyRealistic.General.ArbitraryData += #or.equation_part_1 OverlyRealistic.General.ArbitraryData
item replace entity @s weapon.mainhand from entity 00000001-0000-002b-0000-00010000002b contents
