Merge pull request #15 from Tetro48/main

Replay compatibility and adherence to new ruleset names
This commit is contained in:
Ishaan Bhardwaj
2023-06-23 18:03:15 -04:00
committed by GitHub
34 changed files with 68 additions and 68 deletions

View File

@@ -44,7 +44,7 @@ local maps = {
function ComboChallenge:new()
GameMode:new()
self.grid = Grid(4, 24)
self.grid:applyMap(maps[math.random(#maps)])
self.grid:applyMap(maps[love.math.random(#maps)])
self.randomizer = BagRandomizer()
self.lock_drop = false
self.lock_hard_drop = false

View File

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

View File

@@ -135,25 +135,25 @@ function TheTrueHero:advanceOneFrame(inputs, ruleset)
) and (attack_rolls < 2)) or attack_rolls == 0 do
attack_rolls = attack_rolls + 1
if self.attack_number > 20 then
self.current_attack = math.random(#self.attacks)
self.current_attack = love.math.random(#self.attacks)
else
self.current_attack = math.random(4)
self.current_attack = love.math.random(4)
end
end
if self.current_attack == 1 then
self.var = math.floor(3 + math.random(
self.var = math.floor(3 + love.math.random(
math.floor(self.attack_number / 4),
math.floor(self.attack_number / 3)
) *
self.section_times[Mod1(self.attack_number, #self.section_times)] / 342)
elseif self.current_attack == 2 then
self.var = math.floor(1 + math.random(
self.var = math.floor(1 + love.math.random(
math.floor(self.attack_number / 6),
math.floor(self.attack_number / 4)
) *
self.section_times[Mod1(self.attack_number, #self.section_times)] / 342)
elseif self.current_attack == 3 then
self.var = math.max(10 - math.random(
self.var = math.max(10 - love.math.random(
math.floor(self.attack_number / 8),
math.floor(self.attack_number / 4)
), 3)
@@ -212,7 +212,7 @@ end
function TheTrueHero:advanceBottomRow(dx)
if self.var <= 0 and self.current_attack == 3 then
self.grid:copyBottomRow()
self.var = math.max(10 - math.random(
self.var = math.max(10 - love.math.random(
math.floor(self.attack_number / 8),
math.floor(self.attack_number / 4)
), 3)

View File

@@ -93,7 +93,7 @@ function MarathonWCBGame:shuffleColours()
table.insert(temp_colours, colour)
end
for piece in pairs(self.ruleset.colourscheme) do
self.ruleset.colourscheme[piece] = table.remove(temp_colours, math.random(#temp_colours))
self.ruleset.colourscheme[piece] = table.remove(temp_colours, love.math.random(#temp_colours))
end
end

View File

@@ -33,7 +33,7 @@ end
function Minesweeper:initializeGrid()
self.grid = Grid(width, height + 4)
self.flags = math.floor(0.15 * width * height)
self.chosen_colour = ({ "R", "O", "Y", "G", "C", "B", "M" })[math.random(7)]
self.chosen_colour = ({ "R", "O", "Y", "G", "C", "B", "M" })[love.math.random(7)]
for y = 1, height do
for x = 1, width do
self.grid.grid[y+4][x] = { skin = "2tie", colour = self.chosen_colour }
@@ -45,8 +45,8 @@ function Minesweeper:initializeMines(sel_x, sel_y)
for i = 1, self.flags do
local x, y
repeat
x = math.random(1, width)
y = math.random(1, height)
x = love.math.random(1, width)
y = love.math.random(1, height)
until not (self:isMine(x, y) or (sel_x == x and sel_y == y))
table.insert(self.mines, {x=x, y=y})
end

View File

@@ -59,8 +59,8 @@ end
function Snake:generateGem()
repeat
self.gem.x = math.random(1, 25)
self.gem.y = math.random(5, 24)
self.gem.x = love.math.random(1, 25)
self.gem.y = love.math.random(5, 24)
until not self:isInSnake({x=self.gem.x, y=self.gem.y})
end

View File

@@ -55,8 +55,8 @@ function StackerGame:advanceOneFrame(inputs, ruleset)
self.are = self.are - 1
return false
elseif self.are == 0 then
self.position = math.random(1, 7 + self.block_width - 1)
self.direction = ({-1, 1})[math.random(2)]
self.position = love.math.random(1, 7 + self.block_width - 1)
self.direction = ({-1, 1})[love.math.random(2)]
self.are = -1
end
if not self.prev_inputs.up and inputs.up then