h (v0.2.6)

This commit is contained in:
Ishaan Bhardwaj
2020-12-22 22:09:17 -05:00
parent d01f24dcf8
commit 76dd287a11
16 changed files with 729 additions and 16 deletions

View File

@@ -10,7 +10,7 @@ Cultris.colourscheme = {
L = "M",
J = "B",
S = "C",
Z = "F",
Z = "X",
O = "Y",
T = "R",
}

37
tetris/rulesets/h.lua Normal file
View File

@@ -0,0 +1,37 @@
local SRS = require 'tetris.rulesets.standard_exp'
local H = SRS:extend()
H.name = "h"
H.hash = "h"
H.world = false
function H:attemptRotate(new_inputs, piece, grid, initial)
local rot_dir = 0
if (new_inputs["rotate_left"] or new_inputs["rotate_left2"]) then
rot_dir = 3
elseif (new_inputs["rotate_right"] or new_inputs["rotate_right2"]) then
rot_dir = 1
elseif (new_inputs["rotate_180"]) then
rot_dir = self:get180RotationValue()
end
if rot_dir == 0 then return end
if config.gamesettings.world_reverse == 3 or (self.world and config.gamesettings.world_reverse == 2) then
rot_dir = 4 - rot_dir
end
local new_piece = piece:withRelativeRotation(rot_dir)
if not(initial and self.enable_IRS_wallkicks == false) then
self:onPieceRotate(piece, grid)
piece:setRelativeRotation(rot_dir)
end
end
function H:getDefaultOrientation()
return math.random(4)
end
return H

150
tetris/rulesets/mizu_rs.lua Normal file
View File

@@ -0,0 +1,150 @@
local Piece = require 'tetris.components.piece'
local Ruleset = require 'tetris.rulesets.ruleset'
local MizuRS = Ruleset:extend()
MizuRS.name = "Mizu Rotation"
MizuRS.hash = "MizuRS"
MizuRS.softdrop_lock = false
MizuRS.harddrop_lock = true
MizuRS.colourscheme = {
I = "R",
L = "O",
J = "C",
S = "G",
Z = "M",
O = "Y",
T = "B",
}
MizuRS.spawn_positions = {
I = { x=5, y=2 },
J = { x=4, y=3 },
L = { x=4, y=3 },
O = { x=5, y=3 },
S = { x=4, y=3 },
T = { x=4, y=3 },
Z = { x=4, y=3 },
}
MizuRS.big_spawn_positions = {
I = { x=3, y=0 },
J = { x=2, y=1 },
L = { x=2, y=1 },
O = { x=3, y=1 },
S = { x=2, y=1 },
T = { x=2, y=1 },
Z = { x=2, y=1 },
}
MizuRS.block_offsets = {
I={
{ {x=0, y=0}, {x=-1, y=0}, {x=-2, y=0}, {x=1, y=0} },
{ {x=0, y=0}, {x=0, y=-1}, {x=0, y=1}, {x=0, y=2} },
{ {x=0, y=0}, {x=-1, y=0}, {x=-2, y=0}, {x=1, y=0} },
{ {x=0, y=0}, {x=0, y=-1}, {x=0, y=1}, {x=0, y=2} },
},
J={
{ {x=0, y=0}, {x=-1, y=0}, {x=1, y=0}, {x=-1, y=-1} },
{ {x=0, y=-1}, {x=1, y=-2}, {x=0, y=-2}, {x=0, y=0} },
{ {x=0, y=-1}, {x=-1, y=-1}, {x=1, y=-1}, {x=1, y=0} },
{ {x=0, y=-1}, {x=0, y=-2}, {x=0, y=0}, {x=-1, y=0} },
},
L={
{ {x=0, y=0}, {x=-1, y=0}, {x=1, y=0}, {x=1, y=-1} },
{ {x=0, y=-2}, {x=0, y=-1}, {x=1, y=0}, {x=0, y=0} },
{ {x=0, y=-1}, {x=-1, y=-1}, {x=1, y=-1}, {x=-1, y=0} },
{ {x=0, y=-1}, {x=-1, y=-2}, {x=0, y=-2}, {x=0, y=0} },
},
O={
{ {x=0, y=0}, {x=-1, y=0}, {x=-1, y=-1}, {x=0, y=-1} },
{ {x=0, y=0}, {x=-1, y=0}, {x=-1, y=-1}, {x=0, y=-1} },
{ {x=0, y=0}, {x=-1, y=0}, {x=-1, y=-1}, {x=0, y=-1} },
{ {x=0, y=0}, {x=-1, y=0}, {x=-1, y=-1}, {x=0, y=-1} },
},
S={
{ {x=1, y=-1}, {x=0, y=-1}, {x=0, y=0}, {x=-1, y=0} },
{ {x=-1, y=-2}, {x=-1, y=-1}, {x=0, y=-1}, {x=0, y=0} },
{ {x=-1, y=0}, {x=0, y=0}, {x=0, y=-1}, {x=1, y=-1} },
{ {x=1, y=0}, {x=1, y=-1}, {x=0, y=-1}, {x=0, y=-2} },
},
T={
{ {x=0, y=0}, {x=-1, y=0}, {x=1, y=0}, {x=0, y=-1} },
{ {x=0, y=-1}, {x=0, y=0}, {x=1, y=-1}, {x=0, y=-2} },
{ {x=0, y=-1}, {x=-1, y=-1}, {x=1, y=-1}, {x=0, y=0} },
{ {x=0, y=-1}, {x=0, y=0}, {x=-1, y=-1}, {x=0, y=-2} },
},
Z={
{ {x=1, y=0}, {x=0, y=0}, {x=0, y=-1}, {x=-1, y=-1} },
{ {x=-1, y=0}, {x=-1, y=-1}, {x=0, y=-1}, {x=0, y=-2} },
{ {x=1, y=0}, {x=0, y=0}, {x=0, y=-1}, {x=-1, y=-1} },
{ {x=1, y=-2}, {x=1, y=-1}, {x=0, y=-1}, {x=0, y=0} },
}
}
MizuRS.wallkicks_cw = {{x=0, y=-1}, {x=0, y=-2}, {x=1, y=0}, {x=2, y=0}, {x=0, y=1}, {x=0, y=2}, {x=-1, y=0}, {x=-2, y=0}, {x=1, y=-1}, {x=2, y=-2}, {x=1, y=1}, {x=2, y=2}, {x=-1, y=1}, {x=-2, y=2}, {x=-1, y=-1}, {x=-2, y=-2}}
MizuRS.wallkicks_ccw = {{x=0, y=-1}, {x=0, y=-2}, {x=-1, y=0}, {x=-2, y=0}, {x=0, y=1}, {x=0, y=2}, {x=1, y=0}, {x=2, y=0}, {x=-1, y=-1}, {x=-2, y=-2}, {x=-1, y=1}, {x=-2, y=2}, {x=1, y=1}, {x=2, y=2}, {x=1, y=1}, {x=2, y=2}}
function MizuRS:attemptWallkicks(piece, new_piece, rot_dir, grid)
local kicks
if piece.shape == "O" then
return
elseif rot_dir == 1 then
kicks = MizuRS.wallkicks_cw
else
kicks = MizuRS.wallkicks_ccw
end
assert(piece.rotation ~= new_piece.rotation)
for idx, offset in pairs(kicks) do
kicked_piece = new_piece:withOffset(offset)
if grid:canPlacePiece(kicked_piece) then
piece:setRelativeRotation(rot_dir)
piece:setOffset(offset)
self:onPieceRotate(piece, grid)
return
end
end
end
function MizuRS:checkNewLow(piece)
for _, block in pairs(piece:getBlockOffsets()) do
local y = piece.position.y + block.y
if y > piece.lowest_y then
piece.ldincrease = 20
piece.lock_delay = 0
piece.lowest_y = y
end
end
end
function MizuRS:onPieceCreate(piece, grid)
piece.ldincrease = 20
piece.lowest_y = -math.huge
end
function MizuRS:onPieceDrop(piece, grid)
self:checkNewLow(piece)
end
function MizuRS:onPieceMove(piece, grid)
if piece:isDropBlocked(grid) then
piece.lock_delay = math.max((piece.lock_delay - piece.ldincrease), 0)
piece.ldincrease = piece.ldincrease - 1
end
end
function MizuRS:onPieceRotate(piece, grid)
if piece:isDropBlocked(grid) then
piece.lock_delay = math.max((piece.lock_delay - piece.ldincrease), 0)
piece.ldincrease = piece.ldincrease - 1
end
end
function MizuRS:getDefaultOrientation() return 3 end
return MizuRS

View File

@@ -0,0 +1,24 @@
local ARS = require 'tetris.rulesets.arika'
local BONKERS = ARS:extend()
BONKERS.name = "SUPER302"
BONKERS.hash = "Super302"
function BONKERS:attemptWallkicks(piece, new_piece, rot_dir, grid)
unfilled_block_offsets = {}
for y = 4, 23 do
for x = 0, 9 do
if not grid:isOccupied(x, y) then
table.insert(unfilled_block_offsets, {x=x-100, y=y-100})
end
end
end
-- don't ask
piece.position = {x=100, y=100}
piece.getBlockOffsets = function(piece)
return unfilled_block_offsets
end
end
return BONKERS

View File

@@ -13,7 +13,7 @@ TheNext.colourscheme = {
I = "C",
J = "B",
L = "M",
O = "A",
O = "X",
S = "G",
Z = "R",
T = "Y"