From e93034322c584b99eb7269cb3b7faf1879614c64 Mon Sep 17 00:00:00 2001 From: Ishaan Bhardwaj Date: Mon, 28 Dec 2020 17:11:30 -0500 Subject: [PATCH] v0.2.6.2 --- tetris/modes/marathon_wcb.lua | 1 + tetris/rulesets/dtet.lua | 5 ++++- tetris/rulesets/h.lua | 2 +- tetris/rulesets/pptprs.lua | 4 ++-- tetris/rulesets/srs_o_spin.lua | 4 ++-- tetris/rulesets/srs_x.lua | 19 ++++++++++++++----- 6 files changed, 24 insertions(+), 11 deletions(-) diff --git a/tetris/modes/marathon_wcb.lua b/tetris/modes/marathon_wcb.lua index 500112f..0f680da 100644 --- a/tetris/modes/marathon_wcb.lua +++ b/tetris/modes/marathon_wcb.lua @@ -106,6 +106,7 @@ end function MarathonWCBGame:getHighscoreData() return { pieces = self.pieces, + lines = self.lines, frames = self.frames, } end diff --git a/tetris/rulesets/dtet.lua b/tetris/rulesets/dtet.lua index b522100..36d4215 100644 --- a/tetris/rulesets/dtet.lua +++ b/tetris/rulesets/dtet.lua @@ -81,7 +81,10 @@ DTET.wallkicks_ccw = {{x=-1, y=0}, {x=1, y=0}, {x=0, y=1}, {x=-1, y=1}, {x=1, y= function DTET:attemptWallkicks(piece, new_piece, rot_dir, grid) local kicks - if piece.shape == "O" then + if piece.shape == "O" or ( + (piece.shape == "S" or piece.shape == "Z" or piece.shape == "I") + and rot_dir == 2 + ) then return elseif rot_dir == 1 then kicks = DTET.wallkicks_cw diff --git a/tetris/rulesets/h.lua b/tetris/rulesets/h.lua index fa971aa..475b35b 100644 --- a/tetris/rulesets/h.lua +++ b/tetris/rulesets/h.lua @@ -25,8 +25,8 @@ function H:attemptRotate(new_inputs, piece, grid, initial) local new_piece = piece:withRelativeRotation(rot_dir) if not(initial and self.enable_IRS_wallkicks == false) then - self:onPieceRotate(piece, grid) piece:setRelativeRotation(rot_dir) + self:onPieceRotate(piece, grid) end end diff --git a/tetris/rulesets/pptprs.lua b/tetris/rulesets/pptprs.lua index 8b00c85..c320445 100644 --- a/tetris/rulesets/pptprs.lua +++ b/tetris/rulesets/pptprs.lua @@ -75,8 +75,8 @@ PPTPRS.wallkicks_O = { } function PPTPRS:attemptWallkicks(piece, new_piece, rot_dir, grid) - local kicks + local kicks if piece.shape == "O" then kicks = PPTPRS.wallkicks_O[piece.rotation][new_piece.rotation] elseif piece.shape == "I" then @@ -90,9 +90,9 @@ function PPTPRS:attemptWallkicks(piece, new_piece, rot_dir, grid) for idx, offset in pairs(kicks) do kicked_piece = new_piece:withOffset(offset) if grid:canPlacePiece(kicked_piece) then - self:onPieceRotate(piece, grid) piece:setRelativeRotation(rot_dir) piece:setOffset(offset) + self:onPieceRotate(piece, grid) return end end diff --git a/tetris/rulesets/srs_o_spin.lua b/tetris/rulesets/srs_o_spin.lua index 27d6d40..870d3d0 100644 --- a/tetris/rulesets/srs_o_spin.lua +++ b/tetris/rulesets/srs_o_spin.lua @@ -50,7 +50,7 @@ OSpin.block_offsets = { } } -function OSpin:attemptWallkicks(piece, new_piece, rot_dir, grid) +function SRS:attemptWallkicks(piece, new_piece, rot_dir, grid) local kicks if piece.shape == "I" then @@ -64,9 +64,9 @@ function OSpin:attemptWallkicks(piece, new_piece, rot_dir, grid) for idx, offset in pairs(kicks) do kicked_piece = new_piece:withOffset(offset) if grid:canPlacePiece(kicked_piece) then - self:onPieceRotate(piece, grid) piece:setRelativeRotation(rot_dir) piece:setOffset(offset) + self:onPieceRotate(piece, grid) return end end diff --git a/tetris/rulesets/srs_x.lua b/tetris/rulesets/srs_x.lua index 27de630..0d8c69c 100644 --- a/tetris/rulesets/srs_x.lua +++ b/tetris/rulesets/srs_x.lua @@ -18,12 +18,22 @@ SRS.colourscheme = { T = "C", } +SRS.MANIPULATIONS_MAX = 24 +SRS.ROTATIONS_MAX = 12 + +function SRS:onPieceDrop(piece, grid) + if (piece.manipulations >= self.MANIPULATIONS_MAX or piece.rotations >= self.ROTATIONS_MAX) and piece:isDropBlocked(grid) then + piece.locked = true + else + piece.lock_delay = 0 -- step reset + end +end + function SRS:onPieceMove(piece, grid) piece.lock_delay = 0 -- move reset if piece:isDropBlocked(grid) then piece.manipulations = piece.manipulations + 1 - if piece.manipulations >= 24 then - piece:dropToBottom(grid) + if piece.manipulations >= self.MANIPULATIONS_MAX then piece.locked = true end end @@ -32,9 +42,8 @@ end function SRS:onPieceRotate(piece, grid) piece.lock_delay = 0 -- rotate reset if piece:isDropBlocked(grid) then - piece.rotations = piece.rotations + 1 - if piece.rotations >= 12 then - piece:dropToBottom(grid) + piece.rotations = piece.rotations + 1 + if piece.rotations >= self.ROTATIONS_MAX then piece.locked = true end end