新增物理hold

This commit is contained in:
MrZ626
2021-03-06 17:24:27 +08:00
parent 4567f19885
commit ae3338dc20
11 changed files with 53 additions and 17 deletions

View File

@@ -160,6 +160,7 @@ CUSTOMENV={--gameEnv for cutsom game
nextCount=6,
holdCount=1,
infHold=false,
phyHold=false,
--Visual
bone=false,

View File

@@ -424,6 +424,7 @@ return{
nextCount="Next",
holdCount="Hold",
infHold="Infinite Hold",
phyHold="Physical Hold",
bone="Bone Blocks",
mindas="Min. DAS",

View File

@@ -400,6 +400,7 @@ return{
nextCount="Prévisualisations de pièces",
holdCount="Réserve",
infHold="Réserver une fois",
-- phyHold="Physical Hold",
bone="Crochets",
mindas="DAS minimum",

View File

@@ -424,6 +424,7 @@ return{
nextCount="Prox.",
holdCount="Segurar",
infHold="Segurar Infinito",
-- phyHold="Physical Hold",
bone="Bone Blocks",
mindas="Min. DAS",

View File

@@ -400,6 +400,7 @@ return{
nextCount="Siguiente",
holdCount="Reserva",
-- infHold="Hold Único",
-- phyHold="Physical Hold",
bone="Bone Block",
mindas="DAS Mínimo",

View File

@@ -281,6 +281,7 @@ return{
nextCount="",
holdCount="[ ]",
infHold="∞*[ ]",
phyHold="P-[ ]",
bone="[]",
mindas="mDAS",

View File

@@ -424,6 +424,7 @@ return{
nextCount="Next",
holdCount="Hold",
infHold="无限Hold",
phyHold="物理Hold",
bone="骨块",
mindas="最小DAS",

View File

@@ -84,6 +84,7 @@ return{
nextCount="预览个数",
holdCount="暂存个数",
infHold="无限暂存",
phyHold="物理暂存",
mindas="最小首次移动延迟",
minarr="最小移动重复延迟",

View File

@@ -33,7 +33,7 @@ return{
bone=false,
fieldH=20,
nextCount=6,nextStartPos=1,
holdCount=1,infHold=false,
holdCount=1,infHold=false,phyHold=false,
ospin=true,deepDrop=false,
RS="TRS",
sequence="bag",

View File

@@ -624,23 +624,50 @@ function Player.hold(P,ifpre)
else--Hold
local C,H=P.cur,P.holdQueue[1]
--Finesse check
if H and C and H.id==C.id and H.name==C.name then
P.ctrlCount=P.ctrlCount+1
elseif P.ctrlCount<=1 then
P.ctrlCount=0
if P.gameEnv.phyHold and C and not ifpre then--Physical hold
local success
local x,y=P.curX,P.curY
x=x+(#C.bk[1]-#H.bk[1])*.5
y=y+(#C.bk-#H.bk)*.5
for X=int(x-.5),ceil(x+.5)do
for Y=int(y),ceil(y)do
if not P:ifoverlap(H.bk,X,Y)then
x,y=X,Y
success=true
goto BREAK
end
end
end
::BREAK::
if success then
P.spinLast=false
P.spinSeq=0
ins(P.holdQueue,P:getBlock(C.id))
P.cur=rem(P.holdQueue,1)
P.curX,P.curY=x,y
else
SFX.play("finesseError")
return
end
else--Normal hold
--Finesse check
if H and C and H.id==C.id and H.name==C.name then
P.ctrlCount=P.ctrlCount+1
elseif P.ctrlCount<=1 then
P.ctrlCount=0
end
P.spinLast=false
P.spinSeq=0
if C then
ins(P.holdQueue,P:getBlock(C.id))
end
P.cur=rem(P.holdQueue,1)
P:resetBlock()
end
P.spinLast=false
P.spinSeq=0
if C then
C.bk=BLOCKS[C.id][P.gameEnv.face[C.id]]
ins(P.holdQueue,P:getBlock(C.id))
end
P.cur=rem(P.holdQueue,1)
P:resetBlock()
P:freshBlock("move")
P.dropDelay=P.gameEnv.drop
P.lockDelay=P.gameEnv.lock

View File

@@ -11,6 +11,7 @@ scene.widgetList={
WIDGET.newSlider{name="nextCount", x=180, y=380,w=200,unit=6, disp=lnk_CUSval("nextCount"),code=lnk_CUSsto("nextCount")},
WIDGET.newSlider{name="holdCount", x=180, y=450,w=200,unit=6, disp=lnk_CUSval("holdCount"),code=lnk_CUSsto("holdCount")},
WIDGET.newSwitch{name="infHold", x=280, y=530, disp=lnk_CUSval("infHold"), code=lnk_CUSrev("infHold"),hide=function()return CUSTOMENV.holdCount==0 end},
WIDGET.newSwitch{name="phyHold", x=280, y=620, disp=lnk_CUSval("phyHold"), code=lnk_CUSrev("phyHold"),hide=function()return CUSTOMENV.holdCount==0 end},
--Rule
WIDGET.newSelector{name="fieldH", x=550, y=520, w=260,color="sky", list={1,2,3,4,6,8,10,15,20,30,50,100},disp=lnk_CUSval("fieldH"),code=lnk_CUSsto("fieldH")},