h (v0.2.6)

This commit is contained in:
Ishaan Bhardwaj
2020-12-22 22:09:17 -05:00
parent d01f24dcf8
commit 76dd287a11
16 changed files with 729 additions and 16 deletions

View File

@@ -26,7 +26,7 @@ function DemonModeGame:new()
self.enable_hold = true
self.lock_drop = true
self.lock_hard_drop = true
self.next_queue_length = 3
self.next_queue_length = 6
if math.random() < 1/6.66 then
self.rpc_details = "Suffering"
end

View File

@@ -23,7 +23,7 @@ function JokerGame:new()
self.lock_drop = true
self.lock_hard_drop = true
self.enable_hold = false
self.next_queue_length = 5
self.next_queue_length = 6
end
function JokerGame:getARE() return 16 end

View File

@@ -25,7 +25,7 @@ function MarathonGFGame:new()
self.instant_hard_drop = true
self.instant_soft_drop = false
self.enable_hold = true
self.next_queue_length = 5
self.next_queue_length = 6
end
function MarathonGFGame:getARE() return 6 end
@@ -91,7 +91,7 @@ end
function MarathonGFGame:updateScore(level, drop_bonus, cleared_lines)
local normal_table = {[0] = 0, 1, 3, 5, 8}
local spin_score = 4 * (cleared_lines + 1)
local all_clear_table = {8, 12, 18, 20}
local all_clear_table = {[0] = 0, 8, 12, 18, 20}
if self.grid:checkForBravo(cleared_lines) then
self.score = self.score + (
@@ -139,11 +139,15 @@ function MarathonGFGame:onAttemptPieceMove(piece)
end
function MarathonGFGame:onAttemptPieceRotate(piece)
if self.piece ~= nil and piece:isDropBlocked(self.grid) and
if self.piece ~= nil then
if piece:isDropBlocked(self.grid) and
piece:isMoveBlocked(self.grid, { x=-1, y=0 }) and
piece:isMoveBlocked(self.grid, { x=1, y=0 }) and
piece:isMoveBlocked(self.grid, { x=0, y=-1 }) then
piece.spin = true
else
piece.spin = false
end
end
end

View File

@@ -28,6 +28,13 @@ function MarathonWCBGame:new()
self.piece_is_active = false
end
function MarathonWCBGame:initialize(ruleset)
self.super.initialize(self, ruleset)
ruleset.onPieceDrop = function() end
ruleset.onPieceMove = function() end
ruleset.onPieceRotate = function() end
end
function MarathonWCBGame:getDropSpeed()
return 20
end

View File

@@ -1,5 +1,10 @@
require 'funcs'
bgm.non = {
start = love.audio.newSource("res/bgm/non-start.ogg", "stream"),
loop = love.audio.newSource("res/bgm/non-loop.ogg", "stream"),
}
local GameMode = require 'tetris.modes.gamemode'
local Bag7NoSZOStartRandomizer = require 'tetris.randomizers.bag7noSZOstart'
@@ -14,6 +19,7 @@ function NightOfNights:new()
self.super:new()
self.active_time = 0
self.pieces = 0
self.randomizer = Bag7NoSZOStartRandomizer()
@@ -22,7 +28,7 @@ function NightOfNights:new()
self.instant_soft_drop = false
self.instant_hard_drop = false
self.enable_hold = true
self.next_queue_length = 3
self.next_queue_length = 6
end
function NightOfNights:getARE() return 0 end
@@ -32,6 +38,19 @@ function NightOfNights:getDasLimit() return config.das end
function NightOfNights:getARR() return config.arr end
function NightOfNights:getGravity() return 20 end
function NightOfNights:advanceOneFrame()
if self.ready_frames == 0 then
if self.frames == 0 then
switchBGM("non", "start")
elseif self.frames == 1280 then
switchBGMLoop("non", "loop")
end
self.frames = self.frames + 1
else
switchBGM(nil)
end
end
function NightOfNights:whilePieceActive()
self.active_time = self.active_time + 1
if self.active_time >= 20 then self.piece.locked = true end
@@ -40,6 +59,7 @@ end
function NightOfNights:onPieceLock(piece, cleared_row_count)
self.super:onPieceLock()
self.active_time = 0
self.pieces = self.pieces + 1
self.lines = self.lines + cleared_row_count
end
@@ -57,10 +77,12 @@ function NightOfNights:drawScoringInfo()
strTrueValues(self.prev_inputs)
)
love.graphics.printf("NEXT", 64, 40, 40, "left")
love.graphics.printf("LINES", 240, 200, 40, "left")
love.graphics.printf("LINES", 240, 160, 80, "left")
love.graphics.printf("PIECES", 240, 240, 80, "left")
love.graphics.setFont(font_3x5_4)
love.graphics.printf(self.lines, 240, 220, 90, "left")
love.graphics.printf(self.lines, 240, 180, 90, "left")
love.graphics.printf(self.pieces, 240, 260, 90, "left")
love.graphics.setFont(font_8x11)
love.graphics.printf(formatTime(self.frames), 64, 420, 160, "center")
@@ -72,7 +94,8 @@ end
function NightOfNights:getHighscoreData()
return {
level = self.level,
lines = self.lines,
pieces = self.pieces,
frames = self.frames,
}
end

177
tetris/modes/pacer_test.lua Normal file
View File

@@ -0,0 +1,177 @@
require 'funcs'
local GameMode = require 'tetris.modes.gamemode'
local Piece = require 'tetris.components.piece'
local History6RollsRandomizer = require 'tetris.randomizers.history_6rolls'
local PacerTest = GameMode:extend()
PacerTest.name = "TetrisGram™ Pacer Test"
PacerTest.hash = "PacerTest"
PacerTest.tagline = "The FitnessGram Pacer Test is a multi-stage aerobic capacity test"
local function getLevelFrames(level)
if level == 1 then return 72 * 60 / 8.0
else return 72 * 60 / (8.0 + level * 0.5)
end
end
local level_end_sections = {
7, 15, 23, 32, 41, 51, 61, 72, 83, 94,
106, 118, 131, 144, 157, 171, 185, 200,
215, 231, 247
}
function PacerTest:new()
PacerTest.super:new()
self.ready_frames = 2430
self.clear_frames = 0
self.randomizer = History6RollsRandomizer()
self.level = 1
self.section = 0
self.level_frames = 0
self.section_lines = 0
self.section_clear = false
self.strikes = 0
self.lock_drop = true
self.lock_hard_drop = true
self.enable_hold = true
self.instant_hard_drop = true
self.instant_soft_drop = false
self.next_queue_length = 3
end
function PacerTest:initialize(ruleset)
self.super.initialize(self, ruleset)
self.level_frames = getLevelFrames(1)
switchBGM("pacer_test")
end
function PacerTest:getARE()
return 0
end
function PacerTest:getARR()
return config.arr
end
function PacerTest:getLineARE()
return 0
end
function PacerTest:getDasLimit()
return config.das
end
function PacerTest:getLineClearDelay()
return 6
end
function PacerTest:getLockDelay()
return 30
end
function PacerTest:getGravity()
return 1/64
end
function PacerTest:getSection()
return math.floor(level / 100) + 1
end
function PacerTest:onPieceEnter()
self.irs = false
self.ihs = false
end
function PacerTest:advanceOneFrame()
if self.clear then
self.clear_frames = self.clear_frames + 1
if self.clear_frames > 600 then
self.completed = true
end
return false
elseif self.ready_frames == 0 then
self.frames = self.frames + 1
self.level_frames = self.level_frames - 1
if self.level_frames <= 0 then
self:checkSectionStatus()
self.section = self.section + 1
if self.section >= level_end_sections[self.level] then
self.level = self.level + 1
end
self.level_frames = self.level_frames + getLevelFrames(self.level)
end
end
return true
end
function PacerTest:checkSectionStatus()
if self.section_clear then
self.strikes = 0
self.section_clear = false
else
self.strikes = self.strikes + 1
if self.strikes >= 2 then
self.game_over = true
fadeoutBGM(2.5)
end
end
self.section_lines = 0
end
function PacerTest:onLineClear(cleared_row_count)
self.section_lines = self.section_lines + cleared_row_count
if self.section_lines >= 3 then
self.section_clear = true
end
end
function PacerTest:drawGrid(ruleset)
self.grid:draw()
if self.piece ~= nil then
self:drawGhostPiece(ruleset)
end
end
function PacerTest:getHighscoreData()
return {
level = self.level,
frames = self.frames,
}
end
function PacerTest:drawScoringInfo()
PacerTest.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, 224, 70, "left")
love.graphics.printf("LEVEL", text_x, 320, 40, "left")
for i = 1, math.min(self.strikes, 3) do
love.graphics.draw(misc_graphics["strike"], text_x + (i - 1) * 30, 280)
end
love.graphics.setFont(font_3x5_3)
love.graphics.printf(self.section_lines .. "/3", text_x, 244, 80, "left")
love.graphics.printf(self.level, text_x, 340, 40, "right")
love.graphics.printf(self.section, text_x, 370, 40, "right")
end
function PacerTest:getBackground()
return math.min(self.level - 1, 19)
end
return PacerTest

View File

@@ -35,7 +35,7 @@ function Race40Game:new()
self.instant_hard_drop = true
self.instant_soft_drop = false
self.enable_hold = true
self.next_queue_length = 3
self.next_queue_length = 6
end
function Race40Game:getDropSpeed()

View File

@@ -0,0 +1,223 @@
require 'funcs'
local GameMode = require 'tetris.modes.gamemode'
local Piece = require 'tetris.components.piece'
local History4RollsRandomizer = require 'tetris.randomizers.bag7noSZOstart'
local ArcadeScoreAttack = GameMode:extend()
ArcadeScoreAttack.name = "Arcade Score Attack"
ArcadeScoreAttack.hash = "Oshisaure-ArcadeScoreAttack"
ArcadeScoreAttack.tagline = "Huge scores! How big can you make yours?"
function ArcadeScoreAttack:new()
ArcadeScoreAttack.super:new()
self.timeleft = 9000
self.chain = 0
self.quads = 0
self.level = 1
self.multiplier = 1
self.b2b = false
self.randomizer = History4RollsRandomizer()
self.lock_drop = false
self.enable_hard_drop = true
self.enable_hold = true
self.next_queue_length = 5
end
function ArcadeScoreAttack:updateMultiplier()
end
function ArcadeScoreAttack:getARE()
return 24
end
function ArcadeScoreAttack:getLineARE()
return 8
end
function ArcadeScoreAttack:getLineClearDelay()
return 16
end
function ArcadeScoreAttack:getLockDelay()
return 30
end
function ArcadeScoreAttack:getDasLimit()
return 12
end
function ArcadeScoreAttack:getARR()
return 1
end
local levelchanges = {
5, --lv 1: 5 lines
10,
15,
20,
25,
35, --lv 6: 10 lines
45,
55,
65,
75,
90, --lv11: 15 lines
115,
130,
145,
160, --lv15: 20 lines
180,
200,
220,
250,
math.huge --lv20: infinite
}
local gravitycurve = {
1/60, --lv1
1/30,
1/20,
1/15,
1/12, --lv5
1/10,
1/ 6,
1/ 4,
1/ 3,
1/ 2, --lv10
2/ 2,
3/ 2,
4/ 2,
5/ 2,
3/ 1, --lv15
4/ 1,
5/ 1,
7/ 1,
10/ 1,
20/ 1, --lv20
}
function ArcadeScoreAttack:getGravity()
return gravitycurve[self.level]
end
function ArcadeScoreAttack:advanceOneFrame()
if self.ready_frames == 0 then
self.score = self.score + self.multiplier
self.timeleft = self.timeleft-1
if self.timeleft <= 0 then
self.game_over = true
end
self.frames = self.frames + 1
end
end
function ArcadeScoreAttack:onPieceEnter()
end
function ArcadeScoreAttack:onLineClear(cleared_row_count)
self.lines = self.lines + cleared_row_count
if self.lines >= levelchanges[self.level] then
self.level = self.level + 1
self.timeleft = self.timeleft + 1800
end
end
function ArcadeScoreAttack:updateScore(level, drop_bonus, cleared_lines)
local pts = 0
if cleared_lines == 0 then
if not self.b2b then self.chain = 0 end
else
self.chain = self.chain + 1
self.b2b = false
if cleared_lines >= 4 then
self.b2b = true
self.quads = self.quads + 1
end
pts = 1000
for i = 2, cleared_lines do pts = pts * i end
end
self.multiplier = self.level * (self.chain+1) * (self.quads+1)
if pts > 0 then
self.score = self.score + pts * self.multiplier
end
end
function ArcadeScoreAttack:drawGrid()
self.grid:draw()
self:drawGhostPiece(ruleset)
end
local function comma(score)
if score == 0 then return "0" end
local scorestr = ""
local p = 1
for d = 0, math.log10(score) do
if d % 3 == 0 and d ~= 0 then scorestr = ","..scorestr end
local digit = math.floor(score/p)%10
scorestr = digit..scorestr
p = p*10
end
return scorestr
end
function ArcadeScoreAttack:drawScoringInfo()
ArcadeScoreAttack.super.drawScoringInfo(self)
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("SCORE", 240, 100, 40, "left")
love.graphics.printf("LINES", 240, 165, 40, "left")
love.graphics.printf("MULTIPLIER" , 240, 220, 153, "right")
love.graphics.printf("LEVEL" , 240, 240, 153, "left")
love.graphics.printf("QUADS x (1 + ", 240, 260, 160, "left")
love.graphics.printf("CHAIN x (1 + ", 240, 280, 160, "left")
love.graphics.printf("TOTAL =" , 240, 310, 153, "left")
love.graphics.printf("TIME REMAINING", 240, 350, 120, "left")
love.graphics.printf(self.level .." ", 240, 240, 153, "right")
love.graphics.printf(self.quads ..")", 240, 260, 160, "right")
love.graphics.printf(self.chain ..")", 240, 280, 160, "right")
love.graphics.printf(self.multiplier.." ", 240, 310, 153, "right")
love.graphics.setFont(font_3x5_3)
local li = levelchanges[self.level]
if li == math.huge then
love.graphics.printf(self.lines, 240, 190, 40, "left")
else
love.graphics.printf(self.lines.."/"..li, 240, 185, 100, "left")
end
love.graphics.printf(formatTime(self.timeleft), 240, 370, 150, "left")
love.graphics.setFont(font_3x5_4)
love.graphics.printf(comma(self.score), 240, 120, 300, "left")
love.graphics.setFont(font_8x11)
love.graphics.printf(formatTime(self.frames), 64, 420, 160, "center")
end
function ArcadeScoreAttack:getBackground()
return self.level - 1
end
function ArcadeScoreAttack:getHighscoreData()
return {
score = self.score,
level = self.level,
frames = self.frames,
}
end
return ArcadeScoreAttack

View File

@@ -25,10 +25,7 @@ function LudicrousSpeed:new()
self.instant_soft_drop = false
self.instant_hard_drop = true
self.enable_hold = true
self.next_queue_length = 3
self.irs = false
self.ihs = false
self.next_queue_length = 6
end
function LudicrousSpeed:getGravity()

View File

@@ -0,0 +1,15 @@
local SurvivalA2Game = require 'tetris.modes.survival_a2'
local SurvivalA2NGame = SurvivalA2Game:extend()
SurvivalA2NGame.name = "Survival A2N"
SurvivalA2NGame.hash = "SurvivalA2N"
SurvivalA2NGame.tagline = "A variation of Survival A2 for Carnival of Derp."
function SurvivalA2NGame:new()
self.super:new()
self.next_queue_length = 3
self.enable_hold = true
end
return SurvivalA2NGame