Proper bravo detection!

pull/1/head
Ishaan Bhardwaj 2020-10-08 20:44:06 -04:00
parent 4e8a237de3
commit 6178b2cee9
2 changed files with 10 additions and 9 deletions

View File

@ -185,6 +185,15 @@ function Grid:applyBigPiece(piece)
end
end
function Grid:checkForBravo(cleared_row_count)
for i = 0, 23 - cleared_row_count do
for j = 0, 9 do
if self:isOccupied(j, i) then return false end
end
end
return true
end
function Grid:update()
for y = 1, 24 do
for x = 1, 10 do

View File

@ -127,15 +127,7 @@ function KonohaGame:onLineClear(cleared_row_count)
local oldtime = self.time_limit
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
if self.grid:checkForBravo(cleared_row_count) 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]