diff --git a/tetris/rulesets/arika_srs.lua b/tetris/rulesets/arika_srs.lua index 062e335..d8252f0 100755 --- a/tetris/rulesets/arika_srs.lua +++ b/tetris/rulesets/arika_srs.lua @@ -6,6 +6,8 @@ local SRS = Ruleset:extend() SRS.name = "ACE-SRS" SRS.hash = "ACE Standard" +SRS.MANIPULATIONS_MAX = 128 + SRS.spawn_positions = { I = { x=5, y=2 }, J = { x=4, y=3 }, @@ -26,23 +28,11 @@ SRS.big_spawn_positions = { Z = { x=2, y=1 }, } -function SRS:onPieceMove(piece, grid) - piece.lock_delay = 0 -- move reset - if piece:isDropBlocked(grid) then - piece.manipulations = piece.manipulations + 1 - if piece.manipulations >= 128 then - piece:dropToBottom(grid) - piece.locked = true - end - end -end - function SRS:onPieceRotate(piece, grid) piece.lock_delay = 0 -- rotate reset if piece:isDropBlocked(grid) then - piece.manipulations = piece.manipulations + 1 - if piece.manipulations >= 128 then - piece:dropToBottom(grid) + piece.manipulations = piece.manipulations + 1 + if piece.manipulations >= self.MANIPULATIONS_MAX then piece.locked = true end end diff --git a/tetris/rulesets/ruleset.lua b/tetris/rulesets/ruleset.lua index 537de97..2b185da 100644 --- a/tetris/rulesets/ruleset.lua +++ b/tetris/rulesets/ruleset.lua @@ -115,8 +115,8 @@ function Ruleset:attemptRotate(new_inputs, piece, grid, initial) local new_piece = piece:withRelativeRotation(rot_dir) if (grid:canPlacePiece(new_piece)) then - self:onPieceRotate(piece, grid) piece:setRelativeRotation(rot_dir) + self:onPieceRotate(piece, grid) else if not(initial and self.enable_IRS_wallkicks == false) then self:attemptWallkicks(piece, new_piece, rot_dir, grid) diff --git a/tetris/rulesets/standard_exp.lua b/tetris/rulesets/standard_exp.lua index ff62db8..e80224e 100755 --- a/tetris/rulesets/standard_exp.lua +++ b/tetris/rulesets/standard_exp.lua @@ -8,6 +8,8 @@ SRS.hash = "Standard" SRS.enable_IRS_wallkicks = true +SRS.MANIPULATIONS_MAX = 15 + function SRS:check_new_low(piece) for _, block in pairs(piece:getBlockOffsets()) do local y = piece.position.y + block.y @@ -75,7 +77,7 @@ end function SRS:onPieceDrop(piece, grid) self:check_new_low(piece) - if piece.manipulations >= 15 and piece:isDropBlocked(grid) then + if piece.manipulations >= self.MANIPULATIONS_MAX and piece:isDropBlocked(grid) then piece.locked = true else piece.lock_delay = 0 -- step reset @@ -86,8 +88,7 @@ function SRS:onPieceMove(piece, grid) piece.lock_delay = 0 -- move reset if piece:isDropBlocked(grid) then piece.manipulations = piece.manipulations + 1 - if piece.manipulations >= 15 then - piece:dropToBottom(grid) + if piece.manipulations >= self.MANIPULATIONS_MAX then piece.locked = true end end @@ -97,12 +98,12 @@ function SRS:onPieceRotate(piece, grid) piece.lock_delay = 0 -- rotate reset self:check_new_low(piece) piece.manipulations = piece.manipulations + 1 - if piece:isDropBlocked(grid) then - if piece.manipulations >= 15 then - piece:dropToBottom(grid) - piece.locked = true - end - end + if piece.manipulations >= self.MANIPULATIONS_MAX then + piece:moveInGrid({ x = 0, y = 1 }, 1, grid) + if piece:isDropBlocked(grid) then + piece.locked = true + end + end end function SRS:get180RotationValue() return 2 end diff --git a/tetris/rulesets/ti_srs.lua b/tetris/rulesets/ti_srs.lua index 2fbe90b..8e38244 100644 --- a/tetris/rulesets/ti_srs.lua +++ b/tetris/rulesets/ti_srs.lua @@ -18,6 +18,9 @@ SRS.colourscheme = { SRS.softdrop_lock = false SRS.harddrop_lock = true +SRS.MANIPULATIONS_MAX = 10 +SRS.ROTATIONS_MAX = 8 + SRS.spawn_positions = { I = { x=5, y=4 }, J = { x=4, y=5 }, @@ -162,15 +165,18 @@ function SRS:onPieceCreate(piece, grid) end function SRS:onPieceDrop(piece, grid) - piece.lock_delay = 0 -- step reset + 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 >= 10 then - piece:dropToBottom(grid) + if piece.manipulations >= self.MANIPULATIONS_MAX then piece.locked = true end end @@ -179,9 +185,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 >= 8 then - piece:dropToBottom(grid) + piece.rotations = piece.rotations + 1 + if piece.rotations >= self.ROTATIONS_MAX then piece.locked = true end end