diff --git a/tetris/modes/gamemode.lua b/tetris/modes/gamemode.lua index a7e9950..89a7f04 100644 --- a/tetris/modes/gamemode.lua +++ b/tetris/modes/gamemode.lua @@ -145,18 +145,18 @@ function GameMode:update(inputs, ruleset) if self.piece.locked == true then self.grid:applyPiece(self.piece) - self:onPieceLock(self.piece) - self.piece = nil - if self.enable_hold then - self.held = false - end - self.grid:markClearedRows() 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.piece = nil + if self.enable_hold then + self.held = false + end + if cleared_row_count > 0 then self.lcd = self:getLineClearDelay() self.are = self:getLineARE() @@ -191,7 +191,7 @@ end -- event functions 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:onPieceEnter() end function GameMode:onHold() end diff --git a/tetris/modes/phantom_mania2.lua b/tetris/modes/phantom_mania2.lua index 4833b22..392f4c5 100644 --- a/tetris/modes/phantom_mania2.lua +++ b/tetris/modes/phantom_mania2.lua @@ -92,7 +92,7 @@ function PhantomMania2Game:hitTorikan(old_level, new_level) self.level = 500 return true 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 return true end @@ -155,8 +155,8 @@ function PhantomMania2Game:onLineClear(cleared_row_count) end end -function PhantomMania2Game:onPieceLock() - self:advanceBottomRow(1) +function PhantomMania2Game:onPieceLock(piece, cleared_row_count) + if cleared_row_count == 0 then self:advanceBottomRow(1) end end function PhantomMania2Game:onHold() diff --git a/tetris/modes/survival_a3.lua b/tetris/modes/survival_a3.lua index be28d64..a755b44 100644 --- a/tetris/modes/survival_a3.lua +++ b/tetris/modes/survival_a3.lua @@ -141,8 +141,8 @@ function SurvivalA3Game:onLineClear(cleared_row_count) end end -function SurvivalA3Game:onPieceLock() - self:advanceBottomRow(1) +function SurvivalA3Game:onPieceLock(piece, cleared_row_count) + if cleared_row_count == 0 then self:advanceBottomRow(1) end end function SurvivalA3Game:updateScore(level, drop_bonus, cleared_lines) diff --git a/tetris/randomizers/always.lua b/tetris/randomizers/always.lua new file mode 100644 index 0000000..456ef0d --- /dev/null +++ b/tetris/randomizers/always.lua @@ -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 diff --git a/tetris/randomizers/always_o.lua b/tetris/randomizers/always_o.lua deleted file mode 100644 index 442a1d6..0000000 --- a/tetris/randomizers/always_o.lua +++ /dev/null @@ -1,9 +0,0 @@ -local Randomizer = require 'tetris.randomizers.randomizer' - -local AlwaysORandomizer = Randomizer:extend() - -function AlwaysORandomizer:generatePiece() - return "O" -end - -return AlwaysORandomizer