diff --git a/tetris/rulesets/arika_ace2.lua b/tetris/rulesets/arika_ace2.lua index 1bec39c..fc80665 100644 --- a/tetris/rulesets/arika_ace2.lua +++ b/tetris/rulesets/arika_ace2.lua @@ -37,41 +37,41 @@ function ARS:attemptWallkicks(piece, new_piece, rot_dir, grid) (piece:isMoveBlocked(grid, {x=-1, y=0}) or piece:isMoveBlocked(grid, {x=1, y=0})) then -- kick right, right2, left if grid:canPlacePiece(new_piece:withOffset({x=1, y=0})) then - self:onPieceRotate(piece, grid) piece:setRelativeRotation(rot_dir):setOffset({x=1, y=0}) + self:onPieceRotate(piece, grid) elseif grid:canPlacePiece(new_piece:withOffset({x=2, y=0})) then - self:onPieceRotate(piece, grid) piece:setRelativeRotation(rot_dir):setOffset({x=2, y=0}) - elseif grid:canPlacePiece(new_piece:withOffset({x=-1, y=0})) then self:onPieceRotate(piece, grid) + elseif grid:canPlacePiece(new_piece:withOffset({x=-1, y=0})) then piece:setRelativeRotation(rot_dir):setOffset({x=-1, y=0}) + self:onPieceRotate(piece, grid) end elseif piece:isDropBlocked(grid) and (new_piece.rotation == 1 or new_piece.rotation == 3) then -- kick up, up2 if grid:canPlacePiece(new_piece:withOffset({x=0, y=-1})) then - self:onPieceRotate(piece, grid) piece:setRelativeRotation(rot_dir):setOffset({x=0, y=-1}) - elseif grid:canPlacePiece(new_piece:withOffset({x=0, y=-2})) then self:onPieceRotate(piece, grid) + elseif grid:canPlacePiece(new_piece:withOffset({x=0, y=-2})) then piece:setRelativeRotation(rot_dir):setOffset({x=0, y=-2}) + self:onPieceRotate(piece, grid) end end else -- kick right, kick left if grid:canPlacePiece(new_piece:withOffset({x=1, y=0})) then - self:onPieceRotate(piece, grid) piece:setRelativeRotation(rot_dir):setOffset({x=1, y=0}) - elseif grid:canPlacePiece(new_piece:withOffset({x=-1, y=0})) then self:onPieceRotate(piece, grid) + elseif grid:canPlacePiece(new_piece:withOffset({x=-1, y=0})) then piece:setRelativeRotation(rot_dir):setOffset({x=-1, y=0}) + self:onPieceRotate(piece, grid) elseif piece.shape == "T" and new_piece.rotation == 0 and piece:isDropBlocked(grid) and grid:canPlacePiece(new_piece:withOffset({x=0, y=-1})) then -- T floorkick - self:onPieceRotate(piece, grid) piece:setRelativeRotation(rot_dir):setOffset({x=0, y=-1}) + self:onPieceRotate(piece, grid) end end diff --git a/tetris/rulesets/arika_ti.lua b/tetris/rulesets/arika_ti.lua index 2034d34..02db8b7 100644 --- a/tetris/rulesets/arika_ti.lua +++ b/tetris/rulesets/arika_ti.lua @@ -52,11 +52,11 @@ function ARS:attemptWallkicks(piece, new_piece, rot_dir, grid) if grid:canPlacePiece(new_piece:withOffset({x=0, y=-1})) then piece:setRelativeRotation(rot_dir):setOffset({x=0, y=-1}) piece.floorkick = 1 - self:onPieceRotate(piece, grid) + self:onPieceRotate(piece, grid, true) elseif grid:canPlacePiece(new_piece:withOffset({x=0, y=-2})) then piece:setRelativeRotation(rot_dir):setOffset({x=0, y=-2}) piece.floorkick = 1 - self:onPieceRotate(piece, grid) + self:onPieceRotate(piece, grid, true) end end else @@ -76,7 +76,7 @@ function ARS:attemptWallkicks(piece, new_piece, rot_dir, grid) -- T floorkick piece.floorkick = piece.floorkick + 1 piece:setRelativeRotation(rot_dir):setOffset({x=0, y=-1}) - self:onPieceRotate(piece, grid) + self:onPieceRotate(piece, grid, true) end end @@ -93,10 +93,10 @@ function ARS:onPieceDrop(piece, grid) end end -function ARS:onPieceRotate(piece, grid) +function ARS:onPieceRotate(piece, grid, floorkick) if piece.floorkick >= 2 and piece:isDropBlocked(grid) then piece.locked = true - elseif piece.floorkick >= 1 then + elseif piece.floorkick >= 1 and not floorkick then piece.floorkick = piece.floorkick + 1 end end