Compare commits

..

18 Commits

Author SHA1 Message Date
Ishaan Bhardwaj
36837a3af5 Update main.lua 2020-12-03 13:45:23 -05:00
Ishaan Bhardwaj
01b0f9f618 DAS switch behavior implemented 2020-12-02 21:09:52 -05:00
Ishaan Bhardwaj
7c8c5bb11d Hide hold queue when hold is disabled 2020-12-02 13:41:47 -05:00
Ishaan Bhardwaj
acaa6bdbbf whoops forgot to not require socket 2020-12-01 11:58:29 -05:00
Ishaan Bhardwaj
c37757f592 Implement an axis timer (fixes #12) 2020-12-01 11:57:09 -05:00
Ishaan Bhardwaj
905e4bcc77 drawSectionTimesWithSecondary update 2020-12-01 11:56:44 -05:00
Ishaan Bhardwaj
d956647678 Core mode rebalancing 2020-12-01 11:56:28 -05:00
Ishaan Bhardwaj
10f032b49b Added more functionality to advanceOneFrame 2020-11-30 12:34:21 -05:00
Ishaan Bhardwaj
5590e6c89b Small DAS changes 2020-11-29 11:11:47 -05:00
Joe Z
0393396d74 Made instant DAS respect instant gravity. 2020-11-29 09:19:17 -05:00
Joe Zeng
8c1eaec1aa DAS priority reversal (#25)
* Reversed the priority of key presses when charging DAS.
* Made it an actual config option.
* Config should be false by default.
2020-11-28 23:29:46 -05:00
Ishaan Bhardwaj
957802a78e Fixed a minor bug in the scope of SA2's line 2020-11-27 23:21:59 -05:00
Ishaan Bhardwaj
169a4e4d2f AX4 no longer shows timer in the roll 2020-11-22 10:39:42 -05:00
Ishaan Bhardwaj
48aee18340 Fix I wallkicks in ARS rules 2020-11-21 23:29:06 -05:00
Ishaan Bhardwaj
7b496d9412 Ti and ACE floorkick fix 2020-11-21 21:48:45 -05:00
Ishaan Bhardwaj
7abb861446 Hard drop can ARE cancel now 2020-11-21 16:29:24 -05:00
Ishaan Bhardwaj
21f8769228 Made ARE canceling also cancel LCD 2020-11-20 11:29:46 -05:00
Ishaan Bhardwaj
44423fd2e8 Made ARE canceling less slippery (again) 2020-11-19 22:22:43 -05:00
13 changed files with 163 additions and 52 deletions

View File

@@ -12,6 +12,7 @@ function love.load()
config["side_next"] = false config["side_next"] = false
config["reverse_rotate"] = true config["reverse_rotate"] = true
config["fullscreen"] = false config["fullscreen"] = false
config["das_last_key"] = false
love.window.setMode(love.graphics.getWidth(), love.graphics.getHeight(), {resizable = true}); love.window.setMode(love.graphics.getWidth(), love.graphics.getHeight(), {resizable = true});

View File

@@ -9,6 +9,7 @@ ConfigScene.options = {
{"manlock", "Manual locking",{"Per ruleset","Per gamemode","Harddrop", "Softdrop"}}, {"manlock", "Manual locking",{"Per ruleset","Per gamemode","Harddrop", "Softdrop"}},
{"piece_colour", "Piece Colours", {"Per ruleset","Arika" ,"TTC"}}, {"piece_colour", "Piece Colours", {"Per ruleset","Arika" ,"TTC"}},
{"world_reverse","A Button Rotation", {"Left" ,"Auto" ,"Right"}}, {"world_reverse","A Button Rotation", {"Left" ,"Auto" ,"Right"}},
{"das_last_key", "DAS Switch", {"Default", "Instant"}}
} }
local optioncount = #ConfigScene.options local optioncount = #ConfigScene.options
@@ -24,6 +25,7 @@ function ConfigScene:new()
end end
function ConfigScene:update() function ConfigScene:update()
config["das_last_key"] = config.gamesettings.das_last_key == 2
end end
function ConfigScene:render() function ConfigScene:render()

View File

@@ -32,6 +32,7 @@ function ConfigScene:new()
self.input_state = 1 self.input_state = 1
self.set_inputs = newSetInputs() self.set_inputs = newSetInputs()
self.new_input = {} self.new_input = {}
self.axis_timer = 0
DiscordRPC:update({ DiscordRPC:update({
details = "In menus", details = "In menus",
@@ -63,6 +64,8 @@ function ConfigScene:render()
love.graphics.print("press key or joystick input for " .. configurable_inputs[self.input_state] .. ", tab to skip" .. (config.input and ", escape to cancel" or ""), 0, 0) love.graphics.print("press key or joystick input for " .. configurable_inputs[self.input_state] .. ", tab to skip" .. (config.input and ", escape to cancel" or ""), 0, 0)
love.graphics.print("function keys (F1, F2, etc.), escape, and tab can't be changed", 0, 20) love.graphics.print("function keys (F1, F2, etc.), escape, and tab can't be changed", 0, 20)
end end
self.axis_timer = self.axis_timer + 1
end end
local function addJoystick(input, name) local function addJoystick(input, name)
@@ -118,7 +121,7 @@ function ConfigScene:onInputPress(e)
self.new_input.joysticks[e.name].buttons[e.button] = configurable_inputs[self.input_state] self.new_input.joysticks[e.name].buttons[e.button] = configurable_inputs[self.input_state]
self.input_state = self.input_state + 1 self.input_state = self.input_state + 1
elseif e.type == "joyaxis" then elseif e.type == "joyaxis" then
if math.abs(e.value) >= 0.5 then if (e.axis ~= self.last_axis or self.axis_timer > 30) and math.abs(e.value) >= 1 then
addJoystick(self.new_input, e.name) addJoystick(self.new_input, e.name)
if not self.new_input.joysticks[e.name].axes then if not self.new_input.joysticks[e.name].axes then
self.new_input.joysticks[e.name].axes = {} self.new_input.joysticks[e.name].axes = {}
@@ -128,10 +131,12 @@ function ConfigScene:onInputPress(e)
end end
self.set_inputs[configurable_inputs[self.input_state]] = self.set_inputs[configurable_inputs[self.input_state]] =
"jaxis " .. "jaxis " ..
(e.value >= 0.5 and "+" or "-") .. e.axis .. (e.value >= 1 and "+" or "-") .. e.axis ..
" " .. string.sub(e.name, 1, 10) .. (string.len(e.name) > 10 and "..." or "") " " .. string.sub(e.name, 1, 10) .. (string.len(e.name) > 10 and "..." or "")
self.new_input.joysticks[e.name].axes[e.axis][e.value >= 0.5 and "positive" or "negative"] = configurable_inputs[self.input_state] self.new_input.joysticks[e.name].axes[e.axis][e.value >= 1 and "positive" or "negative"] = configurable_inputs[self.input_state]
self.input_state = self.input_state + 1 self.input_state = self.input_state + 1
self.last_axis = e.axis
self.axis_timer = 0
end end
elseif e.type == "joyhat" then elseif e.type == "joyhat" then
if e.direction ~= "c" then if e.direction ~= "c" then

View File

@@ -78,12 +78,15 @@ function Piece:setRelativeRotation(rot)
return self return self
end end
function Piece:moveInGrid(step, squares, grid) function Piece:moveInGrid(step, squares, grid, instant)
local moved = false local moved = false
for x = 1, squares do for x = 1, squares do
if grid:canPlacePiece(self:withOffset(step)) then if grid:canPlacePiece(self:withOffset(step)) then
moved = true moved = true
self:setOffset(step) self:setOffset(step)
if instant then
self:dropToBottom(grid)
end
else else
break break
end end

View File

@@ -96,10 +96,20 @@ function GameMode:update(inputs, ruleset)
if self.completed then return end if self.completed then return end
-- advance one frame -- advance one frame
if self:advanceOneFrame(inputs) == false then return end if self:advanceOneFrame(inputs, ruleset) == false then return end
self:chargeDAS(inputs, self:getDasLimit(), self.getARR()) self:chargeDAS(inputs, self:getDasLimit(), self.getARR())
-- set attempt flags
if inputs["left"] or inputs["right"] then self:onAttemptPieceMove(self.piece) end
if
inputs["rotate_left"] or inputs["rotate_right"] or
inputs["rotate_left2"] or inputs["rotate_right2"] or
inputs["rotate_180"]
then
self:onAttemptPieceRotate(self.piece)
end
if self.piece == nil then if self.piece == nil then
self:processDelays(inputs, ruleset) self:processDelays(inputs, ruleset)
else else
@@ -200,6 +210,8 @@ end
-- event functions -- event functions
function GameMode:whilePieceActive() end function GameMode:whilePieceActive() end
function GameMode:onAttemptPieceMove(piece) end
function GameMode:onAttemptPieceRotate(piece) end
function GameMode:onPieceLock(piece, cleared_row_count) function GameMode:onPieceLock(piece, cleared_row_count)
playSE("lock") playSE("lock")
end end
@@ -223,8 +235,25 @@ function GameMode:onGameOver()
switchBGM(nil) switchBGM(nil)
end end
function GameMode:chargeDAS(inputs) -- DAS functions
if inputs[self.das.direction] == true then
function GameMode:startRightDAS()
self.move = "right"
self.das = { direction = "right", frames = 0 }
if self:getDasLimit() == 0 then
self:continueDAS()
end
end
function GameMode:startLeftDAS()
self.move = "left"
self.das = { direction = "left", frames = 0 }
if self:getDasLimit() == 0 then
self:continueDAS()
end
end
function GameMode:continueDAS()
local das_frames = self.das.frames + 1 local das_frames = self.das.frames + 1
if das_frames >= self:getDasLimit() then if das_frames >= self:getDasLimit() then
if self.das.direction == "left" then if self.das.direction == "left" then
@@ -238,15 +267,34 @@ function GameMode:chargeDAS(inputs)
self.move = "none" self.move = "none"
self.das.frames = das_frames self.das.frames = das_frames
end end
elseif inputs["right"] == true then end
self.move = "right"
self.das = { direction = "right", frames = 0 } function GameMode:stopDAS()
elseif inputs["left"] == true then
self.move = "left"
self.das = { direction = "left", frames = 0 }
else
self.move = "none" self.move = "none"
self.das = { direction = "none", frames = -1 } self.das = { direction = "none", frames = -1 }
end
function GameMode:chargeDAS(inputs)
if config["das_last_key"] then
if inputs["right"] == true and self.das.direction ~= "right" and not self.prev_inputs["right"] then
self:startRightDAS()
elseif inputs["left"] == true and self.das.direction ~= "left" and not self.prev_inputs["left"] then
self:startLeftDAS()
elseif inputs[self.das.direction] == true then
self:continueDAS()
else
self:stopDAS()
end
else -- default behaviour, das first key pressed
if inputs[self.das.direction] == true then
self:continueDAS()
elseif inputs["right"] == true then
self:startRightDAS()
elseif inputs["left"] == true then
self:startLeftDAS()
else
self:stopDAS()
end
end end
end end
@@ -270,6 +318,18 @@ function GameMode:processDelays(inputs, ruleset, drop_speed)
end end
elseif self.lcd > 0 then elseif self.lcd > 0 then
self.lcd = self.lcd - 1 self.lcd = self.lcd - 1
if ruleset.are_cancel and
(self.move == "none" and not self.prev_inputs["up"] and
not self.prev_inputs["rotate_left"] and not self.prev_inputs["rotate_left2"] and
not self.prev_inputs["rotate_right"] and not self.prev_inputs["rotate_right2"] and
not self.prev_inputs["rotate_180"]) and
(inputs["left"] or inputs["right"] or inputs["up"] or
inputs["rotate_left"] or inputs["rotate_left2"] or
inputs["rotate_right"] or inputs["rotate_right2"] or
inputs["rotate_180"]) then
self.lcd = 0
self.are = 0
end
if self.lcd == 0 then if self.lcd == 0 then
self.grid:clearClearedRows() self.grid:clearClearedRows()
playSE("fall") playSE("fall")
@@ -280,7 +340,11 @@ function GameMode:processDelays(inputs, ruleset, drop_speed)
elseif self.are > 0 then elseif self.are > 0 then
self.are = self.are - 1 self.are = self.are - 1
if ruleset.are_cancel and if ruleset.are_cancel and
(inputs["left"] or inputs["right"] or (self.move == "none" and not self.prev_inputs["up"] and
not self.prev_inputs["rotate_left"] and not self.prev_inputs["rotate_left2"] and
not self.prev_inputs["rotate_right"] and not self.prev_inputs["rotate_right2"] and
not self.prev_inputs["rotate_180"]) and
(inputs["left"] or inputs["right"] or inputs["up"] or
inputs["rotate_left"] or inputs["rotate_left2"] or inputs["rotate_left"] or inputs["rotate_left2"] or
inputs["rotate_right"] or inputs["rotate_right2"] or inputs["rotate_right"] or inputs["rotate_right2"] or
inputs["rotate_180"]) then inputs["rotate_180"]) then
@@ -398,7 +462,7 @@ function GameMode:drawNextQueue(ruleset)
drawPiece(next_piece, skin, ruleset.block_offsets[next_piece][rotation], -16+i*80, -32) drawPiece(next_piece, skin, ruleset.block_offsets[next_piece][rotation], -16+i*80, -32)
end end
end end
if self.hold_queue ~= nil then if self.hold_queue ~= nil and self.enable_hold then
local hold_color = self.held and 0.6 or 1 local hold_color = self.held and 0.6 or 1
self:setHoldOpacity(1, hold_color) self:setHoldOpacity(1, hold_color)
drawPiece( drawPiece(
@@ -455,7 +519,7 @@ function GameMode:drawSectionTimes(current_section)
love.graphics.printf(formatTime(self.frames - self.section_start_time), section_x, 40 + 20 * current_section, 90, "left") love.graphics.printf(formatTime(self.frames - self.section_start_time), section_x, 40 + 20 * current_section, 90, "left")
end end
function GameMode:drawSectionTimesWithSecondary(current_section) function GameMode:drawSectionTimesWithSecondary(current_section, section_colour_function)
local section_x = 530 local section_x = 530
local section_secondary_x = 440 local section_secondary_x = 440
@@ -466,6 +530,9 @@ function GameMode:drawSectionTimesWithSecondary(current_section)
end end
for section, time in pairs(self.secondary_section_times) do for section, time in pairs(self.secondary_section_times) do
if self.section_colour_function then
love.graphics.setColor(self:section_colour_function(section))
end
if section > 0 then if section > 0 then
love.graphics.printf(formatTime(time), section_secondary_x, 40 + 20 * section, 90, "left") love.graphics.printf(formatTime(time), section_secondary_x, 40 + 20 * section, 90, "left")
end end

View File

@@ -327,10 +327,10 @@ function Marathon2020Game:checkClear(level)
end end
function Marathon2020Game:updateSectionTimes(old_level, new_level) function Marathon2020Game:updateSectionTimes(old_level, new_level)
function sectionCool() function sectionCool(section)
self.section_cool_count = self.section_cool_count + 1 self.section_cool_count = self.section_cool_count + 1
self.delay_level = math.min(20, self.delay_level + 1) self.delay_level = math.min(20, self.delay_level + 1)
table.insert(self.section_status, "cool") if section < 10 then table.insert(self.section_status, "cool") end
self.cool_timer = 300 self.cool_timer = 300
end end
@@ -348,7 +348,7 @@ function Marathon2020Game:updateSectionTimes(old_level, new_level)
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 > 4 then self.delay_level = math.min(20, self.delay_level + 1) end if section > 5 then self.delay_level = math.min(20, self.delay_level + 1) end
self:checkTorikan(section) self:checkTorikan(section)
self:checkClear(new_level) self:checkClear(new_level)
@@ -357,11 +357,11 @@ function Marathon2020Game:updateSectionTimes(old_level, new_level)
self.secondary_section_times[section] < self.secondary_section_times[section - 1] + 120 and self.secondary_section_times[section] < self.secondary_section_times[section - 1] + 120 and
self.secondary_section_times[section] < cool_cutoffs[section] self.secondary_section_times[section] < cool_cutoffs[section]
) then ) then
sectionCool() sectionCool(section)
elseif self.section_status[section - 1] == "cool" then elseif self.section_status[section - 1] == "cool" then
table.insert(self.section_status, "none") table.insert(self.section_status, "none")
elseif section <= 19 and self.secondary_section_times[section] < cool_cutoffs[section] then elseif section <= 19 and self.secondary_section_times[section] < cool_cutoffs[section] then
sectionCool() sectionCool(section)
else else
table.insert(self.section_status, "none") table.insert(self.section_status, "none")
end end
@@ -423,6 +423,14 @@ function Marathon2020Game:drawGrid()
end end
end end
function Marathon2020Game:sectionColourFunction(section)
if self.section_status[section] == "cool" then
return { 0, 1, 0, 1 }
else
return { 1, 1, 1, 1 }
end
end
function Marathon2020Game:drawScoringInfo() function Marathon2020Game:drawScoringInfo()
Marathon2020Game.super.drawScoringInfo(self) Marathon2020Game.super.drawScoringInfo(self)
@@ -434,7 +442,7 @@ function Marathon2020Game:drawScoringInfo()
love.graphics.printf("GRADE PTS.", text_x, 200, 90, "left") love.graphics.printf("GRADE PTS.", text_x, 200, 90, "left")
love.graphics.printf("LEVEL", text_x, 320, 40, "left") love.graphics.printf("LEVEL", text_x, 320, 40, "left")
self:drawSectionTimesWithSecondary(current_section) self:drawSectionTimesWithSecondary(current_section, self.sectionColourFunction)
if (self.cool_timer > 0) then if (self.cool_timer > 0) then
love.graphics.printf("COOL!!", 64, 400, 160, "center") love.graphics.printf("COOL!!", 64, 400, 160, "center")

View File

@@ -146,7 +146,7 @@ function MarathonAX4Game:drawScoringInfo()
strTrueValues(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") if self.lines < 150 then love.graphics.printf("TIME LEFT", 240, 250, 80, "left") end
love.graphics.printf("LINES", 240, 320, 40, "left") love.graphics.printf("LINES", 240, 320, 40, "left")
local current_section = math.floor(self.lines / 10) + 1 local current_section = math.floor(self.lines / 10) + 1
@@ -161,7 +161,7 @@ function MarathonAX4Game:drawScoringInfo()
if not self.game_over and not self.clear and time_left < frameTime(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") if self.lines < 150 then love.graphics.printf(formatTime(time_left), 240, 270, 160, "left") end
love.graphics.setColor(1, 1, 1, 1) love.graphics.setColor(1, 1, 1, 1)
end end

View File

@@ -255,7 +255,7 @@ PhantomMania2Game.garbageOpacityFunction = function(age)
end end
function PhantomMania2Game:drawGrid() function PhantomMania2Game:drawGrid()
if not (self.game_over or (self.clear and self.level < 1300)) then if not (self.game_over) then
self.grid:drawInvisible(self.rollOpacityFunction, self.garbageOpacityFunction) self.grid:drawInvisible(self.rollOpacityFunction, self.garbageOpacityFunction)
else else
self.grid:draw() self.grid:draw()

View File

@@ -161,6 +161,7 @@ function SurvivalA2Game:drawScoringInfo()
if self.roll_frames > 2968 then love.graphics.setColor(1, 0.5, 0, 1) if self.roll_frames > 2968 then love.graphics.setColor(1, 0.5, 0, 1)
elseif self.clear then love.graphics.setColor(0, 1, 0, 1) end elseif self.clear then love.graphics.setColor(0, 1, 0, 1) end
if self:getLetterGrade() ~= "" then love.graphics.printf(self:getLetterGrade(), text_x, 140, 90, "left") end if self:getLetterGrade() ~= "" then love.graphics.printf(self:getLetterGrade(), text_x, 140, 90, "left") end
love.graphics.setColor(1, 1, 1, 1)
love.graphics.printf(self.level, text_x, 340, 40, "right") love.graphics.printf(self.level, text_x, 340, 40, "right")
love.graphics.printf(self:getSectionEndLevel(), text_x, 370, 40, "right") love.graphics.printf(self:getSectionEndLevel(), text_x, 370, 40, "right")
if sg >= 5 then if sg >= 5 then

View File

@@ -113,7 +113,8 @@ function ARS:attemptWallkicks(piece, new_piece, rot_dir, grid)
if piece.shape == "I" then if piece.shape == "I" then
-- special kick rules for I -- special kick rules for I
if new_piece.rotation == 0 or new_piece.rotation == 2 then if new_piece.rotation == 0 or new_piece.rotation == 2 and
(piece:isMoveBlocked(grid, {x=-1, y=0}) or piece:isMoveBlocked(grid, {x=1, y=0})) then
-- kick right, right2, left -- kick right, right2, left
if grid:canPlacePiece(new_piece:withOffset({x=1, y=0})) then if grid:canPlacePiece(new_piece:withOffset({x=1, y=0})) then
piece:setRelativeRotation(rot_dir):setOffset({x=1, y=0}) piece:setRelativeRotation(rot_dir):setOffset({x=1, y=0})
@@ -163,13 +164,16 @@ end
function ARS:onPieceDrop(piece, grid) function ARS:onPieceDrop(piece, grid)
piece.lock_delay = 0 -- step reset piece.lock_delay = 0 -- step reset
if piece.floorkick >= 2 and piece:isDropBlocked(grid) then
piece.locked = true
end
end end
function ARS:onPieceMove(piece, grid) function ARS:onPieceMove(piece, grid)
piece.lock_delay = 0 -- move reset piece.lock_delay = 0 -- move reset
if piece:isDropBlocked(grid) then if piece:isDropBlocked(grid) then
piece.manipulations = piece.manipulations + 1 piece.manipulations = piece.manipulations + 1
if piece.manipulations >= 127 then if piece.manipulations >= 128 then
piece.locked = true piece.locked = true
end end
end end
@@ -179,10 +183,13 @@ function ARS:onPieceRotate(piece, grid)
piece.lock_delay = 0 -- rotate reset piece.lock_delay = 0 -- rotate reset
if piece:isDropBlocked(grid) then if piece:isDropBlocked(grid) then
piece.manipulations = piece.manipulations + 1 piece.manipulations = piece.manipulations + 1
if piece.manipulations >= 127 then if piece.manipulations >= 128 then
piece.locked = true piece.locked = true
end end
end end
if piece.floorkick >= 1 then
piece.floorkick = piece.floorkick + 1
end
end end
function ARS:get180RotationValue() function ARS:get180RotationValue()

View File

@@ -100,7 +100,8 @@ function ARS:attemptWallkicks(piece, new_piece, rot_dir, grid)
if piece.shape == "I" then if piece.shape == "I" then
-- special kick rules for I -- special kick rules for I
if new_piece.rotation == 0 or new_piece.rotation == 2 then if new_piece.rotation == 0 or new_piece.rotation == 2 and
(piece:isMoveBlocked(grid, {x=-1, y=0}) or piece:isMoveBlocked(grid, {x=1, y=0})) then
-- kick right, right2, left -- kick right, right2, left
if grid:canPlacePiece(new_piece:withOffset({x=1, y=0})) then if grid:canPlacePiece(new_piece:withOffset({x=1, y=0})) then
piece:setRelativeRotation(rot_dir):setOffset({x=1, y=0}) piece:setRelativeRotation(rot_dir):setOffset({x=1, y=0})
@@ -150,13 +151,16 @@ end
function ARS:onPieceDrop(piece, grid) function ARS:onPieceDrop(piece, grid)
piece.lock_delay = 0 -- step reset piece.lock_delay = 0 -- step reset
if piece.floorkick >= 2 and piece:isDropBlocked(grid) then
piece.locked = true
end
end end
function ARS:onPieceMove(piece, grid) function ARS:onPieceMove(piece, grid)
piece.lock_delay = 0 -- move reset piece.lock_delay = 0 -- move reset
if piece:isDropBlocked(grid) then if piece:isDropBlocked(grid) then
piece.manipulations = piece.manipulations + 1 piece.manipulations = piece.manipulations + 1
if piece.manipulations >= 127 then if piece.manipulations >= 128 then
piece.locked = true piece.locked = true
end end
end end
@@ -166,10 +170,13 @@ function ARS:onPieceRotate(piece, grid)
piece.lock_delay = 0 -- rotate reset piece.lock_delay = 0 -- rotate reset
if piece:isDropBlocked(grid) then if piece:isDropBlocked(grid) then
piece.manipulations = piece.manipulations + 1 piece.manipulations = piece.manipulations + 1
if piece.manipulations >= 127 then if piece.manipulations >= 128 then
piece.locked = true piece.locked = true
end end
end end
if piece.floorkick >= 1 then
piece.floorkick = piece.floorkick + 1
end
end end
function ARS:get180RotationValue() function ARS:get180RotationValue()

View File

@@ -100,7 +100,8 @@ function ARS:attemptWallkicks(piece, new_piece, rot_dir, grid)
if piece.shape == "I" then if piece.shape == "I" then
-- special kick rules for I -- special kick rules for I
if new_piece.rotation == 0 or new_piece.rotation == 2 then if (new_piece.rotation == 0 or new_piece.rotation == 2) and
(piece:isMoveBlocked(grid, {x=-1, y=0}) or piece:isMoveBlocked(grid, {x=1, y=0})) then
-- kick right, right2, left -- kick right, right2, left
if grid:canPlacePiece(new_piece:withOffset({x=1, y=0})) then if grid:canPlacePiece(new_piece:withOffset({x=1, y=0})) then
piece:setRelativeRotation(rot_dir):setOffset({x=1, y=0}) piece:setRelativeRotation(rot_dir):setOffset({x=1, y=0})
@@ -149,6 +150,15 @@ end
function ARS:onPieceDrop(piece, grid) function ARS:onPieceDrop(piece, grid)
piece.lock_delay = 0 -- step reset piece.lock_delay = 0 -- step reset
if piece.floorkick >= 2 and piece:isDropBlocked(grid) then
piece.locked = true
end
end
function ARS:onPieceRotate(piece, grid)
if piece.floorkick >= 1 then
piece.floorkick = piece.floorkick + 1
end
end end
function ARS:get180RotationValue() function ARS:get180RotationValue()

View File

@@ -128,16 +128,16 @@ function Ruleset:attemptWallkicks(piece, new_piece, rot_dir, grid)
-- do nothing in default ruleset -- do nothing in default ruleset
end end
function Ruleset:movePiece(piece, grid, move) function Ruleset:movePiece(piece, grid, move, instant)
local x = piece.position.x local x = piece.position.x
if move == "left" then if move == "left" then
piece:moveInGrid({x=-1, y=0}, 1, grid) piece:moveInGrid({x=-1, y=0}, 1, grid, false)
elseif move == "speedleft" then
piece:moveInGrid({x=-1, y=0}, 10, grid)
elseif move == "right" then elseif move == "right" then
piece:moveInGrid({x=1, y=0}, 1, grid) piece:moveInGrid({x=1, y=0}, 1, grid, false)
elseif move == "speedleft" then
piece:moveInGrid({x=-1, y=0}, 10, grid, instant)
elseif move == "speedright" then elseif move == "speedright" then
piece:moveInGrid({x=1, y=0}, 10, grid) piece:moveInGrid({x=1, y=0}, 10, grid, instant)
end end
if piece.position.x ~= x then if piece.position.x ~= x then
self:onPieceMove(piece, grid) self:onPieceMove(piece, grid)
@@ -212,7 +212,7 @@ function Ruleset:processPiece(
hard_drop_enabled, additive_gravity hard_drop_enabled, additive_gravity
) )
self:rotatePiece(inputs, piece, grid, prev_inputs, false) self:rotatePiece(inputs, piece, grid, prev_inputs, false)
self:movePiece(piece, grid, move) self:movePiece(piece, grid, move, gravity >= 20)
self:dropPiece( self:dropPiece(
inputs, piece, grid, gravity, drop_speed, drop_locked, hard_drop_locked, inputs, piece, grid, gravity, drop_speed, drop_locked, hard_drop_locked,
hard_drop_enabled, additive_gravity hard_drop_enabled, additive_gravity