From 5e0e36fc5c7aa7e6079e1cbe0a16ec0762c58c80 Mon Sep 17 00:00:00 2001 From: Ishaan Bhardwaj Date: Thu, 19 Nov 2020 11:34:39 -0500 Subject: [PATCH] NES transition fixes --- tetris/modes/marathon_c89.lua | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/tetris/modes/marathon_c89.lua b/tetris/modes/marathon_c89.lua index 50e8ae1..6ff94e5 100644 --- a/tetris/modes/marathon_c89.lua +++ b/tetris/modes/marathon_c89.lua @@ -144,14 +144,12 @@ end local cleared_line_scores = { 40, 100, 300, 1200 } +function MarathonC89Game:getTransitionLines() + return math.min(self.start_level * 10 + 10, math.max(100, self.start_level * 10 - 50)) +end + function MarathonC89Game:getLevelForLines() - if self.start_level < 10 then - return math.max(self.start_level, math.floor(self.lines / 10)) - elseif self.start_level < 16 then - return math.max(self.start_level, self.start_level + math.floor((self.lines - 100) / 10)) - else - return math.max(self.start_level, math.floor((self.lines - 60) / 10)) - end + return self.start_level + math.max(0, math.floor(self.lines - self:getTransitionLines()) + 1) end function MarathonC89Game:updateScore(level, drop_bonus, cleared_lines)