Skip to content

Commit

Permalink
fixed t-spins
Browse files Browse the repository at this point in the history
  • Loading branch information
Spentine committed Jun 28, 2024
1 parent 08daf1a commit 7ccb7c0
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion stacker/stacker.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -864,6 +867,7 @@ class Stacker {
if (moved) {
this.stats.score += 1;
this.events.softDropMovement += 1;
this.piece.spin = 0;
} else {
i = moveAmount;
}
Expand All @@ -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;
}
Expand All @@ -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;
}
Expand Down

0 comments on commit 7ccb7c0

Please sign in to comment.