v0.3-pre3

This commit is contained in:
Ishaan Bhardwaj 2021-01-28 21:09:42 -05:00
parent b50b573331
commit d2ab381ac8
7 changed files with 48 additions and 76 deletions

View File

@ -1,4 +1,4 @@
local SRS = require 'tetris.rulesets.standard_exp' local SRS = require 'tetris.rulesets.standard'
local DS = SRS:extend() 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:onPieceRotate(piece) piece.lock_delay = 0 end
function DS:get180RotationValue() function DS:get180RotationValue()
if config.gamesettings.world_reverse == 1 then
return 1
else
return 3 return 3
end
end end
return DS return DS

42
tetris/rulesets/ears.lua Normal file
View File

@ -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

View File

@ -188,11 +188,7 @@ function SRS:onPieceRotate(piece, grid)
end end
function SRS:get180RotationValue() function SRS:get180RotationValue()
if config.gamesettings.world_reverse == 1 then
return 1
else
return 3 return 3
end
end end
return SRS return SRS

View File

@ -75,11 +75,7 @@ function Nintendo:onPieceDrop(piece)
end end
function Nintendo:get180RotationValue() function Nintendo:get180RotationValue()
if config.gamesettings.world_reverse == 3 then
return 1
else
return 3 return 3
end
end end
function Nintendo:getDefaultOrientation() return 3 end -- downward facing pieces by default function Nintendo:getDefaultOrientation() return 3 end -- downward facing pieces by default

View File

@ -1,5 +1,5 @@
local Piece = require 'tetris.components.piece' local Piece = require 'tetris.components.piece'
local SRS = require 'tetris.rulesets.standard_exp' local SRS = require 'tetris.rulesets.standard'
local PPTPRS = SRS:extend() local PPTPRS = SRS:extend()

View File

@ -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

View File

@ -117,11 +117,7 @@ function TheNew:onPieceDrop(piece, grid)
end end
function TheNew:get180RotationValue() function TheNew:get180RotationValue()
if config.gamesettings.world_reverse == 1 then
return 1
else
return 3 return 3
end
end end
function TheNew:getDefaultOrientation() return 3 end function TheNew:getDefaultOrientation() return 3 end