diff --git a/tetris/rulesets/dtet-h.lua b/tetris/rulesets/dtet-h.lua new file mode 100644 index 0000000..1a18f90 --- /dev/null +++ b/tetris/rulesets/dtet-h.lua @@ -0,0 +1,35 @@ +local DTET = require 'tetris.rulesets.dtet' + +local DTETH = DTET:extend() + +DTETH.name = "D.R.S.-H" +DTETH.hash = "D.R.S.-H" + +DTETH.are_cancel = false + +function DTETH:attemptWallkicks(piece, new_piece, rot_dir, grid) + + local kicks + if piece.shape == "O" then + return + elseif rot_dir == 1 then + kicks = DTET.wallkicks_cw + else + kicks = DTET.wallkicks_ccw + 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 + self:onPieceRotate(piece, grid) + piece:setRelativeRotation(rot_dir) + piece:setOffset(offset) + return + end + end + +end + +return DTETH \ No newline at end of file