Added all the Marathon AX modes and Ace-ARS.

This commit is contained in:
Joe Z
2019-06-19 22:56:33 -04:00
parent 1254de15d5
commit 7deaa5ab92
10 changed files with 311 additions and 65 deletions

View File

@@ -0,0 +1,32 @@
local ArikaTI = require 'tetris.rulesets.arika_ti'
local ARS = ArikaTI:extend()
ARS.name = "Ace-ARS"
ARS.hash = "ArikaAce"
function ARS:onPieceCreate(piece, grid)
piece.floorkick = 0
piece.rotate_counter = 0
piece.move_counter = 0
end
function ARS:onPieceDrop(piece, grid)
piece.lock_delay = 0 -- step reset
end
function ARS:onPieceMove(piece, grid)
piece.lock_delay = 0 -- move reset
if piece:isDropBlocked(grid) then
piece.move_counter = piece.move_counter + 1
if piece.move_counter >= 128 then
piece.locked = true
end
end
end
function ARS:onPieceRotate(piece, grid)
self:onPieceMove(piece, grid)
end
return ARS

View File

@@ -117,13 +117,12 @@ function ARS:attemptWallkicks(piece, new_piece, rot_dir, grid)
end
end
elseif piece.shape ~= "I" then
-- kick right, kick left
if (grid:canPlacePiece(new_piece:withOffset({x=1, y=0}))) then
piece:setRelativeRotation(rot_dir):setOffset({x=1, y=0})
elseif (grid:canPlacePiece(new_piece:withOffset({x=-1, y=0}))) then
piece:setRelativeRotation(rot_dir):setOffset({x=-1, y=0})
end
else
-- kick right, kick left
if (grid:canPlacePiece(new_piece:withOffset({x=1, y=0}))) then
piece:setRelativeRotation(rot_dir):setOffset({x=1, y=0})
elseif (grid:canPlacePiece(new_piece:withOffset({x=-1, y=0}))) then
piece:setRelativeRotation(rot_dir):setOffset({x=-1, y=0})
end
end
end

View File

@@ -398,6 +398,7 @@ function CRS:onPieceDrop(piece, grid)
end
function CRS:onPieceMove(piece, grid)
piece.lock_delay = 0 -- move reset
if piece:isDropBlocked(grid) then
piece.move_counter = piece.move_counter + 1
if piece.move_counter >= 24 then
@@ -407,6 +408,7 @@ function CRS:onPieceMove(piece, grid)
end
function CRS:onPieceRotate(piece, grid)
piece.lock_delay = 0 -- move reset
if piece:isDropBlocked(grid) then
piece.rotate_counter = piece.rotate_counter + 1
if piece.rotate_counter >= 12 then
@@ -415,6 +417,4 @@ function CRS:onPieceRotate(piece, grid)
end
end
function CRS:getDefaultOrientation() return 1 end -- downward facing pieces by default
return CRS