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

@@ -0,0 +1,30 @@
return{
task=function(P)
while true do
YIELD()
if P.control and P.atkBufferSum==0 then
local D=P.modeData
if D.wave<20 then
local t=1500-30*D.wave--1500~900
table.insert(P.atkBuffer,{line=generateLine(P.holeRND:random(4,7)),amount=12,countdown=t,cd0=t,time=0,sent=false,lv=3})
table.insert(P.atkBuffer,{line=generateLine(P.holeRND:random(3,8)),amount=10,countdown=t,cd0=t,time=0,sent=false,lv=4})
else
local t=900-10*(D.wave-20)--900~600
table.insert(P.atkBuffer,{line=generateLine(P.holeRND:random(10)),amount=14,countdown=t,cd0=t,time=0,sent=false,lv=4})
table.insert(P.atkBuffer,{line=generateLine(P.holeRND:random(4,7)),amount=8,countdown=t,cd0=t,time=0,sent=false,lv=5})
end
P.atkBufferSum=P.atkBufferSum+22
P.stat.recv=P.stat.recv+22
D.wave=D.wave+1
if D.wave%10==0 then
if D.wave==20 then
P:_showText(text.great,0,-140,100,'appear',.6)
P.gameEnv.pushSpeed=3
elseif D.wave==50 then
P:_showText(text.maxspeed,0,-140,100,'appear',.6)
end
end
end
end
end
}

View File

@@ -0,0 +1,39 @@
return{
task=function(P)
while true do
YIELD()
if P.control and P.atkBufferSum<4 then
local D=P.modeData
local s
local t=800-10*D.wave--800~700~600~500
if D.wave<10 then
table.insert(P.atkBuffer,{line=generateLine(P.holeRND:random(5,6)),amount=9,countdown=t,cd0=t,time=0,sent=false,lv=3})
table.insert(P.atkBuffer,{line=generateLine(P.holeRND:random(4,7)),amount=11,countdown=t,cd0=t+62,time=0,sent=false,lv=4})
s=20
elseif D.wave<20 then
table.insert(P.atkBuffer,{line=generateLine(P.holeRND:random(3,8)),amount=11,countdown=t,cd0=t,time=0,sent=false,lv=4})
table.insert(P.atkBuffer,{line=generateLine(P.holeRND:random(4,7)),amount=13,countdown=t,cd0=t+62,time=0,sent=false,lv=5})
s=24
else
table.insert(P.atkBuffer,{line=generateLine(P.holeRND:random(2)*9-8),amount=14,countdown=t,cd0=t,time=0,sent=false,lv=5})
table.insert(P.atkBuffer,{line=generateLine(P.holeRND:random(3,8)),amount=14,countdown=t+62,cd0=t,time=0,sent=false,lv=5})
s=28
end
P.atkBufferSum=P.atkBufferSum+s
P.stat.recv=P.stat.recv+s
D.wave=D.wave+1
if D.wave%10==0 then
if D.wave==10 then
P:_showText(text.great,0,-140,100,'appear',.6)
P.gameEnv.pushSpeed=4
elseif D.wave==20 then
P:_showText(text.awesome,0,-140,100,'appear',.6)
P.gameEnv.pushSpeed=5
elseif D.wave==30 then
P:_showText(text.maxspeed,0,-140,100,'appear',.6)
end
end
end
end
end
}

View File

@@ -0,0 +1,7 @@
return{
dropPiece=function(P)
if P.lastPiece.atk>0 then
P:receive(nil,P.lastPiece.atk,0,generateLine(P.holeRND:random(10)))
end
end,
}

View File

@@ -0,0 +1,7 @@
return{
dropPiece=function(P)
if P.lastPiece.atk>0 then
P:receive(nil,P.lastPiece.atk,120,generateLine(P.holeRND:random(10)))
end
end,
}

View File

@@ -0,0 +1,7 @@
return{
dropPiece=function(P)
if P.lastPiece.atk>0 then
P:receive(nil,P.lastPiece.atk,30,generateLine(P.holeRND:random(10)))
end
end,
}

View File

@@ -0,0 +1,7 @@
return{
dropPiece=function(P)
if P.lastPiece.atk>0 then
P:receive(nil,P.lastPiece.atk,60,generateLine(P.holeRND:random(10)))
end
end,
}

View File

@@ -0,0 +1,27 @@
local rem=table.remove
return{
task=function(P)
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
}

View File

@@ -0,0 +1,18 @@
return{
dropPiece=function(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
}

View File

@@ -0,0 +1,20 @@
return{
dropPiece=function(P)
if P.lastPiece.row==0 then
P:lose()
else
for _=1,P.lastPiece.row 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
}

View File

@@ -0,0 +1,7 @@
return{
dropPiece=function(P)
if P.stat.atk>=100 then
P:win('finish')
end
end
}

View File

@@ -0,0 +1,21 @@
return{
dropPiece=function(P)
if P.garbageBeneath==0 then
local D=P.modeData
D.finished=D.finished+1
if FIELD[D.finished+1]then
P.waiting=26
for i=#P.field,1,-1 do
FREEROW.discard(P.field[i])
FREEROW.discard(P.visTime[i])
P.field[i],P.visTime[i]=nil
end
setField(P,D.finished+1)
SYSFX.newShade(1.4,P.absFieldX,P.absFieldY,300*P.size,610*P.size,.6,.8,.6)
SFX.play('blip_1')
else
P:win('finish')
end
end
end,
}

View File

@@ -0,0 +1,7 @@
return{
dropPiece=function(P)
if P.stat.row>=10 then
P:win('finish')
end
end
}

View File

@@ -0,0 +1,7 @@
return{
dropPiece=function(P)
if P.stat.row>=100 then
P:win('finish')
end
end
}

View File

@@ -0,0 +1,7 @@
return{
dropPiece=function(P)
if P.stat.row>=1000 then
P:win('finish')
end
end
}

View File

@@ -0,0 +1,7 @@
return{
dropPiece=function(P)
if P.stat.row>=20 then
P:win('finish')
end
end
}

View File

@@ -0,0 +1,7 @@
return{
dropPiece=function(P)
if P.stat.row>=40 then
P:win('finish')
end
end
}

View File

@@ -0,0 +1,7 @@
return{
dropPiece=function(P)
if P.stat.row>=400 then
P:win('finish')
end
end
}

View File

@@ -0,0 +1,13 @@
return{
dropPiece=function(P)
if #PLY_ALIVE>1 then
P.control=false
local ID=P.id
repeat
ID=ID+1
if not PLAYERS[ID]then ID=1 end
until PLAYERS[ID].alive or ID==P.id
PLAYERS[ID].control=true
end
end
}

View File

@@ -0,0 +1,13 @@
return{
dropPiece=function(P)
if P.stat.piece%7==0 and #PLY_ALIVE>1 then
P.control=false
local ID=P.id
repeat
ID=ID+1
if not PLAYERS[ID]then ID=1 end
until PLAYERS[ID].alive or ID==P.id
PLAYERS[ID].control=true
end
end
}

View File

@@ -0,0 +1,20 @@
return{
task=function(P)
P.modeData.target=10
end,
dropPiece=function(P)
local D=P.modeData
if P.stat.row>=D.target then
D.target=D.target+10
if D.target==110 then
P.gameEnv.drop,P.gameEnv.lock=2,2
SFX.play('blip_1')
elseif D.target==200 then
P.gameEnv.drop,P.gameEnv.lock=1,1
SFX.play('blip_1')
else
SFX.play('reach')
end
end
end,
}

View File

@@ -0,0 +1,36 @@
return{
task=function(P)
while true do
YIELD()
if P.control then
local D=P.modeData
D.counter=D.counter+1
local t=math.max(240-2*D.wave,40)
if D.counter>=t then
D.counter=0
for _=1,4 do
table.insert(P.atkBuffer,{line=generateLine(P.holeRND:random(10)),amount=1,countdown=5*t,cd0=5*t,time=0,sent=false,lv=2})
end
P.atkBufferSum=P.atkBufferSum+4
P.stat.recv=P.stat.recv+4
D.wave=D.wave+1
if D.wave<=75 then
D.rpm=math.floor(144e3/t)*.1
if D.wave==25 then
P:_showText(text.great,0,-140,100,'appear',.6)
P.gameEnv.pushSpeed=3
P.dropDelay,P.gameEnv.drop=4,4
elseif D.wave==50 then
P:_showText(text.awesome,0,-140,100,'appear',.6)
P.gameEnv.pushSpeed=4
P.dropDelay,P.gameEnv.drop=3,3
elseif D.wave==75 then
P:_showText(text.maxspeed,0,-140,100,'appear',.6)
P.dropDelay,P.gameEnv.drop=2,2
end
end
end
end
end
end,
}

View File

@@ -0,0 +1,36 @@
return{
task=function(P)
while true do
YIELD()
if P.control then
local D=P.modeData
D.counter=D.counter+1
local t=math.max(360-D.wave*2,60)
if D.counter>=t then
D.counter=0
for _=1,3 do
table.insert(P.atkBuffer,{line=generateLine(P.holeRND:random(10)),amount=1,countdown=2*t,cd0=2*t,time=0,sent=false,lv=1})
end
P.atkBufferSum=P.atkBufferSum+3
P.stat.recv=P.stat.recv+3
D.wave=D.wave+1
if D.wave<=90 then
D.rpm=math.floor(108e3/t)*.1
if D.wave==25 then
P:_showText(text.great,0,-140,100,'appear',.6)
P.gameEnv.pushSpeed=2
P.dropDelay,P.gameEnv.drop=20,20
elseif D.wave==50 then
P:_showText(text.awesome,0,-140,100,'appear',.6)
P.gameEnv.pushSpeed=3
P.dropDelay,P.gameEnv.drop=10,10
elseif D.wave==90 then
P.dropDelay,P.gameEnv.drop=5,5
P:_showText(text.maxspeed,0,-140,100,'appear',.6)
end
end
end
end
end
end
}

17
parts/eventsets/dig_h.lua Normal file
View File

@@ -0,0 +1,17 @@
return{
task=function(P)
while true do
YIELD()
if P.control then
local D=P.modeData
D.timer=D.timer+1
if D.timer>=math.max(90,180-D.wave)then
P:garbageRise(21,1,P:getHolePos())
P.stat.recv=P.stat.recv+1
D.timer=0
D.wave=D.wave+1
end
end
end
end,
}

17
parts/eventsets/dig_u.lua Normal file
View File

@@ -0,0 +1,17 @@
return{
task=function(P)
while true do
YIELD()
if P.control then
local D=P.modeData
D.timer=D.timer+1
if D.timer>=math.max(30,80-.3*D.wave)then
P:garbageRise(20+D.wave%5,1,P:getHolePos())
P.stat.recv=P.stat.recv+1
D.timer=0
D.wave=D.wave+1
end
end
end
end,
}

View File

@@ -0,0 +1,11 @@
return setmetatable({},{
__index=function(self,k)
assert(type(k)=='number'and k>0)
self[k]=function(P)
if P.stat.row>=k then
P:win('finish')
end
end
return self[k]
end
})

View File

@@ -0,0 +1,35 @@
local dropSpeed={50,40,30,25,20,15,12,9,7,5,4,3,2,1,1,.5,.5,.25,.25}
return{
task=function(P)
P.gameEnv.drop=60
P.gameEnv.wait=8
P.gameEnv.fall=20
P.modeData.target=10
end,
dropPiece=function(P)
local flag
local l=P.lastPiece
if P.combo>1 then flag=true;P:showText("2x",0,-220,40,'flicker',.3)end
if l.spin then flag=true;P:showText("spin",0,-180,40,'flicker',.3)end
if l.row>1 then flag=true;P:showText("1+",0,-140,40,'flicker',.3)end
if l.pc then flag=true;P:showText("PC",0,-100,40,'flicker',.3)end
if l.hpc then flag=true;P:showText("HPC",0,-100,40,'flicker',.3)end
if flag then
P:lose()
else
local T=P.modeData.target
if P.stat.row>=T then
if T==200 then
P:win('finish')
else
T=T+10
P.gameEnv.drop=dropSpeed[T/10]
P.modeData.target=T
SFX.play('reach')
end
end
end
end,
}

View File

@@ -0,0 +1,25 @@
return
{
task=function(P)
P.gameEnv.drop=.5
P.gameEnv.wait=8
P.gameEnv.fall=20
P.modeData.target=50
end,
dropPiece=function(P)
if P.stat.row>=P.modeData.target then
if P.modeData.target==50 then
P.gameEnv.drop=.25
P.modeData.target=100
SFX.play('reach')
elseif P.modeData.target==100 then
P:set20G(true)
P.modeData.target=200
SFX.play('reach')
else
P:win('finish')
end
end
end
}

View File

@@ -0,0 +1,23 @@
local dropSpeed={50,40,30,24,18,14,10,8,6,5,4,3,2,1,1,.5,.5,.25,.25}
return
{
task=function(P)
P.gameEnv.drop=60
P.gameEnv.wait=8
P.gameEnv.fall=20
P.modeData.target=10
end,
dropPiece=function(P)
if P.stat.row>=P.modeData.target then
if P.modeData.target==200 then
P:win('finish')
else
P.gameEnv.drop=dropSpeed[P.modeData.target/10]
P.modeData.target=P.modeData.target+10
SFX.play('reach')
end
end
end
}

View File

@@ -0,0 +1,34 @@
local sectionName={"D","C","B","A","A+","S-","S","S+","S+","SS","SS","U","U","X","X+"}
local passPoint=16
return{
dropPiece=function(P)
if P.modeData.rankPoint<140-passPoint then--If Less then X
local R=#P.clearedRow
if R>0 then
if R==4 then R=10 end--Techrash +10
P.modeData.rankPoint=math.min(P.modeData.rankPoint+R,140-passPoint)
P.modeData.rankName=sectionName[math.floor(P.modeData.rankPoint/10)+1]
end
end
end,
task=function(P)
P:set20G(true)
P.lockDelay=15
P.gameEnv.lock=15
P.gameEnv.wait=15
P.gameEnv.fall=6
P.modeData.rankPoint=0
P.modeData.rankName=sectionName[1]
while true do
YIELD()
if P.stat.frame>=3600 then
P.modeData.rankPoint=math.min(P.modeData.rankPoint+passPoint,140)
P.modeData.rankName=sectionName[math.floor(P.modeData.rankPoint/10)+1]
P:win('finish')
return
end
end
end,
}

View File

@@ -0,0 +1,51 @@
return{
dropPiece=function(P)
local D=P.modeData
local c=#P.clearedRow
if c==0 and D.pt%100==99 then return end
local s=c<3 and c+1 or c==3 and 5 or 7
if P.combo>7 then s=s+2
elseif P.combo>3 then s=s+1
end
D.pt=D.pt+s
if D.pt%100==99 then
SFX.play('blip_1')
elseif D.pt>=D.target then--Level up!
s=D.target/100--range from 1 to 9
local E=P.gameEnv
if s<4 then
P:_showText(text.stage:gsub("$1",s),0,-120,80,'fly')
--First 300
if s~=1 then E.lock=E.lock-1 end
if s~=2 then E.wait=E.wait-1 end
if s~=3 then E.fall=E.fall-1 end
D.target=D.target+100
elseif s<10 then
if s==5 then BGM.play('distortion')end
P:_showText(text.stage:gsub("$1",s),0,-120,60,'fly',1.26)
if s==4 or s==7 then E.das=E.das-1 end
if s%3==0 then E.lock=E.lock-1
elseif s%3==1 then E.wait=E.wait-1
elseif s%3==2 then E.fall=E.fall-1
end
D.target=D.target+100
else
D.pt=1000
P:win('finish')
end
SFX.play('reach')
end
end,
task=function(P)
P:set20G(true)
P.lockDelay=12
P.gameEnv.lock=12
P.gameEnv.wait=10
P.gameEnv.fall=10
P.modeData.pt=0
P.modeData.target=100
end,
}

View File

@@ -0,0 +1,67 @@
local death_lock={12,11,10,9,8, 7,7,7,7,6}
local death_wait={10,9, 8, 7,6, 6,6,5,5,4}
local death_fall={10,9, 8, 7,6, 6,5,5,4,4}
return{
dropPiece=function(P)
local D=P.modeData
local c=#P.clearedRow
if c==0 and D.pt%100==99 then return end
local s=c<3 and c+1 or c==3 and 5 or 7
if P.combo>7 then s=s+2
elseif P.combo>3 then s=s+1
end
D.pt=D.pt+s
if D.pt%100==99 then
SFX.play('blip_1')
elseif D.pt>=D.target then--Level up!
s=D.target/100
local E=P.gameEnv
E.lock=death_lock[s]
E.wait=death_wait[s]
E.fall=death_fall[s]
if s==2 then
E.das=5
BG.set('rainbow')
elseif s==4 then
E.das=4
BG.set('rainbow2')
elseif s==5 then
if P.stat.frame>183*60 then
D.pt=500
P:win('finish')
return
else
E.bone=true
P.gameEnv.freshLimit=10
BG.set('glow')
BGM.play('secret7th remix')
end
elseif s==6 then
E.das=3
BG.set('lightning')
elseif s==7 then
E.bone=true
elseif s==10 then
D.pt=1000
P:win('finish')
return
end
D.target=D.target+100
P:_showText(text.stage:gsub("$1",s),0,-120,80,'beat')
SFX.play('reach')
end
end,
task=function(P)
P:set20G(true)
P.lockDelay=death_lock[1]
P.gameEnv.lock=death_lock[1]
P.gameEnv.wait=death_wait[1]
P.gameEnv.fall=death_fall[1]
P.modeData.pt=0
P.modeData.target=100
end,
}

View File

@@ -0,0 +1,53 @@
local rush_lock={20,18,16,15,14}
local rush_wait={12,10, 9, 8, 7}
local rush_fall={18,16,14,13,12}
return{
dropPiece=function(P)
local D=P.modeData
local c=#P.clearedRow
if c==0 and D.pt%100==99 then return end
local s=c<3 and c+1 or c==3 and 5 or 7
if P.combo>7 then s=s+2
elseif P.combo>3 then s=s+1
end
D.pt=D.pt+s
if D.pt%100==99 then
SFX.play('blip_1')
elseif D.pt>=D.target then--Level up!
s=D.target/100
local E=P.gameEnv
BG.set(s==1 and'bg1'or s==2 and'bg2'or s==3 and'rainbow'or 'rainbow2')
E.lock=rush_lock[s]
E.wait=rush_wait[s]
E.fall=rush_fall[s]
E.das=10-s
if s==2 then
E.arr=2
elseif s==4 then
E.bone=true
end
if s==5 then
D.pt=500
P:win('finish')
else
D.target=D.target+100
P:_showText(text.stage:gsub("$1",s),0,-120,80,'fly')
end
SFX.play('reach')
end
end,
task=function(P)
P:set20G(true)
P.lockDelay=rush_lock[1]
P.gameEnv.lock=rush_lock[1]
P.gameEnv.wait=rush_wait[1]
P.gameEnv.fall=rush_fall[1]
P.modeData.pt=0
P.modeData.target=100
end,
}

View File

@@ -0,0 +1,67 @@
local rush_lock={20,18,16,15,14, 14,13,12,11,11}
local rush_wait={12,11,11,10,10, 10,10, 9, 9, 9}
local rush_fall={18,16,14,13,12, 12,11,11,10,10}
return{
dropPiece=function(P)
local D=P.modeData
local c=#P.clearedRow
if c==0 and D.pt%100==99 then return end
local s=c<3 and c+1 or c==3 and 5 or 7
if P.combo>7 then s=s+2
elseif P.combo>3 then s=s+1
end
D.pt=D.pt+s
if D.pt%100==99 then
SFX.play('blip_1')
elseif D.pt>=D.target then--Level up!
s=D.target/100
local E=P.gameEnv
E.lock=rush_lock[s]
E.wait=rush_wait[s]
E.fall=rush_fall[s]
if s==2 then
E.das=8
BG.set('rainbow')
elseif s==4 then
BG.set('rainbow2')
elseif s==5 then
if P.stat.frame>260*60 then
D.pt=500
P:win('finish')
return
else
P.gameEnv.freshLimit=10
E.das=7
BG.set('glow')
BGM.play('secret8th remix')
end
elseif s==7 then
E.das=6
BG.set('lightning')
elseif s==9 then
E.bone=true
elseif s==10 then
D.pt=1000
P:win('finish')
return
end
D.target=D.target+100
P:_showText(text.stage:gsub("$1",s),0,-120,80,'fly')
SFX.play('reach')
end
end,
task=function(P)
P:set20G(true)
P.lockDelay=rush_lock[1]
P.gameEnv.lock=rush_lock[1]
P.gameEnv.wait=rush_wait[1]
P.gameEnv.fall=rush_fall[1]
P.modeData.pt=0
P.modeData.target=100
end,
}

View File

@@ -0,0 +1,140 @@
return
{
dropPiece=function(P)
local p=P.modeData.pt+P.lastPiece.row
if p>=P.modeData.target then
local ENV=P.gameEnv
local T=P.modeData.target
--Stage 1: clear 3 techrash
if T==12 then--Stage 2: swap color of S/Z & J/L
P.waiting=30
P.curMission=false
ENV.skin[1],ENV.skin[2]=ENV.skin[2],ENV.skin[1]
ENV.skin[3],ENV.skin[4]=ENV.skin[4],ENV.skin[3]
ENV.lock=14
ENV.wait=7
ENV.fall=7
P:setNext(4)
P.modeData.target=26
SFX.play('reach')
elseif T==26 then--Stage 3: dig to bottom
if not P.holdQueue[1]then P.life=P.life+1 end--1 up if ban hold
P.waiting=45
ENV.skin[1],ENV.skin[2]=ENV.skin[2],ENV.skin[1]
ENV.skin[3],ENV.skin[4]=ENV.skin[4],ENV.skin[3]
for i=1,10 do
if P.field[i]then
for j=1,10 do
if P.field[i][j]>0 then
P.field[i][j]=17
P.visTime[i][j]=15
end
end
for _=1,5 do
P.field[i][P.holeRND:random(10)]=0
end
else
P.field[i]=FREEROW.get(0)
P.visTime[i]=FREEROW.get(30)
for j=1,10 do
if P.holeRND:random()>.9 then
P.field[i][j]=P.holeRND:random(16)
end
end
P.field[i][P.holeRND:random(10)]=0
end
P.field[i].garbage=true
end
P.garbageBeneath=10
for i=1,10 do
P:createClearingFX(i,1.5)
end
SYSFX.newShade(2.5,P.absFieldX,P.y+300*P.size,300*P.size,300*P.size)
ENV.lock=13
ENV.wait=6
ENV.fall=6
P:setNext(5)
P.modeData.target=42
SFX.play('reach')
elseif T==42 then--Stage 4: survive in high speed
if P.garbageBeneath==0 then
P.waiting=30
ENV.lock=11
P:setNext(6)
P:setHold(false)
ENV.bone=true
P.modeData.target=62
else
p=41
end
elseif T==62 then--Stage 5: survive without easy-fresh rule
P.life=P.life+1
ENV.lock=13
ENV.wait=5
ENV.fall=5
ENV.easyFresh=false
P.modeData.target=126
SFX.play('reach')
elseif T==126 then--Stage 6: speed up
P.life=P.life+1
ENV.lock=11
ENV.wait=4
ENV.fall=4
P.modeData.target=162
elseif T==162 then--Stage 7: speed up+++
P.life=P.life+1
ENV.lock=10
P:setHold(true)
P:setInvisible(180)
P.modeData.target=226
SFX.play('reach')
elseif T==226 then--Stage 8: final invisible
P.life=P.life+1
ENV.bone=false
P:setInvisible(90)
P.modeData.target=259
SFX.play('reach')
elseif T==259 then--Stage 9: ending
P.life=P.life+1
for i=1,7 do ENV.skin[i]=P.holeRND:random(16)end
P:setInvisible(40)
ENV.lock=15
P.curMission=1
ENV.mission={4,4,4,4,4,4,4,4}
ENV.missionKill=false
P.modeData.target=260
p=260
SFX.play('blip_2')
else
p=260
end
end
P.modeData.pt=p
end,
task=function(P)
P:set20G(true)
P.lockDelay=15
P.gameEnv.lock=15
P.gameEnv.wait=10
P.gameEnv.fall=10
P.modeData.target=12
end,
}

View File

@@ -0,0 +1,62 @@
local death_lock={12,11,10,9,8, 7,7,7,6,6}
local death_wait={10, 9, 8,7,6, 6,5,4,4,3}
local death_fall={10, 9, 8,7,6, 5,5,4,3,3}
return{
dropPiece=function(P)
local D=P.modeData
local c=#P.clearedRow
if c==0 and D.pt%100==99 then return end
local s=c<3 and c+1 or c==3 and 5 or 7
if P.combo>7 then s=s+2
elseif P.combo>3 then s=s+1
end
D.pt=D.pt+s
if D.pt%100==99 then
SFX.play('blip_1')
elseif D.pt>=D.target then--Level up!
s=D.target/100
local E=P.gameEnv
SFX.play('reach')
E.lock=death_lock[s]
E.wait=death_wait[s]
E.fall=death_fall[s]
E.das=math.floor(6.9-s*.4)
if s==1 then
BG.set('rainbow')
elseif s==2 then
BG.set('rainbow2')
elseif s==3 then
BG.set('glow')
elseif s==5 then
if P.stat.frame>183*60 then
D.pt=500
P:win('finish')
return
else
P.gameEnv.freshLimit=10
BG.set('lightning')
BGM.play('secret7th remix')
end
elseif s==10 then
D.pt=1000
P:win('finish')
return
end
D.target=D.target+100
P:_showText(text.stage:gsub("$1",s),0,-120,80,'fly')
end
end,
task=function(P)
P:set20G(true)
P.lockDelay=death_lock[1]
P.gameEnv.lock=death_lock[1]
P.gameEnv.wait=death_wait[1]
P.gameEnv.fall=death_fall[1]
P.modeData.pt=0
P.modeData.target=100
end,
}

View File

@@ -0,0 +1,13 @@
return function(P)
if P.lastPiece.pc then
P.gameEnv.heightLimit=4
if P.stat.pc%5==0 then
P.gameEnv.drop=math.max(P.gameEnv.drop-1,1)
end
else
P.gameEnv.heightLimit=P.gameEnv.heightLimit-P.lastPiece.row
end
if #P.field>P.gameEnv.heightLimit then
P:lose()
end
end

View File

@@ -0,0 +1,46 @@
local pc_drop={50,45,40,35,30,26,22,18,15,12}
local pc_lock={55,50,46,42,39,36,33,31,29,27}
local pc_fall={18,16,14,12,10,9,8,7,6,5}
local PCbase=require"parts.modes.PCbase"
local PClist=require"parts.modes.PClist"
local function task_PC(P)
if P.frameRun>180 then
P.control=false
for _=1,26 do YIELD()end
P.control=true
end
local base=PCbase[P.modeData.type]
P:pushLineList(base[P.holeRND:random(#base)],P.modeData.symmetry)
end
local function check(P)
local f=P.field
if #f>0 then
if #f+P.stat.row%4>4 then
P:lose()
end
else
local type=P.stat.pc<10 and 4 or 5
local L=PClist[type][P.holeRND:random(#PClist[type])]
local symmetry=P.holeRND:random()>.5
P.modeData.type=type
P.modeData.symmetry=symmetry
P:pushNextList(L,symmetry)
P.modeData.counter=P.stat.piece==0 and 20 or 0
P:newTask(task_PC)
local s=P.stat.pc*.25
if math.floor(s)==s and s>0 then
P.gameEnv.drop=pc_drop[s]or 10
P.gameEnv.lock=pc_lock[s]or 25
P.gameEnv.fall=pc_fall[s]or 4
if s==10 then
P:_showText(text.maxspeed,0,-140,100,'appear',.6)
end
end
end
end
return{
dropPiece=check,
task=check,
}

View File

@@ -0,0 +1,37 @@
local PCbase=require"parts.modes.PCbase"
local PClist=require"parts.modes.PClist"
local PCtype={
1,1,1,1,2,
1,1,1,1,3,
1,1,1,2,
1,2,1,3,
1,2,3,
}
local function task_PC(P)
P.control=false
for _=1,26 do YIELD()end
P.control=true
local base=PCbase[P.modeData.type]
P:pushLineList(base[P.holeRND:random(#base)],P.modeData.symmetry)
end
local function check(P)
local r=P.field
if #r>0 then
if #r+P.stat.row%4>4 then
P:lose()
end
else
local type=PCtype[P.stat.pc+1]or 3
local L=PClist[type][P.holeRND:random(#PClist[type])]
local symmetry=P.holeRND:random()>.5
P.modeData.type=type
P.modeData.symmetry=symmetry
P:pushNextList(L,symmetry)
P.modeData.counter=P.stat.piece==0 and 20 or 0
P:newTask(task_PC)
end
end
return{
dropPiece=check,
task=check,
}

View File

@@ -0,0 +1,36 @@
local dropSpeed={[0]=40,33,27,20,16,12,11,10,9,8,7,6,5,4,3,3,2,2,1,1}
return{
dropPiece=function(P)
if P.stat.row>=P.modeData.target then
if P.modeData.target==200 then
P:win('finish')
else
P.modeData.bpm=40+2*P.modeData.target/10
P.modeData.beatFrame=math.floor(3600/P.modeData.bpm)
P.gameEnv.fall=P.modeData.beatFrame
P.gameEnv.wait=math.max(P.gameEnv.wait-2,0)
P.gameEnv.drop=dropSpeed[P.modeData.target/10]
P.modeData.target=P.modeData.target+10
SFX.play('reach')
end
end
end,
task=function(P)
P.modeData.target=10
P.modeData.bpm=40
P.modeData.beatFrame=90
P.modeData.counter=90
while true do
YIELD()
P.modeData.counter=P.modeData.counter-1
if P.modeData.counter==0 then
P.modeData.counter=P.modeData.beatFrame
SFX.play('click',.3)
P:switchKey(6,true)
P:pressKey(6)
P:switchKey(6,false)
end
end
end,
}

View File

@@ -0,0 +1,36 @@
local dropSpeed={[0]=60,50,40,30,24,18,14,10,8,6,5,4,3,2,1,1,.5,.5,.25,.25}
return{
dropPiece=function(P)
if P.stat.row>=P.modeData.target then
if P.modeData.target==200 then
P:win('finish')
else
P.modeData.bpm=60+3*P.modeData.target/10
P.modeData.beatFrame=math.floor(3600/P.modeData.bpm)
P.gameEnv.fall=P.modeData.beatFrame
P.gameEnv.wait=math.max(P.gameEnv.wait-1,0)
P.gameEnv.drop=dropSpeed[P.modeData.target/10]
P.modeData.target=P.modeData.target+10
SFX.play('reach')
end
end
end,
task=function(P)
P.modeData.target=10
P.modeData.bpm=60
P.modeData.beatFrame=60
P.modeData.counter=60
while true do
YIELD()
P.modeData.counter=P.modeData.counter-1
if P.modeData.counter==0 then
P.modeData.counter=P.modeData.beatFrame
SFX.play('click',.3)
P:switchKey(6,true)
P:pressKey(6)
P:switchKey(6,false)
end
end
end,
}

View File

@@ -0,0 +1,40 @@
return{
dropPiece=function(P)
if P.stat.row>=P.modeData.target then
if P.modeData.target==200 then
P:win('finish')
else
P.modeData.bpm=120+2*P.modeData.target/10
P.modeData.beatFrame=math.floor(3600/P.modeData.bpm)
P.gameEnv.fall=P.modeData.beatFrame
P.gameEnv.wait=math.max(P.gameEnv.wait-1,0)
if P.modeData.target==50 then
P.gameEnv.das=5
P.gameEnv.drop=.25
elseif P.modeData.target==100 then
P.gameEnv.das=4
P:set20G(true)
end
P.modeData.target=P.modeData.target+10
SFX.play('reach')
end
end
end,
task=function(P)
P.modeData.target=10
P.modeData.bpm=120
P.modeData.beatFrame=30
P.modeData.counter=30
while true do
YIELD()
P.modeData.counter=P.modeData.counter-1
if P.modeData.counter==0 then
P.modeData.counter=P.modeData.beatFrame
SFX.play('click',.3)
P:switchKey(6,true)
P:pressKey(6)
P:switchKey(6,false)
end
end
end,
}

View File

@@ -0,0 +1,19 @@
return{
task=function(P)
while true do
YIELD()
if P.control then
local D=P.modeData
D.timer=D.timer+1
if D.timer>=math.max(60,150-2*D.wave)and P.atkBufferSum<4 then
table.insert(P.atkBuffer,{line=generateLine(P.holeRND:random(10)),amount=1,countdown=30,cd0=30,time=0,sent=false,lv=1})
P.atkBufferSum=P.atkBufferSum+1
P.stat.recv=P.stat.recv+1
if D.wave==45 then P:_showText(text.maxspeed,0,-140,100,'appear',.6)end
D.timer=0
D.wave=D.wave+1
end
end
end
end,
}

View File

@@ -0,0 +1,26 @@
return{
task=function(P)
while true do
YIELD()
if P.control then
local D=P.modeData
D.timer=D.timer+1
if D.timer>=math.max(60,180-2*D.wave)and P.atkBufferSum<15 then
local s
if D.wave%3<2 then
table.insert(P.atkBuffer,{line=generateLine(P.holeRND:random(10)),amount=1,countdown=0,cd0=0,time=0,sent=false,lv=1})
s=1
else
table.insert(P.atkBuffer,{line=generateLine(P.holeRND:random(10)),amount=3,countdown=60,cd0=60,time=0,sent=false,lv=2})
s=3
end
P.atkBufferSum=P.atkBufferSum+s
P.stat.recv=P.stat.recv+s
if D.wave==60 then P:_showText(text.maxspeed,0,-140,100,'appear',.6)end
D.timer=0
D.wave=D.wave+1
end
end
end
end,
}

View File

@@ -0,0 +1,20 @@
return{
task=function(P)
while true do
YIELD()
if P.control then
local D=P.modeData
D.timer=D.timer+1
if D.timer>=math.max(60,150-D.wave)and P.atkBufferSum<20 then
local t=math.max(60,90-D.wave)
table.insert(P.atkBuffer,{line=generateLine(P.holeRND:random(10)),amount=4,countdown=t,cd0=t,time=0,sent=false,lv=3})
P.atkBufferSum=P.atkBufferSum+4
P.stat.recv=P.stat.recv+4
if D.wave==60 then P:_showText(text.maxspeed,0,-140,100,'appear',.6)end
D.timer=0
D.wave=D.wave+1
end
end
end
end,
}

View File

@@ -0,0 +1,25 @@
return{
task=function(P)
while true do
YIELD()
if P.control then
local D=P.modeData
D.timer=D.timer+1
if D.timer>=math.max(90,180-2*D.wave)and P.atkBufferSum<8 then
local d=D.wave+1
table.insert(P.atkBuffer,
d%4==0 and{line=generateLine(P.holeRND:random(10)),amount=1,countdown=60,cd0=60,time=0,sent=false,lv=1}or
d%4==1 and{line=generateLine(P.holeRND:random(10)),amount=2,countdown=70,cd0=70,time=0,sent=false,lv=1}or
d%4==2 and{line=generateLine(P.holeRND:random(10)),amount=3,countdown=80,cd0=80,time=0,sent=false,lv=2}or
d%4==3 and{line=generateLine(P.holeRND:random(10)),amount=4,countdown=90,cd0=90,time=0,sent=false,lv=3}
)
P.atkBufferSum=P.atkBufferSum+d%4+1
P.stat.recv=P.stat.recv+d%4+1
if D.wave==45 then P:_showText(text.maxspeed,0,-140,100,'appear',.6)end
D.timer=0
D.wave=d
end
end
end
end,
}

View File

@@ -0,0 +1,23 @@
return{
task=function(P)
while true do
YIELD()
if P.control then
local D=P.modeData
D.timer=D.timer+1
if D.timer>=math.max(300,600-10*D.wave)and P.atkBufferSum<20 then
local t=math.max(300,480-12*D.wave)
table.insert(P.atkBuffer,{line=generateLine(P.holeRND:random(10)),amount=4,countdown=t,cd0=t,time=0,sent=false,lv=2})
table.insert(P.atkBuffer,{line=generateLine(P.holeRND:random(10)),amount=4,countdown=t,cd0=t,time=0,sent=false,lv=3})
table.insert(P.atkBuffer,{line=generateLine(P.holeRND:random(10)),amount=6,countdown=1.2*t,cd0=1.2*t,time=0,sent=false,lv=4})
table.insert(P.atkBuffer,{line=generateLine(P.holeRND:random(10)),amount=6,countdown=1.5*t,cd0=1.5*t,time=0,sent=false,lv=5})
P.atkBufferSum=P.atkBufferSum+20
P.stat.recv=P.stat.recv+20
if D.wave==31 then P:_showText(text.maxspeed,0,-140,100,'appear',.6)end
D.timer=0
D.wave=D.wave+1
end
end
end
end,
}

23
parts/eventsets/tsd_h.lua Normal file
View File

@@ -0,0 +1,23 @@
return{
dropPiece=function(P)
local C=P.lastPiece
if C.row>0 then
if C.id==5 and C.row==2 and C.spin then
local L=P.modeData.history
if L[1]==C.centX and L[1]==L[2]and L[1]==L[3]then
P:showText("STACK",0,-140,40,'flicker',.3)
P:lose()
else
P.modeData.tsd=P.modeData.tsd+1
table.insert(L,1,C.centX)
L[4]=nil
end
else
P:lose()
end
end
end,
task=function(P)
P.modeData.history={}
end,
}

22
parts/eventsets/tsd_u.lua Normal file
View File

@@ -0,0 +1,22 @@
return{
dropPiece=function(P)
local C=P.lastPiece
if C.row>0 then
if C.id==5 and C.row==2 and C.spin then
if TABLE.find(P.modeData.history,C.centX)then
P:showText("STACK",0,-140,40,'flicker',.3)
P:lose()
else
P.modeData.tsd=P.modeData.tsd+1
table.insert(P.modeData.history,1,C.centX)
P.modeData.history[5]=nil
end
else
P:lose()
end
end
end,
task=function(P)
P.modeData.history={}
end,
}

20
parts/eventsets/ultra.lua Normal file
View File

@@ -0,0 +1,20 @@
local warnTime={60,90,105,115,116,117,118,119,120}
return{
task=function(P)
P.modeData.stage=1
while true do
YIELD()
if P.stat.frame/60>=warnTime[P.modeData.stage]then
if P.modeData.stage<9 then
P.modeData.stage=P.modeData.stage+1
SFX.play('ready',.7+P.modeData.stage*.03)
else
SFX.play('start')
P:win('finish')
return
end
end
end
end,
}