TGM2 fixes and cool fixes

This commit is contained in:
Ishaan Bhardwaj 2020-11-02 12:21:12 -05:00
parent 0badcde9ad
commit eb70f55b6e
4 changed files with 30 additions and 72 deletions

View File

@ -20,12 +20,10 @@ function MarathonA2Game:new()
self.roll_frames = 0
self.combo = 1
self.grade = 0
self.level = 998
self.grade = 31
self.grade_points = 0
self.grade_point_decay_counter = 0
self.section_start_time = 0
self.section_times = { [0] = 0 }
self.section_tetrises = { [0] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
self.randomizer = History6RollsRandomizer()
@ -103,11 +101,9 @@ end
function MarathonA2Game:advanceOneFrame()
if self.clear then
self.roll_frames = self.roll_frames + 1
if self.roll_frames < 0 then return true end
if self.roll_frames > 3694 then
self.completed = true
if self.grade == 32 then
self.grade = 33
end
end
elseif self.ready_frames == 0 then
self.frames = self.frames + 1
@ -123,15 +119,11 @@ end
function MarathonA2Game:onLineClear(cleared_row_count)
cleared_row_count = cleared_row_count / 2
self:updateSectionTimes(self.level, self.level + cleared_row_count)
self.level = math.min(self.level + cleared_row_count, 999)
if self.level == 999 and not self.clear then
self.clear = true
if self:qualifiesForMRoll() then
self.grade = 32
end
self.grid:clear()
self.roll_frames = -150
self.roll_frames = -1500
end
end
@ -152,17 +144,6 @@ function MarathonA2Game:updateScore(level, drop_bonus, cleared_lines)
self.drop_bonus = 0
end
function MarathonA2Game:updateSectionTimes(old_level, new_level)
if self.clear then return end
if math.floor(old_level / 100) < math.floor(new_level / 100) or
new_level >= 999 then
-- record new section
section_time = self.frames - self.section_start_time
self.section_times[math.floor(old_level / 100)] = section_time
self.section_start_time = self.frames
end
end
local grade_point_bonuses = {
{10, 20, 40, 50},
{10, 20, 30, 40},
@ -249,49 +230,12 @@ function MarathonA2Game:updateGrade(cleared_lines)
end
end
local tetris_requirements = { [0] = 2, 2, 2, 2, 2, 1, 1, 1, 1, 0 }
function MarathonA2Game:qualifiesForMRoll()
if not self.clear then return false end
-- tetris requirements
for section = 0, 9 do
if self.section_tetrises[section] < tetris_requirements[section] then
return false
end
end
-- section time requirements
local section_average = 0
for section = 0, 4 do
section_average = section_average + self.section_times[section]
if self.section_times[section] > frameTime(1,05) then
return false
end
end
-- section time average requirements
if self.section_times[5] > section_average / 5 then
return false
end
for section = 6, 9 do
if self.section_times[section] > self.section_times[section - 1] + 120 then
return false
end
end
if self.grade < 17 or self.frames > frameTime(8,45) then
return false
end
return true
end
function MarathonA2Game:getLetterGrade()
local grade = grade_conversion[self.grade]
if grade < 9 then
return tostring(9 - grade)
elseif grade < 18 then
return "S" .. tostring(grade - 8)
elseif grade == 18 then
return "M"
else
return "GM"
end
end
@ -301,18 +245,9 @@ MarathonA2Game.rollOpacityFunction = function(age)
else return 1 - (age - 240) / 60 end
end
MarathonA2Game.mRollOpacityFunction = function(age)
if age > 4 then return 0
else return 1 - age / 4 end
end
function MarathonA2Game:drawGrid(ruleset)
if self.clear and not (self.completed or self.game_over) then
if self:qualifiesForMRoll() then
self.grid:drawInvisible(self.mRollOpacityFunction)
else
self.grid:drawInvisible(self.rollOpacityFunction)
end
self.grid:drawInvisible(self.rollOpacityFunction)
else
self.grid:draw()
if self.piece ~= nil and self.level < 100 then

View File

@ -36,6 +36,8 @@ function Marathon2020Game:new()
self.grade_points = 0
self.grade_point_decay_counter = 0
self.max_grade_points = 0
self.cool_timer = 0
end
function Marathon2020Game:getARE()
@ -327,6 +329,7 @@ function Marathon2020Game:updateSectionTimes(old_level, new_level)
self.section_cool_count = self.section_cool_count + 1
self.delay_level = math.min(20, self.delay_level + 1)
table.insert(self.section_status, "cool")
self.cool_timer = 300
end
local section = getSectionForLevel(old_level)
@ -430,6 +433,11 @@ function Marathon2020Game:drawScoringInfo()
self:drawSectionTimesWithSecondary(current_section)
if (self.cool_timer > 0) then
love.graphics.printf("COOL!!", 64, 400, 160, "center")
self.cool_timer = self.cool_timer - 1
end
love.graphics.setFont(font_3x5_3)
love.graphics.printf(self:getTotalGrade(), text_x, 120, 90, "left")
love.graphics.printf(self.grade_points, text_x, 220, 90, "left")

View File

@ -16,7 +16,8 @@ MarathonA2Game.tagline = "The points don't matter! Can you reach the invisible r
function MarathonA2Game:new()
MarathonA2Game.super:new()
self.level = 900
self.roll_frames = 0
self.combo = 1
self.randomizer = History6RollsRandomizer()
@ -107,6 +108,7 @@ end
function MarathonA2Game:advanceOneFrame()
if self.clear then
self.roll_frames = self.roll_frames + 1
if self.roll_frames < 0 then return false end
if self.roll_frames > 3694 then
self.completed = true
if self.grade == 32 then

View File

@ -16,7 +16,7 @@ PhantomMania2Game.tagline = "The blocks disappear even faster now! Can you make
function PhantomMania2Game:new()
PhantomMania2Game.super:new()
self.level = 0
self.level = 99
self.grade = 0
self.garbage = 0
self.clear = false
@ -38,6 +38,9 @@ function PhantomMania2Game:new()
self.lock_drop = true
self.enable_hold = true
self.next_queue_length = 3
self.coolregret_message = ""
self.coolregret_timer = 0
end
function PhantomMania2Game:getARE()
@ -213,8 +216,13 @@ function PhantomMania2Game:updateSectionTimes(old_level, new_level)
self.section_start_time = self.frames
if section_time <= cool_cutoffs[section] then
self.grade = self.grade + 2
self.coolregret_message = "COOL!!"
self.coolregret_timer = 300
elseif section_time <= regret_cutoffs[section] then
self.grade = self.grade + 1
else
self.coolregret_message = "REGRET!!"
self.coolregret_timer = 300
end
end
end
@ -296,6 +304,11 @@ function PhantomMania2Game:drawScoringInfo()
love.graphics.printf("SECRET GRADE", 240, 430, 180, "left")
end
if(self.coolregret_timer > 0) then
love.graphics.printf(self.coolregret_message, 64, 400, 160, "center")
self.coolregret_timer = self.coolregret_timer - 1
end
love.graphics.setFont(font_3x5_3)
love.graphics.printf(getLetterGrade(math.floor(self.grade)), text_x, 140, 90, "left")
love.graphics.printf(self.score, text_x, 220, 90, "left")