mirror of
https://github.com/SashLilac/cambridge-modpack.git
synced 2024-11-22 13:49:02 -06:00
Compare commits
No commits in common. "c7926b284383cddf6048f81cfb62c48dacf2eb8a" and "5ece2994e9a526bb0ea81b7e9443e45cc967dcd0" have entirely different histories.
c7926b2843
...
5ece2994e9
@ -14,9 +14,9 @@ function LudicrousSpeed:new()
|
|||||||
self.super:new()
|
self.super:new()
|
||||||
|
|
||||||
self.time_limit = 300
|
self.time_limit = 300
|
||||||
self.delays = {}
|
self.pps = {}
|
||||||
self.last_piece = 0
|
|
||||||
self.pps_limit = 1
|
self.pps_limit = 1
|
||||||
|
self.pieces = 0
|
||||||
|
|
||||||
self.randomizer = Bag7Randomizer()
|
self.randomizer = Bag7Randomizer()
|
||||||
|
|
||||||
@ -28,16 +28,6 @@ function LudicrousSpeed:new()
|
|||||||
self.next_queue_length = 6
|
self.next_queue_length = 6
|
||||||
end
|
end
|
||||||
|
|
||||||
local function mean(t)
|
|
||||||
local sum = 0
|
|
||||||
|
|
||||||
for _, v in ipairs(t) do
|
|
||||||
sum = sum + v
|
|
||||||
end
|
|
||||||
|
|
||||||
return sum / #t
|
|
||||||
end
|
|
||||||
|
|
||||||
function LudicrousSpeed:getGravity()
|
function LudicrousSpeed:getGravity()
|
||||||
if self.lines < 180 then
|
if self.lines < 180 then
|
||||||
return (0.8 - (math.floor(self.lines / 10) * 0.007)) ^ -math.floor(self.lines / 10) / 60
|
return (0.8 - (math.floor(self.lines / 10) * 0.007)) ^ -math.floor(self.lines / 10) / 60
|
||||||
@ -52,31 +42,41 @@ function LudicrousSpeed:getARR() return config.arr end
|
|||||||
function LudicrousSpeed:getDasCutDelay() return config.dcd end
|
function LudicrousSpeed:getDasCutDelay() return config.dcd end
|
||||||
function LudicrousSpeed:getDropSpeed() return 20 end
|
function LudicrousSpeed:getDropSpeed() return 20 end
|
||||||
|
|
||||||
function LudicrousSpeed:getPPS()
|
local function mean(t)
|
||||||
if #self.delays == 0 then return 0 end
|
local sum = 0
|
||||||
local delays = copy(self.delays)
|
local count = 0
|
||||||
delays[#delays + 1] = self.frames - self.last_piece
|
|
||||||
return (mean(delays) / 60) ^ -1
|
for k, v in pairs(t) do
|
||||||
|
if type(v) == 'number' then
|
||||||
|
sum = sum + v
|
||||||
|
count = count + 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return (sum / count)
|
||||||
end
|
end
|
||||||
|
|
||||||
function LudicrousSpeed:advanceOneFrame()
|
function LudicrousSpeed:advanceOneFrame()
|
||||||
if self.ready_frames == 0 then
|
if self.ready_frames == 0 then
|
||||||
self.frames = self.frames + 1
|
self.frames = self.frames + 1
|
||||||
if self:getPPS() < self.pps_limit then
|
if mean(self.pps) * 60 < self.pps_limit then
|
||||||
self.time_limit = self.time_limit - 1
|
self.time_limit = self.time_limit - 1
|
||||||
self.game_over = self.time_limit <= 0
|
self.game_over = self.time_limit <= 0
|
||||||
else self.time_limit = 300 end
|
else self.time_limit = 300 end
|
||||||
|
if self.frames ~= 0 then
|
||||||
|
if table.getn(self.pps) == 750 then
|
||||||
|
table.remove(self.pps, 1)
|
||||||
|
table.insert(self.pps, self.pieces)
|
||||||
|
else table.insert(self.pps, self.pieces) end
|
||||||
|
self.pieces = 0
|
||||||
|
end
|
||||||
end
|
end
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
function LudicrousSpeed:onPieceLock(...)
|
function LudicrousSpeed:onPieceLock()
|
||||||
self.super:onPieceLock(...)
|
self.super:onPieceLock()
|
||||||
self.delays[#self.delays + 1] = self.frames - self.last_piece
|
self.pieces = self.pieces + 1
|
||||||
if #self.delays >= 25 then
|
|
||||||
table.remove(self.delays, 1)
|
|
||||||
end
|
|
||||||
self.last_piece = self.frames
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function LudicrousSpeed:onLineClear(cleared_row_count)
|
function LudicrousSpeed:onLineClear(cleared_row_count)
|
||||||
@ -114,7 +114,7 @@ function LudicrousSpeed:drawScoringInfo()
|
|||||||
|
|
||||||
love.graphics.setFont(font_3x5_3)
|
love.graphics.setFont(font_3x5_3)
|
||||||
love.graphics.printf(self.lines, text_x, 140, 80, "left")
|
love.graphics.printf(self.lines, text_x, 140, 80, "left")
|
||||||
love.graphics.printf(string.format("%.02f", self:getPPS()), text_x, 200, 80, "left")
|
love.graphics.printf(string.format("%.02f", self.frames > 0 and mean(self.pps) * 60 or 0), text_x, 200, 80, "left")
|
||||||
love.graphics.printf(string.format("%.02f", self.pps_limit), text_x, 260, 80, "left")
|
love.graphics.printf(string.format("%.02f", self.pps_limit), text_x, 260, 80, "left")
|
||||||
|
|
||||||
love.graphics.setFont(font_8x11)
|
love.graphics.setFont(font_8x11)
|
||||||
|
@ -56,25 +56,6 @@ function SurvivalGTEGame:onLineClear(cleared_row_count)
|
|||||||
self.completed = self.lines >= 300
|
self.completed = self.lines >= 300
|
||||||
end
|
end
|
||||||
|
|
||||||
local function getLowestBlockY(offsets)
|
|
||||||
local res = -math.huge
|
|
||||||
for _, o in pairs(offsets) do
|
|
||||||
if o.y > res then
|
|
||||||
res = o.y
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return res
|
|
||||||
end
|
|
||||||
|
|
||||||
function SurvivalGTEGame:onEnterOrHold(...)
|
|
||||||
while (
|
|
||||||
getLowestBlockY(self.piece:getBlockOffsets()) + self.piece.position.y
|
|
||||||
) < 4 do
|
|
||||||
self.piece.position.y = self.piece.position.y + 1
|
|
||||||
end
|
|
||||||
self.super.onEnterOrHold(self, ...)
|
|
||||||
end
|
|
||||||
|
|
||||||
function SurvivalGTEGame:advanceOneFrame()
|
function SurvivalGTEGame:advanceOneFrame()
|
||||||
if self.ready_frames == 0 then
|
if self.ready_frames == 0 then
|
||||||
self.frames = self.frames + 1
|
self.frames = self.frames + 1
|
||||||
|
@ -21,32 +21,26 @@ function Trans:attemptRotate(new_inputs, piece, grid, initial)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local new_piece = piece:withRelativeRotation(rot_dir)
|
local new_piece = piece:withRelativeRotation(rot_dir)
|
||||||
|
|
||||||
if initial then
|
|
||||||
if (grid:canPlacePiece(new_piece)) then
|
|
||||||
self:onPieceRotate(piece, grid)
|
|
||||||
piece:setRelativeRotation(rot_dir)
|
|
||||||
end
|
|
||||||
else
|
|
||||||
self:attemptWallkicks(piece, new_piece, rot_dir, grid)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function Trans:attemptWallkicks(piece, new_piece, rot_dir, grid)
|
|
||||||
local pieces = {"I", "J", "L", "O", "S", "T", "Z"}
|
local pieces = {"I", "J", "L", "O", "S", "T", "Z"}
|
||||||
repeat
|
repeat
|
||||||
new_piece.shape = pieces[math.random(7)]
|
new_piece.shape = pieces[math.random(7)]
|
||||||
until piece.shape ~= new_piece.shape
|
until piece.shape ~= new_piece.shape
|
||||||
|
|
||||||
local offsets = {{x=0, y=0}, {x=1, y=0}, {x=-1, y=0}}
|
if (grid:canPlacePiece(new_piece)) then
|
||||||
for _, o in pairs(offsets) do
|
|
||||||
local kicked_piece = new_piece:withOffset(o)
|
|
||||||
if (grid:canPlacePiece(kicked_piece)) then
|
|
||||||
self:onPieceRotate(piece, grid)
|
self:onPieceRotate(piece, grid)
|
||||||
piece:setRelativeRotation(rot_dir)
|
piece:setRelativeRotation(rot_dir)
|
||||||
piece:setOffset(o)
|
|
||||||
piece.shape = new_piece.shape
|
piece.shape = new_piece.shape
|
||||||
return
|
else
|
||||||
|
if not(initial and self.enable_IRS_wallkicks == false) then
|
||||||
|
if (grid:canPlacePiece(new_piece:withOffset({x=1, y=0}))) then
|
||||||
|
self:onPieceRotate(piece, grid)
|
||||||
|
piece:setRelativeRotation(rot_dir):setOffset({x=1, y=0})
|
||||||
|
piece.shape = new_piece.shape
|
||||||
|
elseif (grid:canPlacePiece(new_piece:withOffset({x=-1, y=0}))) then
|
||||||
|
self:onPieceRotate(piece, grid)
|
||||||
|
piece:setRelativeRotation(rot_dir):setOffset({x=-1, y=0})
|
||||||
|
piece.shape = new_piece.shape
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user