重构模式环境的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

@@ -1,55 +1,12 @@
local rem=table.remove
local function check_c4w(P)
if P.lastPiece.row>0 then
for _=1,#P.clearedRow do
local h=#P.field
P.field[h+1]=FREEROW.get(20)
P.visTime[h+1]=FREEROW.get(20)
for i=4,7 do P.field[h+1][i]=0 end
end
if P.combo>P.modeData.maxCombo then
P.modeData.maxCombo=P.combo
end
if P.stat.row>=100 then
P:win('finish')
end
end
end
return{
color=COLOR.green,
env={
drop=30,lock=60,infHold=true,
task=function(P)P.modeData.maxCombo=0 end,
dropPiece=check_c4w,
freshLimit=15,ospin=false,
dropPiece=require'parts.eventsets.c4wCheck_easy'.dropPiece,
eventSet='c4wBase',
bg='rgb',bgm='oxygen',
},
load=function()
PLY.newPlayer(1)
local P=PLAYERS[1]
local F=P.field
for i=1,24 do
F[i]=FREEROW.get(20)
P.visTime[i]=FREEROW.get(20)
for x=4,7 do F[i][x]=0 end
end
if P.holeRND:random()<.6 then
local initCell={11,14,12,13,21,24}
for _=1,3 do
_=rem(initCell,P.holeRND:random(#initCell))
F[math.floor(_/10)][3+_%10]=20
end
else
local initCell={11,12,13,14,21,22,23,24}
rem(initCell,P.holeRND:random(5,8))
rem(initCell,P.holeRND:random(1,4))
for _=1,6 do
_=rem(initCell,P.holeRND:random(#initCell))
F[math.floor(_/10)][3+_%10]=20
end
end
end,
mesDisp=function(P)
setFont(45)
mStr(P.combo,63,310)