落块事件改名落块钩子

添加死亡钩子(仅在窒息和超高触发)
堆积模式消行动作挂到死亡钩子上
This commit is contained in:
MrZ626
2021-11-13 05:20:32 +08:00
parent 8cbb4a38bc
commit bc5193f95e
7 changed files with 48 additions and 29 deletions

View File

@@ -7,9 +7,9 @@ return{
mText(TEXTOBJ.line,63,350)
PLY.draw.drawMarkLine(P,20,.3,1,1,TIME()%.42<.21 and .95 or .6)
end,
hook_drop=function(P)
if #P.field>20 then
local cc=P:clearFilledLines(P.garbageBeneath+1,#P.field-P.garbageBeneath)
hook_die=function(P)
local cc=P:clearFilledLines(P.garbageBeneath+1,#P.field-P.garbageBeneath)
if cc>0 then
local h=20-cc-P.garbageBeneath
if h>0 then
P:garbageRise(21,h,2e10-1)

View File

@@ -7,9 +7,9 @@ return{
mText(TEXTOBJ.line,63,350)
PLY.draw.drawMarkLine(P,17,.3,1,1,TIME()%.42<.21 and .95 or .6)
end,
hook_drop=function(P)
if #P.field>20 then
local cc=P:clearFilledLines(P.garbageBeneath+1,#P.field-P.garbageBeneath)
hook_die=function(P)
local cc=P:clearFilledLines(P.garbageBeneath+1,#P.field-P.garbageBeneath)
if cc>0 then
local h=20-cc-P.garbageBeneath-3
if h>0 then
P:garbageRise(21,h,2e10-1)

View File

@@ -3,7 +3,6 @@ return{
drop=60,lock=60,
wait=0,fall=50,
garbageSpeed=30,
highCam=false,
seqData={1,2,3,4,5,6,7},
eventSet='stack_e',
bg='blockrain',bgm='there',

View File

@@ -2,7 +2,6 @@ return{
env={
drop=60,lock=60,
wait=0,fall=50,
highCam=false,
garbageSpeed=30,
seqData={8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25},
eventSet='stack_u',

View File

@@ -62,6 +62,7 @@ return{
mesDisp={},
hook_drop={},
hook_die={},
task={},
eventSet="X",

View File

@@ -304,6 +304,7 @@ local function _applyGameEnv(P)--Finish gameEnv processing
--Apply events
ENV.mesDisp=_mergeFuncTable(ENV.mesDisp,{})
ENV.hook_drop=_mergeFuncTable(ENV.hook_drop,{})
ENV.hook_die=_mergeFuncTable(ENV.hook_die,{})
ENV.task=_mergeFuncTable(ENV.task,{})
--Apply eventSet
@@ -315,6 +316,7 @@ local function _applyGameEnv(P)--Finish gameEnv processing
if
k=='mesDisp'or
k=='hook_drop'or
k=='hook_die'or
k=='task'
then
_mergeFuncTable(v,ENV[k])

View File

@@ -313,10 +313,13 @@ function Player:setRS(RSname)
end
end
function Player:triggerDropEvents()
local L=self.gameEnv.hook_drop
for i=1,#L do
L[i](self)
function Player:_triggerEvent(eventName)
local L=self.gameEnv[eventName]
if L[1]then
for i=1,#L do
L[i](self)
end
return true
end
end
@@ -378,9 +381,22 @@ function Player:garbageRise(color,amount,line)--Release n-lines garbage to field
_=self.dropFX[i]
_[3],_[5]=_[3]+amount,_[5]+amount
end
if #self.field>self.gameEnv.heightLimit then
if
#self.field>self.gameEnv.heightLimit and(
not self:_triggerEvent('hook_die')or
#self.field>self.gameEnv.heightLimit
)
then
self:lock()
self:lose()
end
if #self.field>self.gameEnv.heightLimit then
self:_triggerEvent('hook_die')
if #self.field>self.gameEnv.heightLimit then
self:lose()
end
end
end
local invList={2,1,4,3,5,6,7}
@@ -724,7 +740,7 @@ function Player:removeTopClearingFX()
return true
end
end
function Player:checkMission(piece,mission)
function Player:_checkMission(piece,mission)
if mission<5 then
return piece.row==mission and not piece.spin
elseif mission<9 then
@@ -736,6 +752,17 @@ function Player:checkMission(piece,mission)
end
return false
end
function Player:_checkSuffocate()
if
self:ifoverlap(self.cur.bk,self.curX,self.curY)and(
not self:_triggerEvent('hook_die')or
self:ifoverlap(self.cur.bk,self.curX,self.curY)
)
then
self:lock()
self:lose()
end
end
local spawnSFX_name={'spawn_1','spawn_2','spawn_3','spawn_4','spawn_5','spawn_6','spawn_7'}
function Player:resetBlock()--Reset Block's position and execute I*S
@@ -905,10 +932,7 @@ function Player:hold_norm(ifpre)
self:freshBlock('move')
self.dropDelay=ENV.drop
self.lockDelay=ENV.lock
if self:ifoverlap(self.cur.bk,self.curX,self.curY)then
self:lock()
self:lose()
end
self:_checkSuffocate()
end
self.freshTime=int(min(self.freshTime+ENV.freshLimit*.25,ENV.freshLimit*((self.holdTime+1)/ENV.holdCount),ENV.freshLimit))
@@ -971,10 +995,7 @@ function Player:hold_swap(ifpre)
self:freshBlock('move')
self.dropDelay=ENV.drop
self.lockDelay=ENV.lock
if self:ifoverlap(self.cur.bk,self.curX,self.curY)then
self:lock()
self:lose()
end
self:_checkSuffocate()
end
self.freshTime=int(min(self.freshTime+ENV.freshLimit*.25,ENV.freshLimit*((self.holdTime+1)/ENV.holdCount),ENV.freshLimit))
@@ -1044,10 +1065,7 @@ function Player:popNext(ifhold)--Pop nextQueue to hand
self.freshTime=ENV.freshLimit
if self.cur then
if self:ifoverlap(self.cur.bk,self.curX,self.curY)then
self:lock()
self:lose()
end
self:_checkSuffocate()
self:freshBlock('newBlock')
end
@@ -1608,7 +1626,7 @@ do
--Check clearing task
if cc>0 and self.curMission then
if self:checkMission(piece,ENV.mission[self.curMission])then
if self:_checkMission(piece,ENV.mission[self.curMission])then
self.curMission=self.curMission+1
SFX.play('reach')
if self.curMission>#ENV.mission then
@@ -1670,13 +1688,13 @@ do
if finish=='lose'then
self:lose()
else
self:triggerDropEvents()
self:_triggerEvent('hook_drop')
if finish then
self:win(finish)
end
end
else
self:triggerDropEvents()
self:_triggerEvent('hook_drop')
end
end