fix: delay boss notifications until reveal and animate hp bar colours
Security Scan and Upload / Security & DefectDojo Upload (push) Successful in 1m3s
CI / Lint, Build & Test (push) Successful in 1m5s

- Move bossVictory sound and notification from gameContext into BattleModal,
  fired at the 5.2s reveal timeout so the animation plays before the spoiler
- Replace CSS width transition with a setInterval tick (50ms steps over 5s)
  so bossHpPercent and partyHpPercent update incrementally during the animation
- Both bars now use a shared getHpColour helper: green >50%, yellow 25-50%,
  red <25%, causing colour to shift naturally as the bar visually drains
This commit is contained in:
2026-03-08 19:07:04 -07:00
committed by Naomi Carrigan
parent f9c925b9fc
commit 5a065998b6
2 changed files with 73 additions and 44 deletions
-19
View File
@@ -1175,17 +1175,6 @@ export const GameProvider = ({
return applyBossResult(previous, bossId, result);
});
setBattleResult({ bossName, result });
if (result.won) {
if (enableSoundsReference.current) {
playSound("bossVictory");
}
if (enableNotificationsReference.current) {
sendNotification(
"⚔️ Boss Defeated!",
`You defeated ${bossName}!`,
);
}
}
}).
catch(() => {
@@ -1785,14 +1774,6 @@ export const GameProvider = ({
return applyBossResult(previous, bossId, result);
});
setBattleResult({ bossName: boss.name, result: result });
if (result.won) {
if (enableSoundsReference.current) {
playSound("bossVictory");
}
if (enableNotificationsReference.current) {
sendNotification("⚔️ Boss Defeated!", `You defeated ${boss.name}!`);
}
}
} catch {
// Silently ignore — server errors shouldn't crash the UI
}