This commit is contained in:
Ishaan Bhardwaj 2020-12-28 17:11:30 -05:00
parent 92f17c54df
commit e93034322c
6 changed files with 24 additions and 11 deletions

View File

@ -106,6 +106,7 @@ end
function MarathonWCBGame:getHighscoreData()
return {
pieces = self.pieces,
lines = self.lines,
frames = self.frames,
}
end

View File

@ -81,7 +81,10 @@ DTET.wallkicks_ccw = {{x=-1, y=0}, {x=1, y=0}, {x=0, y=1}, {x=-1, y=1}, {x=1, y=
function DTET:attemptWallkicks(piece, new_piece, rot_dir, grid)
local kicks
if piece.shape == "O" then
if piece.shape == "O" or (
(piece.shape == "S" or piece.shape == "Z" or piece.shape == "I")
and rot_dir == 2
) then
return
elseif rot_dir == 1 then
kicks = DTET.wallkicks_cw

View File

@ -25,8 +25,8 @@ function H:attemptRotate(new_inputs, piece, grid, initial)
local new_piece = piece:withRelativeRotation(rot_dir)
if not(initial and self.enable_IRS_wallkicks == false) then
self:onPieceRotate(piece, grid)
piece:setRelativeRotation(rot_dir)
self:onPieceRotate(piece, grid)
end
end

View File

@ -75,8 +75,8 @@ PPTPRS.wallkicks_O = {
}
function PPTPRS:attemptWallkicks(piece, new_piece, rot_dir, grid)
local kicks
local kicks
if piece.shape == "O" then
kicks = PPTPRS.wallkicks_O[piece.rotation][new_piece.rotation]
elseif piece.shape == "I" then
@ -90,9 +90,9 @@ function PPTPRS:attemptWallkicks(piece, new_piece, rot_dir, grid)
for idx, offset in pairs(kicks) do
kicked_piece = new_piece:withOffset(offset)
if grid:canPlacePiece(kicked_piece) then
self:onPieceRotate(piece, grid)
piece:setRelativeRotation(rot_dir)
piece:setOffset(offset)
self:onPieceRotate(piece, grid)
return
end
end

View File

@ -50,7 +50,7 @@ OSpin.block_offsets = {
}
}
function OSpin:attemptWallkicks(piece, new_piece, rot_dir, grid)
function SRS:attemptWallkicks(piece, new_piece, rot_dir, grid)
local kicks
if piece.shape == "I" then
@ -64,9 +64,9 @@ function OSpin:attemptWallkicks(piece, new_piece, rot_dir, grid)
for idx, offset in pairs(kicks) do
kicked_piece = new_piece:withOffset(offset)
if grid:canPlacePiece(kicked_piece) then
self:onPieceRotate(piece, grid)
piece:setRelativeRotation(rot_dir)
piece:setOffset(offset)
self:onPieceRotate(piece, grid)
return
end
end

View File

@ -18,12 +18,22 @@ SRS.colourscheme = {
T = "C",
}
SRS.MANIPULATIONS_MAX = 24
SRS.ROTATIONS_MAX = 12
function SRS:onPieceDrop(piece, grid)
if (piece.manipulations >= self.MANIPULATIONS_MAX or piece.rotations >= self.ROTATIONS_MAX) and piece:isDropBlocked(grid) then
piece.locked = true
else
piece.lock_delay = 0 -- step reset
end
end
function SRS:onPieceMove(piece, grid)
piece.lock_delay = 0 -- move reset
if piece:isDropBlocked(grid) then
piece.manipulations = piece.manipulations + 1
if piece.manipulations >= 24 then
piece:dropToBottom(grid)
if piece.manipulations >= self.MANIPULATIONS_MAX then
piece.locked = true
end
end
@ -32,9 +42,8 @@ end
function SRS:onPieceRotate(piece, grid)
piece.lock_delay = 0 -- rotate reset
if piece:isDropBlocked(grid) then
piece.rotations = piece.rotations + 1
if piece.rotations >= 12 then
piece:dropToBottom(grid)
piece.rotations = piece.rotations + 1
if piece.rotations >= self.ROTATIONS_MAX then
piece.locked = true
end
end