mirror of
https://github.com/SashLilac/cambridge.git
synced 2024-11-22 16:19:03 -06:00
Stopped bottom-row garbage from clearing 5 lines. (#16)
Resolves #15. 1) Cleared row count is marked before the onPieceLock method is called, letting the piece lock procedure react to the count of rows the piece is about to clear. (In practice, only 0 and non-0 will be different.) 2) The modes with bottom-row garbage will not advance the garbage counter when the piece is about to clear lines, as should be the case. Also included: 3) Changed the Always O Randomizer to the Always Randomizer that takes which piece it should "always" produce as an argument in the constructor. 4) Fixed the torikan for level 800 in Phantom Mania 2. It should have been 4:45, not 4:40.
This commit is contained in:
parent
b7fc51f4bd
commit
96ac054cf6
@ -145,18 +145,18 @@ function GameMode:update(inputs, ruleset)
|
|||||||
|
|
||||||
if self.piece.locked == true then
|
if self.piece.locked == true then
|
||||||
self.grid:applyPiece(self.piece)
|
self.grid:applyPiece(self.piece)
|
||||||
self:onPieceLock(self.piece)
|
|
||||||
self.piece = nil
|
|
||||||
if self.enable_hold then
|
|
||||||
self.held = false
|
|
||||||
end
|
|
||||||
|
|
||||||
self.grid:markClearedRows()
|
self.grid:markClearedRows()
|
||||||
|
|
||||||
local cleared_row_count = self.grid:getClearedRowCount()
|
local cleared_row_count = self.grid:getClearedRowCount()
|
||||||
|
|
||||||
|
self:onPieceLock(self.piece, cleared_row_count)
|
||||||
self:updateScore(self.level, self.drop_bonus, cleared_row_count)
|
self:updateScore(self.level, self.drop_bonus, cleared_row_count)
|
||||||
|
|
||||||
|
self.piece = nil
|
||||||
|
if self.enable_hold then
|
||||||
|
self.held = false
|
||||||
|
end
|
||||||
|
|
||||||
if cleared_row_count > 0 then
|
if cleared_row_count > 0 then
|
||||||
self.lcd = self:getLineClearDelay()
|
self.lcd = self:getLineClearDelay()
|
||||||
self.are = self:getLineARE()
|
self.are = self:getLineARE()
|
||||||
@ -191,7 +191,7 @@ end
|
|||||||
|
|
||||||
-- event functions
|
-- event functions
|
||||||
function GameMode:whilePieceActive() end
|
function GameMode:whilePieceActive() end
|
||||||
function GameMode:onPieceLock(piece) end
|
function GameMode:onPieceLock(piece, cleared_row_count) end
|
||||||
function GameMode:onLineClear(cleared_row_count) end
|
function GameMode:onLineClear(cleared_row_count) end
|
||||||
function GameMode:onPieceEnter() end
|
function GameMode:onPieceEnter() end
|
||||||
function GameMode:onHold() end
|
function GameMode:onHold() end
|
||||||
|
@ -92,7 +92,7 @@ function PhantomMania2Game:hitTorikan(old_level, new_level)
|
|||||||
self.level = 500
|
self.level = 500
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
if old_level < 800 and new_level >= 800 and self.frames > sp(4,40) then
|
if old_level < 800 and new_level >= 800 and self.frames > sp(4,45) then
|
||||||
self.level = 800
|
self.level = 800
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
@ -155,8 +155,8 @@ function PhantomMania2Game:onLineClear(cleared_row_count)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function PhantomMania2Game:onPieceLock()
|
function PhantomMania2Game:onPieceLock(piece, cleared_row_count)
|
||||||
self:advanceBottomRow(1)
|
if cleared_row_count == 0 then self:advanceBottomRow(1) end
|
||||||
end
|
end
|
||||||
|
|
||||||
function PhantomMania2Game:onHold()
|
function PhantomMania2Game:onHold()
|
||||||
|
@ -141,8 +141,8 @@ function SurvivalA3Game:onLineClear(cleared_row_count)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function SurvivalA3Game:onPieceLock()
|
function SurvivalA3Game:onPieceLock(piece, cleared_row_count)
|
||||||
self:advanceBottomRow(1)
|
if cleared_row_count == 0 then self:advanceBottomRow(1) end
|
||||||
end
|
end
|
||||||
|
|
||||||
function SurvivalA3Game:updateScore(level, drop_bonus, cleared_lines)
|
function SurvivalA3Game:updateScore(level, drop_bonus, cleared_lines)
|
||||||
|
18
tetris/randomizers/always.lua
Normal file
18
tetris/randomizers/always.lua
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
local Randomizer = require 'tetris.randomizers.randomizer'
|
||||||
|
|
||||||
|
local AlwaysRandomizer = Randomizer:extend()
|
||||||
|
|
||||||
|
function AlwaysRandomizer:new(piece)
|
||||||
|
self.piece = piece
|
||||||
|
self:initialize()
|
||||||
|
self.next_queue = {}
|
||||||
|
for i = 1, 30 do
|
||||||
|
table.insert(self.next_queue, self:generatePiece())
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function AlwaysRandomizer:generatePiece()
|
||||||
|
return self.piece
|
||||||
|
end
|
||||||
|
|
||||||
|
return AlwaysRandomizer
|
@ -1,9 +0,0 @@
|
|||||||
local Randomizer = require 'tetris.randomizers.randomizer'
|
|
||||||
|
|
||||||
local AlwaysORandomizer = Randomizer:extend()
|
|
||||||
|
|
||||||
function AlwaysORandomizer:generatePiece()
|
|
||||||
return "O"
|
|
||||||
end
|
|
||||||
|
|
||||||
return AlwaysORandomizer
|
|
Loading…
Reference in New Issue
Block a user