From 7ccb7c02188e715e2270e683364069045299680c Mon Sep 17 00:00:00 2001 From: Spentine <114318049+Spentine@users.noreply.github.com> Date: Thu, 27 Jun 2024 18:39:16 -0700 Subject: [PATCH] fixed t-spins --- stacker/stacker.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/stacker/stacker.js b/stacker/stacker.js index d44acdf..f3d17a7 100644 --- a/stacker/stacker.js +++ b/stacker/stacker.js @@ -841,6 +841,9 @@ class Stacker { if (keys.softDrop) { if (this.c.sdf == Infinity) { // if sdf is infinity const sonicFall = this.DASMove(new Position([0, 1])); + if (sonicFall) { + this.piece.spin = 0; + } this.events.softDropMovement = sonicFall; this.stats.score += sonicFall; // sonic drop } else { @@ -864,6 +867,7 @@ class Stacker { if (moved) { this.stats.score += 1; this.events.softDropMovement += 1; + this.piece.spin = 0; } else { i = moveAmount; } @@ -883,6 +887,7 @@ class Stacker { const moved = this.moveIfPossible(new Position([0, 1])); // move if (moved) { this.events.gravityMovement += 1; + this.piece.spin = 0; } else { i = moveAmount; } @@ -894,10 +899,15 @@ class Stacker { if (keys.sonicDrop) { this.DASMove(new Position([0, 1])); + this.piece.spin = 0; } if (keys.hardDrop && !prevKeys.hardDrop && this.c.hardDropAllowed) { - this.stats.score += this.DASMove(new Position([0, 1])) * 2; + const movements = this.DASMove(new Position([0, 1])); + if (movements) { + this.stats.score += movements * 2; + this.piece.spin = 0; + } this.placePiece(); this.events.hardDrop = true; }