mirror of
https://github.com/SashLilac/cambridge-modpack.git
synced 2024-11-22 10:09:02 -06:00
New misc modes
This commit is contained in:
parent
c5ec18d9e1
commit
51e24c09b8
299
tetris/modes/g_lock.lua
Normal file
299
tetris/modes/g_lock.lua
Normal file
@ -0,0 +1,299 @@
|
||||
require 'funcs'
|
||||
|
||||
local GameMode = require 'tetris.modes.gamemode'
|
||||
|
||||
local History4RollsRandomizer = require 'tetris.randomizers.history_4rolls'
|
||||
|
||||
local GLock = GameMode:extend()
|
||||
|
||||
GLock.name = "G-Lock"
|
||||
GLock.hash = "GLock"
|
||||
GLock.tagline = "The speeds fluctuate rapidly! Can you withstand the pressure?"
|
||||
|
||||
function GLock:new()
|
||||
self.super:new()
|
||||
|
||||
self.pieces = 0
|
||||
self.time_active = 0
|
||||
|
||||
self.randomizer = History4RollsRandomizer()
|
||||
self.lock_drop = true
|
||||
self.lock_hard_drop = true
|
||||
self.enable_hold = false
|
||||
self.next_queue_length = 4
|
||||
end
|
||||
|
||||
function GLock:getARE()
|
||||
if (self.pieces < 250) then return 23
|
||||
elseif (self.pieces < 275) then return 20
|
||||
elseif (self.pieces < 285) then return 23
|
||||
elseif (self.pieces < 305) then return 14
|
||||
elseif (self.pieces < 315) then return 20
|
||||
elseif (self.pieces < 340) then return 14
|
||||
elseif (self.pieces < 350) then return 20
|
||||
elseif (self.pieces < 380) then return 12
|
||||
elseif (self.pieces < 395) then return 18
|
||||
elseif (self.pieces < 430) then return 12
|
||||
elseif (self.pieces < 445) then return 16
|
||||
elseif (self.pieces < 475) then return 10
|
||||
else return 8
|
||||
end
|
||||
end
|
||||
|
||||
function GLock:getLineARE()
|
||||
if (self.pieces < 250) then return 20
|
||||
elseif (self.pieces < 275) then return 18
|
||||
elseif (self.pieces < 285) then return 18
|
||||
elseif (self.pieces < 305) then return 14
|
||||
elseif (self.pieces < 315) then return 16
|
||||
elseif (self.pieces < 340) then return 12
|
||||
elseif (self.pieces < 350) then return 14
|
||||
elseif (self.pieces < 380) then return 12
|
||||
elseif (self.pieces < 395) then return 12
|
||||
elseif (self.pieces < 430) then return 10
|
||||
elseif (self.pieces < 445) then return 10
|
||||
else return 8
|
||||
end
|
||||
end
|
||||
|
||||
function GLock:getDasLimit()
|
||||
if (self.pieces < 195) then return 16
|
||||
elseif (self.pieces < 235) then return 14
|
||||
elseif (self.pieces < 250) then return 16
|
||||
elseif (self.pieces < 275) then return 14
|
||||
elseif (self.pieces < 285) then return 14
|
||||
elseif (self.pieces < 305) then return 14
|
||||
elseif (self.pieces < 315) then return 14
|
||||
elseif (self.pieces < 340) then return 12
|
||||
elseif (self.pieces < 350) then return 12
|
||||
elseif (self.pieces < 380) then return 12
|
||||
elseif (self.pieces < 395) then return 12
|
||||
else return 10
|
||||
end
|
||||
end
|
||||
|
||||
function GLock:getLineClearDelay()
|
||||
if (self.pieces < 275) then return 25
|
||||
elseif (self.pieces < 285) then return 18
|
||||
elseif (self.pieces < 305) then return 20
|
||||
elseif (self.pieces < 315) then return 18
|
||||
elseif (self.pieces < 340) then return 18
|
||||
elseif (self.pieces < 350) then return 16
|
||||
elseif (self.pieces < 380) then return 16
|
||||
elseif (self.pieces < 395) then return 16
|
||||
elseif (self.pieces < 430) then return 12
|
||||
elseif (self.pieces < 445) then return 14
|
||||
elseif (self.pieces < 475) then return 10
|
||||
else return 8
|
||||
end
|
||||
end
|
||||
|
||||
function GLock:getLockDelay()
|
||||
if (self.pieces < 285) then return 30
|
||||
elseif (self.pieces < 305) then return 25
|
||||
elseif (self.pieces < 315) then return 30
|
||||
elseif (self.pieces < 340) then return 25
|
||||
elseif (self.pieces < 350) then return 30
|
||||
elseif (self.pieces < 380) then return 22
|
||||
elseif (self.pieces < 395) then return 30
|
||||
elseif (self.pieces < 430) then return 22
|
||||
elseif (self.pieces < 445) then return 30
|
||||
elseif (self.pieces < 475) then return 17
|
||||
else return 15
|
||||
end
|
||||
end
|
||||
|
||||
function GLock:getGravity()
|
||||
if (self.pieces < 20) then return 64/256
|
||||
elseif (self.pieces < 50) then return 2
|
||||
elseif (self.pieces < 65) then return 64/256
|
||||
elseif (self.pieces < 115) then return 4
|
||||
elseif (self.pieces < 130) then return 128/256
|
||||
elseif (self.pieces < 180) then return 5
|
||||
elseif (self.pieces < 195) then return 1
|
||||
elseif (self.pieces < 235) then return 10
|
||||
elseif (self.pieces < 250) then return 2
|
||||
elseif (self.pieces < 275) then return 20
|
||||
elseif (self.pieces < 285) then return 2
|
||||
elseif (self.pieces < 305) then return 20
|
||||
elseif (self.pieces < 315) then return 3
|
||||
elseif (self.pieces < 340) then return 20
|
||||
elseif (self.pieces < 350) then return 3
|
||||
elseif (self.pieces < 380) then return 20
|
||||
elseif (self.pieces < 395) then return 4
|
||||
elseif (self.pieces < 430) then return 20
|
||||
elseif (self.pieces < 445) then return 5
|
||||
else return 20
|
||||
end
|
||||
end
|
||||
|
||||
function GLock:advanceOneFrame()
|
||||
if self.ready_frames == 0 then
|
||||
self.frames = self.frames + 1
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
function GLock:onPieceLock()
|
||||
self.super:onPieceLock()
|
||||
self.pieces = self.pieces + 1
|
||||
self.time_active = 0
|
||||
if self.pieces == 500 then
|
||||
self.completed = true
|
||||
local emptyGarbage = {"e", "e", "e", "e", "e", "e", "e", "e", "e", "e"}
|
||||
local letterGTopBottom = {"e", "e", "e", "", "", "", "", "e", "e", "e"}
|
||||
local letterG145 = {"e", "e", "", "e", "e", "e", "e", "", "e", "e"}
|
||||
local letterG2 = {"e", "e", "", "e", "e", "e", "e", "e", "e", "e"}
|
||||
local letterG3 = {"e", "e", "", "e", "e", "", "", "e", "e", "e"}
|
||||
self.grid:clear()
|
||||
self.grid:garbageRise(letterGTopBottom)
|
||||
self.grid:garbageRise(letterG145)
|
||||
self.grid:garbageRise(letterG2)
|
||||
self.grid:garbageRise(letterG3)
|
||||
self.grid:garbageRise(letterG145)
|
||||
self.grid:garbageRise(letterG145)
|
||||
self.grid:garbageRise(letterGTopBottom)
|
||||
self.grid:garbageRise(emptyGarbage)
|
||||
self.grid:garbageRise(emptyGarbage)
|
||||
self.grid:garbageRise(letterGTopBottom)
|
||||
self.grid:garbageRise(letterG145)
|
||||
self.grid:garbageRise(letterG2)
|
||||
self.grid:garbageRise(letterG3)
|
||||
self.grid:garbageRise(letterG145)
|
||||
self.grid:garbageRise(letterG145)
|
||||
self.grid:garbageRise(letterGTopBottom)
|
||||
self.grid:garbageRise(emptyGarbage)
|
||||
self.grid:garbageRise(emptyGarbage)
|
||||
end
|
||||
end
|
||||
|
||||
function GLock:whilePieceActive()
|
||||
if not self.piece:isMoveBlocked(self.grid, {x=-1, y=0}) and self.prev_inputs["left"]
|
||||
or not self.piece:isMoveBlocked(self.grid, {x=1, y=0}) and self.prev_inputs["right"] then
|
||||
self.piece.lock_delay = 0
|
||||
end
|
||||
if self.piece:isDropBlocked(self.grid) then
|
||||
self.time_active = self.time_active + 1
|
||||
if self.time_active >= 240 then self.piece.locked = true end
|
||||
end
|
||||
end
|
||||
|
||||
function GLock:drawGrid()
|
||||
self.grid:draw()
|
||||
self:drawGhostPiece()
|
||||
end
|
||||
|
||||
function GLock:drawScoringInfo()
|
||||
love.graphics.setColor(1, 1, 1, 1)
|
||||
|
||||
love.graphics.setFont(font_3x5_2)
|
||||
love.graphics.print(
|
||||
self.das.direction .. " " ..
|
||||
self.das.frames .. " " ..
|
||||
strTrueValues(self.prev_inputs)
|
||||
)
|
||||
love.graphics.printf("NEXT", 64, 40, 40, "left")
|
||||
love.graphics.printf("GRADE", 240, 120, 40, "left")
|
||||
love.graphics.printf("SECTION", 240, 200, 60, "left")
|
||||
love.graphics.printf("PIECES", 240, 320, 60, "left")
|
||||
|
||||
if self:getGSectionState() then
|
||||
love.graphics.printf("G-SECTION", 240, 220, 90, "left")
|
||||
else
|
||||
love.graphics.printf("N-SECTION", 240, 220, 90, "left")
|
||||
end
|
||||
|
||||
love.graphics.setFont(font_3x5_3)
|
||||
|
||||
if self:getGSection() == 11 then
|
||||
if self.frames <= 18000 then love.graphics.printf("GM", 240, 140, 90, "left")
|
||||
else love.graphics.printf("M", 240, 140, 90, "left") end
|
||||
else
|
||||
love.graphics.printf("G"..1+self:getGSection(), 240, 140, 90, "left")
|
||||
end
|
||||
|
||||
love.graphics.printf(self.pieces, 240, 340, 40, "right")
|
||||
love.graphics.printf(self:getSectionEndLevel(), 240, 370, 40, "right")
|
||||
|
||||
love.graphics.setFont(font_8x11)
|
||||
love.graphics.printf(formatTime(self.frames), 64, 420, 160, "center")
|
||||
end
|
||||
|
||||
function GLock:getSectionEndLevel()
|
||||
if self.pieces < 20 then return 20
|
||||
elseif self.pieces < 50 then return 50
|
||||
elseif self.pieces < 65 then return 65
|
||||
elseif self.pieces < 115 then return 115
|
||||
elseif self.pieces < 130 then return 130
|
||||
elseif self.pieces < 180 then return 180
|
||||
elseif self.pieces < 195 then return 195
|
||||
elseif self.pieces < 235 then return 235
|
||||
elseif self.pieces < 250 then return 250
|
||||
elseif self.pieces < 275 then return 275
|
||||
elseif self.pieces < 285 then return 285
|
||||
elseif self.pieces < 305 then return 305
|
||||
elseif self.pieces < 315 then return 315
|
||||
elseif self.pieces < 340 then return 340
|
||||
elseif self.pieces < 350 then return 350
|
||||
elseif self.pieces < 380 then return 380
|
||||
elseif self.pieces < 395 then return 395
|
||||
elseif self.pieces < 430 then return 430
|
||||
elseif self.pieces < 445 then return 445
|
||||
elseif self.pieces < 475 then return 475
|
||||
else return 500 end
|
||||
end
|
||||
|
||||
function GLock:getGSectionState()
|
||||
if self.pieces < 20 then return false
|
||||
elseif self.pieces < 50 then return true
|
||||
elseif self.pieces < 65 then return false
|
||||
elseif self.pieces < 115 then return true
|
||||
elseif self.pieces < 130 then return false
|
||||
elseif self.pieces < 180 then return true
|
||||
elseif self.pieces < 195 then return false
|
||||
elseif self.pieces < 235 then return true
|
||||
elseif self.pieces < 250 then return false
|
||||
elseif self.pieces < 275 then return true
|
||||
elseif self.pieces < 285 then return false
|
||||
elseif self.pieces < 305 then return true
|
||||
elseif self.pieces < 315 then return false
|
||||
elseif self.pieces < 340 then return true
|
||||
elseif self.pieces < 350 then return false
|
||||
elseif self.pieces < 380 then return true
|
||||
elseif self.pieces < 395 then return false
|
||||
elseif self.pieces < 430 then return true
|
||||
elseif self.pieces < 445 then return false
|
||||
else return true
|
||||
end
|
||||
end
|
||||
|
||||
function GLock:getGSection()
|
||||
if (self.pieces < 50) then return 0
|
||||
elseif (self.pieces < 115) then return 1
|
||||
elseif (self.pieces < 180) then return 2
|
||||
elseif (self.pieces < 235) then return 3
|
||||
elseif (self.pieces < 275) then return 4
|
||||
elseif (self.pieces < 305) then return 5
|
||||
elseif (self.pieces < 340) then return 6
|
||||
elseif (self.pieces < 380) then return 7
|
||||
elseif (self.pieces < 430) then return 8
|
||||
elseif (self.pieces < 475) then return 9
|
||||
elseif (self.pieces < 500) then return 10
|
||||
else return 11 end
|
||||
end
|
||||
|
||||
function GLock:getBackground()
|
||||
if self:getGSectionState() then return 4
|
||||
else return 7 end
|
||||
end
|
||||
|
||||
function GLock:getHighscoreData()
|
||||
return {
|
||||
gsection = self:getGSection(),
|
||||
pieces = self.pieces,
|
||||
frames = self.frames,
|
||||
}
|
||||
end
|
||||
|
||||
return GLock
|
||||
|
106
tetris/modes/joker.lua
Normal file
106
tetris/modes/joker.lua
Normal file
@ -0,0 +1,106 @@
|
||||
require 'funcs'
|
||||
|
||||
local GameMode = require 'tetris.modes.gamemode'
|
||||
local Piece = require 'tetris.components.piece'
|
||||
|
||||
local History6RollsRandomizer = require 'tetris.randomizers.history_6rolls'
|
||||
|
||||
local JokerGame = GameMode:extend()
|
||||
|
||||
JokerGame.name = "Final J"
|
||||
JokerGame.hash = "Joker"
|
||||
JokerGame.tagline = "One of the hardest modes! Can you retain your stock to level 300?"
|
||||
|
||||
function JokerGame:new()
|
||||
self.super:new()
|
||||
|
||||
self.randomizer = History6RollsRandomizer()
|
||||
|
||||
self.level = 50
|
||||
self.stock = 0
|
||||
self.time_limit = 7200
|
||||
|
||||
self.lock_drop = true
|
||||
self.lock_hard_drop = true
|
||||
self.enable_hold = false
|
||||
self.next_queue_length = 5
|
||||
end
|
||||
|
||||
function JokerGame:getARE() return 16 end
|
||||
function JokerGame:getLineARE() return self:getARE() end
|
||||
function JokerGame:getDasLimit() return 8 end
|
||||
function JokerGame:getLineClearDelay() return 6 end
|
||||
function JokerGame:getLockDelay() return 30 end
|
||||
function JokerGame:getGravity() return 20 end
|
||||
|
||||
function JokerGame:advanceOneFrame()
|
||||
if self.ready_frames == 0 then
|
||||
self.frames = self.frames + 1
|
||||
self.time_limit = self.time_limit - 1
|
||||
end
|
||||
if self.time_limit <= 0 then self.game_over = true end
|
||||
return true
|
||||
end
|
||||
|
||||
function JokerGame:onLineClear(cleared_row_count)
|
||||
if cleared_row_count >= 4 and self.level < 200 then self.stock = self.stock + 1
|
||||
elseif cleared_row_count < 4 and self.level >= 200 then self.stock = self.stock - 1 end
|
||||
|
||||
if self.level >= 200 then
|
||||
if self.stock > 0 or (cleared_row_count >= 4 and self.stock <= 0) then
|
||||
self.level = self.level + 1
|
||||
self.time_limit = math.min(self.time_limit + frameTime(0,15), frameTime(5,00))
|
||||
elseif self.stock == 0 then
|
||||
self.level = self.level + 1
|
||||
self.time_limit = math.min(self.time_limit + frameTime(0,15), frameTime(5,00))
|
||||
end
|
||||
else
|
||||
self.level = self.level + 1
|
||||
self.time_limit = math.min(self.time_limit + frameTime(0,15), frameTime(5,00))
|
||||
end
|
||||
|
||||
if self.stock <= 0 and (self.level == 200 or self.level == 300) then self.game_over = true end
|
||||
end
|
||||
|
||||
function JokerGame:drawGrid() self.grid:drawOutline() end
|
||||
|
||||
function JokerGame:drawScoringInfo()
|
||||
love.graphics.setColor(1, 1, 1, 1)
|
||||
|
||||
love.graphics.setFont(font_3x5_2)
|
||||
love.graphics.print(
|
||||
self.das.direction .. " " ..
|
||||
self.das.frames .. " " ..
|
||||
strTrueValues(self.prev_inputs)
|
||||
)
|
||||
love.graphics.printf("NEXT", 64, 40, 40, "left")
|
||||
love.graphics.printf("TIME LIMIT", 240, 120, 80, "left")
|
||||
love.graphics.printf("LEVEL", 240, 200, 40, "left")
|
||||
love.graphics.printf("STOCK", 240, 280, 40, "left")
|
||||
|
||||
love.graphics.setFont(font_3x5_3)
|
||||
if not self.game_over and self.time_limit < frameTime(0,10) and self.time_limit % 4 < 2 then
|
||||
love.graphics.setColor(1, 0.3, 0.3, 1)
|
||||
end
|
||||
love.graphics.printf(formatTime(self.time_limit), 240, 140, 120, "left")
|
||||
love.graphics.setColor(1, 1, 1, 1)
|
||||
love.graphics.printf(self.level, 240, 220, 90, "left")
|
||||
love.graphics.printf(math.max(self.stock, 0), 240, 300, 90, "left")
|
||||
|
||||
love.graphics.setFont(font_8x11)
|
||||
love.graphics.printf(formatTime(self.frames), 64, 420, 160, "center")
|
||||
end
|
||||
|
||||
function JokerGame:getBackground()
|
||||
if self.level < 200 then return 0
|
||||
elseif self.level < 300 then return 4
|
||||
else return 19 end
|
||||
end
|
||||
|
||||
function JokerGame:getHighscoreData()
|
||||
return {
|
||||
level = self.level,
|
||||
}
|
||||
end
|
||||
|
||||
return JokerGame
|
Loading…
Reference in New Issue
Block a user