重构模式环境的dropPiece和task事件为更强大的自定义和未来联网任意模式做准备

整理出所有模式的这两个事件独立到一个文件夹并整理所有模式引用它们的方式
警告:很可能有错误,需要他人帮助测试
This commit is contained in:
MrZ626
2021-08-26 23:49:20 +08:00
parent a4c9bdef4a
commit 7ad386d28f
127 changed files with 1504 additions and 1334 deletions

View File

@@ -290,6 +290,13 @@ function Player:setRS(RSname)
if self.cur then self.cur.RS=rs end
end
function Player:triggerDropEvents()
local L=self.gameEnv.dropPiece
for i=1,#L do
L[i](self)
end
end
function Player:getHolePos()--Get a good garbage-line hole position
if self.garbageBeneath==0 then
return generateLine(self.holeRND:random(10))
@@ -1183,7 +1190,7 @@ do--Player.drop(self)--Place piece
if finePts<5 then
Stat.extraPiece=Stat.extraPiece+1
if ENV.fineKill then
finish=true
finish='lose'
end
if self.sound then
if ENV.fineKill then
@@ -1349,7 +1356,7 @@ do--Player.drop(self)--Place piece
if self.b2b>1000 then
self.b2b=1000
elseif self.b2b==0 and ENV.b2bKill then
finish=true
finish='lose'
end
--Bonus atk/def when focused
@@ -1468,7 +1475,7 @@ do--Player.drop(self)--Place piece
elseif ENV.missionKill then
self:_showText(text.missionFailed,0,140,40,'flicker',.5)
SFX.play('finesseError_long',.6)
finish=true
finish='lose'
end
end
@@ -1513,11 +1520,14 @@ do--Player.drop(self)--Place piece
end
if finish then
if finish==true then self:lose()return end
_=ENV.dropPiece if _ then _(self)end
if finish then self:win(finish)end
if finish=='lose'then
self:lose()
else
self:triggerDropEvents()
if finish then self:win(finish)end
end
else
_=ENV.dropPiece if _ then _(self)end
self:triggerDropEvents()
end
end
end