# Upgrade Ancient Netherite Core to Level 4 (in hand) - MAXIMUM LEVEL

# Play upgrade sounds and effects - extra epic!
execute if score @s ec.fx_snd matches 1.. run playsound minecraft:block.beacon.activate player @s ~ ~ ~ 1 0.5
execute if score @s ec.fx_snd matches 1.. run playsound minecraft:ui.toast.challenge_complete player @s ~ ~ ~ 1 1.2
execute if score @s ec.fx_snd matches 1.. run playsound minecraft:block.note_block.bell player @s ~ ~ ~ 0.5 1.5
particle totem_of_undying ~ ~1 ~ 0.5 0.5 0.5 0.5 50
particle end_rod ~ ~1 ~ 1 1 1 0.1 25

# Replace the item in hand with Level 4 version (MAX)
loot replace entity @s weapon.mainhand loot evercraft:artifacts/special/ancient_netherite_core_4
# NC18-P0.2: reset block-counter (L4 is terminal; this is belt-and-braces for sanity)
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 4

# 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:"MAXIMUM POWER!",color:"gold"}
title @s subtitle {text:"Ancient Netherite Core",color:"#8c0691"}

data modify storage evercraft:notify stage.c set value [{text:"WOW... ",color:"gold",bold:true},{text:"You actually did it!",color:"yellow"}]
scoreboard players set #ndur ec.temp 50
function evercraft:util/notify/emit
data modify storage evercraft:notify stage.c set value [{text:"You finished the ",color:"dark_purple"},{text:"Ancient Netherite Core",color:"#8c0691",bold:true},{text:" and its power begins to seep",color:"dark_purple"}]
scoreboard players set #ndur ec.temp 40
function evercraft:util/notify/emit
data modify storage evercraft:notify stage.c set value [{text:"and meld into your very bones...",color:"dark_purple"}]
scoreboard players set #ndur ec.temp 40
function evercraft:util/notify/emit
data modify storage evercraft:notify stage.c set value [{text:"ALL beacon effects at Level II (except Regen)! You are unstoppable!",color:"yellow"}]
scoreboard players set #ndur ec.temp 40
function evercraft:util/notify/emit
