mirror of
https://github.com/SashLilac/cambridge.git
synced 2025-04-19 13:32:56 -05:00
Added Marathon WCB.
This commit is contained in:
parent
7227085f84
commit
717afbebf6
@ -13,6 +13,7 @@ game_modes = {
|
|||||||
require 'tetris.modes.strategy',
|
require 'tetris.modes.strategy',
|
||||||
require 'tetris.modes.interval_training',
|
require 'tetris.modes.interval_training',
|
||||||
require 'tetris.modes.pacer_test',
|
require 'tetris.modes.pacer_test',
|
||||||
|
require 'tetris.modes.marathon_wcb',
|
||||||
require 'tetris.modes.demon_mode',
|
require 'tetris.modes.demon_mode',
|
||||||
require 'tetris.modes.phantom_mania',
|
require 'tetris.modes.phantom_mania',
|
||||||
require 'tetris.modes.phantom_mania2',
|
require 'tetris.modes.phantom_mania2',
|
||||||
|
@ -95,6 +95,16 @@ function GameMode:update(inputs, ruleset)
|
|||||||
|
|
||||||
self:chargeDAS(inputs, self:getDasLimit(), self.getARR())
|
self:chargeDAS(inputs, self:getDasLimit(), self.getARR())
|
||||||
|
|
||||||
|
-- set attempt flags
|
||||||
|
if inputs["left"] or inputs["right"] then self:onAttemptPieceMove(self.piece) end
|
||||||
|
if
|
||||||
|
inputs["rotate_left"] or inputs["rotate_right"] or
|
||||||
|
inputs["rotate_left2"] or inputs["rotate_right2"] or
|
||||||
|
inputs["rotate_180"]
|
||||||
|
then
|
||||||
|
self:onAttemptPieceRotate(self.piece)
|
||||||
|
end
|
||||||
|
|
||||||
if self.piece == nil then
|
if self.piece == nil then
|
||||||
self:processDelays(inputs, ruleset)
|
self:processDelays(inputs, ruleset)
|
||||||
else
|
else
|
||||||
@ -198,6 +208,8 @@ end
|
|||||||
|
|
||||||
-- event functions
|
-- event functions
|
||||||
function GameMode:whilePieceActive() end
|
function GameMode:whilePieceActive() end
|
||||||
|
function GameMode:onAttemptPieceMove(piece) end
|
||||||
|
function GameMode:onAttemptPieceRotate(piece) end
|
||||||
function GameMode:onPieceLock(piece, cleared_row_count) end
|
function GameMode:onPieceLock(piece, cleared_row_count) end
|
||||||
function GameMode:onLineClear(cleared_row_count) end
|
function GameMode:onLineClear(cleared_row_count) end
|
||||||
function GameMode:onPieceEnter() end
|
function GameMode:onPieceEnter() end
|
||||||
@ -220,11 +232,17 @@ end
|
|||||||
function GameMode:startRightDAS()
|
function GameMode:startRightDAS()
|
||||||
self.move = "right"
|
self.move = "right"
|
||||||
self.das = { direction = "right", frames = 0 }
|
self.das = { direction = "right", frames = 0 }
|
||||||
|
if self:getDasLimit() == 0 then
|
||||||
|
self:continueDAS()
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function GameMode:startLeftDAS()
|
function GameMode:startLeftDAS()
|
||||||
self.move = "left"
|
self.move = "left"
|
||||||
self.das = { direction = "left", frames = 0 }
|
self.das = { direction = "left", frames = 0 }
|
||||||
|
if self:getDasLimit() == 0 then
|
||||||
|
self:continueDAS()
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function GameMode:continueDAS()
|
function GameMode:continueDAS()
|
||||||
@ -300,7 +318,6 @@ function GameMode:initializeOrHold(inputs, ruleset)
|
|||||||
else
|
else
|
||||||
self:initializeNextPiece(inputs, ruleset, self.next_queue[1])
|
self:initializeNextPiece(inputs, ruleset, self.next_queue[1])
|
||||||
end
|
end
|
||||||
self:onPieceEnter()
|
|
||||||
if not self.grid:canPlacePiece(self.piece) then
|
if not self.grid:canPlacePiece(self.piece) then
|
||||||
self:onGameOver()
|
self:onGameOver()
|
||||||
self.game_over = true
|
self.game_over = true
|
||||||
|
133
tetris/modes/marathon_wcb.lua
Normal file
133
tetris/modes/marathon_wcb.lua
Normal file
@ -0,0 +1,133 @@
|
|||||||
|
require 'funcs'
|
||||||
|
|
||||||
|
local GameMode = require 'tetris.modes.gamemode'
|
||||||
|
local Piece = require 'tetris.components.piece'
|
||||||
|
|
||||||
|
local History6RollsRandomizer = require 'tetris.randomizers.history_6rolls'
|
||||||
|
|
||||||
|
local MarathonWCBGame = GameMode:extend()
|
||||||
|
|
||||||
|
MarathonWCBGame.name = "Marathon WCB"
|
||||||
|
MarathonWCBGame.hash = "MarathonWCB"
|
||||||
|
MarathonWCBGame.tagline = "When all the pieces slip right to their destinations... can you keep up?"
|
||||||
|
|
||||||
|
|
||||||
|
function MarathonWCBGame:new()
|
||||||
|
MarathonWCBGame.super:new()
|
||||||
|
|
||||||
|
self.pieces = 0
|
||||||
|
self.randomizer = History6RollsRandomizer()
|
||||||
|
|
||||||
|
self.lock_drop = true
|
||||||
|
self.lock_hard_drop = true
|
||||||
|
self.instant_hard_drop = true
|
||||||
|
self.instant_soft_drop = true
|
||||||
|
self.enable_hold = false
|
||||||
|
self.next_queue_length = 3
|
||||||
|
|
||||||
|
self.piece_is_active = false
|
||||||
|
end
|
||||||
|
|
||||||
|
function MarathonWCBGame:getDropSpeed()
|
||||||
|
return 20
|
||||||
|
end
|
||||||
|
|
||||||
|
function MarathonWCBGame:getARR()
|
||||||
|
return 0
|
||||||
|
end
|
||||||
|
|
||||||
|
function MarathonWCBGame:getARE()
|
||||||
|
return 0
|
||||||
|
end
|
||||||
|
|
||||||
|
function MarathonWCBGame:getLineARE()
|
||||||
|
return 0
|
||||||
|
end
|
||||||
|
|
||||||
|
function MarathonWCBGame:getDasLimit()
|
||||||
|
return 0
|
||||||
|
end
|
||||||
|
|
||||||
|
function MarathonWCBGame:getLineClearDelay()
|
||||||
|
return 0
|
||||||
|
end
|
||||||
|
|
||||||
|
function MarathonWCBGame:getLockDelay()
|
||||||
|
return math.huge
|
||||||
|
end
|
||||||
|
|
||||||
|
function MarathonWCBGame:getGravity()
|
||||||
|
return self.piece_is_active and 20 or 0
|
||||||
|
end
|
||||||
|
|
||||||
|
function MarathonWCBGame:advanceOneFrame()
|
||||||
|
if self.clear then
|
||||||
|
self.roll_frames = self.roll_frames + 1
|
||||||
|
if self.roll_frames > 150 then
|
||||||
|
self.completed = true
|
||||||
|
end
|
||||||
|
return false
|
||||||
|
elseif self.ready_frames == 0 then
|
||||||
|
self.frames = self.frames + 1
|
||||||
|
end
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
|
function MarathonWCBGame:onAttemptPieceMove()
|
||||||
|
if self.piece ~= nil then
|
||||||
|
-- don't let the piece move before it's finished dropping
|
||||||
|
self.piece:dropToBottom(self.grid)
|
||||||
|
end
|
||||||
|
self.piece_is_active = true
|
||||||
|
end
|
||||||
|
|
||||||
|
function MarathonWCBGame:onAttemptPieceRotate()
|
||||||
|
self.piece_is_active = true
|
||||||
|
end
|
||||||
|
|
||||||
|
function MarathonWCBGame:onPieceLock()
|
||||||
|
self.piece_is_active = false
|
||||||
|
self.pieces = self.pieces + 1
|
||||||
|
end
|
||||||
|
|
||||||
|
function MarathonWCBGame:onLineClear(cleared_row_count)
|
||||||
|
if not self.clear then
|
||||||
|
self.lines = self.lines + cleared_row_count
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function MarathonWCBGame:drawGrid(ruleset)
|
||||||
|
self.grid:draw()
|
||||||
|
if self.piece ~= nil then
|
||||||
|
self:drawGhostPiece(ruleset)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function MarathonWCBGame:getHighscoreData()
|
||||||
|
return {
|
||||||
|
pieces = self.pieces,
|
||||||
|
frames = self.frames,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
function MarathonWCBGame:drawScoringInfo()
|
||||||
|
MarathonWCBGame.super.drawScoringInfo(self)
|
||||||
|
love.graphics.setColor(1, 1, 1, 1)
|
||||||
|
|
||||||
|
local text_x = config["side_next"] and 320 or 240
|
||||||
|
|
||||||
|
love.graphics.setFont(font_3x5_2)
|
||||||
|
love.graphics.printf("NEXT", 64, 40, 40, "left")
|
||||||
|
love.graphics.printf("lines", text_x, 160, 80, "left")
|
||||||
|
love.graphics.printf("pieces", text_x, 220, 80, "left")
|
||||||
|
|
||||||
|
love.graphics.setFont(font_3x5_3)
|
||||||
|
love.graphics.printf(self.lines, text_x, 180, 80, "left")
|
||||||
|
love.graphics.printf(self.pieces, text_x, 240, 80, "left")
|
||||||
|
end
|
||||||
|
|
||||||
|
function MarathonWCBGame:getBackground()
|
||||||
|
return (math.floor(self.pieces / 50) % 20)
|
||||||
|
end
|
||||||
|
|
||||||
|
return MarathonWCBGame
|
@ -25,7 +25,7 @@ function Race40Game:new()
|
|||||||
self.lock_drop = true
|
self.lock_drop = true
|
||||||
self.lock_hard_drop = true
|
self.lock_hard_drop = true
|
||||||
self.instant_hard_drop = true
|
self.instant_hard_drop = true
|
||||||
self.instant_soft_drop = false
|
self.instant_soft_drop = true
|
||||||
self.enable_hold = true
|
self.enable_hold = true
|
||||||
self.next_queue_length = 3
|
self.next_queue_length = 3
|
||||||
end
|
end
|
||||||
@ -39,11 +39,11 @@ function Race40Game:getARR()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function Race40Game:getARE()
|
function Race40Game:getARE()
|
||||||
return 0
|
return 4
|
||||||
end
|
end
|
||||||
|
|
||||||
function Race40Game:getLineARE()
|
function Race40Game:getLineARE()
|
||||||
return self:getARE()
|
return 2
|
||||||
end
|
end
|
||||||
|
|
||||||
function Race40Game:getDasLimit()
|
function Race40Game:getDasLimit()
|
||||||
@ -51,15 +51,15 @@ function Race40Game:getDasLimit()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function Race40Game:getLineClearDelay()
|
function Race40Game:getLineClearDelay()
|
||||||
return 0
|
return 2
|
||||||
end
|
end
|
||||||
|
|
||||||
function Race40Game:getLockDelay()
|
function Race40Game:getLockDelay()
|
||||||
return 15
|
return 30
|
||||||
end
|
end
|
||||||
|
|
||||||
function Race40Game:getGravity()
|
function Race40Game:getGravity()
|
||||||
return 1/64
|
return 20
|
||||||
end
|
end
|
||||||
|
|
||||||
function Race40Game:advanceOneFrame()
|
function Race40Game:advanceOneFrame()
|
||||||
|
Loading…
Reference in New Issue
Block a user