diff --git a/packages/frontend/src/pages/drop-and-fusion.vue b/packages/frontend/src/pages/drop-and-fusion.vue index 622214a2dc..55d37a9854 100644 --- a/packages/frontend/src/pages/drop-and-fusion.vue +++ b/packages/frontend/src/pages/drop-and-fusion.vue @@ -148,7 +148,7 @@ SPDX-License-Identifier: AGPL-3.0-only
- Retry + Retry
@@ -468,8 +468,8 @@ function hold() { game.hold(); } -function retry() { - game.gameOver(); +function surrender() { + game.surrender(); } function restart() { diff --git a/packages/frontend/src/scripts/drop-and-fusion-engine.ts b/packages/frontend/src/scripts/drop-and-fusion-engine.ts index 741668a457..698cd68bca 100644 --- a/packages/frontend/src/scripts/drop-and-fusion-engine.ts +++ b/packages/frontend/src/scripts/drop-and-fusion-engine.ts @@ -28,6 +28,9 @@ type Log = { } | { frame: number; operation: 'hold'; +} | { + frame: number; + operation: 'surrender'; }; export class DropAndFusionGame extends EventEmitter<{ @@ -274,6 +277,15 @@ export class DropAndFusionGame extends EventEmitter<{ } } + public surrender() { + this.logs.push({ + frame: this.frame, + operation: 'surrender', + }); + + this.gameOver(); + } + public gameOver() { this.isGameOver = true; if (this.tickRaf) window.cancelAnimationFrame(this.tickRaf); @@ -393,6 +405,10 @@ export class DropAndFusionGame extends EventEmitter<{ this.hold(); break; } + case 'surrender': { + this.surrender(); + break; + } default: break; }