Improve Tech Finesse Lock and add some other minor things (#950)

* Fix VK and overhang detection in Tech Finesse Lock

* Make Tech Finesse Lock overhang logic more lenient

* Add finesse kill to Tech Finesse Lock
(at this point if you still make a finesse error even after getting limited inputs then you have a huge skill issue)

* Disable O rotation in Tech Finesse Lock if no O-spin
+ Added RS name (RS.name, P.RS.name)
+ Added hook_spawn and hook_hold

* Update Zframework

* Fix weird backfire location
This commit is contained in:
NOT_A_ROBOT
2023-09-19 00:15:16 +07:00
committed by GitHub
parent 337293dbe1
commit 009858e2f8
6 changed files with 205 additions and 29 deletions

View File

@@ -1055,7 +1055,8 @@ local RSlist={
None_plus=None_plus, None_plus=None_plus,
} }
for _,rs in next,RSlist do for name,rs in next,RSlist do
rs.name=name
if not rs.centerDisp then rs.centerDisp=TABLE.new(true,29) end if not rs.centerDisp then rs.centerDisp=TABLE.new(true,29) end
if not rs.centerPos then rs.centerPos=defaultCenterPos end if not rs.centerPos then rs.centerPos=defaultCenterPos end
if not rs.centerTex then rs.centerTex=defaultCenterTex end if not rs.centerTex then rs.centerTex=defaultCenterTex end

View File

@@ -1,40 +1,69 @@
local function onMove(P) local function lockKey(P,keys)
if not P.cur then return end for _,v in next,keys do
P.holdTime=0 P.keyAvailable[v]=false
VK.keys[8].ava=false VK.keys[v].ava=false
P.modeData.moveCount=P.modeData.moveCount+1 VK.release(v)
if P.modeData.moveCount>=2 and (P.curY>P.gameEnv.fieldH-2 or P:_roofCheck()) then
P.keyAvailable[1]=false
P.keyAvailable[2]=false
VK.keys[1].ava=false
VK.keys[2].ava=false
end end
end end
local function onRotate(P) local function unlockKey(P,keys)
if not P.cur then return end for _,v in next,keys do
P.holdTime=0 P.keyAvailable[v]=true
VK.keys[8].ava=false VK.keys[v].ava=true
P.modeData.rotations=P.modeData.rotations+1
if P.modeData.rotations>=2 and not (P.curY>P.gameEnv.fieldH-2 or P:_roofCheck()) then
P.keyAvailable[3]=false
P.keyAvailable[4]=false
P.keyAvailable[5]=false
VK.keys[3].ava=false
VK.keys[4].ava=false
VK.keys[5].ava=false
end end
end end
local function lockMovement(P)
lockKey(P,{1,2})
end
local function lockRotation(P)
lockKey(P,{3,4,5})
end
local function unlock(P)
if P.cur and P.cur.name==6 and not P.gameEnv.skipOCheck then -- don't unlock rotation if O piece & no O-spin
unlockKey(P,{1,2,6,7})
return
end
unlockKey(P,{1,2,3,4,5,6,7})
end
local function resetLock(P) local function resetLock(P)
for i=1,8 do unlock(P)
P.keyAvailable[i]=true unlockKey(P,{8})
VK.keys[i].ava=true
end
P.modeData.moveCount=0 P.modeData.moveCount=0
P.modeData.rotations=0 P.modeData.rotations=0
P.holdTime=1 P.holdTime=1
end end
local function onMove(P)
if not P.cur then return end
P.holdTime=0
lockKey(P,{8})
-- return if overhang
if P:_roofCheck() then return end
P.modeData.moveCount=P.modeData.moveCount+1
if P.modeData.moveCount>=2 then lockMovement(P) end
end
local function onAutoMove(P)
if P:_roofCheck() then unlock(P) end
end
local function onRotate(P)
if not P.cur then return end
P.holdTime=0
lockKey(P,{8})
-- return if overhang
if P:_roofCheck() then return end
P.modeData.rotations=P.modeData.rotations+1
if P.modeData.rotations>=2 then lockRotation(P) end
end
return { return {
arr=0, arr=0,
fineKill=true,
mesDisp=function(P) mesDisp=function(P)
setFont(45) setFont(45)
GC.mStr(("%d"):format(P.stat.atk),63,190) GC.mStr(("%d"):format(P.stat.atk),63,190)
@@ -44,6 +73,12 @@ return {
end, end,
task=function(P) task=function(P)
resetLock(P) resetLock(P)
local RSname=P.RS.name
P.gameEnv.skipOCheck=(
string.find(RSname,'TRS') or
string.find(RSname,'BiRS') or
string.find(RSname,'ASC')
)
end, end,
hook_drop=function(P) hook_drop=function(P)
resetLock(P) resetLock(P)
@@ -51,6 +86,23 @@ return {
P:win('finish') P:win('finish')
end end
end, end,
hook_spawn=function(P)
if P.gameEnv.skipOCheck then return end
if P.cur.name==6 then
lockRotation(P)
else
resetLock(P)
end
end,
hook_hold=function(P)
if P.gameEnv.skipOCheck then return end
if P.cur.name==6 then
lockRotation(P)
else
resetLock(P)
end
end,
hook_left_manual=onMove, hook_right_manual=onMove, hook_left_manual=onMove, hook_right_manual=onMove,
hook_rotLeft=onRotate, hook_rotRight=onRotate, hook_rot180=onRotate hook_left_auto=onAutoMove, hook_right_auto=onAutoMove,
hook_rotLeft=onRotate, hook_rotRight=onRotate, hook_rot180=onRotate,
} }

View File

@@ -0,0 +1,116 @@
local function lockKey(P,keys)
for _,v in next,keys do
P.keyAvailable[v]=false
VK.keys[v].ava=false
VK.release(v)
end
end
local function unlockKey(P,keys)
for _,v in next,keys do
P.keyAvailable[v]=true
VK.keys[v].ava=true
end
end
local function lockMovement(P)
lockKey(P,{1,2})
end
local function lockRotation(P)
lockKey(P,{3,4,5})
end
local function unlock(P)
if P.cur and P.cur.name==6 and not P.gameEnv.skipOCheck then -- don't unlock rotation if O piece & no O-spin
unlockKey(P,{1,2,6,7})
return
end
unlockKey(P,{1,2,3,4,5,6,7})
end
local function resetLock(P)
unlock(P)
unlockKey(P,{8})
P.modeData.moveCount=0
P.modeData.rotations=0
P.holdTime=1
end
local function onMove(P)
if not P.cur then return end
P.holdTime=0
lockKey(P,{8})
-- return if overhang
if P:_roofCheck() then return end
P.modeData.moveCount=P.modeData.moveCount+1
if P.modeData.moveCount>=2 then lockMovement(P) end
end
local function onAutoMove(P)
if P:_roofCheck() then unlock(P) end
end
local function onRotate(P)
if not P.cur then return end
P.holdTime=0
lockKey(P,{8})
-- return if overhang
if P:_roofCheck() then return end
P.modeData.rotations=P.modeData.rotations+1
if P.modeData.rotations>=2 then lockRotation(P) end
end
return {
arr=0,
fineKill=true,
mesDisp=function(P)
setFont(45)
GC.mStr(("%d"):format(P.stat.atk),63,190)
GC.mStr(("%.2f"):format(P.stat.atk/P.stat.row),63,310)
mText(TEXTOBJ.atk,63,243)
mText(TEXTOBJ.eff,63,363)
end,
task=function(P)
resetLock(P)
local RSname=P.RS.name
P.gameEnv.skipOCheck=(
string.find(RSname,'TRS') or
string.find(RSname,'BiRS') or
string.find(RSname,'ASC')
)
end,
hook_drop=function(P)
resetLock(P)
local C=P.lastPiece
if C.row>0 then
if not C.special then
P:lose()
return
end
end
if P.stat.atk>=100 then
P:win('finish')
end
end,
hook_spawn=function(P)
if P.gameEnv.skipOCheck then return end
if P.cur.name==6 then
lockRotation(P)
else
resetLock(P)
end
end,
hook_hold=function(P)
if P.gameEnv.skipOCheck then return end
if P.cur.name==6 then
lockRotation(P)
else
resetLock(P)
end
end,
hook_left_manual=onMove, hook_right_manual=onMove,
hook_left_auto=onAutoMove, hook_right_auto=onAutoMove,
hook_rotLeft=onRotate, hook_rotRight=onRotate, hook_rot180=onRotate
}

View File

@@ -5,7 +5,7 @@ return {
b2bKill=true, b2bKill=true,
freshLimit=15, freshLimit=15,
bg='flink',bgm='infinite', bg='flink',bgm='infinite',
eventSet='tech_finesse_lock', eventSet='tech_finesse_lock_f',
}, },
slowMark=true, slowMark=true,
score=function(P) return {P.stat.atk<=100 and math.floor(P.stat.atk) or 100,P.stat.time} end, score=function(P) return {P.stat.atk<=100 and math.floor(P.stat.atk) or 100,P.stat.time} end,

View File

@@ -254,6 +254,8 @@ local hooks = {
'hook_rotRight', 'hook_rotRight',
'hook_rot180', 'hook_rot180',
'hook_drop', 'hook_drop',
'hook_spawn',
'hook_hold',
'hook_die', 'hook_die',
'task' 'task'
} }

View File

@@ -345,6 +345,7 @@ function Player:act_hold()
if self.cur then if self.cur then
if self:hold() then if self:hold() then
self.keyPressing[8]=false self.keyPressing[8]=false
self:_triggerEvent('hook_hold')
end end
end end
end end
@@ -382,6 +383,7 @@ function Player:act_insLeft(auto)
else else
self.ctrlCount=self.ctrlCount+1 self.ctrlCount=self.ctrlCount+1
end end
if auto then self:_triggerEvent('hook_left_auto') end
end end
function Player:act_insRight(auto) function Player:act_insRight(auto)
if not self.control then return end if not self.control then return end
@@ -408,6 +410,7 @@ function Player:act_insRight(auto)
else else
self.ctrlCount=self.ctrlCount+1 self.ctrlCount=self.ctrlCount+1
end end
if auto then self:_triggerEvent('hook_right_auto') end
end end
function Player:act_insDown() function Player:act_insDown()
if not self.control then return end if not self.control then return end
@@ -1495,7 +1498,9 @@ function Player:popNext(ifhold)-- Pop nextQueue to hand
self:hold(true,true) self:hold(true,true)
else-- Next queue is empty, force lose else-- Next queue is empty, force lose
self:lose(true) self:lose(true)
return
end end
self:_triggerEvent('hook_spawn')
end end
function Player:willDieWith(B) function Player:willDieWith(B)
return B and self:ifoverlap(B.bk,self:getSpawnX(B),self:getSpawnY(B)) return B and self:ifoverlap(B.bk,self:getSpawnX(B),self:getSpawnY(B))