# Announce the evolution to the realm
# Run as the evolving player — macro with pet_name from storage

# Title for the evolving player
# (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":"\u2726 EVOLUTION \u2726","color":"gold"}
$title @s subtitle [{"text":"$(pet_name)","color":"yellow"},{"text":" has evolved into ","color":"white"},{"text":"Ascended $(pet_name)","color":"gold"},{"text":"!","color":"white"}]

# Realm-wide announcement \u2014 actor-naming broadcast, rendered directly in the actor's
# context (\u00a75b) so {selector:@s} resolves to the evolving player, not each viewer.
# (Wave 2, 2026-06-10: ascension brag — whoami-baked, protected, 30s TTL.)
function evercraft:util/notify/whoami
$data modify storage evercraft:notify stage.c set value [{text:"\u2726 ",color:"gold"},{text:"",color:"yellow"},{text:"'s ",color:"gray"},{text:"$(pet_name)",color:"gold"},{text:" has ascended to a higher form! ",color:"yellow"},{text:"\u2726",color:"gold"}]
data modify storage evercraft:notify stage.c[1].text set from storage evercraft:notify named.who
scoreboard players set #ndur ec.temp 50
execute as @a run scoreboard players set #nttl ec.temp 600
execute as @a run function evercraft:util/notify/emit_keep

# Realm-wide ascension chord — PER-LISTENER gated (each player's ec.fx_snd, localized at @s;
# replaces the ungated ui.toast.challenge_complete @a).
function evercraft:fx/companion/evolve_announce

# Story Mode: companion evolution hook (Chapter 42)
execute if score @s sm.mode matches 1..2 if score @s sm.chapter matches 42 run function evercraft:story/quest/check_progress
