generated from nhcarrigan/template
fix: delay boss notifications until reveal and animate hp bar colours
- 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:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user