mirror of
https://github.com/SashLilac/cambridge.git
synced 2025-05-13 20:21:25 -05:00
Added all the Marathon AX modes and Ace-ARS.
This commit is contained in:
32
tetris/rulesets/arika_ace.lua
Normal file
32
tetris/rulesets/arika_ace.lua
Normal 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
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user