mirror of
https://github.com/SashLilac/cambridge.git
synced 2024-11-22 14:19:02 -06:00
Slight randomizer logic change, PAIRS incoming
This commit is contained in:
parent
125488b4d9
commit
64047eaf9c
@ -6,6 +6,7 @@ local playedGoSE = false
|
|||||||
|
|
||||||
local Grid = require 'tetris.components.grid'
|
local Grid = require 'tetris.components.grid'
|
||||||
local Randomizer = require 'tetris.randomizers.randomizer'
|
local Randomizer = require 'tetris.randomizers.randomizer'
|
||||||
|
local BagRandomizer = require 'tetris.randomizers.bag'
|
||||||
|
|
||||||
local GameMode = Object:extend()
|
local GameMode = Object:extend()
|
||||||
|
|
||||||
@ -56,6 +57,7 @@ function GameMode:new(secret_inputs)
|
|||||||
self.hard_drop_locked = false
|
self.hard_drop_locked = false
|
||||||
self.lock_on_soft_drop = false
|
self.lock_on_soft_drop = false
|
||||||
self.lock_on_hard_drop = false
|
self.lock_on_hard_drop = false
|
||||||
|
self.used_randomizer = nil
|
||||||
self.hold_queue = nil
|
self.hold_queue = nil
|
||||||
self.held = false
|
self.held = false
|
||||||
self.section_start_time = 0
|
self.section_start_time = 0
|
||||||
@ -74,11 +76,7 @@ function GameMode:getDasLimit() return 15 end
|
|||||||
function GameMode:getNextPiece(ruleset)
|
function GameMode:getNextPiece(ruleset)
|
||||||
return {
|
return {
|
||||||
skin = self:getSkin(),
|
skin = self:getSkin(),
|
||||||
shape = (
|
shape = self.used_randomizer:nextPiece(),
|
||||||
ruleset.pieces == self.randomizer.possible_pieces and
|
|
||||||
self.randomizer:nextPiece() or
|
|
||||||
ruleset.fallback_randomizer:nextPiece()
|
|
||||||
),
|
|
||||||
orientation = ruleset:getDefaultOrientation(),
|
orientation = ruleset:getDefaultOrientation(),
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
@ -90,6 +88,15 @@ end
|
|||||||
function GameMode:initialize(ruleset, secret_inputs)
|
function GameMode:initialize(ruleset, secret_inputs)
|
||||||
-- generate next queue
|
-- generate next queue
|
||||||
self:new(secret_inputs)
|
self:new(secret_inputs)
|
||||||
|
self.used_randomizer = (
|
||||||
|
ruleset.pieces == self.randomizer.possible_pieces and
|
||||||
|
self.randomizer or
|
||||||
|
(
|
||||||
|
ruleset.pieces == 7 and
|
||||||
|
Randomizer() or
|
||||||
|
BagRandomizer(ruleset.pieces)
|
||||||
|
)
|
||||||
|
)
|
||||||
for i = 1, self.next_queue_length do
|
for i = 1, self.next_queue_length do
|
||||||
table.insert(self.next_queue, self:getNextPiece(ruleset))
|
table.insert(self.next_queue, self:getNextPiece(ruleset))
|
||||||
end
|
end
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
local Object = require 'libs.classic'
|
local Object = require 'libs.classic'
|
||||||
local Piece = require 'tetris.components.piece'
|
local Piece = require 'tetris.components.piece'
|
||||||
local Bag7Randomizer = require "tetris.randomizers.bag7"
|
|
||||||
|
|
||||||
local Ruleset = Object:extend()
|
local Ruleset = Object:extend()
|
||||||
|
|
||||||
@ -23,7 +22,6 @@ Ruleset.harddrop_lock = false
|
|||||||
|
|
||||||
Ruleset.enable_IRS_wallkicks = false
|
Ruleset.enable_IRS_wallkicks = false
|
||||||
Ruleset.are_cancel = false
|
Ruleset.are_cancel = false
|
||||||
Ruleset.fallback_randomizer = Bag7Randomizer()
|
|
||||||
|
|
||||||
Ruleset.next_sounds = {
|
Ruleset.next_sounds = {
|
||||||
I = "I",
|
I = "I",
|
||||||
|
Loading…
Reference in New Issue
Block a user