update spirit

This commit is contained in:
jakciehan
2026-06-07 22:10:03 +08:00
parent 427a33c55b
commit 9c57deff6d
82 changed files with 5465 additions and 149 deletions
+6 -3
View File
@@ -65,8 +65,12 @@ export class BossController {
if (!this.butterflyRevealed) return [];
if (this.killed) return [];
const out: BossOutcomeEvent[] = [];
this.hp = Math.max(0, this.hp - 1);
out.push(...this.checkPhaseTransition(), ...this.checkPrincessCutscene());
// Check phase transition AFTER decrementing HP so the ratio
// reflects the new HP (e.g. 3→2 = 2/3).
const hpRatio = this.hp / this.cfg.hp;
out.push(...this.checkPhaseTransitionAtRatio(hpRatio), ...this.checkPrincessCutscene());
if (this.hp === 0) {
this.killed = true;
out.push({ kind: 'boss_killed' });
@@ -76,8 +80,7 @@ export class BossController {
// --------------------------------------------------------------------
private checkPhaseTransition(): BossOutcomeEvent[] {
const hpRatio = this.hp / this.cfg.hp;
private checkPhaseTransitionAtRatio(hpRatio: number): BossOutcomeEvent[] {
for (let i = this.phaseIndex + 1; i < this.cfg.phases.length; i++) {
if (hpRatio <= this.cfg.phases[i].hpThreshold) {
this.phaseIndex = i;