diff --git a/tetris/rulesets/shirase.lua b/tetris/rulesets/shirase.lua index 9a0952c..d88270e 100644 --- a/tetris/rulesets/shirase.lua +++ b/tetris/rulesets/shirase.lua @@ -60,6 +60,29 @@ Shirase.block_offsets = { } } +function Shirase:attemptWallkicks(piece, new_piece, rot_dir, grid) + + local kicks + if piece.shape == "I" then + kicks = SRS.wallkicks_line[piece.rotation][new_piece.rotation] + else + kicks = SRS.wallkicks_3x3[piece.rotation][new_piece.rotation] + end + + assert(piece.rotation ~= new_piece.rotation) + + for idx, offset in pairs(kicks) do + kicked_piece = new_piece:withOffset(offset) + if grid:canPlacePiece(kicked_piece) then + piece:setRelativeRotation(rot_dir) + piece:setOffset(offset) + self:onPieceRotate(piece, grid) + return + end + end + +end + function Shirase:onPieceDrop(piece) piece.lock_delay = 0 end function Shirase:onPieceMove(piece) piece.lock_delay = 0 end function Shirase:onPieceRotate(piece) piece.lock_delay = 0 end