mirror of
https://github.com/SashLilac/cambridge.git
synced 2024-11-22 17:39:03 -06:00
Refactored funcs.lua
- Renamed st and sp to strTrueValues and frameTime respectively - Modified files calling these to use the new names - Tidying like formatTime now using a single string.format
This commit is contained in:
parent
d5ce2ee9ba
commit
6b7f18d58a
27
funcs.lua
27
funcs.lua
@ -1,4 +1,5 @@
|
|||||||
function copy(t)
|
function copy(t)
|
||||||
|
-- returns deep copy of t (as opposed to the shallow copy you get from var = t)
|
||||||
if type(t) ~= "table" then return t end
|
if type(t) ~= "table" then return t end
|
||||||
local meta = getmetatable(t)
|
local meta = getmetatable(t)
|
||||||
local target = {}
|
local target = {}
|
||||||
@ -7,7 +8,8 @@ function copy(t)
|
|||||||
return target
|
return target
|
||||||
end
|
end
|
||||||
|
|
||||||
function st(tbl)
|
function strTrueValues(tbl)
|
||||||
|
-- returns a concatenation of all the keys in tbl with value true, separated with spaces
|
||||||
str = ""
|
str = ""
|
||||||
for k, v in pairs(tbl) do
|
for k, v in pairs(tbl) do
|
||||||
if v == true then
|
if v == true then
|
||||||
@ -17,14 +19,16 @@ function st(tbl)
|
|||||||
return str
|
return str
|
||||||
end
|
end
|
||||||
|
|
||||||
function sp(m, s, f)
|
function frameTime(min, sec, hth)
|
||||||
if m == nil then m = 0 end
|
-- returns a time in frames from a time in minutes-seconds-hundredths format
|
||||||
if s == nil then s = 0 end
|
if min == nil then min = 0 end
|
||||||
if f == nil then f = 0 end
|
if sec == nil then sec = 0 end
|
||||||
return m*3600 + s*60 + math.ceil(f * 0.6)
|
if hth == nil then hth = 0 end
|
||||||
|
return min*3600 + sec*60 + math.ceil(hth * 0.6)
|
||||||
end
|
end
|
||||||
|
|
||||||
function vAdd(v1, v2)
|
function vAdd(v1, v2)
|
||||||
|
-- returns the sum of vectors v1 and v2
|
||||||
return {
|
return {
|
||||||
x = v1.x + v2.x,
|
x = v1.x + v2.x,
|
||||||
y = v1.y + v2.y
|
y = v1.y + v2.y
|
||||||
@ -32,6 +36,7 @@ function vAdd(v1, v2)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function vNeg(v)
|
function vNeg(v)
|
||||||
|
-- returns the opposite of vector v
|
||||||
return {
|
return {
|
||||||
x = -v.x,
|
x = -v.x,
|
||||||
y = -v.y
|
y = -v.y
|
||||||
@ -39,14 +44,18 @@ function vNeg(v)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function formatTime(frames)
|
function formatTime(frames)
|
||||||
|
-- returns a mm:ss:hh (h=hundredths) representation of the time in frames given
|
||||||
if frames < 0 then return formatTime(0) end
|
if frames < 0 then return formatTime(0) end
|
||||||
str = string.format("%02d", math.floor(frames / 3600)) .. ":"
|
local min, sec, hund
|
||||||
.. string.format("%02d", math.floor(frames / 60) % 60) .. "."
|
min = math.floor(frames/3600)
|
||||||
.. string.format("%02d", math.floor(frames / 0.6) % 100)
|
sec = math.floor(frames/60) % 60
|
||||||
|
hund = math.floor(frames/.6) % 100
|
||||||
|
str = string.format("%02d:%02d.%02d", min, sec, hund)
|
||||||
return str
|
return str
|
||||||
end
|
end
|
||||||
|
|
||||||
function formatBigNum(number)
|
function formatBigNum(number)
|
||||||
|
-- returns a string representing a number with commas as thousands separator (e.g. 12,345,678)
|
||||||
local s = string.format("%d", number)
|
local s = string.format("%d", number)
|
||||||
local pos = string.len(s) % 3
|
local pos = string.len(s) % 3
|
||||||
if pos == 0 then pos = 3 end
|
if pos == 0 then pos = 3 end
|
||||||
|
@ -262,7 +262,7 @@ function MarathonA2Game:qualifiesForMRoll()
|
|||||||
local section_average = 0
|
local section_average = 0
|
||||||
for section = 0, 4 do
|
for section = 0, 4 do
|
||||||
section_average = section_average + self.section_times[section]
|
section_average = section_average + self.section_times[section]
|
||||||
if self.section_times[section] > sp(1,05) then
|
if self.section_times[section] > frameTime(1,05) then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -275,7 +275,7 @@ function MarathonA2Game:qualifiesForMRoll()
|
|||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if self.grade < 17 or self.frames > sp(8,45) then
|
if self.grade < 17 or self.frames > frameTime(8,45) then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
return true
|
return true
|
||||||
@ -327,7 +327,7 @@ function MarathonA2Game:drawScoringInfo()
|
|||||||
love.graphics.print(
|
love.graphics.print(
|
||||||
self.das.direction .. " " ..
|
self.das.direction .. " " ..
|
||||||
self.das.frames .. " " ..
|
self.das.frames .. " " ..
|
||||||
st(self.prev_inputs)
|
strTrueValues(self.prev_inputs)
|
||||||
)
|
)
|
||||||
love.graphics.printf("NEXT", 64, 40, 40, "left")
|
love.graphics.printf("NEXT", 64, 40, 40, "left")
|
||||||
love.graphics.printf("GRADE", 240, 120, 40, "left")
|
love.graphics.printf("GRADE", 240, 120, 40, "left")
|
||||||
|
@ -159,7 +159,7 @@ function DemonModeGame:updateSectionTimes(old_level, new_level)
|
|||||||
end
|
end
|
||||||
elseif old_level < 100 then
|
elseif old_level < 100 then
|
||||||
-- If section time is under cutoff, skip to level 500.
|
-- If section time is under cutoff, skip to level 500.
|
||||||
if self.frames < sp(1,00) then
|
if self.frames < frameTime(1,00) then
|
||||||
self.level = 500
|
self.level = 500
|
||||||
self.grade = 5
|
self.grade = 5
|
||||||
self.section_tries = 0
|
self.section_tries = 0
|
||||||
@ -226,7 +226,7 @@ function DemonModeGame:drawScoringInfo()
|
|||||||
love.graphics.print(
|
love.graphics.print(
|
||||||
self.das.direction .. " " ..
|
self.das.direction .. " " ..
|
||||||
self.das.frames .. " " ..
|
self.das.frames .. " " ..
|
||||||
st(self.prev_inputs)
|
strTrueValues(self.prev_inputs)
|
||||||
)
|
)
|
||||||
love.graphics.printf("NEXT", 64, 40, 40, "left")
|
love.graphics.printf("NEXT", 64, 40, 40, "left")
|
||||||
love.graphics.printf("GRADE", 240, 120, 40, "left")
|
love.graphics.printf("GRADE", 240, 120, 40, "left")
|
||||||
|
@ -392,7 +392,7 @@ function GameMode:drawScoringInfo()
|
|||||||
love.graphics.print(
|
love.graphics.print(
|
||||||
self.das.direction .. " " ..
|
self.das.direction .. " " ..
|
||||||
self.das.frames .. " " ..
|
self.das.frames .. " " ..
|
||||||
st(self.prev_inputs) ..
|
strTrueValues(self.prev_inputs) ..
|
||||||
self.drop_bonus
|
self.drop_bonus
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -120,7 +120,7 @@ function IntervalTrainingGame:drawScoringInfo()
|
|||||||
love.graphics.print(
|
love.graphics.print(
|
||||||
self.das.direction .. " " ..
|
self.das.direction .. " " ..
|
||||||
self.das.frames .. " " ..
|
self.das.frames .. " " ..
|
||||||
st(self.prev_inputs)
|
strTrueValues(self.prev_inputs)
|
||||||
)
|
)
|
||||||
love.graphics.printf("NEXT", 64, 40, 40, "left")
|
love.graphics.printf("NEXT", 64, 40, 40, "left")
|
||||||
love.graphics.printf("TIME LEFT", 240, 250, 80, "left")
|
love.graphics.printf("TIME LEFT", 240, 250, 80, "left")
|
||||||
@ -134,7 +134,7 @@ function IntervalTrainingGame:drawScoringInfo()
|
|||||||
|
|
||||||
-- draw time left, flash red if necessary
|
-- draw time left, flash red if necessary
|
||||||
local time_left = self.section_time_limit - math.max(self:getSectionTime(), 0)
|
local time_left = self.section_time_limit - math.max(self:getSectionTime(), 0)
|
||||||
if not self.game_over and not self.clear and time_left < sp(0,10) and time_left % 4 < 2 then
|
if not self.game_over and not self.clear and time_left < frameTime(0,10) and time_left % 4 < 2 then
|
||||||
love.graphics.setColor(1, 0.3, 0.3, 1)
|
love.graphics.setColor(1, 0.3, 0.3, 1)
|
||||||
end
|
end
|
||||||
love.graphics.printf(formatTime(time_left), 240, 270, 160, "left")
|
love.graphics.printf(formatTime(time_left), 240, 270, 160, "left")
|
||||||
|
@ -150,7 +150,7 @@ function KonohaGame:drawScoringInfo()
|
|||||||
love.graphics.print(
|
love.graphics.print(
|
||||||
self.das.direction .. " " ..
|
self.das.direction .. " " ..
|
||||||
self.das.frames .. " " ..
|
self.das.frames .. " " ..
|
||||||
st(self.prev_inputs)
|
strTrueValues(self.prev_inputs)
|
||||||
)
|
)
|
||||||
love.graphics.printf("NEXT", 64, 40, 40, "left")
|
love.graphics.printf("NEXT", 64, 40, 40, "left")
|
||||||
love.graphics.printf("TIME LIMIT", 240, 120, 120, "left")
|
love.graphics.printf("TIME LIMIT", 240, 120, 120, "left")
|
||||||
@ -158,7 +158,7 @@ function KonohaGame:drawScoringInfo()
|
|||||||
love.graphics.printf("LEVEL", 240, 320, 40, "left")
|
love.graphics.printf("LEVEL", 240, 320, 40, "left")
|
||||||
|
|
||||||
love.graphics.setFont(font_3x5_3)
|
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
|
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)
|
love.graphics.setColor(1, 0.3, 0.3, 1)
|
||||||
end
|
end
|
||||||
love.graphics.printf(formatTime(self.time_limit), 240, 140, 120, "left")
|
love.graphics.printf(formatTime(self.time_limit), 240, 140, 120, "left")
|
||||||
|
@ -151,11 +151,11 @@ function Marathon2020Game:advanceOneFrame()
|
|||||||
end
|
end
|
||||||
|
|
||||||
local cool_cutoffs = {
|
local cool_cutoffs = {
|
||||||
sp(0,45,00), sp(0,41,50), sp(0,38,50), sp(0,35,00), sp(0,32,50),
|
frameTime(0,45,00), frameTime(0,41,50), frameTime(0,38,50), frameTime(0,35,00), frameTime(0,32,50),
|
||||||
sp(0,29,20), sp(0,27,20), sp(0,24,80), sp(0,22,80), sp(0,20,60),
|
frameTime(0,29,20), frameTime(0,27,20), frameTime(0,24,80), frameTime(0,22,80), frameTime(0,20,60),
|
||||||
sp(0,19,60), sp(0,19,40), sp(0,19,40), sp(0,18,40), sp(0,18,20),
|
frameTime(0,19,60), frameTime(0,19,40), frameTime(0,19,40), frameTime(0,18,40), frameTime(0,18,20),
|
||||||
sp(0,16,20), sp(0,16,20), sp(0,16,20), sp(0,16,20), sp(0,16,20),
|
frameTime(0,16,20), frameTime(0,16,20), frameTime(0,16,20), frameTime(0,16,20), frameTime(0,16,20),
|
||||||
sp(0,15,20)
|
frameTime(0,15,20)
|
||||||
}
|
}
|
||||||
|
|
||||||
local levels_for_cleared_rows = { 1, 2, 4, 6 }
|
local levels_for_cleared_rows = { 1, 2, 4, 6 }
|
||||||
@ -284,11 +284,11 @@ function Marathon2020Game:sectionPassed(old_level, new_level)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function Marathon2020Game:checkTorikan(section)
|
function Marathon2020Game:checkTorikan(section)
|
||||||
if section == 5 and self.frames < sp(6,00,00) then self.torikan_passed[500] = true end
|
if section == 5 and self.frames < frameTime(6,00,00) then self.torikan_passed[500] = true end
|
||||||
if section == 9 and self.frames < sp(8,30,00) then self.torikan_passed[900] = true end
|
if section == 9 and self.frames < frameTime(8,30,00) then self.torikan_passed[900] = true end
|
||||||
if section == 10 and self.frames < sp(8,45,00) then self.torikan_passed[1000] = true end
|
if section == 10 and self.frames < frameTime(8,45,00) then self.torikan_passed[1000] = true end
|
||||||
if section == 15 and self.frames < sp(11,30,00) then self.torikan_passed[1500] = true end
|
if section == 15 and self.frames < frameTime(11,30,00) then self.torikan_passed[1500] = true end
|
||||||
if section == 19 and self.frames < sp(13,15,00) then self.torikan_passed[1900] = true end
|
if section == 19 and self.frames < frameTime(13,15,00) then self.torikan_passed[1900] = true end
|
||||||
end
|
end
|
||||||
|
|
||||||
function Marathon2020Game:checkClear(level)
|
function Marathon2020Game:checkClear(level)
|
||||||
|
@ -155,15 +155,15 @@ end
|
|||||||
|
|
||||||
function MarathonA1Game:checkGMRequirements(old_level, new_level)
|
function MarathonA1Game:checkGMRequirements(old_level, new_level)
|
||||||
if old_level < 300 and new_level >= 300 then
|
if old_level < 300 and new_level >= 300 then
|
||||||
if self.score > 12000 and self.frames <= sp(4,15) then
|
if self.score > 12000 and self.frames <= frameTime(4,15) then
|
||||||
self.gm_conditions["level300"] = true
|
self.gm_conditions["level300"] = true
|
||||||
end
|
end
|
||||||
elseif old_level < 500 and new_level >= 500 then
|
elseif old_level < 500 and new_level >= 500 then
|
||||||
if self.score > 40000 and self.frames <= sp(7,30) then
|
if self.score > 40000 and self.frames <= frameTime(7,30) then
|
||||||
self.gm_conditions["level500"] = true
|
self.gm_conditions["level500"] = true
|
||||||
end
|
end
|
||||||
elseif old_level < 999 and new_level >= 999 then
|
elseif old_level < 999 and new_level >= 999 then
|
||||||
if self.score > 126000 and self.frames <= sp(13,30) then
|
if self.score > 126000 and self.frames <= frameTime(13,30) then
|
||||||
self.gm_conditions["level900"] = true
|
self.gm_conditions["level900"] = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -184,7 +184,7 @@ function MarathonA1Game:drawScoringInfo()
|
|||||||
love.graphics.print(
|
love.graphics.print(
|
||||||
self.das.direction .. " " ..
|
self.das.direction .. " " ..
|
||||||
self.das.frames .. " " ..
|
self.das.frames .. " " ..
|
||||||
st(self.prev_inputs)
|
strTrueValues(self.prev_inputs)
|
||||||
)
|
)
|
||||||
love.graphics.printf("NEXT", 64, 40, 40, "left")
|
love.graphics.printf("NEXT", 64, 40, 40, "left")
|
||||||
love.graphics.printf("GRADE", 240, 120, 40, "left")
|
love.graphics.printf("GRADE", 240, 120, 40, "left")
|
||||||
|
@ -260,7 +260,7 @@ function MarathonA2Game:qualifiesForMRoll()
|
|||||||
local section_average = 0
|
local section_average = 0
|
||||||
for section = 0, 4 do
|
for section = 0, 4 do
|
||||||
section_average = section_average + self.section_times[section]
|
section_average = section_average + self.section_times[section]
|
||||||
if self.section_times[section] > sp(1,05) then
|
if self.section_times[section] > frameTime(1,05) then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -273,7 +273,7 @@ function MarathonA2Game:qualifiesForMRoll()
|
|||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if self.grade < 17 or self.frames > sp(8,45) then
|
if self.grade < 17 or self.frames > frameTime(8,45) then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
return true
|
return true
|
||||||
@ -325,7 +325,7 @@ function MarathonA2Game:drawScoringInfo()
|
|||||||
love.graphics.print(
|
love.graphics.print(
|
||||||
self.das.direction .. " " ..
|
self.das.direction .. " " ..
|
||||||
self.das.frames .. " " ..
|
self.das.frames .. " " ..
|
||||||
st(self.prev_inputs)
|
strTrueValues(self.prev_inputs)
|
||||||
)
|
)
|
||||||
love.graphics.printf("NEXT", 64, 40, 40, "left")
|
love.graphics.printf("NEXT", 64, 40, 40, "left")
|
||||||
love.graphics.printf("GRADE", 240, 120, 40, "left")
|
love.graphics.printf("GRADE", 240, 120, 40, "left")
|
||||||
|
@ -160,13 +160,13 @@ function MarathonA3Game:onLineClear(cleared_row_count)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local cool_cutoffs = {
|
local cool_cutoffs = {
|
||||||
sp(0,52), sp(0,52), sp(0,49), sp(0,45), sp(0,45),
|
frameTime(0,52), frameTime(0,52), frameTime(0,49), frameTime(0,45), frameTime(0,45),
|
||||||
sp(0,42), sp(0,42), sp(0,38), sp(0,38),
|
frameTime(0,42), frameTime(0,42), frameTime(0,38), frameTime(0,38),
|
||||||
}
|
}
|
||||||
|
|
||||||
local regret_cutoffs = {
|
local regret_cutoffs = {
|
||||||
sp(0,90), sp(0,75), sp(0,75), sp(0,68), sp(0,60),
|
frameTime(0,90), frameTime(0,75), frameTime(0,75), frameTime(0,68), frameTime(0,60),
|
||||||
sp(0,60), sp(0,50), sp(0,50), sp(0,50), sp(0,50),
|
frameTime(0,60), frameTime(0,50), frameTime(0,50), frameTime(0,50), frameTime(0,50),
|
||||||
}
|
}
|
||||||
|
|
||||||
function MarathonA3Game:updateSectionTimes(old_level, new_level)
|
function MarathonA3Game:updateSectionTimes(old_level, new_level)
|
||||||
@ -372,7 +372,7 @@ function MarathonA3Game:drawScoringInfo()
|
|||||||
love.graphics.print(
|
love.graphics.print(
|
||||||
self.das.direction .. " " ..
|
self.das.direction .. " " ..
|
||||||
self.das.frames .. " " ..
|
self.das.frames .. " " ..
|
||||||
st(self.prev_inputs)
|
strTrueValues(self.prev_inputs)
|
||||||
)
|
)
|
||||||
love.graphics.printf("NEXT", 64, 40, 40, "left")
|
love.graphics.printf("NEXT", 64, 40, 40, "left")
|
||||||
love.graphics.printf("GRADE", 240, 120, 40, "left")
|
love.graphics.printf("GRADE", 240, 120, 40, "left")
|
||||||
|
@ -141,7 +141,7 @@ function MarathonAX4Game:drawScoringInfo()
|
|||||||
love.graphics.print(
|
love.graphics.print(
|
||||||
self.das.direction .. " " ..
|
self.das.direction .. " " ..
|
||||||
self.das.frames .. " " ..
|
self.das.frames .. " " ..
|
||||||
st(self.prev_inputs)
|
strTrueValues(self.prev_inputs)
|
||||||
)
|
)
|
||||||
love.graphics.printf("NEXT", 64, 40, 40, "left")
|
love.graphics.printf("NEXT", 64, 40, 40, "left")
|
||||||
love.graphics.printf("TIME LEFT", 240, 250, 80, "left")
|
love.graphics.printf("TIME LEFT", 240, 250, 80, "left")
|
||||||
@ -156,7 +156,7 @@ function MarathonAX4Game:drawScoringInfo()
|
|||||||
|
|
||||||
-- draw time left, flash red if necessary
|
-- draw time left, flash red if necessary
|
||||||
local time_left = self.section_time_limit - math.max(self:getSectionTime(), 0)
|
local time_left = self.section_time_limit - math.max(self:getSectionTime(), 0)
|
||||||
if not self.game_over and not self.clear and time_left < sp(0,10) and time_left % 4 < 2 then
|
if not self.game_over and not self.clear and time_left < frameTime(0,10) and time_left % 4 < 2 then
|
||||||
love.graphics.setColor(1, 0.3, 0.3, 1)
|
love.graphics.setColor(1, 0.3, 0.3, 1)
|
||||||
end
|
end
|
||||||
love.graphics.printf(formatTime(time_left), 240, 270, 160, "left")
|
love.graphics.printf(formatTime(time_left), 240, 270, 160, "left")
|
||||||
|
@ -156,7 +156,7 @@ function MarathonC89Game:drawScoringInfo()
|
|||||||
love.graphics.print(
|
love.graphics.print(
|
||||||
self.das.direction .. " " ..
|
self.das.direction .. " " ..
|
||||||
self.das.frames .. " " ..
|
self.das.frames .. " " ..
|
||||||
st(self.prev_inputs)
|
strTrueValues(self.prev_inputs)
|
||||||
)
|
)
|
||||||
love.graphics.printf("NEXT", 64, 40, 40, "left")
|
love.graphics.printf("NEXT", 64, 40, 40, "left")
|
||||||
love.graphics.printf("LINES", 240, 120, 40, "left")
|
love.graphics.printf("LINES", 240, 120, 40, "left")
|
||||||
|
@ -61,15 +61,15 @@ function PhantomManiaGame:getGravity()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function PhantomManiaGame:hitTorikan(old_level, new_level)
|
function PhantomManiaGame:hitTorikan(old_level, new_level)
|
||||||
if old_level < 300 and new_level >= 300 and self.frames > sp(2,28) then
|
if old_level < 300 and new_level >= 300 and self.frames > frameTime(2,28) then
|
||||||
self.level = 300
|
self.level = 300
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
if old_level < 500 and new_level >= 500 and self.frames > sp(3,38) then
|
if old_level < 500 and new_level >= 500 and self.frames > frameTime(3,38) then
|
||||||
self.level = 500
|
self.level = 500
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
if old_level < 800 and new_level >= 800 and self.frames > sp(5,23) then
|
if old_level < 800 and new_level >= 800 and self.frames > frameTime(5,23) then
|
||||||
self.level = 800
|
self.level = 800
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
@ -86,19 +86,19 @@ function PhantomMania2Game:getNextPiece(ruleset)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function PhantomMania2Game:hitTorikan(old_level, new_level)
|
function PhantomMania2Game:hitTorikan(old_level, new_level)
|
||||||
if old_level < 300 and new_level >= 300 and self.frames > sp(2,02) then
|
if old_level < 300 and new_level >= 300 and self.frames > frameTime(2,02) then
|
||||||
self.level = 300
|
self.level = 300
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
if old_level < 500 and new_level >= 500 and self.frames > sp(3,03) then
|
if old_level < 500 and new_level >= 500 and self.frames > frameTime(3,03) then
|
||||||
self.level = 500
|
self.level = 500
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
if old_level < 800 and new_level >= 800 and self.frames > sp(4,45) then
|
if old_level < 800 and new_level >= 800 and self.frames > frameTime(4,45) then
|
||||||
self.level = 800
|
self.level = 800
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
if old_level < 1000 and new_level >= 1000 and self.frames > sp(5,38) then
|
if old_level < 1000 and new_level >= 1000 and self.frames > frameTime(5,38) then
|
||||||
self.level = 1000
|
self.level = 1000
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
@ -188,15 +188,15 @@ end
|
|||||||
|
|
||||||
|
|
||||||
local cool_cutoffs = {
|
local cool_cutoffs = {
|
||||||
sp(0,36), sp(0,36), sp(0,36), sp(0,36), sp(0,36),
|
frameTime(0,36), frameTime(0,36), frameTime(0,36), frameTime(0,36), frameTime(0,36),
|
||||||
sp(0,30), sp(0,30), sp(0,30), sp(0,30), sp(0,30),
|
frameTime(0,30), frameTime(0,30), frameTime(0,30), frameTime(0,30), frameTime(0,30),
|
||||||
sp(0,27), sp(0,27), sp(0,27),
|
frameTime(0,27), frameTime(0,27), frameTime(0,27),
|
||||||
}
|
}
|
||||||
|
|
||||||
local regret_cutoffs = {
|
local regret_cutoffs = {
|
||||||
sp(0,50), sp(0,50), sp(0,50), sp(0,50), sp(0,50),
|
frameTime(0,50), frameTime(0,50), frameTime(0,50), frameTime(0,50), frameTime(0,50),
|
||||||
sp(0,40), sp(0,40), sp(0,40), sp(0,40), sp(0,40),
|
frameTime(0,40), frameTime(0,40), frameTime(0,40), frameTime(0,40), frameTime(0,40),
|
||||||
sp(0,35), sp(0,35), sp(0,35),
|
frameTime(0,35), frameTime(0,35), frameTime(0,35),
|
||||||
}
|
}
|
||||||
|
|
||||||
function PhantomMania2Game:updateSectionTimes(old_level, new_level)
|
function PhantomMania2Game:updateSectionTimes(old_level, new_level)
|
||||||
|
@ -102,15 +102,15 @@ function Survival2020Game:getNextPiece(ruleset)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function Survival2020Game:hitTorikan(old_level, new_level)
|
function Survival2020Game:hitTorikan(old_level, new_level)
|
||||||
if old_level < 500 and new_level >= 500 and self.frames > sp(3,00) then
|
if old_level < 500 and new_level >= 500 and self.frames > frameTime(3,00) then
|
||||||
self.level = 500
|
self.level = 500
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
if old_level < 1000 and new_level >= 1000 and self.frames > sp(5,00) then
|
if old_level < 1000 and new_level >= 1000 and self.frames > frameTime(5,00) then
|
||||||
self.level = 1000
|
self.level = 1000
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
if old_level < 1500 and new_level >= 1500 and self.frames > sp(7,00) then
|
if old_level < 1500 and new_level >= 1500 and self.frames > frameTime(7,00) then
|
||||||
self.level = 1500
|
self.level = 1500
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
@ -193,7 +193,7 @@ function Survival2020Game:updateSectionTimes(old_level, new_level)
|
|||||||
section_time = self.frames - self.section_start_time
|
section_time = self.frames - self.section_start_time
|
||||||
table.insert(self.section_times, section_time)
|
table.insert(self.section_times, section_time)
|
||||||
self.section_start_time = self.frames
|
self.section_start_time = self.frames
|
||||||
if section_time <= sp(0,30) then
|
if section_time <= frameTime(0,30) then
|
||||||
self.grade = self.grade + 2
|
self.grade = self.grade + 2
|
||||||
else
|
else
|
||||||
self.grade = self.grade + 1
|
self.grade = self.grade + 1
|
||||||
|
@ -125,15 +125,15 @@ end
|
|||||||
|
|
||||||
function SurvivalA1Game:checkGMRequirements(old_level, new_level)
|
function SurvivalA1Game:checkGMRequirements(old_level, new_level)
|
||||||
if old_level < 300 and new_level >= 300 then
|
if old_level < 300 and new_level >= 300 then
|
||||||
if self.score > 12000 and self.frames <= sp(4,15) then
|
if self.score > 12000 and self.frames <= frameTime(4,15) then
|
||||||
self.gm_conditions["level300"] = true
|
self.gm_conditions["level300"] = true
|
||||||
end
|
end
|
||||||
elseif old_level < 500 and new_level >= 500 then
|
elseif old_level < 500 and new_level >= 500 then
|
||||||
if self.score > 40000 and self.frames <= sp(7,30) then
|
if self.score > 40000 and self.frames <= frameTime(7,30) then
|
||||||
self.gm_conditions["level500"] = true
|
self.gm_conditions["level500"] = true
|
||||||
end
|
end
|
||||||
elseif old_level < 999 and new_level >= 999 then
|
elseif old_level < 999 and new_level >= 999 then
|
||||||
if self.score > 126000 and self.frames <= sp(13,30) then
|
if self.score > 126000 and self.frames <= frameTime(13,30) then
|
||||||
self.gm_conditions["level900"] = true
|
self.gm_conditions["level900"] = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -151,7 +151,7 @@ function SurvivalA1Game:drawScoringInfo()
|
|||||||
love.graphics.print(
|
love.graphics.print(
|
||||||
self.das.direction .. " " ..
|
self.das.direction .. " " ..
|
||||||
self.das.frames .. " " ..
|
self.das.frames .. " " ..
|
||||||
st(self.prev_inputs)
|
strTrueValues(self.prev_inputs)
|
||||||
)
|
)
|
||||||
love.graphics.printf("NEXT", 64, 40, 40, "left")
|
love.graphics.printf("NEXT", 64, 40, 40, "left")
|
||||||
love.graphics.printf("GRADE", 240, 120, 40, "left")
|
love.graphics.printf("GRADE", 240, 120, 40, "left")
|
||||||
|
@ -62,7 +62,7 @@ function SurvivalA2Game:getGravity()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function SurvivalA2Game:hitTorikan(old_level, new_level)
|
function SurvivalA2Game:hitTorikan(old_level, new_level)
|
||||||
if old_level < 500 and new_level >= 500 and self.frames > sp(3,25) then
|
if old_level < 500 and new_level >= 500 and self.frames > frameTime(3,25) then
|
||||||
self.level = 500
|
self.level = 500
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
@ -132,7 +132,7 @@ function SurvivalA2Game:drawScoringInfo()
|
|||||||
love.graphics.print(
|
love.graphics.print(
|
||||||
self.das.direction .. " " ..
|
self.das.direction .. " " ..
|
||||||
self.das.frames .. " " ..
|
self.das.frames .. " " ..
|
||||||
st(self.prev_inputs)
|
strTrueValues(self.prev_inputs)
|
||||||
)
|
)
|
||||||
love.graphics.printf("NEXT", 64, 40, 40, "left")
|
love.graphics.printf("NEXT", 64, 40, 40, "left")
|
||||||
love.graphics.printf("GRADE", text_x, 120, 40, "left")
|
love.graphics.printf("GRADE", text_x, 120, 40, "left")
|
||||||
|
@ -86,11 +86,11 @@ function SurvivalA3Game:getNextPiece(ruleset)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function SurvivalA3Game:hitTorikan(old_level, new_level)
|
function SurvivalA3Game:hitTorikan(old_level, new_level)
|
||||||
if old_level < 500 and new_level >= 500 and self.frames > sp(2,28) then
|
if old_level < 500 and new_level >= 500 and self.frames > frameTime(2,28) then
|
||||||
self.level = 500
|
self.level = 500
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
if old_level < 1000 and new_level >= 1000 and self.frames > sp(4,56) then
|
if old_level < 1000 and new_level >= 1000 and self.frames > frameTime(4,56) then
|
||||||
self.level = 1000
|
self.level = 1000
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
@ -168,7 +168,7 @@ function SurvivalA3Game:updateSectionTimes(old_level, new_level)
|
|||||||
section_time = self.frames - self.section_start_time
|
section_time = self.frames - self.section_start_time
|
||||||
table.insert(self.section_times, section_time)
|
table.insert(self.section_times, section_time)
|
||||||
self.section_start_time = self.frames
|
self.section_start_time = self.frames
|
||||||
if section_time <= sp(1,00) then
|
if section_time <= frameTime(1,00) then
|
||||||
self.grade = self.grade + 1
|
self.grade = self.grade + 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user