From 35f4aea67d08f18b57803597b9873426d4fc4557 Mon Sep 17 00:00:00 2001 From: Joe Z Date: Fri, 21 Jun 2019 23:41:53 -0400 Subject: [PATCH] Added Ti-SRS and modified delay curve behaviour on Marathon 2020. I realized that playing at 4/8 for 800 levels straight is probably too much, so I made it that only the first 10 sections count for advancing the delay curve faster than it would normally go. Now only the last 500 levels can be at delay level 20. --- docs/rulesets.md | 17 +++++------ scene/mode_select.lua | 3 +- tetris/modes/gamemode.lua | 10 ++++--- tetris/modes/marathon_2020.lua | 20 +++++++++---- tetris/modes/survival_a3.lua | 2 +- tetris/modes/survival_ax2.lua | 2 +- .../{standard_exp.lua => standard.lua} | 0 tetris/rulesets/standard_ti.lua | 30 +++++++++++++++++++ 8 files changed, 61 insertions(+), 23 deletions(-) rename tetris/rulesets/{standard_exp.lua => standard.lua} (100%) create mode 100644 tetris/rulesets/standard_ti.lua diff --git a/docs/rulesets.md b/docs/rulesets.md index b558720..ef4a27e 100644 --- a/docs/rulesets.md +++ b/docs/rulesets.md @@ -10,16 +10,13 @@ A ruleset consists of the following things: If you're used to Nullpomino, you may notice a few things missing from that definition. For example, piece previews, hold queues, and randomizers have been moved to being game-specific rules, rather than rules that are changeable with the ruleset you use. Soft and hard drop behaviour is also game-specific now, so that times can be more plausibly compared across rulesets. +There are six rulesets currently supported: -Rotation system ---------------- -A rotation system defines the following things: - * The block offsets of each piece orientation. - * The wall or floor kicks that will be attempted for each type of rotation. +* Cambridge - a ruleset original to Cambridge, used for all custom modes. Supports 180-degree rotations! -There are four rotation systems currently supported: +* SRS - the rotation system used in the Tetris Guideline games. Supports 180-degree rotations! +* Ti-SRS - SRS but with no 180-degree rotations. -* Cambridge -* Classic ARS -* Ti-ARS -* SRS \ No newline at end of file +* ARS - the rotation system from the original Tetris the Grand Master. +* Ti-ARS - ARS with floorkicks! From TGM3: Terror Instinct. +* Ace-ARS - ARS with floorkicks and move reset! \ No newline at end of file diff --git a/scene/mode_select.lua b/scene/mode_select.lua index e97d8e4..68148eb 100644 --- a/scene/mode_select.lua +++ b/scene/mode_select.lua @@ -32,10 +32,11 @@ game_modes = { rulesets = { require 'tetris.rulesets.cambridge', + require 'tetris.rulesets.standard', + require 'tetris.rulesets.standard_ti', require 'tetris.rulesets.arika', require 'tetris.rulesets.arika_ti', require 'tetris.rulesets.arika_ace', - require 'tetris.rulesets.standard_exp', --require 'tetris.rulesets.bonkers', --require 'tetris.rulesets.shirase', --require 'tetris.rulesets.super302', diff --git a/tetris/modes/gamemode.lua b/tetris/modes/gamemode.lua index c5d5a15..9b6ec38 100644 --- a/tetris/modes/gamemode.lua +++ b/tetris/modes/gamemode.lua @@ -392,8 +392,7 @@ function GameMode:drawScoringInfo() love.graphics.print( self.das.direction .. " " .. self.das.frames .. " " .. - st(self.prev_inputs) .. - self.drop_bonus + st(self.prev_inputs) ) love.graphics.setFont(font_8x11) @@ -403,7 +402,7 @@ end function GameMode:drawSectionTimes(current_section) local section_x = 530 - for section, time in pairs(self.section_times) do + for section, time in ipairs(self.section_times) do if section > 0 then love.graphics.printf(formatTime(time), section_x, 40 + 20 * section, 90, "left") end @@ -412,7 +411,7 @@ function GameMode:drawSectionTimes(current_section) love.graphics.printf(formatTime(self.frames - self.section_start_time), section_x, 40 + 20 * current_section, 90, "left") end -function GameMode:drawSectionTimesWithSecondary(current_section) +function GameMode:drawSectionTimesWithSecondary(current_section, section_colour_function) local section_x = 530 local section_secondary_x = 440 @@ -423,6 +422,9 @@ function GameMode:drawSectionTimesWithSecondary(current_section) end for section, time in pairs(self.secondary_section_times) do + if self.section_colour_function then + love.graphics.setColor(self:section_colour_function(section)) + end if section > 0 then love.graphics.printf(formatTime(time), section_secondary_x, 40 + 20 * section, 90, "left") end diff --git a/tetris/modes/marathon_2020.lua b/tetris/modes/marathon_2020.lua index 5d49793..7d06f5b 100644 --- a/tetris/modes/marathon_2020.lua +++ b/tetris/modes/marathon_2020.lua @@ -323,9 +323,9 @@ function Marathon2020Game:checkClear(level) end function Marathon2020Game:updateSectionTimes(old_level, new_level) - function sectionCool() + function sectionCool(section) self.section_cool_count = self.section_cool_count + 1 - self.delay_level = math.min(20, self.delay_level + 1) + if section < 10 then self.delay_level = math.min(20, self.delay_level + 1) end table.insert(self.section_status, "cool") end @@ -343,7 +343,7 @@ function Marathon2020Game:updateSectionTimes(old_level, new_level) table.insert(self.section_times, section_time) self.section_start_time = self.frames - if section > 4 then self.delay_level = math.min(20, self.delay_level + 1) end + if section > 5 then self.delay_level = math.min(20, self.delay_level + 1) end self:checkTorikan(section) self:checkClear(new_level) @@ -352,11 +352,11 @@ function Marathon2020Game:updateSectionTimes(old_level, new_level) self.secondary_section_times[section] < self.secondary_section_times[section - 1] + 120 and self.secondary_section_times[section] < cool_cutoffs[section] ) then - sectionCool() + sectionCool(section) elseif self.section_status[section - 1] == "cool" then table.insert(self.section_status, "none") elseif section <= 19 and self.secondary_section_times[section] < cool_cutoffs[section] then - sectionCool() + sectionCool(section) else table.insert(self.section_status, "none") end @@ -417,6 +417,14 @@ function Marathon2020Game:drawGrid() end end +function Marathon2020Game:sectionColourFunction(section) + if self.section_status[section] == "cool" then + return { 0, 1, 0, 1 } + else + return { 1, 1, 1, 1 } + end +end + function Marathon2020Game:drawScoringInfo() Marathon2020Game.super.drawScoringInfo(self) @@ -428,7 +436,7 @@ function Marathon2020Game:drawScoringInfo() love.graphics.printf("GRADE PTS.", text_x, 200, 90, "left") love.graphics.printf("LEVEL", text_x, 320, 40, "left") - self:drawSectionTimesWithSecondary(current_section) + self:drawSectionTimesWithSecondary(current_section, self.sectionColourFunction) love.graphics.setFont(font_3x5_3) love.graphics.printf(self:getTotalGrade(), text_x, 120, 90, "left") diff --git a/tetris/modes/survival_a3.lua b/tetris/modes/survival_a3.lua index 4a980a0..6619908 100644 --- a/tetris/modes/survival_a3.lua +++ b/tetris/modes/survival_a3.lua @@ -132,10 +132,10 @@ function SurvivalA3Game:onLineClear(cleared_row_count) if new_level >= 1300 or self:hitTorikan(self.level, new_level) then if new_level >= 1300 then self.level = 1300 + self.big_mode = true end self.clear = true self.grid:clear() - self.big_mode = true self.roll_frames = -150 else self.level = math.min(new_level, 1300) diff --git a/tetris/modes/survival_ax2.lua b/tetris/modes/survival_ax2.lua index ca750ed..8086a8c 100644 --- a/tetris/modes/survival_ax2.lua +++ b/tetris/modes/survival_ax2.lua @@ -1,6 +1,6 @@ require 'funcs' -local MarathonAX2 = require 'tetris.modes.marathon_AX2' +local MarathonAX2 = require 'tetris.modes.marathon_ax2' local Piece = require 'tetris.components.piece' local History6RollsRandomizer = require 'tetris.randomizers.history_6rolls' diff --git a/tetris/rulesets/standard_exp.lua b/tetris/rulesets/standard.lua similarity index 100% rename from tetris/rulesets/standard_exp.lua rename to tetris/rulesets/standard.lua diff --git a/tetris/rulesets/standard_ti.lua b/tetris/rulesets/standard_ti.lua new file mode 100644 index 0000000..605e46f --- /dev/null +++ b/tetris/rulesets/standard_ti.lua @@ -0,0 +1,30 @@ +local Standard = require 'tetris.rulesets.standard' + +local SRS = Standard:extend() + +SRS.name = "Ti-SRS" +SRS.hash = "StandardTI" + +function SRS: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 >= 10 then + piece.locked = true + end + end +end + +function SRS:onPieceRotate(piece, grid) + piece.lock_delay = 0 -- rotate reset + if piece:isDropBlocked(grid) then + piece.rotate_counter = piece.rotate_counter + 1 + if piece.rotate_counter >= 8 then + piece.locked = true + end + end +end + +function SRS:get180RotationValue() return config["reverse_rotate"] and 1 or 3 end + +return SRS \ No newline at end of file