Added the lost Konoha mode from TGM4

This commit is contained in:
Ishaan Bhardwaj 2020-10-05 22:17:15 -04:00
parent a534331b11
commit f1ad1f0ea4
6 changed files with 420 additions and 33 deletions

12
scene/mode_select.lua Normal file → Executable file
View File

@ -8,10 +8,10 @@ current_ruleset = 1
game_modes = { game_modes = {
require 'tetris.modes.marathon_2020', require 'tetris.modes.marathon_2020',
require 'tetris.modes.survival_2020', require 'tetris.modes.survival_2020',
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.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',
require 'tetris.modes.phantom_mania_n', require 'tetris.modes.phantom_mania_n',
@ -24,12 +24,16 @@ game_modes = {
require 'tetris.modes.survival_a1', require 'tetris.modes.survival_a1',
require 'tetris.modes.survival_a2', require 'tetris.modes.survival_a2',
require 'tetris.modes.survival_a3', require 'tetris.modes.survival_a3',
require 'tetris.modes.big_a2',
require 'tetris.modes.konoha',
} }
rulesets = { rulesets = {
require 'tetris.rulesets.cambridge', require 'tetris.rulesets.cambridge',
require 'tetris.rulesets.arika', require 'tetris.rulesets.arika',
require 'tetris.rulesets.arika_ti', require 'tetris.rulesets.arika_ti',
require 'tetris.rulesets.arika_ace',
require 'tetris.rulesets.arika_srs',
require 'tetris.rulesets.standard_exp', require 'tetris.rulesets.standard_exp',
--require 'tetris.rulesets.bonkers', --require 'tetris.rulesets.bonkers',
--require 'tetris.rulesets.shirase', --require 'tetris.rulesets.shirase',

182
tetris/modes/konoha.lua Executable file
View File

@ -0,0 +1,182 @@
require 'funcs'
local GameMode = require 'tetris.modes.gamemode'
local Piece = require 'tetris.components.piece'
local Bag5Randomizer = require 'tetris.randomizers.bag5'
local Bag5AltRandomizer = require 'tetris.randomizers.bag5alt'
local KonohaGame = GameMode:extend()
KonohaGame.name = "All Clear A4"
KonohaGame.hash = "AllClearA4"
KonohaGame.tagline = "Get as many bravos as you can under the time limit!"
function KonohaGame:new()
KonohaGame.super:new()
self.randomizer = Bag5AltRandomizer()
self.bravos = 0
self.time_limit = 10800
self.big_mode = true
self.enable_hold = true
self.next_queue_length = 3
end
function KonohaGame:getARE()
if self.level < 300 then return 30
elseif self.level < 400 then return 25
elseif self.level < 500 then return 20
elseif self.level < 600 then return 17
elseif self.level < 800 then return 15
elseif self.level < 900 then return 13
elseif self.level < 1000 then return 10
elseif self.level < 1300 then return 8
else return 6 end
end
function KonohaGame:getLineARE()
return self:getARE()
end
function KonohaGame:getDasLimit()
if self.level < 500 then return 10
elseif self.level < 800 then return 9
elseif self.level < 1000 then return 8
else return 7 end
end
function KonohaGame:getLineClearDelay()
if self.level < 200 then return 14
elseif self.level < 500 then return 9
elseif self.level < 800 then return 8
elseif self.level < 1000 then return 7
else return 6 end
end
function KonohaGame:getLockDelay()
if self.level < 500 then return 30
elseif self.level < 600 then return 25
elseif self.level < 700 then return 23
elseif self.level < 800 then return 20
elseif self.level < 900 then return 17
elseif self.level < 1000 then return 15
elseif self.level < 1200 then return 13
elseif self.level < 1300 then return 10
else return 8 end
end
function KonohaGame:getGravity()
if (self.level < 30) then return 4/256
elseif (self.level < 35) then return 8/256
elseif (self.level < 40) then return 12/256
elseif (self.level < 50) then return 16/256
elseif (self.level < 60) then return 32/256
elseif (self.level < 70) then return 48/256
elseif (self.level < 80) then return 64/256
elseif (self.level < 90) then return 128/256
elseif (self.level < 100) then return 192/256
elseif (self.level < 120) then return 1
elseif (self.level < 140) then return 2
elseif (self.level < 160) then return 3
elseif (self.level < 170) then return 4
elseif (self.level < 200) then return 5
else return 20 end
end
function KonohaGame:getSection()
return math.floor(level / 100) + 1
end
function KonohaGame:getSectionEndLevel()
return math.floor(self.level / 100 + 1) * 100
end
function KonohaGame:advanceOneFrame()
if self.ready_frames == 0 then
self.time_limit = self.time_limit - 1
self.frames = self.frames + 1
end
if self.time_limit <= 0 then
self.game_over = true
end
end
function KonohaGame:onPieceEnter()
if (self.level % 100 ~= 99) and self.frames ~= 0 then
self.level = self.level + 1
end
end
function KonohaGame:drawGrid(ruleset)
self.grid:draw()
end
local cleared_row_levels = {2, 4, 6, 12}
local bravo_bonus = {300, 480, 660, 900}
local non_bravo_bonus = {0, 0, 20, 40}
local bravo_ot_bonus = {0, 60, 120, 180}
function KonohaGame:onLineClear(cleared_row_count)
self.level = self.level + cleared_row_levels[cleared_row_count / 2]
self.bravo = true
for i = 0, 23 - cleared_row_count do
for j = 0, 9 do
if self.grid:isOccupied(j, i) then
self.bravo = false
end
end
end
if self.bravo then
self.bravos = self.bravos + 1
if self.level < 1000 then self.time_limit = self.time_limit + bravo_bonus[cleared_row_count / 2]
else self.time_limit = self.time_limit + bravo_ot_bonus[cleared_row_count / 2]
end
elseif self.level < 1000 then
self.time_limit = self.time_limit + non_bravo_bonus[cleared_row_count / 2]
end
if self.bravos >= 11 then self.randomizer = Bag5Randomizer() end
end
function KonohaGame:getBackground()
return math.min(math.floor(self.level / 100), 9)
end
function KonohaGame:drawScoringInfo()
love.graphics.setColor(1, 1, 1, 1)
love.graphics.setFont(font_3x5_2)
love.graphics.print(
self.das.direction .. " " ..
self.das.frames .. " " ..
st(self.prev_inputs)
)
love.graphics.printf("NEXT", 64, 40, 40, "left")
love.graphics.printf("TIME LIMIT", 240, 120, 120, "left")
love.graphics.printf("BRAVOS", 240, 200, 50, "left")
love.graphics.printf("LEVEL", 240, 320, 40, "left")
love.graphics.setFont(font_3x5_3)
if not self.game_over and self.time_limit < sp(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.bravos, 240, 220, 90, "left")
love.graphics.printf(self.level, 240, 340, 40, "left")
love.graphics.printf(self:getSectionEndLevel(), 240, 370, 40, "left")
love.graphics.setFont(font_8x11)
love.graphics.printf(formatTime(self.frames), 64, 420, 160, "center")
end
function KonohaGame:getHighscoreData()
return {
bravos = self.bravos,
level = self.level,
frames = self.frames,
}
end
return KonohaGame

24
tetris/randomizers/bag5alt.lua Executable file
View File

@ -0,0 +1,24 @@
local Randomizer = require 'tetris.randomizers.randomizer'
local Bag5AltRandomizer = Randomizer:extend()
function Bag5AltRandomizer:initialize()
self.bag = {"I", "J", "L", "O", "T"}
self.prev = "O"
end
function Bag5AltRandomizer:generatePiece()
if next(self.bag) == nil then
self.bag = {"I", "J", "L", "O", "T"}
end
local x = math.random(table.getn(self.bag))
local temp = table.remove(self.bag, x)
if temp == self.prev then
local y = math.random(table.getn(self.bag))
temp = table.remove(self.bag, y)
end
self.prev = temp
return temp
end
return Bag5AltRandomizer

View File

@ -7,23 +7,23 @@ ARS.name = "ACE-ARS"
ARS.hash = "ArikaACE" ARS.hash = "ArikaACE"
ARS.spawn_positions = { ARS.spawn_positions = {
I = { x=5, y=4 }, I = { x=5, y=2 },
J = { x=4, y=5 }, J = { x=4, y=3 },
L = { x=4, y=5 }, L = { x=4, y=3 },
O = { x=5, y=5 }, O = { x=5, y=3 },
S = { x=4, y=5 }, S = { x=4, y=3 },
T = { x=4, y=5 }, T = { x=4, y=3 },
Z = { x=4, y=5 }, Z = { x=4, y=3 },
} }
ARS.big_spawn_positions = { ARS.big_spawn_positions = {
I = { x=2, y=2 }, I = { x=2, y=1 },
J = { x=2, y=3 }, J = { x=2, y=2 },
L = { x=2, y=3 }, L = { x=2, y=2 },
O = { x=2, y=3 }, O = { x=2, y=2 },
S = { x=2, y=3 }, S = { x=2, y=2 },
T = { x=2, y=3 }, T = { x=2, y=2 },
Z = { x=2, y=3 }, Z = { x=2, y=2 },
} }
ARS.block_offsets = { ARS.block_offsets = {

177
tetris/rulesets/arika_srs.lua Executable file
View File

@ -0,0 +1,177 @@
local Piece = require 'tetris.components.piece'
local Ruleset = require 'tetris.rulesets.ruleset'
local SRS = Ruleset:extend()
SRS.name = "ACE-SRS"
SRS.hash = "ACE Standard"
SRS.enable_IRS_wallkicks = true
SRS.spawn_positions = {
I = { x=5, y=2 },
J = { x=4, y=3 },
L = { x=4, y=3 },
O = { x=5, y=3 },
S = { x=4, y=3 },
T = { x=4, y=3 },
Z = { x=4, y=3 },
}
SRS.big_spawn_positions = {
I = { x=2, y=1 },
J = { x=2, y=2 },
L = { x=2, y=2 },
O = { x=2, y=2 },
S = { x=2, y=2 },
T = { x=2, y=2 },
Z = { x=2, y=2 },
}
SRS.block_offsets = {
I={
{ {x=0, y=0}, {x=-1, y=0}, {x=-2, y=0}, {x=1, y=0} },
{ {x=0, y=0}, {x=0, y=-1}, {x=0, y=1}, {x=0, y=2} },
{ {x=0, y=1}, {x=-1, y=1}, {x=-2, y=1}, {x=1, y=1} },
{ {x=-1, y=0}, {x=-1, y=-1}, {x=-1, y=1}, {x=-1, y=2} },
},
J={
{ {x=0, y=0}, {x=-1, y=0}, {x=1, y=0}, {x=-1, y=-1} },
{ {x=0, y=0}, {x=0, y=-1}, {x=0, y=1} , {x=1, y=-1} },
{ {x=0, y=0}, {x=1, y=0}, {x=-1, y=0}, {x=1, y=1} },
{ {x=0, y=0}, {x=0, y=1}, {x=0, y=-1}, {x=-1, y=1} },
},
L={
{ {x=0, y=0}, {x=-1, y=0}, {x=1, y=0}, {x=1, y=-1} },
{ {x=0, y=0}, {x=0, y=-1}, {x=0, y=1}, {x=1, y=1} },
{ {x=0, y=0}, {x=1, y=0}, {x=-1, y=0}, {x=-1, y=1} },
{ {x=0, y=0}, {x=0, y=1}, {x=0, y=-1}, {x=-1, y=-1} },
},
O={
{ {x=0, y=0}, {x=-1, y=0}, {x=-1, y=-1}, {x=0, y=-1} },
{ {x=0, y=0}, {x=-1, y=0}, {x=-1, y=-1}, {x=0, y=-1} },
{ {x=0, y=0}, {x=-1, y=0}, {x=-1, y=-1}, {x=0, y=-1} },
{ {x=0, y=0}, {x=-1, y=0}, {x=-1, y=-1}, {x=0, y=-1} },
},
S={
{ {x=1, y=-1}, {x=0, y=-1}, {x=0, y=0}, {x=-1, y=0} },
{ {x=1, y=1}, {x=1, y=0}, {x=0, y=0}, {x=0, y=-1} },
{ {x=-1, y=1}, {x=0, y=1}, {x=0, y=0}, {x=1, y=0} },
{ {x=-1, y=-1}, {x=-1, y=0}, {x=0, y=0}, {x=0, y=1} },
},
T={
{ {x=0, y=0}, {x=-1, y=0}, {x=1, y=0}, {x=0, y=-1} },
{ {x=0, y=0}, {x=0, y=-1}, {x=0, y=1}, {x=1, y=0} },
{ {x=0, y=0}, {x=1, y=0}, {x=-1, y=0}, {x=0, y=1} },
{ {x=0, y=0}, {x=0, y=1}, {x=0, y=-1}, {x=-1, y=0} },
},
Z={
{ {x=-1, y=-1}, {x=0, y=-1}, {x=0, y=0}, {x=1, y=0} },
{ {x=1, y=-1}, {x=1, y=0}, {x=0, y=0}, {x=0, y=1} },
{ {x=1, y=1}, {x=0, y=1}, {x=0, y=0}, {x=-1, y=0} },
{ {x=-1, y=1}, {x=-1, y=0}, {x=0, y=0}, {x=0, y=-1} },
}
}
SRS.wallkicks_3x3 = {
[0]={
[1]={{x=-1, y=0}, {x=-1, y=-1}, {x=0, y=2}, {x=-1, y=2}},
[2]={{x=0, y=1}, {x=0, y=-1}},
[3]={{x=1, y=0}, {x=1, y=-1}, {x=0, y=2}, {x=1, y=2}},
},
[1]={
[0]={{x=1, y=0}, {x=1, y=1}, {x=0, y=-2}, {x=1, y=-2}},
[2]={{x=1, y=0}, {x=1, y=1}, {x=0, y=-2}, {x=1, y=-2}},
[3]={{x=0, y=1}, {x=0, y=-1}},
},
[2]={
[0]={{x=0, y=1}, {x=0, y=-1}},
[1]={{x=-1, y=0}, {x=-1, y=-1}, {x=0, y=2}, {x=-1, y=2}},
[3]={{x=1, y=0}, {x=1, y=-1}, {x=0, y=2}, {x=1, y=2}},
},
[3]={
[0]={{x=-1, y=0}, {x=-1, y=1}, {x=0, y=-2}, {x=-1, y=-2}},
[1]={{x=0, y=1}, {x=0, y=-1}},
[2]={{x=-1, y=0}, {x=-1, y=1}, {x=0, y=-2}, {x=-1, y=-2}},
},
};
SRS.wallkicks_line = {
[0]={
[1]={{x=-2, y=0}, {x=1, y=0}, {x=-2, y=1}, {x=1, y=-2}},
[2]={},
[3]={{x=-1, y=0}, {x=2, y=0}, {x=-1, y=-2}, {x=2, y=1}},
},
[1]={
[0]={{x=2, y=0}, {x=-1, y=0}, {x=2, y=-1}, {x=-1, y=2}},
[2]={{x=-1, y=0}, {x=2, y=0}, {x=-1, y=-2}, {x=2, y=1}},
[3]={{x=0, y=1}, {x=0, y=-1}, {x=0, y=2}, {x=0, y=-2}},
},
[2]={
[0]={},
[1]={{x=1, y=0}, {x=-2, y=0}, {x=1, y=2}, {x=-2, y=-1}},
[3]={{x=2, y=0}, {x=-1, y=0}, {x=2, y=-1}, {x=-1, y=2}},
},
[3]={
[0]={{x=1, y=0}, {x=-2, y=0}, {x=1, y=2}, {x=-2, y=-1}},
[1]={{x=0, y=1}, {x=0, y=-1}, {x=0, y=2}, {x=0, y=-2}},
[2]={{x=-2, y=0}, {x=1, y=0}, {x=-2, y=1}, {x=1, y=-2}},
},
};
-- Component functions.
function SRS:attemptWallkicks(piece, new_piece, rot_dir, grid)
local kicks
if piece.shape == "O" then
return
elseif piece.shape == "I" then
kicks = SRS.wallkicks_line[piece.rotation][new_piece.rotation]
else
kicks = SRS.wallkicks_3x3[piece.rotation][new_piece.rotation]
end
assert(piece.rotation ~= new_piece.rotation)
for idx, offset in pairs(kicks) do
kicked_piece = new_piece:withOffset(offset)
if grid:canPlacePiece(kicked_piece) then
piece:setRelativeRotation(rot_dir)
piece:setOffset(offset)
self:onPieceRotate(piece, grid)
return
end
end
end
function SRS:onPieceCreate(piece, grid)
piece.manipulations = 0
end
function SRS:onPieceDrop(piece, grid)
piece.lock_delay = 0 -- step reset
end
function SRS:onPieceMove(piece, grid)
piece.lock_delay = 0 -- move reset
if piece:isDropBlocked(grid) then
piece.manipulations = piece.manipulations + 1
if piece.manipulations >= 127 then
piece.locked = true
end
end
end
function SRS:onPieceRotate(piece, grid)
piece.lock_delay = 0 -- rotate reset
if piece:isDropBlocked(grid) then
piece.manipulations = piece.manipulations + 1
if piece.manipulations >= 127 then
piece.locked = true
end
end
end
return SRS

30
tetris/rulesets/standard_exp.lua Normal file → Executable file
View File

@ -3,29 +3,29 @@ local Ruleset = require 'tetris.rulesets.ruleset'
local SRS = Ruleset:extend() local SRS = Ruleset:extend()
SRS.name = "SRS" SRS.name = "Guideline SRS"
SRS.hash = "Standard" SRS.hash = "Standard"
SRS.enable_IRS_wallkicks = true SRS.enable_IRS_wallkicks = true
SRS.spawn_positions = { SRS.spawn_positions = {
I = { x=5, y=4 }, I = { x=5, y=2 },
J = { x=4, y=5 }, J = { x=4, y=3 },
L = { x=4, y=5 }, L = { x=4, y=3 },
O = { x=5, y=5 }, O = { x=5, y=3 },
S = { x=4, y=5 }, S = { x=4, y=3 },
T = { x=4, y=5 }, T = { x=4, y=3 },
Z = { x=4, y=5 }, Z = { x=4, y=3 },
} }
SRS.big_spawn_positions = { SRS.big_spawn_positions = {
I = { x=2, y=2 }, I = { x=2, y=1 },
J = { x=2, y=3 }, J = { x=2, y=2 },
L = { x=2, y=3 }, L = { x=2, y=2 },
O = { x=2, y=3 }, O = { x=2, y=2 },
S = { x=2, y=3 }, S = { x=2, y=2 },
T = { x=2, y=3 }, T = { x=2, y=2 },
Z = { x=2, y=3 }, Z = { x=2, y=2 },
} }
SRS.block_offsets = { SRS.block_offsets = {