Merge commit '2604d034fe1b220fb952fa6ba13c11c09b36cdb7'
This commit is contained in:
@@ -170,7 +170,7 @@ do
|
|||||||
},-- T
|
},-- T
|
||||||
function(P,d)
|
function(P,d)
|
||||||
if P.gameEnv.easyFresh then
|
if P.gameEnv.easyFresh then
|
||||||
P:freshBlock('fresh')
|
P:freshBlockDelay()
|
||||||
end
|
end
|
||||||
if P.gameEnv.ospin then
|
if P.gameEnv.ospin then
|
||||||
local x,y=P.curX,P.curY
|
local x,y=P.curX,P.curY
|
||||||
@@ -203,7 +203,7 @@ do
|
|||||||
C.dir=dir
|
C.dir=dir
|
||||||
P.spinLast=2
|
P.spinLast=2
|
||||||
P.stat.rotate=P.stat.rotate+1
|
P.stat.rotate=P.stat.rotate+1
|
||||||
P:freshBlock('move')
|
P:freshMoveBlock()
|
||||||
C.spinSeq=nil
|
C.spinSeq=nil
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@@ -681,7 +681,7 @@ do
|
|||||||
|
|
||||||
local t=P.freshTime
|
local t=P.freshTime
|
||||||
if not ifpre then
|
if not ifpre then
|
||||||
P:freshBlock('move')
|
P:freshMoveBlock()
|
||||||
end
|
end
|
||||||
if fdy>0 and P.freshTime==t and P.curY~=P.imgY then
|
if fdy>0 and P.freshTime==t and P.curY~=P.imgY then
|
||||||
P.freshTime=P.freshTime-1
|
P.freshTime=P.freshTime-1
|
||||||
|
|||||||
@@ -15,13 +15,13 @@ return {
|
|||||||
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:createMoveFX('left')
|
P:createMoveFX('left')
|
||||||
P.curX=P.curX-1
|
P.curX=P.curX-1
|
||||||
P:freshBlock('move')
|
P:freshMoveBlock()
|
||||||
end
|
end
|
||||||
elseif r==2 then
|
elseif r==2 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:createMoveFX('left')
|
P:createMoveFX('left')
|
||||||
P.curX=P.curX-1
|
P.curX=P.curX-1
|
||||||
P:freshBlock('move')
|
P:freshMoveBlock()
|
||||||
end
|
end
|
||||||
elseif r==3 then
|
elseif r==3 then
|
||||||
P:act_rotRight()
|
P:act_rotRight()
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ return {
|
|||||||
P.garbageBeneath=P.garbageBeneath-bonus
|
P.garbageBeneath=P.garbageBeneath-bonus
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
P:freshBlock('push')
|
P:freshBlockGhost()
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
@@ -26,7 +26,7 @@ return {
|
|||||||
P.garbageBeneath=P.garbageBeneath-bonus
|
P.garbageBeneath=P.garbageBeneath-bonus
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
P:freshBlock('push')
|
P:freshBlockGhost()
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
@@ -214,7 +214,7 @@ function Player:_deepDrop()
|
|||||||
self.ghoY=y
|
self.ghoY=y
|
||||||
self:createDropFX()
|
self:createDropFX()
|
||||||
self.curY=y
|
self.curY=y
|
||||||
self:freshBlock('move')
|
self:freshMoveBlock()
|
||||||
SFX.play('swipe')
|
SFX.play('swipe')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -230,7 +230,7 @@ function Player:act_moveLeft(auto)
|
|||||||
self:_triggerEvent('hook_left_'..(auto and 'auto' or 'manual'))
|
self:_triggerEvent('hook_left_'..(auto and 'auto' or 'manual'))
|
||||||
self:createMoveFX('left')
|
self:createMoveFX('left')
|
||||||
self.curX=self.curX+self.movDir
|
self.curX=self.curX+self.movDir
|
||||||
self:freshBlock('move')
|
self:freshMoveBlock()
|
||||||
if not auto then
|
if not auto then
|
||||||
self.moving=0
|
self.moving=0
|
||||||
end
|
end
|
||||||
@@ -254,7 +254,7 @@ function Player:act_moveRight(auto)
|
|||||||
self:_triggerEvent('hook_right_'..(auto and 'auto' or 'manual'))
|
self:_triggerEvent('hook_right_'..(auto and 'auto' or 'manual'))
|
||||||
self:createMoveFX('right')
|
self:createMoveFX('right')
|
||||||
self.curX=self.curX+self.movDir
|
self.curX=self.curX+self.movDir
|
||||||
self:freshBlock('move')
|
self:freshMoveBlock()
|
||||||
if not auto then
|
if not auto then
|
||||||
self.moving=0
|
self.moving=0
|
||||||
end
|
end
|
||||||
@@ -367,7 +367,7 @@ function Player:act_insLeft(auto)
|
|||||||
while not self:ifoverlap(self.cur.bk,self.curX-1,self.curY) do
|
while not self:ifoverlap(self.cur.bk,self.curX-1,self.curY) do
|
||||||
self:createMoveFX('left')
|
self:createMoveFX('left')
|
||||||
self.curX=self.curX-1
|
self.curX=self.curX-1
|
||||||
self:freshBlock('move',true)
|
self:freshMoveBlock(true)
|
||||||
end
|
end
|
||||||
if self.curX~=x0 then
|
if self.curX~=x0 then
|
||||||
self.spinLast=false
|
self.spinLast=false
|
||||||
@@ -391,7 +391,7 @@ function Player:act_insRight(auto)
|
|||||||
while not self:ifoverlap(self.cur.bk,self.curX+1,self.curY) do
|
while not self:ifoverlap(self.cur.bk,self.curX+1,self.curY) do
|
||||||
self:createMoveFX('right')
|
self:createMoveFX('right')
|
||||||
self.curX=self.curX+1
|
self.curX=self.curX+1
|
||||||
self:freshBlock('move',true)
|
self:freshMoveBlock(true)
|
||||||
end
|
end
|
||||||
if self.curX~=x0 then
|
if self.curX~=x0 then
|
||||||
self.spinLast=false
|
self.spinLast=false
|
||||||
@@ -417,7 +417,7 @@ function Player:act_insDown()
|
|||||||
self.curY=self.ghoY
|
self.curY=self.ghoY
|
||||||
self.lockDelay=ENV.lock
|
self.lockDelay=ENV.lock
|
||||||
self.spinLast=false
|
self.spinLast=false
|
||||||
self:freshBlock('fresh')
|
self:freshBlockDelay()
|
||||||
self:checkTouchSound()
|
self:checkTouchSound()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -427,7 +427,7 @@ function Player:act_down1()
|
|||||||
if self.curY>self.ghoY then
|
if self.curY>self.ghoY then
|
||||||
self:createMoveFX('down')
|
self:createMoveFX('down')
|
||||||
self.curY=self.curY-1
|
self.curY=self.curY-1
|
||||||
self:freshBlock('fresh')
|
self:freshBlockDelay()
|
||||||
self.spinLast=false
|
self.spinLast=false
|
||||||
elseif self.gameEnv.deepDrop then
|
elseif self.gameEnv.deepDrop then
|
||||||
self:_deepDrop()
|
self:_deepDrop()
|
||||||
@@ -442,7 +442,7 @@ function Player:act_down4()
|
|||||||
self.ghoY=max(self.curY-4,self.ghoY)
|
self.ghoY=max(self.curY-4,self.ghoY)
|
||||||
self:createDropFX()
|
self:createDropFX()
|
||||||
self.curY,self.ghoY=self.ghoY,ghoY0
|
self.curY,self.ghoY=self.ghoY,ghoY0
|
||||||
self:freshBlock('fresh')
|
self:freshBlockDelay()
|
||||||
self.spinLast=false
|
self.spinLast=false
|
||||||
elseif self.gameEnv.deepDrop then
|
elseif self.gameEnv.deepDrop then
|
||||||
self:_deepDrop()
|
self:_deepDrop()
|
||||||
@@ -457,7 +457,7 @@ function Player:act_down10()
|
|||||||
self.ghoY=max(self.curY-0,self.ghoY)
|
self.ghoY=max(self.curY-0,self.ghoY)
|
||||||
self:createDropFX()
|
self:createDropFX()
|
||||||
self.curY,self.ghoY=self.ghoY,ghoY0
|
self.curY,self.ghoY=self.ghoY,ghoY0
|
||||||
self:freshBlock('fresh')
|
self:freshBlockDelay()
|
||||||
self.spinLast=false
|
self.spinLast=false
|
||||||
elseif self.gameEnv.deepDrop then
|
elseif self.gameEnv.deepDrop then
|
||||||
self:_deepDrop()
|
self:_deepDrop()
|
||||||
@@ -747,7 +747,7 @@ function Player:garbageRise(color,amount,line)-- Release n-lines garbage to fiel
|
|||||||
for i=1,#self.clearingRow do
|
for i=1,#self.clearingRow do
|
||||||
self.clearingRow[i]=self.clearingRow[i]+amount
|
self.clearingRow[i]=self.clearingRow[i]+amount
|
||||||
end
|
end
|
||||||
self:freshBlock('push')
|
self:freshBlockGhost()
|
||||||
for i=1,#self.lockFX do
|
for i=1,#self.lockFX do
|
||||||
_=self.lockFX[i]
|
_=self.lockFX[i]
|
||||||
_[2]=_[2]-30*amount-- Shift 30px per line cleared
|
_[2]=_[2]-30*amount-- Shift 30px per line cleared
|
||||||
@@ -789,7 +789,7 @@ function Player:pushLineList(L,mir)-- Push some lines to field
|
|||||||
self.curY=self.curY+l
|
self.curY=self.curY+l
|
||||||
self.ghoY=self.ghoY+l
|
self.ghoY=self.ghoY+l
|
||||||
end
|
end
|
||||||
self:freshBlock('push')
|
self:freshBlockGhost()
|
||||||
end
|
end
|
||||||
function Player:pushNextList(L,mir)-- Push some nexts to nextQueue
|
function Player:pushNextList(L,mir)-- Push some nexts to nextQueue
|
||||||
for i=1,#L do
|
for i=1,#L do
|
||||||
@@ -947,75 +947,69 @@ function Player:changeAtk(R)
|
|||||||
self.atking=false
|
self.atking=false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function Player:freshBlock(mode,ifTele)-- string mode: push/move/fresh/newBlock
|
function Player:freshBlockGhost()
|
||||||
|
if not self.cur then return end
|
||||||
local ENV=self.gameEnv
|
local ENV=self.gameEnv
|
||||||
-- Fresh ghost
|
local CB=self.cur.bk
|
||||||
if (mode=='move' or mode=='newBlock' or mode=='push') and self.cur then
|
self.ghoY=min(#self.field+1,self.curY)
|
||||||
local CB=self.cur.bk
|
if self._20G or ENV.sdarr==0 and self.keyPressing[7] and self.downing>=ENV.sddas then
|
||||||
self.ghoY=min(#self.field+1,self.curY)
|
local _=self.ghoY
|
||||||
if self._20G or ENV.sdarr==0 and self.keyPressing[7] and self.downing>=ENV.sddas then
|
|
||||||
local _=self.ghoY
|
|
||||||
|
|
||||||
-- Move ghost to bottom
|
-- Move ghost to bottom
|
||||||
while not self:ifoverlap(CB,self.curX,self.ghoY-1) do
|
while not self:ifoverlap(CB,self.curX,self.ghoY-1) do
|
||||||
self.ghoY=self.ghoY-1
|
self.ghoY=self.ghoY-1
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Cancel spinLast
|
-- Cancel spinLast
|
||||||
if _~=self.ghoY then
|
if _~=self.ghoY then
|
||||||
self.spinLast=false
|
self.spinLast=false
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Create FX if dropped
|
-- Create FX if dropped
|
||||||
if self.curY>self.ghoY then
|
if self.curY>self.ghoY then
|
||||||
self:createDropFX()
|
self:createDropFX()
|
||||||
if ENV.shakeFX then
|
if ENV.shakeFX then
|
||||||
self.swingOffset.vy=.5
|
self.swingOffset.vy=.5
|
||||||
end
|
|
||||||
self.curY=self.ghoY
|
|
||||||
end
|
|
||||||
else
|
|
||||||
while not self:ifoverlap(CB,self.curX,self.ghoY-1) do
|
|
||||||
self.ghoY=self.ghoY-1
|
|
||||||
end
|
end
|
||||||
|
self.curY=self.ghoY
|
||||||
|
end
|
||||||
|
else
|
||||||
|
while not self:ifoverlap(CB,self.curX,self.ghoY-1) do
|
||||||
|
self.ghoY=self.ghoY-1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
-- Fresh delays
|
function Player:freshBlockDelay(keepFreshTimeInEasyFresh)
|
||||||
if mode=='move' or mode=='newBlock' or mode=='fresh' then
|
local ENV=self.gameEnv
|
||||||
local d0,l0=ENV.drop,ENV.lock
|
local d0,l0=ENV.drop,ENV.lock
|
||||||
local C=self.cur
|
local C=self.cur
|
||||||
local sc=C.RS.centerPos[C.id][C.dir]
|
local sc=C.RS.centerPos[C.id][C.dir]
|
||||||
if ENV.easyFresh then
|
local goDown=self.curY+sc[1]<self.minY
|
||||||
if self.lockDelay<l0 and self.freshTime>0 then
|
if goDown then
|
||||||
if mode~='newBlock' then
|
self.minY=self.curY+sc[1]
|
||||||
self.freshTime=self.freshTime-1
|
|
||||||
end
|
|
||||||
self.lockDelay=l0
|
|
||||||
self.dropDelay=d0
|
|
||||||
end
|
|
||||||
if self.curY+sc[1]<self.minY then
|
|
||||||
self.minY=self.curY+sc[1]
|
|
||||||
self.dropDelay=d0
|
|
||||||
self.lockDelay=l0
|
|
||||||
end
|
|
||||||
else
|
|
||||||
if self.curY+sc[1]<self.minY then
|
|
||||||
self.minY=self.curY+sc[1]
|
|
||||||
if self.lockDelay<l0 and self.freshTime>0 then
|
|
||||||
self.freshTime=self.freshTime-1
|
|
||||||
self.dropDelay=d0
|
|
||||||
self.lockDelay=l0
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
local shouldRefresh=self.lockDelay<l0 and self.freshTime>0
|
||||||
|
local easyFresh=ENV.easyFresh
|
||||||
|
if easyFresh and (shouldRefresh or goDown) or goDown and shouldRefresh then
|
||||||
|
self.dropDelay=d0
|
||||||
|
self.lockDelay=l0
|
||||||
|
end
|
||||||
|
if shouldRefresh and (easyFresh and not keepFreshTimeInEasyFresh or not easyFresh and goDown) then
|
||||||
|
self.freshTime=self.freshTime-1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
function Player:freshMoveBlock(ifTele)
|
||||||
|
self:freshBlockGhost()
|
||||||
|
self:freshBlockDelay()
|
||||||
-- Play sound if touch ground
|
-- Play sound if touch ground
|
||||||
if mode=='move' and not ifTele then
|
if not ifTele then
|
||||||
self:checkTouchSound()
|
self:checkTouchSound()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
function Player:freshNewBlock()
|
||||||
|
self:freshBlockGhost()
|
||||||
|
self:freshBlockDelay(true)
|
||||||
|
end
|
||||||
function Player:lock()
|
function Player:lock()
|
||||||
local CB=self.cur.bk
|
local CB=self.cur.bk
|
||||||
for i=1,#CB do
|
for i=1,#CB do
|
||||||
@@ -1207,7 +1201,7 @@ function Player:spin(d,ifpre)
|
|||||||
local idir=(C.dir+d)%4
|
local idir=(C.dir+d)%4
|
||||||
kickData=kickData[C.dir*10+idir]
|
kickData=kickData[C.dir*10+idir]
|
||||||
if not kickData then
|
if not kickData then
|
||||||
self:freshBlock('move')
|
self:freshMoveBlock()
|
||||||
SFX.play(ifpre and 'prerotate' or 'rotate',nil,self:getCenterX()*.15)
|
SFX.play(ifpre and 'prerotate' or 'rotate',nil,self:getCenterX()*.15)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@@ -1228,7 +1222,7 @@ function Player:spin(d,ifpre)
|
|||||||
-- Fresh ghost and freshTime
|
-- Fresh ghost and freshTime
|
||||||
local t=self.freshTime
|
local t=self.freshTime
|
||||||
if not ifpre then
|
if not ifpre then
|
||||||
self:freshBlock('move')
|
self:freshMoveBlock()
|
||||||
end
|
end
|
||||||
if kickData[test][2]>0 and self.freshTime==t and self.curY~=self.imgY then
|
if kickData[test][2]>0 and self.freshTime==t and self.curY~=self.imgY then
|
||||||
self.freshTime=self.freshTime-1
|
self.freshTime=self.freshTime-1
|
||||||
@@ -1254,7 +1248,7 @@ function Player:spin(d,ifpre)
|
|||||||
elseif kickData then
|
elseif kickData then
|
||||||
kickData(self,d)
|
kickData(self,d)
|
||||||
else
|
else
|
||||||
self:freshBlock('move')
|
self:freshMoveBlock()
|
||||||
SFX.play(ifpre and 'prerotate' or 'rotate',nil,self:getCenterX()*.15)
|
SFX.play(ifpre and 'prerotate' or 'rotate',nil,self:getCenterX()*.15)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -1320,7 +1314,7 @@ function Player:hold_norm(ifpre)
|
|||||||
|
|
||||||
self:resetBlock()
|
self:resetBlock()
|
||||||
end
|
end
|
||||||
self:freshBlock('move')
|
self:freshMoveBlock()
|
||||||
self.dropDelay=ENV.drop
|
self.dropDelay=ENV.drop
|
||||||
self.lockDelay=ENV.lock
|
self.lockDelay=ENV.lock
|
||||||
self:_checkSuffocate()
|
self:_checkSuffocate()
|
||||||
@@ -1376,7 +1370,7 @@ function Player:hold_swap(ifpre)
|
|||||||
|
|
||||||
self:resetBlock()
|
self:resetBlock()
|
||||||
end
|
end
|
||||||
self:freshBlock('move')
|
self:freshMoveBlock()
|
||||||
self.dropDelay=ENV.drop
|
self.dropDelay=ENV.drop
|
||||||
self.lockDelay=ENV.lock
|
self.lockDelay=ENV.lock
|
||||||
self:_checkSuffocate()
|
self:_checkSuffocate()
|
||||||
@@ -2622,7 +2616,7 @@ local function update_alive(P,dt)
|
|||||||
end
|
end
|
||||||
|
|
||||||
P.spinLast=false
|
P.spinLast=false
|
||||||
P:freshBlock('fresh')
|
P:freshBlockDelay()
|
||||||
P:checkTouchSound()
|
P:checkTouchSound()
|
||||||
else
|
else
|
||||||
P.lockDelay=P.lockDelay-1
|
P.lockDelay=P.lockDelay-1
|
||||||
@@ -2826,7 +2820,7 @@ function Player:revive()
|
|||||||
self.life=self.life-1
|
self.life=self.life-1
|
||||||
self.fieldBeneath=0
|
self.fieldBeneath=0
|
||||||
self.b2b=0
|
self.b2b=0
|
||||||
self:freshBlock('push')
|
self:freshBlockGhost()
|
||||||
|
|
||||||
for i=1,h do
|
for i=1,h do
|
||||||
self:createClearingFX(i)
|
self:createClearingFX(i)
|
||||||
|
|||||||
Reference in New Issue
Block a user