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
+5 -2
View File
@@ -36,7 +36,7 @@ export interface IPlayerState {
export class PlayerStateMachine {
private state: IPlayerState;
constructor(initialLives = 3) {
constructor(initialLives = 1) {
this.state = {
color: PlayerColorState.Red,
lives: initialLives,
@@ -135,8 +135,11 @@ export class PlayerStateMachine {
this.startIFrames();
if (this.state.lives === 0) {
this.state.isDead = true;
return { kind: 'died', cause };
}
return { kind: 'died', cause };
// Lost a life but still alive — treat as a downgrade so callers
// can distinguish real death from a mere life-loss.
return { kind: 'downgraded', from: this.state.color, to: PlayerColorState.Red };
}
private startIFrames(): void {