Fixed Arika rulesets

- Fixed centre column rule on Classic ARS, Ti-ARS and ACE-ARS
- Added T floorkick for Ti-ARS and ACE-ARS
This commit is contained in:
Oshisaure 2020-10-07 19:54:18 +01:00
parent bdad32ac79
commit 8a2237a77c
3 changed files with 69 additions and 31 deletions

View File

@ -81,11 +81,19 @@ function ARS:attemptWallkicks(piece, new_piece, rot_dir, grid)
piece.shape == "J" or piece.shape == "T" or piece.shape == "L" piece.shape == "J" or piece.shape == "T" or piece.shape == "L"
) and ( ) and (
piece.rotation == 0 or piece.rotation == 2 piece.rotation == 0 or piece.rotation == 2
) and ( ) then
grid:isOccupied(piece.position.x, piece.position.y) or local offsets = new_piece:getBlockOffsets()
grid:isOccupied(piece.position.x, piece.position.y - 1) or table.sort(offsets, function(A, B) return A.y < B.y or A.y == B.y and A.x < B.y end)
grid:isOccupied(piece.position.x, piece.position.y - 2) for index, offset in pairs(offsets) do
) then return end if grid:isOccupied(piece.position.x + offset.x, piece.position.y + offset.y) then
if offset.x == 0 then
return
else
break
end
end
end
end
-- kick right, kick left -- kick right, kick left
if (grid:canPlacePiece(new_piece:withOffset({x=1, y=0}))) then if (grid:canPlacePiece(new_piece:withOffset({x=1, y=0}))) then

View File

@ -84,11 +84,19 @@ function ARS:attemptWallkicks(piece, new_piece, rot_dir, grid)
piece.shape == "J" or piece.shape == "T" or piece.shape == "L" piece.shape == "J" or piece.shape == "T" or piece.shape == "L"
) and ( ) and (
piece.rotation == 0 or piece.rotation == 2 piece.rotation == 0 or piece.rotation == 2
) and ( ) then
grid:isOccupied(piece.position.x, piece.position.y) or local offsets = new_piece:getBlockOffsets()
grid:isOccupied(piece.position.x, piece.position.y - 1) or table.sort(offsets, function(A, B) return A.y < B.y or A.y == B.y and A.x < B.y end)
grid:isOccupied(piece.position.x, piece.position.y - 2) for index, offset in pairs(offsets) do
) then return end if grid:isOccupied(piece.position.x + offset.x, piece.position.y + offset.y) then
if offset.x == 0 then
return
else
break
end
end
end
end
if piece.shape == "I" then if piece.shape == "I" then
-- special kick rules for I -- special kick rules for I
@ -116,14 +124,21 @@ function ARS:attemptWallkicks(piece, new_piece, rot_dir, grid)
piece.floorkick = 1 piece.floorkick = 1
end end
end end
elseif piece.shape ~= "I" then else
-- kick right, kick left -- kick right, kick left
if (grid:canPlacePiece(new_piece:withOffset({x=1, y=0}))) then if grid:canPlacePiece(new_piece:withOffset({x=1, y=0})) then
piece:setRelativeRotation(rot_dir):setOffset({x=1, y=0}) piece:setRelativeRotation(rot_dir):setOffset({x=1, y=0})
elseif (grid:canPlacePiece(new_piece:withOffset({x=-1, y=0}))) then elseif grid:canPlacePiece(new_piece:withOffset({x=-1, y=0})) then
piece:setRelativeRotation(rot_dir):setOffset({x=-1, y=0}) piece:setRelativeRotation(rot_dir):setOffset({x=-1, y=0})
end elseif piece.shape == "T"
else and newpiece.rotation == 1
and piece.floorkick == 0
and grid:canPlacePiece(new_piece:withOffset({x=0, y=-1}))
then
-- T floorkick
piece.floorkick = piece.floorkick + 1
piece:setRelativeRotation(rot_dir):setOffset({x=0, y=-1})
end
end end
end end

View File

@ -84,11 +84,19 @@ function ARS:attemptWallkicks(piece, new_piece, rot_dir, grid)
piece.shape == "J" or piece.shape == "T" or piece.shape == "L" piece.shape == "J" or piece.shape == "T" or piece.shape == "L"
) and ( ) and (
piece.rotation == 0 or piece.rotation == 2 piece.rotation == 0 or piece.rotation == 2
) and ( ) then
grid:isOccupied(piece.position.x, piece.position.y) or local offsets = new_piece:getBlockOffsets()
grid:isOccupied(piece.position.x, piece.position.y - 1) or table.sort(offsets, function(A, B) return A.y < B.y or A.y == B.y and A.x < B.y end)
grid:isOccupied(piece.position.x, piece.position.y - 2) for index, offset in pairs(offsets) do
) then return end if grid:isOccupied(piece.position.x + offset.x, piece.position.y + offset.y) then
if offset.x == 0 then
return
else
break
end
end
end
end
if piece.shape == "I" then if piece.shape == "I" then
-- special kick rules for I -- special kick rules for I
@ -116,14 +124,21 @@ function ARS:attemptWallkicks(piece, new_piece, rot_dir, grid)
piece.floorkick = 1 piece.floorkick = 1
end end
end end
elseif piece.shape ~= "I" then else
-- kick right, kick left -- kick right, kick left
if (grid:canPlacePiece(new_piece:withOffset({x=1, y=0}))) then if grid:canPlacePiece(new_piece:withOffset({x=1, y=0})) then
piece:setRelativeRotation(rot_dir):setOffset({x=1, y=0}) piece:setRelativeRotation(rot_dir):setOffset({x=1, y=0})
elseif (grid:canPlacePiece(new_piece:withOffset({x=-1, y=0}))) then elseif grid:canPlacePiece(new_piece:withOffset({x=-1, y=0})) then
piece:setRelativeRotation(rot_dir):setOffset({x=-1, y=0}) piece:setRelativeRotation(rot_dir):setOffset({x=-1, y=0})
end elseif piece.shape == "T"
else and newpiece.rotation == 1
and piece.floorkick == 0
and grid:canPlacePiece(new_piece:withOffset({x=0, y=-1}))
then
-- T floorkick
piece.floorkick = piece.floorkick + 1
piece:setRelativeRotation(rot_dir):setOffset({x=0, y=-1})
end
end end
end end