# Upgrade Ancient Netherite Core to Level 2 (in hand)

# Play upgrade sounds and effects
execute if score @s ec.fx_snd matches 1.. run playsound minecraft:block.beacon.activate player @s ~ ~ ~ 1 0.8
execute if score @s ec.fx_snd matches 1.. run playsound minecraft:ui.toast.challenge_complete player @s ~ ~ ~ 1 1.2
particle totem_of_undying ~ ~1 ~ 0.5 0.5 0.5 0.5 25

# Replace the item in hand with Level 2 version
loot replace entity @s weapon.mainhand loot evercraft:artifacts/special/ancient_netherite_core_2
# NC18-P0.2: reset block-counter so a recrafted L0 core can't free-upgrade off old accumulation
scoreboard players set @s evercraft.nc_blocks 0
# NC18-P1.2: mirror level into score for next consume_block dispatch
scoreboard players set @s anc.level 2

# Title and message
# (AB-1 sticky-times sweep 2026-06-10: explicit stamp — `title times` is sticky per player and this sequence set none, so it inherited whatever ran last.)
title @s times 10 60 20
title @s title {text:"Level 2 Unlocked!",color:"gold"}
title @s subtitle {text:"Ancient Netherite Core",color:"dark_purple"}

data modify storage evercraft:notify stage.c set value [{text:"Your ",color:"gray"},{text:"Ancient Netherite Core",color:"dark_purple",bold:true},{text:" grows stronger!",color:"gray"}]
scoreboard players set #ndur ec.temp 50
function evercraft:util/notify/emit
data modify storage evercraft:notify stage.c set value [{text:"Effects: Speed I, Haste I, Resistance I, Strength I!",color:"yellow"}]
scoreboard players set #ndur ec.temp 40
function evercraft:util/notify/emit
