update spirit
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user