玩家属性新增minY,y_img更名imgY,修改锁延刷新机制
This commit is contained in:
@@ -230,7 +230,7 @@ function royaleLevelup()
|
|||||||
local P=players.alive[i]
|
local P=players.alive[i]
|
||||||
P.gameEnv.drop=int(P.gameEnv.drop*.3)
|
P.gameEnv.drop=int(P.gameEnv.drop*.3)
|
||||||
if P.gameEnv.drop==0 then
|
if P.gameEnv.drop==0 then
|
||||||
P.curY=P.y_img
|
P.curY=P.imgY
|
||||||
P.gameEnv._20G=true
|
P.gameEnv._20G=true
|
||||||
if P.AI_mode=="CC"then CC_switch20G(P)end
|
if P.AI_mode=="CC"then CC_switch20G(P)end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -114,10 +114,10 @@ local TRS={
|
|||||||
},--T
|
},--T
|
||||||
function(P,d)
|
function(P,d)
|
||||||
if P.human then SFX.fieldPlay("rotate",nil,P)end
|
if P.human then SFX.fieldPlay("rotate",nil,P)end
|
||||||
if P.gameEnv.easyFresh then P:freshLockDelay()end
|
P:freshLockDelay()
|
||||||
if not P.gameEnv.ospin then return end
|
if not P.gameEnv.ospin then return end
|
||||||
local x,y=P.curX,P.curY
|
local x,y=P.curX,P.curY
|
||||||
if y==P.y_img and((P:solid(x-1,y)or P:solid(x-1,y+1)))and(P:solid(x+2,y)or P:solid(x+2,y+1))then
|
if y==P.imgY and((P:solid(x-1,y)or P:solid(x-1,y+1)))and(P:solid(x+2,y)or P:solid(x+2,y+1))then
|
||||||
local D=P.spinSeq%100*10+d
|
local D=P.spinSeq%100*10+d
|
||||||
P.spinSeq=D
|
P.spinSeq=D
|
||||||
if D<100 then return end
|
if D<100 then return end
|
||||||
@@ -256,7 +256,7 @@ local TRS={
|
|||||||
},--W
|
},--W
|
||||||
function(P,d)
|
function(P,d)
|
||||||
if P.human then SFX.fieldPlay("rotate",nil,P)end
|
if P.human then SFX.fieldPlay("rotate",nil,P)end
|
||||||
if P.gameEnv.easyFresh then P:freshLockDelay()end
|
P:freshLockDelay()
|
||||||
local iki=XspinList[d]
|
local iki=XspinList[d]
|
||||||
for test=1,#iki do
|
for test=1,#iki do
|
||||||
local x,y=P.curX+iki[test][1],P.curY+iki[test][2]
|
local x,y=P.curX+iki[test][1],P.curY+iki[test][2]
|
||||||
|
|||||||
213
parts/player.lua
213
parts/player.lua
@@ -318,6 +318,7 @@ local function Pupdate_alive(P,dt)
|
|||||||
end end
|
end end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--Moving pressed
|
||||||
if P.movDir~=0 then
|
if P.movDir~=0 then
|
||||||
local das,arr=P.gameEnv.das,P.gameEnv.arr
|
local das,arr=P.gameEnv.das,P.gameEnv.arr
|
||||||
local mov=P.moving
|
local mov=P.moving
|
||||||
@@ -379,6 +380,7 @@ local function Pupdate_alive(P,dt)
|
|||||||
P.moving=mov
|
P.moving=mov
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--Drop pressed
|
||||||
if P.keyPressing[7]and not P.keyPressing[9]then
|
if P.keyPressing[7]and not P.keyPressing[9]then
|
||||||
local d=P.downing-P.gameEnv.sddas
|
local d=P.downing-P.gameEnv.sddas
|
||||||
P.downing=P.downing+1
|
P.downing=P.downing+1
|
||||||
@@ -397,6 +399,8 @@ local function Pupdate_alive(P,dt)
|
|||||||
else
|
else
|
||||||
P.downing=0
|
P.downing=0
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--Falling animation
|
||||||
if P.falling>=0 then
|
if P.falling>=0 then
|
||||||
P.falling=P.falling-1
|
P.falling=P.falling-1
|
||||||
if P.falling>=0 then
|
if P.falling>=0 then
|
||||||
@@ -407,33 +411,43 @@ local function Pupdate_alive(P,dt)
|
|||||||
P.clearingRow={}
|
P.clearingRow={}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--Try spawn new block
|
||||||
if not P.control then goto stop end
|
if not P.control then goto stop end
|
||||||
if P.waiting==0 then P:popNext()end
|
if P.waiting==0 then P:popNext()end
|
||||||
if P.waiting>=0 then
|
if P.waiting>=0 then
|
||||||
P.waiting=P.waiting-1
|
P.waiting=P.waiting-1
|
||||||
goto stop
|
goto stop
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--Natural block falling
|
||||||
if P.cur then
|
if P.cur then
|
||||||
if P.curY~=P.y_img then
|
if P.curY~=P.imgY then
|
||||||
local D=P.dropDelay
|
local D=P.dropDelay
|
||||||
if D>1 then
|
if D>1 then
|
||||||
P.dropDelay=D-1
|
P.dropDelay=D-1
|
||||||
goto stop
|
goto stop
|
||||||
end
|
end
|
||||||
|
|
||||||
if D==1 then
|
if D==1 then
|
||||||
P.curY=P.curY-1
|
P.curY=P.curY-1
|
||||||
else
|
else
|
||||||
local _=P.curY-P.y_img--Max fall dist
|
local _=P.curY-P.imgY--Max fall dist
|
||||||
D=1/D--Fall dist
|
D=1/D--Fall dist
|
||||||
if D<_ then
|
if D<_ then
|
||||||
P.curY=P.curY-D
|
P.curY=P.curY-D
|
||||||
assert(P.curY==int(P.curY),"y:"..P.curY.." fall:"..D.." D_env:"..P.gameEnv.drop)
|
-- assert(P.curY==int(P.curY),"y:"..P.curY.." fall:"..D.." D_env:"..P.gameEnv.drop)
|
||||||
else
|
else
|
||||||
P.curY=P.y_img
|
P.curY=P.imgY
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
if P.curY<P.minY then
|
||||||
|
P.minY=P.curY
|
||||||
|
P.lockDelay=P.gameEnv.lock
|
||||||
|
end
|
||||||
P.spinLast=false
|
P.spinLast=false
|
||||||
if P.y_img~=P.curY then
|
|
||||||
|
if P.imgY~=P.curY then
|
||||||
P.dropDelay=P.gameEnv.drop
|
P.dropDelay=P.gameEnv.drop
|
||||||
elseif P.AI_mode=="CC"then
|
elseif P.AI_mode=="CC"then
|
||||||
CC_updateField(P)
|
CC_updateField(P)
|
||||||
@@ -441,9 +455,6 @@ local function Pupdate_alive(P,dt)
|
|||||||
CC_switch20G(P)
|
CC_switch20G(P)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if P.freshTime<=P.gameEnv.freshLimit then
|
|
||||||
P.lockDelay=P.gameEnv.lock
|
|
||||||
end
|
|
||||||
else
|
else
|
||||||
P.lockDelay=P.lockDelay-1
|
P.lockDelay=P.lockDelay-1
|
||||||
if P.lockDelay>=0 then goto stop end
|
if P.lockDelay>=0 then goto stop end
|
||||||
@@ -627,12 +638,12 @@ local function Pdraw_norm(P)
|
|||||||
gc.setColor(1,1,1,.3)
|
gc.setColor(1,1,1,.3)
|
||||||
for i=1,P.r do for j=1,P.c do
|
for i=1,P.r do for j=1,P.c do
|
||||||
if P.cur.bk[i][j]then
|
if P.cur.bk[i][j]then
|
||||||
drawPixel(i+P.y_img-1,j+P.curX-1,curColor)
|
drawPixel(i+P.imgY-1,j+P.curX-1,curColor)
|
||||||
end
|
end
|
||||||
end end
|
end end
|
||||||
end
|
end
|
||||||
|
|
||||||
local dy=P.gameEnv.smooth and P.y_img~=P.curY and (min(P.dropDelay,1e99)/P.gameEnv.drop-1)*30 or 0
|
local dy=P.gameEnv.smooth and P.imgY~=P.curY and (min(P.dropDelay,1e99)/P.gameEnv.drop-1)*30 or 0
|
||||||
gc.translate(0,-dy)
|
gc.translate(0,-dy)
|
||||||
local trans=P.lockDelay/P.gameEnv.lock
|
local trans=P.lockDelay/P.gameEnv.lock
|
||||||
if P.gameEnv.block then
|
if P.gameEnv.block then
|
||||||
@@ -681,7 +692,14 @@ local function Pdraw_norm(P)
|
|||||||
gc.rectangle("line",-16,-3,15,604)--B2b bar boarder
|
gc.rectangle("line",-16,-3,15,604)--B2b bar boarder
|
||||||
gc.setColor(P.frameColor)
|
gc.setColor(P.frameColor)
|
||||||
gc.rectangle("line",-1,-11,302,612)--Boarder
|
gc.rectangle("line",-1,-11,302,612)--Boarder
|
||||||
|
if P.lockDelay>=0 then
|
||||||
|
gc.rectangle("fill",0,602,300*P.lockDelay/P.gameEnv.lock,6)--Lock delay indicator
|
||||||
|
end
|
||||||
|
_=10
|
||||||
|
for i=1,min(P.gameEnv.freshLimit-P.freshTime,15)do
|
||||||
|
gc.circle("fill",_,615,5)
|
||||||
|
_=_+20
|
||||||
|
end
|
||||||
--Buffer line
|
--Buffer line
|
||||||
local h=0
|
local h=0
|
||||||
for i=1,#P.atkBuffer do
|
for i=1,#P.atkBuffer do
|
||||||
@@ -921,7 +939,7 @@ local function Pdraw_demo(P)
|
|||||||
gc.setColor(1,1,1,.3)
|
gc.setColor(1,1,1,.3)
|
||||||
for i=1,P.r do for j=1,P.c do
|
for i=1,P.r do for j=1,P.c do
|
||||||
if P.cur.bk[i][j]then
|
if P.cur.bk[i][j]then
|
||||||
drawPixel(i+P.y_img-1,j+P.curX-1,curColor)
|
drawPixel(i+P.imgY-1,j+P.curX-1,curColor)
|
||||||
end
|
end
|
||||||
end end
|
end end
|
||||||
|
|
||||||
@@ -1071,12 +1089,6 @@ end
|
|||||||
--------------------------</FX>--------------------------
|
--------------------------</FX>--------------------------
|
||||||
|
|
||||||
--------------------------<Method>--------------------------
|
--------------------------<Method>--------------------------
|
||||||
function player.RND(P,n)
|
|
||||||
local _=P.randomSeed
|
|
||||||
P.randomSeed=int(_/2.626+626262626)
|
|
||||||
return _%n+1
|
|
||||||
end
|
|
||||||
|
|
||||||
local function getNewStatTable()
|
local function getNewStatTable()
|
||||||
local T={
|
local T={
|
||||||
time=0,score=0,
|
time=0,score=0,
|
||||||
@@ -1188,7 +1200,7 @@ function player.garbageRise(P,color,amount,pos)
|
|||||||
P.fieldBeneath=P.fieldBeneath+amount*30
|
P.fieldBeneath=P.fieldBeneath+amount*30
|
||||||
P.curY=P.curY+amount
|
P.curY=P.curY+amount
|
||||||
P.garbageBeneath=P.garbageBeneath+amount
|
P.garbageBeneath=P.garbageBeneath+amount
|
||||||
P.y_img=P.y_img+amount
|
P.imgY=P.imgY+amount
|
||||||
for i=1,#P.clearingRow do
|
for i=1,#P.clearingRow do
|
||||||
P.clearingRow[i]=P.clearingRow[i]+amount
|
P.clearingRow[i]=P.clearingRow[i]+amount
|
||||||
end
|
end
|
||||||
@@ -1222,7 +1234,7 @@ function player.pushLine(P,L,mir)
|
|||||||
end
|
end
|
||||||
P.fieldBeneath=P.fieldBeneath+120
|
P.fieldBeneath=P.fieldBeneath+120
|
||||||
P.curY=P.curY+#L
|
P.curY=P.curY+#L
|
||||||
P.y_img=P.y_img+#L
|
P.imgY=P.imgY+#L
|
||||||
P:freshgho()
|
P:freshgho()
|
||||||
end
|
end
|
||||||
function player.pushNext(P,L,mir)
|
function player.pushNext(P,L,mir)
|
||||||
@@ -1280,34 +1292,50 @@ function player.changeAtk(P,R)
|
|||||||
end
|
end
|
||||||
function player.freshgho(P)
|
function player.freshgho(P)
|
||||||
if not P.cur then return end
|
if not P.cur then return end
|
||||||
P.y_img=min(#P.field+1,P.curY)
|
P.imgY=min(#P.field+1,P.curY)
|
||||||
|
|
||||||
if P.gameEnv._20G or P.keyPressing[7]and P.gameEnv.sdarr==0 then
|
if P.gameEnv._20G or P.keyPressing[7]and P.gameEnv.sdarr==0 then
|
||||||
while not P:ifoverlap(P.cur.bk,P.curX,P.y_img-1)do
|
local _=P.imgY
|
||||||
P.y_img=P.y_img-1
|
|
||||||
|
--Move ghost to bottom
|
||||||
|
while not P:ifoverlap(P.cur.bk,P.curX,P.imgY-1)do
|
||||||
|
P.imgY=P.imgY-1
|
||||||
|
end
|
||||||
|
|
||||||
|
--Cancel spinLast
|
||||||
|
if _~=P.imgY then
|
||||||
P.spinLast=false
|
P.spinLast=false
|
||||||
end
|
end
|
||||||
if P.curY>P.y_img then
|
|
||||||
|
--Create FX if dropped
|
||||||
|
if P.curY>P.imgY then
|
||||||
if P.gameEnv.dropFX then
|
if P.gameEnv.dropFX then
|
||||||
P:createDropFX(P.curX,P.curY+1,P.curX+P.c-1,P.y_img+P.r-1)
|
P:createDropFX(P.curX,P.curY+1,P.curX+P.c-1,P.imgY+P.r-1)
|
||||||
end
|
end
|
||||||
if P.gameEnv.shakeFX then
|
if P.gameEnv.shakeFX then
|
||||||
P.fieldOff.vy=P.gameEnv.shakeFX*.5
|
P.fieldOff.vy=P.gameEnv.shakeFX*.5
|
||||||
end
|
end
|
||||||
P.curY=P.y_img
|
P.curY=P.imgY
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
while not P:ifoverlap(P.cur.bk,P.curX,P.y_img-1)do
|
while not P:ifoverlap(P.cur.bk,P.curX,P.imgY-1)do
|
||||||
P.y_img=P.y_img-1
|
P.imgY=P.imgY-1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function player.freshLockDelay(P)
|
function player.freshLockDelay(P)
|
||||||
if P.lockDelay<P.gameEnv.lock then
|
--Return when fall-fresh but no fall
|
||||||
P.dropDelay=P.gameEnv.drop
|
if not P.gameEnv.easyFresh and P.curY>=P.minY then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local d,d0=P.lockDelay,P.gameEnv.lock
|
||||||
|
if d<d0 and(P.freshTime<P.gameEnv.freshLimit or P.curY<P.minY)then
|
||||||
P.freshTime=P.freshTime+1
|
P.freshTime=P.freshTime+1
|
||||||
if P.freshTime<=P.gameEnv.freshLimit then
|
P.lockDelay=min(d+d0*.6,d0)
|
||||||
P.lockDelay=P.gameEnv.lock
|
end
|
||||||
end
|
if P.curY<P.minY then
|
||||||
|
P.minY=P.curY
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function player.lock(P)
|
function player.lock(P)
|
||||||
@@ -1336,20 +1364,20 @@ function player.spin(P,d,ifpre)
|
|||||||
SFX.fieldPlay(ifpre and"prerotate"or "rotate",nil,P)
|
SFX.fieldPlay(ifpre and"prerotate"or "rotate",nil,P)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
for test=1,P.freshTime<=1.2*P.gameEnv.freshLimit and #iki or 1 do
|
for test=1,#iki do
|
||||||
local x,y=ix+iki[test][1],iy+iki[test][2]
|
local x,y=ix+iki[test][1],iy+iki[test][2]
|
||||||
if not P:ifoverlap(icb,x,y)then
|
if not P:ifoverlap(icb,x,y)and(P.gameEnv.easyFresh or y<=P.curY)then
|
||||||
ix=x;iy=y
|
ix,iy=x,y
|
||||||
if P.gameEnv.dropFX then
|
if P.gameEnv.dropFX then
|
||||||
P:createDropFX(P.curX,P.curY+P.r-1,P.curX+P.c-1,P.curY)
|
P:createDropFX(P.curX,P.curY+P.r-1,P.curX+P.c-1,P.curY)
|
||||||
end
|
end
|
||||||
local y0=P.curY
|
|
||||||
P.curX,P.curY,P.dir=ix,iy,idir
|
P.curX,P.curY,P.dir=ix,iy,idir
|
||||||
P.sc,P.cur.bk=scs[P.cur.id][idir],icb
|
P.sc,P.cur.bk=scs[P.cur.id][idir],icb
|
||||||
P.r,P.c=ir,ic
|
P.r,P.c=ir,ic
|
||||||
P.spinLast=test==2 and 0 or 1
|
P.spinLast=test==2 and 0 or 1
|
||||||
if not ifpre then P:freshgho()end
|
if not ifpre then P:freshgho()end
|
||||||
if P.gameEnv.easyFresh or y0>P.curY then P:freshLockDelay()end
|
P:freshLockDelay()
|
||||||
|
|
||||||
if P.human then
|
if P.human then
|
||||||
SFX.fieldPlay(ifpre and"prerotate"or P:ifoverlap(P.cur.bk,P.curX,P.curY+1)and P:ifoverlap(P.cur.bk,P.curX-1,P.curY)and P:ifoverlap(P.cur.bk,P.curX+1,P.curY)and"rotatekick"or"rotate",nil,P)
|
SFX.fieldPlay(ifpre and"prerotate"or P:ifoverlap(P.cur.bk,P.curX,P.curY+1)and P:ifoverlap(P.cur.bk,P.curX-1,P.curY)and P:ifoverlap(P.cur.bk,P.curX+1,P.curY)and"rotatekick"or"rotate",nil,P)
|
||||||
end
|
end
|
||||||
@@ -1371,19 +1399,37 @@ function player.resetBlock(P)
|
|||||||
P.r,P.c=#C.bk,#C.bk[1] --Row/column
|
P.r,P.c=#C.bk,#C.bk[1] --Row/column
|
||||||
P.curX=int(6-P.c*.5)
|
P.curX=int(6-P.c*.5)
|
||||||
local y=21+ceil(P.fieldBeneath/30)
|
local y=21+ceil(P.fieldBeneath/30)
|
||||||
P.curY=y
|
P.curY,P.minY=y,y
|
||||||
|
|
||||||
|
local _=P.keyPressing
|
||||||
--IMS
|
--IMS
|
||||||
if P.gameEnv.ims and(P.keyPressing[1]and P.movDir==-1 or P.keyPressing[2]and P.movDir==1)and P.moving>=P.gameEnv.das then
|
if P.gameEnv.ims and(_[1]and P.movDir==-1 or _[2]and P.movDir==1)and P.moving>=P.gameEnv.das then
|
||||||
local x=P.curX+P.movDir
|
local x=P.curX+P.movDir
|
||||||
if not P:ifoverlap(C.bk,x,y)then
|
if not P:ifoverlap(C.bk,x,y)then
|
||||||
P.curX=x
|
P.curX=x
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--IRS
|
||||||
|
if P.gameEnv.irs then
|
||||||
|
if _[5]then
|
||||||
|
P:spin(2,true)
|
||||||
|
else
|
||||||
|
if _[3]then
|
||||||
|
if _[4]then
|
||||||
|
P:spin(2,true)
|
||||||
|
else
|
||||||
|
P:spin(1,true)
|
||||||
|
end
|
||||||
|
elseif _[4]then
|
||||||
|
P:spin(3,true)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
--Spawn SFX
|
--Spawn SFX
|
||||||
if P.human and id<8 then
|
if P.human and id<8 then
|
||||||
SFX.play("spawn_"..id,setting.spawn,nil,true)
|
SFX.fplay("spawn_"..id,setting.spawn)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function player.hold(P,ifpre)
|
function player.hold(P,ifpre)
|
||||||
@@ -1458,8 +1504,8 @@ function player.popNext(P)--Pop next queue to hand
|
|||||||
BOT.addNext(P.AI_bot,CCblockID[next.id])
|
BOT.addNext(P.AI_bot,CCblockID[next.id])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local _=P.keyPressing
|
local _=P.keyPressing
|
||||||
|
|
||||||
--IHS
|
--IHS
|
||||||
if _[8]and P.gameEnv.hold and P.gameEnv.ihs then
|
if _[8]and P.gameEnv.hold and P.gameEnv.ihs then
|
||||||
P:hold(true)
|
P:hold(true)
|
||||||
@@ -1470,23 +1516,6 @@ function player.popNext(P)--Pop next queue to hand
|
|||||||
|
|
||||||
P.dropDelay,P.lockDelay,P.freshTime=P.gameEnv.drop,P.gameEnv.lock,0
|
P.dropDelay,P.lockDelay,P.freshTime=P.gameEnv.drop,P.gameEnv.lock,0
|
||||||
|
|
||||||
--IRS
|
|
||||||
if P.gameEnv.irs then
|
|
||||||
if _[5]then
|
|
||||||
P:spin(2,true)
|
|
||||||
else
|
|
||||||
if _[3]then
|
|
||||||
if _[4]then
|
|
||||||
P:spin(2,true)
|
|
||||||
else
|
|
||||||
P:spin(1,true)
|
|
||||||
end
|
|
||||||
elseif _[4]then
|
|
||||||
P:spin(3,true)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
if P.cur then
|
if P.cur then
|
||||||
if P:ifoverlap(P.cur.bk,P.curX,P.curY)then P:lock()P:lose()end
|
if P:ifoverlap(P.cur.bk,P.curX,P.curY)then P:lock()P:lose()end
|
||||||
P:freshgho()
|
P:freshgho()
|
||||||
@@ -2193,10 +2222,9 @@ function player.act.moveLeft(P,auto)
|
|||||||
elseif P.control and P.waiting==-1 then
|
elseif P.control and P.waiting==-1 then
|
||||||
if P.cur and not P:ifoverlap(P.cur.bk,P.curX-1,P.curY)then
|
if P.cur and not P:ifoverlap(P.cur.bk,P.curX-1,P.curY)then
|
||||||
P.curX=P.curX-1
|
P.curX=P.curX-1
|
||||||
local y0=P.curY
|
|
||||||
P:freshgho()
|
P:freshgho()
|
||||||
if P.gameEnv.easyFresh or y0~=P.curY then P:freshLockDelay()end
|
P:freshLockDelay()
|
||||||
if P.human and P.curY==P.y_img then SFX.play("move")end
|
if P.human and P.curY==P.imgY then SFX.play("move")end
|
||||||
if not auto then P.moving=0 end
|
if not auto then P.moving=0 end
|
||||||
P.spinLast=false
|
P.spinLast=false
|
||||||
else
|
else
|
||||||
@@ -2219,10 +2247,9 @@ function player.act.moveRight(P,auto)
|
|||||||
elseif P.control and P.waiting==-1 then
|
elseif P.control and P.waiting==-1 then
|
||||||
if P.cur and not P:ifoverlap(P.cur.bk,P.curX+1,P.curY)then
|
if P.cur and not P:ifoverlap(P.cur.bk,P.curX+1,P.curY)then
|
||||||
P.curX=P.curX+1
|
P.curX=P.curX+1
|
||||||
local y0=P.curY
|
|
||||||
P:freshgho()
|
P:freshgho()
|
||||||
if P.gameEnv.easyFresh or y0~=P.curY then P:freshLockDelay()end
|
P:freshLockDelay()
|
||||||
if P.human and P.curY==P.y_img then SFX.play("move")end
|
if P.human and P.curY==P.imgY then SFX.play("move")end
|
||||||
if not auto then P.moving=0 end
|
if not auto then P.moving=0 end
|
||||||
P.spinLast=false
|
P.spinLast=false
|
||||||
else
|
else
|
||||||
@@ -2260,11 +2287,11 @@ function player.act.hardDrop(P)
|
|||||||
end
|
end
|
||||||
P.keyPressing[6]=false
|
P.keyPressing[6]=false
|
||||||
elseif P.control and P.waiting==-1 and P.cur then
|
elseif P.control and P.waiting==-1 and P.cur then
|
||||||
if P.curY~=P.y_img then
|
if P.curY~=P.imgY then
|
||||||
if P.gameEnv.dropFX then
|
if P.gameEnv.dropFX then
|
||||||
P:createDropFX(P.curX,P.curY+1,P.curX+P.c-1,P.y_img+P.r-1)
|
P:createDropFX(P.curX,P.curY+1,P.curX+P.c-1,P.imgY+P.r-1)
|
||||||
end
|
end
|
||||||
P.curY=P.y_img
|
P.curY=P.imgY
|
||||||
P.spinLast=false
|
P.spinLast=false
|
||||||
if P.gameEnv.shakeFX then
|
if P.gameEnv.shakeFX then
|
||||||
P.fieldOff.vy=P.gameEnv.shakeFX*.6
|
P.fieldOff.vy=P.gameEnv.shakeFX*.6
|
||||||
@@ -2287,8 +2314,11 @@ function player.act.softDrop(P)
|
|||||||
else
|
else
|
||||||
P.downing=1
|
P.downing=1
|
||||||
if P.control and P.waiting==-1 and P.cur then
|
if P.control and P.waiting==-1 and P.cur then
|
||||||
if P.curY~=P.y_img then
|
if P.curY~=P.imgY then
|
||||||
P.curY=P.curY-1
|
P.curY=P.curY-1
|
||||||
|
if P.curY<P.minY then
|
||||||
|
P.minY=P.curY
|
||||||
|
end
|
||||||
P.spinLast=false
|
P.spinLast=false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -2310,7 +2340,7 @@ function player.act.restart(P)
|
|||||||
end
|
end
|
||||||
function player.act.insLeft(P,auto)
|
function player.act.insLeft(P,auto)
|
||||||
if P.gameEnv.nofly or not P.cur then return end
|
if P.gameEnv.nofly or not P.cur then return end
|
||||||
local x0,y0=P.curX,P.curY
|
local x0=P.curX
|
||||||
while not P:ifoverlap(P.cur.bk,P.curX-1,P.curY)do
|
while not P:ifoverlap(P.cur.bk,P.curX-1,P.curY)do
|
||||||
P.curX=P.curX-1
|
P.curX=P.curX-1
|
||||||
if P.gameEnv.dropFX then
|
if P.gameEnv.dropFX then
|
||||||
@@ -2318,8 +2348,8 @@ function player.act.insLeft(P,auto)
|
|||||||
end
|
end
|
||||||
P:freshgho()
|
P:freshgho()
|
||||||
end
|
end
|
||||||
if x0~=P.curX then
|
if P.curX~=x0 then
|
||||||
if P.gameEnv.easyFresh or y0~=P.curY then P:freshLockDelay()end
|
P:freshLockDelay()
|
||||||
P.spinLast=false
|
P.spinLast=false
|
||||||
end
|
end
|
||||||
if P.gameEnv.shakeFX then
|
if P.gameEnv.shakeFX then
|
||||||
@@ -2333,7 +2363,7 @@ function player.act.insLeft(P,auto)
|
|||||||
end
|
end
|
||||||
function player.act.insRight(P,auto)
|
function player.act.insRight(P,auto)
|
||||||
if P.gameEnv.nofly or not P.cur then return end
|
if P.gameEnv.nofly or not P.cur then return end
|
||||||
local x0,y0=P.curX,P.curY
|
local x0=P.curX
|
||||||
while not P:ifoverlap(P.cur.bk,P.curX+1,P.curY)do
|
while not P:ifoverlap(P.cur.bk,P.curX+1,P.curY)do
|
||||||
P.curX=P.curX+1
|
P.curX=P.curX+1
|
||||||
if P.gameEnv.dropFX then
|
if P.gameEnv.dropFX then
|
||||||
@@ -2341,8 +2371,8 @@ function player.act.insRight(P,auto)
|
|||||||
end
|
end
|
||||||
P:freshgho()
|
P:freshgho()
|
||||||
end
|
end
|
||||||
if x0~=P.curX then
|
if P.curX~=x0 then
|
||||||
if P.gameEnv.easyFresh or y0~=P.curY then P:freshLockDelay()end
|
P:freshLockDelay()
|
||||||
P.spinLast=false
|
P.spinLast=false
|
||||||
end
|
end
|
||||||
if P.gameEnv.shakeFX then
|
if P.gameEnv.shakeFX then
|
||||||
@@ -2355,40 +2385,52 @@ function player.act.insRight(P,auto)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
function player.act.insDown(P)
|
function player.act.insDown(P)
|
||||||
if P.curY~=P.y_img and P.cur then
|
if P.curY~=P.imgY and P.cur then
|
||||||
if P.gameEnv.dropFX then
|
if P.gameEnv.dropFX then
|
||||||
P:createDropFX(P.curX,P.curY+1,P.curX+P.c-1,P.y_img+P.r-1)
|
P:createDropFX(P.curX,P.curY+1,P.curX+P.c-1,P.imgY+P.r-1)
|
||||||
end
|
end
|
||||||
if P.gameEnv.shakeFX then
|
if P.gameEnv.shakeFX then
|
||||||
P.fieldOff.vy=P.gameEnv.shakeFX*.5
|
P.fieldOff.vy=P.gameEnv.shakeFX*.5
|
||||||
end
|
end
|
||||||
P.curY,P.lockDelay,P.spinLast=P.y_img,P.gameEnv.lock,false
|
P.curY,P.lockDelay,P.spinLast=P.imgY,P.gameEnv.lock,false
|
||||||
|
if P.curY<P.minY then
|
||||||
|
P.minY=P.curY
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function player.act.down1(P)
|
function player.act.down1(P)
|
||||||
if P.curY~=P.y_img and P.cur then
|
if P.curY~=P.imgY and P.cur then
|
||||||
P.curY=P.curY-1
|
P.curY=P.curY-1
|
||||||
|
if P.curY<P.minY then
|
||||||
|
P.minY=P.curY
|
||||||
|
end
|
||||||
P.spinLast=false
|
P.spinLast=false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function player.act.down4(P)
|
function player.act.down4(P)
|
||||||
for _=1,4 do
|
for _=1,4 do
|
||||||
if P.curY~=P.y_img and P.cur then
|
if P.curY~=P.imgY and P.cur then
|
||||||
P.curY=P.curY-1
|
P.curY=P.curY-1
|
||||||
|
if P.curY<P.minY then
|
||||||
|
P.minY=P.curY
|
||||||
|
end
|
||||||
P.spinLast=false
|
P.spinLast=false
|
||||||
else
|
else
|
||||||
break
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function player.act.down10(P)
|
function player.act.down10(P)
|
||||||
if P.cur then
|
if P.cur then
|
||||||
for _=1,10 do
|
for _=1,10 do
|
||||||
if P.curY~=P.y_img then
|
if P.curY~=P.imgY then
|
||||||
P.curY=P.curY-1
|
P.curY=P.curY-1
|
||||||
|
if P.curY<P.minY then
|
||||||
|
P.minY=P.curY
|
||||||
|
end
|
||||||
P.spinLast=false
|
P.spinLast=false
|
||||||
else
|
else
|
||||||
break
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -2495,7 +2537,7 @@ local function newEmptyPlayer(id,x,y,size)
|
|||||||
--P.sc,P.dir={0,0},0--SpinCenterCoord, direction
|
--P.sc,P.dir={0,0},0--SpinCenterCoord, direction
|
||||||
--P.r,P.c=0,0--row, col
|
--P.r,P.c=0,0--row, col
|
||||||
--P.hd={...},same as P.cur
|
--P.hd={...},same as P.cur
|
||||||
P.curX,P.curY,P.y_img=0,0,0--x,y,ghostY
|
-- P.curX,P.curY,P.imgY,P.minY=0,0,0,0--x,y,ghostY
|
||||||
P.holded=false
|
P.holded=false
|
||||||
P.next={}
|
P.next={}
|
||||||
|
|
||||||
@@ -2547,6 +2589,9 @@ local function applyGameEnv(P)--Finish gameEnv processing
|
|||||||
|
|
||||||
P.dropDelay=ENV.drop
|
P.dropDelay=ENV.drop
|
||||||
P.lockDelay=ENV.lock
|
P.lockDelay=ENV.lock
|
||||||
|
if not P.gameEnv.easyFresh then
|
||||||
|
P.gameEnv.freshLimit=0
|
||||||
|
end
|
||||||
|
|
||||||
P.color={}
|
P.color={}
|
||||||
for _=1,7 do
|
for _=1,7 do
|
||||||
|
|||||||
Reference in New Issue
Block a user