Joker now has a 21-tall board, Tengen added

pull/4/head
Ishaan Bhardwaj 2021-02-07 19:26:53 -05:00
parent 86c3006962
commit ccb032ad4c
2 changed files with 109 additions and 0 deletions

View File

@ -1,6 +1,7 @@
require 'funcs'
local GameMode = require 'tetris.modes.gamemode'
local Grid = require 'tetris.components.grid'
local Piece = require 'tetris.components.piece'
local DTETRandomizer = require 'tetris.randomizers.dtet'
@ -16,6 +17,7 @@ JokerGame.tagline = "One of the hardest modes! Can you retain your stock to leve
function JokerGame:new()
self.super:new()
self.grid = Grid(10, 25)
self.randomizer = DTETRandomizer()
self.level = 50

107
tetris/rulesets/tengen.lua Normal file
View File

@ -0,0 +1,107 @@
local Piece = require 'tetris.components.piece'
local Ruleset = require 'tetris.rulesets.ruleset'
local Tengen = Ruleset:extend()
Tengen.name = "Tengen"
Tengen.hash = "Tengen"
Tengen.colourscheme = {
I = "R",
J = "O",
L = "M",
O = "B",
S = "G",
T = "Y",
Z = "C"
}
Tengen.spawn_positions = {
I = { x=3, y=4 },
J = { x=4, y=5 },
L = { x=4, y=5 },
O = { x=4, y=5 },
S = { x=4, y=5 },
T = { x=4, y=5 },
Z = { x=4, y=5 },
}
Tengen.big_spawn_positions = {
I = { x=1, y=2 },
J = { x=2, y=3 },
L = { x=2, y=3 },
O = { x=2, y=3 },
S = { x=2, y=3 },
T = { x=2, y=3 },
Z = { x=2, y=3 },
}
Tengen.block_offsets = {
I={
{ {x=0, y=0}, {x=1, y=0}, {x=2, y=0}, {x=3, y=0} },
{ {x=1, y=0}, {x=1, y=1}, {x=1, y=2}, {x=1, y=3} },
{ {x=0, y=0}, {x=1, y=0}, {x=2, y=0}, {x=3, y=0} },
{ {x=1, y=0}, {x=1, y=1}, {x=1, y=2}, {x=1, y=3} },
},
J={
{ {x=-1, y=-1}, {x=-1, y=0}, {x=0, y=0}, {x=1, y=0} },
{ {x=-1, y=-1}, {x=0, y=-1}, {x=-1, y=0}, {x=-1, y=1} },
{ {x=-1, y=-1}, {x=0, y=-1}, {x=1, y=-1}, {x=1, y=0} },
{ {x=0, y=-1}, {x=0, y=0}, {x=-1, y=1}, {x=0, y=1} },
},
L={
{ {x=1, y=-1}, {x=-1, y=0}, {x=0, y=0}, {x=1, y=0} },
{ {x=-1, y=-1}, {x=-1, y=0}, {x=-1, y=1}, {x=0, y=1} },
{ {x=-1, y=-1}, {x=0, y=-1}, {x=1, y=-1}, {x=-1, y=0} },
{ {x=-1, y=-1}, {x=0, y=-1}, {x=0, y=0}, {x=0, y=1} },
},
O={
{ {x=0, y=-1}, {x=1, y=-1}, {x=0, y=0}, {x=1, y=0} },
{ {x=0, y=-1}, {x=1, y=-1}, {x=0, y=0}, {x=1, y=0} },
{ {x=0, y=-1}, {x=1, y=-1}, {x=0, y=0}, {x=1, y=0} },
{ {x=0, y=-1}, {x=1, y=-1}, {x=0, y=0}, {x=1, y=0} },
},
S={
{ {x=0, y=-1}, {x=1, y=-1}, {x=-1, y=0}, {x=0, y=0} },
{ {x=-1, y=-1}, {x=-1, y=0}, {x=0, y=0}, {x=0, y=1} },
{ {x=0, y=-1}, {x=1, y=-1}, {x=-1, y=0}, {x=0, y=0} },
{ {x=-1, y=-1}, {x=-1, y=0}, {x=0, y=0}, {x=0, y=1} },
},
T={
{ {x=0, y=-1}, {x=-1, y=0}, {x=0, y=0}, {x=1, y=0} },
{ {x=-1, y=-1}, {x=-1, y=0}, {x=0, y=0}, {x=-1, y=1} },
{ {x=-1, y=-1}, {x=0, y=-1}, {x=1, y=-1}, {x=0, y=0} },
{ {x=0, y=-1}, {x=-1, y=0}, {x=0, y=0}, {x=0, y=1} },
},
Z={
{ {x=-1, y=-1}, {x=0, y=-1}, {x=0, y=0}, {x=1, y=0} },
{ {x=0, y=-1}, {x=-1, y=0}, {x=0, y=0}, {x=-1, y=1} },
{ {x=-1, y=-1}, {x=0, y=-1}, {x=0, y=0}, {x=1, y=0} },
{ {x=0, y=-1}, {x=-1, y=0}, {x=0, y=0}, {x=-1, y=1} },
}
}
-- Component functions.
function Tengen:attemptWallkicks(piece, new_piece, rot_dir, grid)
-- O doesn't kick
if (piece.shape == "O") then return end
if (grid:canPlacePiece(new_piece:withOffset({x=-1, y=0}))) then
piece:setRelativeRotation(rot_dir):setOffset({x=-1, y=0})
end
end
function Tengen:onPieceDrop(piece, grid)
piece.lock_delay = 0 -- step reset
end
function Tengen:get180RotationValue()
return 3
end
function Tengen:getDefaultOrientation() return 3 end -- downward facing pieces by default
return Tengen