From d2ab381ac8e58aae90c9335297658f351ed4cc1a Mon Sep 17 00:00:00 2001 From: Ishaan Bhardwaj Date: Thu, 28 Jan 2021 21:09:42 -0500 Subject: [PATCH] v0.3-pre3 --- tetris/rulesets/ds_world.lua | 8 ++--- tetris/rulesets/ears.lua | 42 ++++++++++++++++++++++++++ tetris/rulesets/mob_deluxe.lua | 6 +--- tetris/rulesets/nintendo_r.lua | 6 +--- tetris/rulesets/pptprs.lua | 2 +- tetris/rulesets/srs_x.lua | 54 ---------------------------------- tetris/rulesets/thenew.lua | 6 +--- 7 files changed, 48 insertions(+), 76 deletions(-) create mode 100644 tetris/rulesets/ears.lua delete mode 100644 tetris/rulesets/srs_x.lua diff --git a/tetris/rulesets/ds_world.lua b/tetris/rulesets/ds_world.lua index d729e0d..fcc97a0 100644 --- a/tetris/rulesets/ds_world.lua +++ b/tetris/rulesets/ds_world.lua @@ -1,4 +1,4 @@ -local SRS = require 'tetris.rulesets.standard_exp' +local SRS = require 'tetris.rulesets.standard' local DS = SRS:extend() @@ -12,11 +12,7 @@ function DS:onPieceMove(piece) piece.lock_delay = 0 end function DS:onPieceRotate(piece) piece.lock_delay = 0 end function DS:get180RotationValue() - if config.gamesettings.world_reverse == 1 then - return 1 - else - return 3 - end + return 3 end return DS \ No newline at end of file diff --git a/tetris/rulesets/ears.lua b/tetris/rulesets/ears.lua new file mode 100644 index 0000000..9333c3b --- /dev/null +++ b/tetris/rulesets/ears.lua @@ -0,0 +1,42 @@ +local SRS = require 'tetris.rulesets.arika_srs' + +local EARS = SRS:extend() + +EARS.name = "E.A.R.S." +EARS.hash = "EARS" + +EARS.colourscheme = { + I = "F", + J = "G", + L = "R", + O = "C", + S = "B", + T = "Y", + Z = "O", +} + +function EARS:attemptWallkicks(piece, new_piece, rot_dir, grid) + for kd = 1, grid.height do + for x = -kd, kd do + tx = rot_dir == 3 and -x or x + for y = kd, -kd, -1 do + if math.abs(tx) + math.abs(y) == kd then + offset = {x=tx, y=y} + kicked_piece = new_piece:withOffset(offset) + if grid:canPlacePiece(kicked_piece) then + self:onPieceRotate(piece, grid) + piece:setRelativeRotation(rot_dir) + piece:setOffset(offset) + return + end + end + end + end + end +end + +function EARS:get180RotationValue() + return 2 +end + +return EARS \ No newline at end of file diff --git a/tetris/rulesets/mob_deluxe.lua b/tetris/rulesets/mob_deluxe.lua index aaf10f6..afa443d 100644 --- a/tetris/rulesets/mob_deluxe.lua +++ b/tetris/rulesets/mob_deluxe.lua @@ -188,11 +188,7 @@ function SRS:onPieceRotate(piece, grid) end function SRS:get180RotationValue() - if config.gamesettings.world_reverse == 1 then - return 1 - else - return 3 - end + return 3 end return SRS diff --git a/tetris/rulesets/nintendo_r.lua b/tetris/rulesets/nintendo_r.lua index 2908caa..4e59353 100644 --- a/tetris/rulesets/nintendo_r.lua +++ b/tetris/rulesets/nintendo_r.lua @@ -75,11 +75,7 @@ function Nintendo:onPieceDrop(piece) end function Nintendo:get180RotationValue() - if config.gamesettings.world_reverse == 3 then - return 1 - else - return 3 - end + return 3 end function Nintendo:getDefaultOrientation() return 3 end -- downward facing pieces by default diff --git a/tetris/rulesets/pptprs.lua b/tetris/rulesets/pptprs.lua index 804429d..aa9e9b0 100644 --- a/tetris/rulesets/pptprs.lua +++ b/tetris/rulesets/pptprs.lua @@ -1,5 +1,5 @@ local Piece = require 'tetris.components.piece' -local SRS = require 'tetris.rulesets.standard_exp' +local SRS = require 'tetris.rulesets.standard' local PPTPRS = SRS:extend() diff --git a/tetris/rulesets/srs_x.lua b/tetris/rulesets/srs_x.lua deleted file mode 100644 index 0d8c69c..0000000 --- a/tetris/rulesets/srs_x.lua +++ /dev/null @@ -1,54 +0,0 @@ -local Piece = require 'tetris.components.piece' -local Ruleset = require 'tetris.rulesets.ti_srs' - -local SRS = Ruleset:extend() - -SRS.name = "SRS-X" -SRS.hash = "Reversed SRS drop functions" -SRS.softdrop_lock = true -SRS.harddrop_lock = false - -SRS.colourscheme = { - I = "R", - L = "O", - J = "B", - S = "M", - Z = "G", - O = "Y", - 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 >= self.MANIPULATIONS_MAX then - piece.locked = true - end - end -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 >= self.ROTATIONS_MAX then - piece.locked = true - end - end -end - -function SRS:get180RotationValue() return 2 end - -return SRS diff --git a/tetris/rulesets/thenew.lua b/tetris/rulesets/thenew.lua index 290c862..1246243 100644 --- a/tetris/rulesets/thenew.lua +++ b/tetris/rulesets/thenew.lua @@ -117,11 +117,7 @@ function TheNew:onPieceDrop(piece, grid) end function TheNew:get180RotationValue() - if config.gamesettings.world_reverse == 1 then - return 1 - else - return 3 - end + return 3 end function TheNew:getDefaultOrientation() return 3 end