Fix I wallkicks in ARS rules

This commit is contained in:
Ishaan Bhardwaj 2020-11-21 23:29:06 -05:00
parent 7b496d9412
commit 48aee18340
3 changed files with 6 additions and 3 deletions

View File

@ -113,7 +113,8 @@ function ARS:attemptWallkicks(piece, new_piece, rot_dir, grid)
if piece.shape == "I" then
-- special kick rules for I
if new_piece.rotation == 0 or new_piece.rotation == 2 then
if new_piece.rotation == 0 or new_piece.rotation == 2 and
(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
piece:setRelativeRotation(rot_dir):setOffset({x=1, y=0})

View File

@ -100,7 +100,8 @@ function ARS:attemptWallkicks(piece, new_piece, rot_dir, grid)
if piece.shape == "I" then
-- special kick rules for I
if new_piece.rotation == 0 or new_piece.rotation == 2 then
if new_piece.rotation == 0 or new_piece.rotation == 2 and
(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
piece:setRelativeRotation(rot_dir):setOffset({x=1, y=0})

View File

@ -100,7 +100,8 @@ function ARS:attemptWallkicks(piece, new_piece, rot_dir, grid)
if piece.shape == "I" then
-- special kick rules for I
if new_piece.rotation == 0 or new_piece.rotation == 2 then
if (new_piece.rotation == 0 or new_piece.rotation == 2) and
(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
piece:setRelativeRotation(rot_dir):setOffset({x=1, y=0})