# --- Coins ---
execute if predicate items:in_inventory/mcoin at @s run function items:stats_calc/coins/meta_coin
execute if predicate items:in_inventory/coin at @s run function items:stats_calc/coins/ingame

# ============================================================
#               Calc Stats - On/Off item
#
#     (This doesn't consider the player base attributes)
# ============================================================
function items:stats_calc/reset

# --- Specific slot ---
function items:stats_calc/slots/armor
function items:stats_calc/slots/mainhand
function items:stats_calc/slots/offhand

# ---Any slot ---
function items:stats_calc/slots/any

# Add equipped (tags + on/off effects)
execute at @s run function items_py:equipped
execute at @s run function items:stats_calc/equipped_custom

# --- Sets ---
function items:stats_calc/set/0_calc

# --- Attributes ---
function items:stats_calc/update_attr

# --- Store & Lore ---
# Minecraft stats
scoreboard players add damage stats_calc 1000
scoreboard players add health stats_calc 20000
scoreboard players add attack_s stats_calc 4000
scoreboard players add speed stats_calc 100
# Souls Capacity limit
execute if score souls_capacity stats_calc matches ..0 run scoreboard players set souls_capacity stats_calc 1
# Store spesific stats
function items:stats_calc/store_specific_stats
# Paper Stats
function items:stats_calc/paper/update

# --- Store max stat for statistics ---
function items:stats_calc/statistics

# --- Soul decrease with overflow ---
execute if score @s souls >= @s souls_capacity run function items:soul/trigger_max

# --- Shield & Map ---
function items:stats_calc/shield/check
execute if entity @s[tag=map] run function items:stats_calc/map/check


# This must be last since if not, the paper would endlessly be given
tag @s remove inv_update
advancement revoke @s only items:inv_update inv_update
