玩家的随机数生成器独立为四个,尝试避免联网对战时不同步错误,整理代码
This commit is contained in:
@@ -272,7 +272,7 @@ return{
|
|||||||
|
|
||||||
--Check if time to change target
|
--Check if time to change target
|
||||||
yield()
|
yield()
|
||||||
if P:RND()<.00126 then
|
if P.aiRND:random()<.00126 then
|
||||||
P:changeAtkMode(rnd()<.85 and 1 or #P.atker>3 and 4 or rnd()<.3 and 2 or 3)
|
P:changeAtkMode(rnd()<.85 and 1 or #P.atker>3 and 4 or rnd()<.3 and 2 or 3)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -315,7 +315,7 @@ return{
|
|||||||
|
|
||||||
--Check if time to change target
|
--Check if time to change target
|
||||||
yield()
|
yield()
|
||||||
if P:RND()<.00126 then
|
if P.aiRND:random()<.00126 then
|
||||||
P:changeAtkMode(rnd()<.85 and 1 or #P.atker>3 and 4 or rnd()<.3 and 2 or 3)
|
P:changeAtkMode(rnd()<.85 and 1 or #P.atker>3 and 4 or rnd()<.3 and 2 or 3)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -12,12 +12,12 @@ return{
|
|||||||
local D=P.modeData
|
local D=P.modeData
|
||||||
if D.wave<20 then
|
if D.wave<20 then
|
||||||
local t=1500-30*D.wave--1500~900
|
local t=1500-30*D.wave--1500~900
|
||||||
table.insert(P.atkBuffer,{line=generateLine(P:RND(4,7)),amount=12,countdown=t,cd0=t,time=0,sent=false,lv=3})
|
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:RND(3,8)),amount=10,countdown=t,cd0=t,time=0,sent=false,lv=4})
|
table.insert(P.atkBuffer,{line=generateLine(P.holeRND:random(3,8)),amount=10,countdown=t,cd0=t,time=0,sent=false,lv=4})
|
||||||
else
|
else
|
||||||
local t=900-10*(D.wave-20)--900~600
|
local t=900-10*(D.wave-20)--900~600
|
||||||
table.insert(P.atkBuffer,{line=generateLine(P:RND(10)),amount=14,countdown=t,cd0=t,time=0,sent=false,lv=4})
|
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:RND(4,7)),amount=8,countdown=t,cd0=t,time=0,sent=false,lv=5})
|
table.insert(P.atkBuffer,{line=generateLine(P.holeRND:random(4,7)),amount=8,countdown=t,cd0=t,time=0,sent=false,lv=5})
|
||||||
end
|
end
|
||||||
P.atkBufferSum=P.atkBufferSum+22
|
P.atkBufferSum=P.atkBufferSum+22
|
||||||
P.stat.recv=P.stat.recv+22
|
P.stat.recv=P.stat.recv+22
|
||||||
|
|||||||
@@ -12,16 +12,16 @@ return{
|
|||||||
local s
|
local s
|
||||||
local t=800-10*D.wave--800~700~600~500
|
local t=800-10*D.wave--800~700~600~500
|
||||||
if D.wave<10 then
|
if D.wave<10 then
|
||||||
table.insert(P.atkBuffer,{line=generateLine(P:RND(5,6)),amount=9,countdown=t,cd0=t,time=0,sent=false,lv=3})
|
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:RND(4,7)),amount=11,countdown=t,cd0=t+62,time=0,sent=false,lv=4})
|
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
|
s=20
|
||||||
elseif D.wave<20 then
|
elseif D.wave<20 then
|
||||||
table.insert(P.atkBuffer,{line=generateLine(P:RND(3,8)),amount=11,countdown=t,cd0=t,time=0,sent=false,lv=4})
|
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:RND(4,7)),amount=13,countdown=t,cd0=t+62,time=0,sent=false,lv=5})
|
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
|
s=24
|
||||||
else
|
else
|
||||||
table.insert(P.atkBuffer,{line=generateLine(P:RND(2)*9-8),amount=14,countdown=t,cd0=t,time=0,sent=false,lv=5})
|
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:RND(3,8)),amount=14,countdown=t+62,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
|
s=28
|
||||||
end
|
end
|
||||||
P.atkBufferSum=P.atkBufferSum+s
|
P.atkBufferSum=P.atkBufferSum+s
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ return{
|
|||||||
freshLimit=15,
|
freshLimit=15,
|
||||||
dropPiece=function(P)
|
dropPiece=function(P)
|
||||||
if P.lastPiece.atk>0 then
|
if P.lastPiece.atk>0 then
|
||||||
P:receive(nil,P.lastPiece.atk,60,generateLine(P:RND(10)))
|
P:receive(nil,P.lastPiece.atk,60,generateLine(P.holeRND:random(10)))
|
||||||
end
|
end
|
||||||
if P.stat.atk>=100 then
|
if P.stat.atk>=100 then
|
||||||
P:win('finish')
|
P:win('finish')
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ return{
|
|||||||
freshLimit=15,
|
freshLimit=15,
|
||||||
dropPiece=function(P)
|
dropPiece=function(P)
|
||||||
if P.lastPiece.atk>0 then
|
if P.lastPiece.atk>0 then
|
||||||
P:receive(nil,P.lastPiece.atk,30,generateLine(P:RND(10)))
|
P:receive(nil,P.lastPiece.atk,30,generateLine(P.holeRND:random(10)))
|
||||||
end
|
end
|
||||||
if P.stat.atk>=100 then
|
if P.stat.atk>=100 then
|
||||||
P:win('finish')
|
P:win('finish')
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ return{
|
|||||||
drop=30,lock=60,
|
drop=30,lock=60,
|
||||||
dropPiece=function(P)
|
dropPiece=function(P)
|
||||||
if P.lastPiece.atk>0 then
|
if P.lastPiece.atk>0 then
|
||||||
P:receive(nil,P.lastPiece.atk,120,generateLine(P:RND(10)))
|
P:receive(nil,P.lastPiece.atk,120,generateLine(P.holeRND:random(10)))
|
||||||
end
|
end
|
||||||
if P.stat.atk>=100 then
|
if P.stat.atk>=100 then
|
||||||
P:win('finish')
|
P:win('finish')
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ return{
|
|||||||
freshLimit=10,
|
freshLimit=10,
|
||||||
dropPiece=function(P)
|
dropPiece=function(P)
|
||||||
if P.lastPiece.atk>0 then
|
if P.lastPiece.atk>0 then
|
||||||
P:receive(nil,P.lastPiece.atk,0,generateLine(P:RND(10)))
|
P:receive(nil,P.lastPiece.atk,0,generateLine(P.holeRND:random(10)))
|
||||||
end
|
end
|
||||||
if P.stat.atk>=100 then
|
if P.stat.atk>=100 then
|
||||||
P:win('finish')
|
P:win('finish')
|
||||||
|
|||||||
@@ -37,18 +37,18 @@ return{
|
|||||||
P.visTime[i]=FREEROW.get(20)
|
P.visTime[i]=FREEROW.get(20)
|
||||||
for x=4,7 do F[i][x]=0 end
|
for x=4,7 do F[i][x]=0 end
|
||||||
end
|
end
|
||||||
if P:RND()<.6 then
|
if P.holeRND:random()<.6 then
|
||||||
local initCell={11,14,12,13,21,24}
|
local initCell={11,14,12,13,21,24}
|
||||||
for _=1,3 do
|
for _=1,3 do
|
||||||
_=rem(initCell,P:RND(#initCell))
|
_=rem(initCell,P.holeRND:random(#initCell))
|
||||||
F[math.floor(_/10)][3+_%10]=20
|
F[math.floor(_/10)][3+_%10]=20
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
local initCell={11,12,13,14,21,22,23,24}
|
local initCell={11,12,13,14,21,22,23,24}
|
||||||
rem(initCell,P:RND(5,8))
|
rem(initCell,P.holeRND:random(5,8))
|
||||||
rem(initCell,P:RND(1,4))
|
rem(initCell,P.holeRND:random(1,4))
|
||||||
for _=1,6 do
|
for _=1,6 do
|
||||||
_=rem(initCell,P:RND(#initCell))
|
_=rem(initCell,P.holeRND:random(#initCell))
|
||||||
F[math.floor(_/10)][3+_%10]=20
|
F[math.floor(_/10)][3+_%10]=20
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -35,18 +35,18 @@ return{
|
|||||||
P.visTime[i]=FREEROW.get(20)
|
P.visTime[i]=FREEROW.get(20)
|
||||||
for x=4,7 do F[i][x]=0 end
|
for x=4,7 do F[i][x]=0 end
|
||||||
end
|
end
|
||||||
if P:RND()<.6 then
|
if P.holeRND:random()<.6 then
|
||||||
local initCell={11,14,12,13,21,24}
|
local initCell={11,14,12,13,21,24}
|
||||||
for _=1,3 do
|
for _=1,3 do
|
||||||
_=rem(initCell,P:RND(#initCell))
|
_=rem(initCell,P.holeRND:random(#initCell))
|
||||||
F[math.floor(_/10)][3+_%10]=20
|
F[math.floor(_/10)][3+_%10]=20
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
local initCell={11,12,13,14,21,22,23,24}
|
local initCell={11,12,13,14,21,22,23,24}
|
||||||
rem(initCell,P:RND(5,8))
|
rem(initCell,P.holeRND:random(5,8))
|
||||||
rem(initCell,P:RND(1,4))
|
rem(initCell,P.holeRND:random(1,4))
|
||||||
for _=1,6 do
|
for _=1,6 do
|
||||||
_=rem(initCell,P:RND(#initCell))
|
_=rem(initCell,P.holeRND:random(#initCell))
|
||||||
F[math.floor(_/10)][3+_%10]=20
|
F[math.floor(_/10)][3+_%10]=20
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ return{
|
|||||||
if D.counter>=t then
|
if D.counter>=t then
|
||||||
D.counter=0
|
D.counter=0
|
||||||
for _=1,4 do
|
for _=1,4 do
|
||||||
table.insert(P.atkBuffer,{line=generateLine(P:RND(10)),amount=1,countdown=5*t,cd0=5*t,time=0,sent=false,lv=2})
|
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
|
end
|
||||||
P.atkBufferSum=P.atkBufferSum+4
|
P.atkBufferSum=P.atkBufferSum+4
|
||||||
P.stat.recv=P.stat.recv+4
|
P.stat.recv=P.stat.recv+4
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ return{
|
|||||||
if D.counter>=t then
|
if D.counter>=t then
|
||||||
D.counter=0
|
D.counter=0
|
||||||
for _=1,3 do
|
for _=1,3 do
|
||||||
table.insert(P.atkBuffer,{line=generateLine(P:RND(10)),amount=1,countdown=2*t,cd0=2*t,time=0,sent=false,lv=1})
|
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
|
end
|
||||||
P.atkBufferSum=P.atkBufferSum+3
|
P.atkBufferSum=P.atkBufferSum+3
|
||||||
P.stat.recv=P.stat.recv+3
|
P.stat.recv=P.stat.recv+3
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ return{
|
|||||||
end
|
end
|
||||||
|
|
||||||
FREEROW.discard(height)
|
FREEROW.discard(height)
|
||||||
P:getNext(wei[P:RND(#wei)])
|
P:getNext(wei[P.seqRND:random(#wei)])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ local function check_rise(P)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
for _=1,8-L do
|
for _=1,8-L do
|
||||||
P:garbageRise(13,1,generateLine(P:RND(10)))
|
P:garbageRise(13,1,generateLine(P.holeRND:random(10)))
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if L==0 then
|
if L==0 then
|
||||||
@@ -17,7 +17,7 @@ local function check_rise(P)
|
|||||||
SFX.play('clear')
|
SFX.play('clear')
|
||||||
BG.send(26)
|
BG.send(26)
|
||||||
for _=1,8 do
|
for _=1,8 do
|
||||||
P:garbageRise(13,1,generateLine(P:RND(10)))
|
P:garbageRise(13,1,generateLine(P.holeRND:random(10)))
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
BG.send(#P.clearedRow)
|
BG.send(#P.clearedRow)
|
||||||
@@ -38,7 +38,7 @@ return{
|
|||||||
PLY.newPlayer(1)
|
PLY.newPlayer(1)
|
||||||
local P=PLAYERS[1]
|
local P=PLAYERS[1]
|
||||||
for _=1,8 do
|
for _=1,8 do
|
||||||
P:garbageRise(13,1,generateLine(P:RND(10)))
|
P:garbageRise(13,1,generateLine(P.holeRND:random(10)))
|
||||||
end
|
end
|
||||||
P.fieldBeneath=0
|
P.fieldBeneath=0
|
||||||
end,
|
end,
|
||||||
|
|||||||
@@ -45,17 +45,17 @@ return{
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
for _=1,5 do
|
for _=1,5 do
|
||||||
P.field[i][P:RND(10)]=0
|
P.field[i][P.holeRND:random(10)]=0
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
P.field[i]=FREEROW.get(0)
|
P.field[i]=FREEROW.get(0)
|
||||||
P.visTime[i]=FREEROW.get(30)
|
P.visTime[i]=FREEROW.get(30)
|
||||||
for j=1,10 do
|
for j=1,10 do
|
||||||
if P:RND()>.9 then
|
if P.holeRND:random()>.9 then
|
||||||
P.field[i][j]=math.random(16)
|
P.field[i][j]=math.random(16)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
P.field[i][P:RND(10)]=0
|
P.field[i][P.holeRND:random(10)]=0
|
||||||
end
|
end
|
||||||
P.field[i].garbage=true
|
P.field[i].garbage=true
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ local function task_PC(P)
|
|||||||
D.counter=D.counter+1
|
D.counter=D.counter+1
|
||||||
if D.counter==26 then
|
if D.counter==26 then
|
||||||
local base=PCbase[D.type]
|
local base=PCbase[D.type]
|
||||||
P:pushLineList(base[P:RND(#base)],D.symmetry)
|
P:pushLineList(base[P.holeRND:random(#base)],D.symmetry)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -23,8 +23,8 @@ local function check(P)
|
|||||||
end
|
end
|
||||||
else
|
else
|
||||||
local type=P.stat.pc<10 and 4 or 5
|
local type=P.stat.pc<10 and 4 or 5
|
||||||
local L=PClist[type][P:RND(#PClist[type])]
|
local L=PClist[type][P.holeRND:random(#PClist[type])]
|
||||||
local symmetry=P:RND()>.5
|
local symmetry=P.holeRND:random()>.5
|
||||||
P.modeData.type=type
|
P.modeData.type=type
|
||||||
P.modeData.symmetry=symmetry
|
P.modeData.symmetry=symmetry
|
||||||
P:pushNextList(L,symmetry)
|
P:pushNextList(L,symmetry)
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ local function task_PC(P)
|
|||||||
D.counter=D.counter+1
|
D.counter=D.counter+1
|
||||||
if D.counter==26 then
|
if D.counter==26 then
|
||||||
local base=PCbase[D.type]
|
local base=PCbase[D.type]
|
||||||
P:pushLineList(base[P:RND(#base)],D.symmetry)
|
P:pushLineList(base[P.holeRND:random(#base)],D.symmetry)
|
||||||
end
|
end
|
||||||
YIELD()
|
YIELD()
|
||||||
end
|
end
|
||||||
@@ -26,8 +26,8 @@ local function check(P)
|
|||||||
end
|
end
|
||||||
else
|
else
|
||||||
local type=PCtype[P.stat.pc+1]or 3
|
local type=PCtype[P.stat.pc+1]or 3
|
||||||
local L=PClist[type][P:RND(#PClist[type])]
|
local L=PClist[type][P.holeRND:random(#PClist[type])]
|
||||||
local symmetry=P:RND()>.5
|
local symmetry=P.holeRND:random()>.5
|
||||||
P.modeData.type=type
|
P.modeData.type=type
|
||||||
P.modeData.symmetry=symmetry
|
P.modeData.symmetry=symmetry
|
||||||
P:pushNextList(L,symmetry)
|
P:pushNextList(L,symmetry)
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ return{
|
|||||||
local D=P.modeData
|
local D=P.modeData
|
||||||
D.timer=D.timer+1
|
D.timer=D.timer+1
|
||||||
if D.timer>=math.max(60,150-2*D.wave)and P.atkBufferSum<4 then
|
if D.timer>=math.max(60,150-2*D.wave)and P.atkBufferSum<4 then
|
||||||
table.insert(P.atkBuffer,{line=generateLine(P:RND(10)),amount=1,countdown=30,cd0=30,time=0,sent=false,lv=1})
|
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.atkBufferSum=P.atkBufferSum+1
|
||||||
P.stat.recv=P.stat.recv+1
|
P.stat.recv=P.stat.recv+1
|
||||||
if D.wave==45 then P:showTextF(text.maxspeed,0,-140,100,'appear',.6)end
|
if D.wave==45 then P:showTextF(text.maxspeed,0,-140,100,'appear',.6)end
|
||||||
|
|||||||
@@ -12,10 +12,10 @@ return{
|
|||||||
if D.timer>=math.max(60,180-2*D.wave)and P.atkBufferSum<15 then
|
if D.timer>=math.max(60,180-2*D.wave)and P.atkBufferSum<15 then
|
||||||
local s
|
local s
|
||||||
if D.wave%3<2 then
|
if D.wave%3<2 then
|
||||||
table.insert(P.atkBuffer,{line=generateLine(P:RND(10)),amount=1,countdown=0,cd0=0,time=0,sent=false,lv=1})
|
table.insert(P.atkBuffer,{line=generateLine(P.holeRND:random(10)),amount=1,countdown=0,cd0=0,time=0,sent=false,lv=1})
|
||||||
s=1
|
s=1
|
||||||
else
|
else
|
||||||
table.insert(P.atkBuffer,{line=generateLine(P:RND(10)),amount=3,countdown=60,cd0=60,time=0,sent=false,lv=2})
|
table.insert(P.atkBuffer,{line=generateLine(P.holeRND:random(10)),amount=3,countdown=60,cd0=60,time=0,sent=false,lv=2})
|
||||||
s=3
|
s=3
|
||||||
end
|
end
|
||||||
P.atkBufferSum=P.atkBufferSum+s
|
P.atkBufferSum=P.atkBufferSum+s
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ return{
|
|||||||
D.timer=D.timer+1
|
D.timer=D.timer+1
|
||||||
if D.timer>=math.max(60,150-D.wave)and P.atkBufferSum<20 then
|
if D.timer>=math.max(60,150-D.wave)and P.atkBufferSum<20 then
|
||||||
local t=math.max(60,90-D.wave)
|
local t=math.max(60,90-D.wave)
|
||||||
table.insert(P.atkBuffer,{line=generateLine(P:RND(10)),amount=4,countdown=t,cd0=t,time=0,sent=false,lv=3})
|
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.atkBufferSum=P.atkBufferSum+4
|
||||||
P.stat.recv=P.stat.recv+4
|
P.stat.recv=P.stat.recv+4
|
||||||
if D.wave==60 then P:showTextF(text.maxspeed,0,-140,100,'appear',.6)end
|
if D.wave==60 then P:showTextF(text.maxspeed,0,-140,100,'appear',.6)end
|
||||||
|
|||||||
@@ -12,10 +12,10 @@ return{
|
|||||||
if D.timer>=math.max(90,180-2*D.wave)and P.atkBufferSum<8 then
|
if D.timer>=math.max(90,180-2*D.wave)and P.atkBufferSum<8 then
|
||||||
local d=D.wave+1
|
local d=D.wave+1
|
||||||
table.insert(P.atkBuffer,
|
table.insert(P.atkBuffer,
|
||||||
d%4==0 and{line=generateLine(P:RND(10)),amount=1,countdown=60,cd0=60,time=0,sent=false,lv=1}or
|
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:RND(10)),amount=2,countdown=70,cd0=70,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:RND(10)),amount=3,countdown=80,cd0=80,time=0,sent=false,lv=2}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:RND(10)),amount=4,countdown=90,cd0=90,time=0,sent=false,lv=3}
|
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.atkBufferSum=P.atkBufferSum+d%4+1
|
||||||
P.stat.recv=P.stat.recv+d%4+1
|
P.stat.recv=P.stat.recv+d%4+1
|
||||||
|
|||||||
@@ -13,10 +13,10 @@ return{
|
|||||||
D.timer=D.timer+1
|
D.timer=D.timer+1
|
||||||
if D.timer>=math.max(300,600-10*D.wave)and P.atkBufferSum<20 then
|
if D.timer>=math.max(300,600-10*D.wave)and P.atkBufferSum<20 then
|
||||||
local t=math.max(300,480-12*D.wave)
|
local t=math.max(300,480-12*D.wave)
|
||||||
table.insert(P.atkBuffer,{line=generateLine(P:RND(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=2})
|
||||||
table.insert(P.atkBuffer,{line=generateLine(P:RND(10)),amount=4,countdown=t,cd0=t,time=0,sent=false,lv=3})
|
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:RND(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.2*t,cd0=1.2*t,time=0,sent=false,lv=4})
|
||||||
table.insert(P.atkBuffer,{line=generateLine(P:RND(10)),amount=6,countdown=1.5*t,cd0=1.5*t,time=0,sent=false,lv=5})
|
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.atkBufferSum=P.atkBufferSum+20
|
||||||
P.stat.recv=P.stat.recv+20
|
P.stat.recv=P.stat.recv+20
|
||||||
if D.wave==31 then P:showTextF(text.maxspeed,0,-140,100,'appear',.6)end
|
if D.wave==31 then P:showTextF(text.maxspeed,0,-140,100,'appear',.6)end
|
||||||
|
|||||||
@@ -111,7 +111,10 @@ local function newEmptyPlayer(id,mini)
|
|||||||
P.draw=ply_draw.norm
|
P.draw=ply_draw.norm
|
||||||
end
|
end
|
||||||
|
|
||||||
P.randGen=love.math.newRandomGenerator(GAME.seed)
|
P.seqRND=love.math.newRandomGenerator(GAME.seed)
|
||||||
|
P.atkRND=love.math.newRandomGenerator(GAME.seed)
|
||||||
|
P.holeRND=love.math.newRandomGenerator(GAME.seed)
|
||||||
|
P.aiRND=love.math.newRandomGenerator(GAME.seed)
|
||||||
|
|
||||||
P.frameRun=GAME.frameStart
|
P.frameRun=GAME.frameStart
|
||||||
P.alive=true
|
P.alive=true
|
||||||
|
|||||||
@@ -121,10 +121,6 @@ end
|
|||||||
--------------------------</FX>--------------------------
|
--------------------------</FX>--------------------------
|
||||||
|
|
||||||
--------------------------<Method>--------------------------
|
--------------------------<Method>--------------------------
|
||||||
function Player:RND(a,b)
|
|
||||||
local R=self.randGen
|
|
||||||
return R:random(a,b)
|
|
||||||
end
|
|
||||||
function Player:newTask(code,...)
|
function Player:newTask(code,...)
|
||||||
local thread=coroutine.create(code)
|
local thread=coroutine.create(code)
|
||||||
resume(thread,self,...)
|
resume(thread,self,...)
|
||||||
@@ -227,11 +223,11 @@ end
|
|||||||
|
|
||||||
function Player:getHolePos()--Get a good garbage-line hole position
|
function Player:getHolePos()--Get a good garbage-line hole position
|
||||||
if self.garbageBeneath==0 then
|
if self.garbageBeneath==0 then
|
||||||
return generateLine(self:RND(10))
|
return generateLine(self.holeRND:random(10))
|
||||||
else
|
else
|
||||||
local p=self:RND(10)
|
local p=self.holeRND:random(10)
|
||||||
if self.field[1][p]<=0 then
|
if self.field[1][p]<=0 then
|
||||||
return generateLine(self:RND(10))
|
return generateLine(self.holeRND:random(10))
|
||||||
end
|
end
|
||||||
return generateLine(p)
|
return generateLine(p)
|
||||||
end
|
end
|
||||||
@@ -1336,7 +1332,7 @@ do--Player.drop(self)--Place piece
|
|||||||
local M=#self.atker
|
local M=#self.atker
|
||||||
if M>0 then
|
if M>0 then
|
||||||
for i=1,M do
|
for i=1,M do
|
||||||
self:attack(self.atker[i],send,sendTime,generateLine(self:RND(10)))
|
self:attack(self.atker[i],send,sendTime,generateLine(self.atkRND:random(10)))
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
T=randomTarget(self)
|
T=randomTarget(self)
|
||||||
@@ -1349,7 +1345,7 @@ do--Player.drop(self)--Place piece
|
|||||||
T=randomTarget(self)
|
T=randomTarget(self)
|
||||||
end
|
end
|
||||||
if T then
|
if T then
|
||||||
self:attack(T,send,sendTime,generateLine(self:RND(10)))
|
self:attack(T,send,sendTime,generateLine(self.atkRND:random(10)))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if self.sound and send>3 then SFX.play('emit',min(send,7)*.1)end
|
if self.sound and send>3 then SFX.play('emit',min(send,7)*.1)end
|
||||||
@@ -1709,8 +1705,7 @@ function Player:lose(force)
|
|||||||
if self.type=='remote'and not force then self.waiting=1e99 return end
|
if self.type=='remote'and not force then self.waiting=1e99 return end
|
||||||
if self.life>0 and not force then self:revive()return end
|
if self.life>0 and not force then self:revive()return end
|
||||||
self:die()
|
self:die()
|
||||||
local i=TABLE.find(PLY_ALIVE,self)
|
local p=TABLE.find(PLY_ALIVE,self)if p then rem(PLY_ALIVE,p)end
|
||||||
if i then rem(PLY_ALIVE,i)end
|
|
||||||
self.result='lose'
|
self.result='lose'
|
||||||
if GAME.modeEnv.royaleMode then
|
if GAME.modeEnv.royaleMode then
|
||||||
self:changeAtk()
|
self:changeAtk()
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ local yield=YIELD
|
|||||||
local seqGenerators={
|
local seqGenerators={
|
||||||
none=function()while true do yield()end end,
|
none=function()while true do yield()end end,
|
||||||
bag=function(P,seq0)
|
bag=function(P,seq0)
|
||||||
|
local rndGen=P.seqRND
|
||||||
local len=#seq0
|
local len=#seq0
|
||||||
local bag={}
|
local bag={}
|
||||||
while true do
|
while true do
|
||||||
@@ -14,12 +15,13 @@ local seqGenerators={
|
|||||||
bag[i]=seq0[len-i+1]
|
bag[i]=seq0[len-i+1]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
P:getNext(rem(bag,P:RND(#bag)))
|
P:getNext(rem(bag,rndGen:random(#bag)))
|
||||||
end
|
end
|
||||||
yield()
|
yield()
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
his=function(P,seq0)
|
his=function(P,seq0)
|
||||||
|
local rndGen=P.seqRND
|
||||||
local len=#seq0
|
local len=#seq0
|
||||||
local hisLen=ceil(len*.5)
|
local hisLen=ceil(len*.5)
|
||||||
local history=TABLE.new(0,hisLen)
|
local history=TABLE.new(0,hisLen)
|
||||||
@@ -27,7 +29,7 @@ local seqGenerators={
|
|||||||
while #P.nextQueue<6 do
|
while #P.nextQueue<6 do
|
||||||
local r
|
local r
|
||||||
for _=1,hisLen do--Reroll up to [hisLen] times
|
for _=1,hisLen do--Reroll up to [hisLen] times
|
||||||
r=P:RND(len)
|
r=rndGen:random(len)
|
||||||
for i=1,hisLen do
|
for i=1,hisLen do
|
||||||
if r==history[i]then
|
if r==history[i]then
|
||||||
goto CONTINUE_rollAgain
|
goto CONTINUE_rollAgain
|
||||||
@@ -43,6 +45,7 @@ local seqGenerators={
|
|||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
hisPool=function(P,seq0)
|
hisPool=function(P,seq0)
|
||||||
|
local rndGen=P.seqRND
|
||||||
local len=#seq0
|
local len=#seq0
|
||||||
local hisLen=ceil(len*.5)
|
local hisLen=ceil(len*.5)
|
||||||
local history=TABLE.new(0,hisLen)--Indexes of mino-index
|
local history=TABLE.new(0,hisLen)--Indexes of mino-index
|
||||||
@@ -51,7 +54,7 @@ local seqGenerators={
|
|||||||
local droughtTimes=TABLE.new(len,len)--Drought times of seq0
|
local droughtTimes=TABLE.new(len,len)--Drought times of seq0
|
||||||
local pool={}for i=1,len do for _=1,5 do ins(pool,i)end end--5 times indexes of seq0
|
local pool={}for i=1,len do for _=1,5 do ins(pool,i)end end--5 times indexes of seq0
|
||||||
local function poolPick()
|
local function poolPick()
|
||||||
local r=P:RND(poolLen)
|
local r=rndGen:random(poolLen)
|
||||||
local res=pool[r]
|
local res=pool[r]
|
||||||
|
|
||||||
--Find droughtest(s) minoes
|
--Find droughtest(s) minoes
|
||||||
@@ -72,7 +75,7 @@ local seqGenerators={
|
|||||||
|
|
||||||
--Update pool
|
--Update pool
|
||||||
-- print("Rem "..res)
|
-- print("Rem "..res)
|
||||||
pool[r]=droughtList[P:RND(#droughtList)]
|
pool[r]=droughtList[rndGen:random(#droughtList)]
|
||||||
-- print("Add "..pool[r])
|
-- print("Add "..pool[r])
|
||||||
|
|
||||||
return res
|
return res
|
||||||
@@ -105,6 +108,7 @@ local seqGenerators={
|
|||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
c2=function(P,seq0)
|
c2=function(P,seq0)
|
||||||
|
local rndGen=P.seqRND
|
||||||
local len=#seq0
|
local len=#seq0
|
||||||
local weight={}
|
local weight={}
|
||||||
for i=1,len do weight[i]=0 end
|
for i=1,len do weight[i]=0 end
|
||||||
@@ -113,7 +117,7 @@ local seqGenerators={
|
|||||||
while #P.nextQueue<6 do
|
while #P.nextQueue<6 do
|
||||||
local maxK=1
|
local maxK=1
|
||||||
for i=1,len do
|
for i=1,len do
|
||||||
weight[i]=weight[i]*.5+P:RND()
|
weight[i]=weight[i]*.5+rndGen:random()
|
||||||
if weight[i]>weight[maxK]then
|
if weight[i]>weight[maxK]then
|
||||||
maxK=i
|
maxK=i
|
||||||
end
|
end
|
||||||
@@ -127,13 +131,14 @@ local seqGenerators={
|
|||||||
rnd=function(P,seq0)
|
rnd=function(P,seq0)
|
||||||
if #seq0==1 then
|
if #seq0==1 then
|
||||||
local i=seq0[1]
|
local i=seq0[1]
|
||||||
while true do P:getNext(i) yield() end
|
while true do P:getNext(i)yield()end
|
||||||
else
|
else
|
||||||
|
local rndGen=P.seqRND
|
||||||
local len=#seq0
|
local len=#seq0
|
||||||
local last=0
|
local last=0
|
||||||
while true do
|
while true do
|
||||||
while #P.nextQueue<6 do
|
while #P.nextQueue<6 do
|
||||||
local r=P:RND(len-1)
|
local r=rndGen:random(len-1)
|
||||||
if r>=last then r=r+1 end
|
if r>=last then r=r+1 end
|
||||||
P:getNext(seq0[r])
|
P:getNext(seq0[r])
|
||||||
last=r
|
last=r
|
||||||
@@ -143,32 +148,34 @@ local seqGenerators={
|
|||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
mess=function(P,seq0)
|
mess=function(P,seq0)
|
||||||
|
local rndGen=P.seqRND
|
||||||
while true do
|
while true do
|
||||||
while #P.nextQueue<6 do
|
while #P.nextQueue<6 do
|
||||||
P:getNext(seq0[P:RND(#seq0)])
|
P:getNext(seq0[rndGen:random(#seq0)])
|
||||||
end
|
end
|
||||||
yield()
|
yield()
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
reverb=function(P,seq0)
|
reverb=function(P,seq0)
|
||||||
|
local rndGen=P.seqRND
|
||||||
local bufferSeq,bag={},{}
|
local bufferSeq,bag={},{}
|
||||||
while true do
|
while true do
|
||||||
while #P.nextQueue<6 do
|
while #P.nextQueue<6 do
|
||||||
if #bag==0 then
|
if #bag==0 then
|
||||||
for i=1,#seq0 do bufferSeq[i]=seq0[i]end
|
for i=1,#seq0 do bufferSeq[i]=seq0[i]end
|
||||||
repeat
|
repeat
|
||||||
local r=rem(bufferSeq,P:RND(#bag))
|
local r=rem(bufferSeq,rndGen:random(#bag))
|
||||||
local p=1
|
local p=1
|
||||||
repeat
|
repeat
|
||||||
ins(bag,r)
|
ins(bag,r)
|
||||||
p=p-.15-P:RND()
|
p=p-.15-rndGen:random()
|
||||||
until p<0
|
until p<0
|
||||||
until #bufferSeq==0
|
until #bufferSeq==0
|
||||||
for i=1,#bag do
|
for i=1,#bag do
|
||||||
bufferSeq[i]=bag[i]
|
bufferSeq[i]=bag[i]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
P:getNext(rem(bag,P:RND(#bag)))
|
P:getNext(rem(bag,rndGen:random(#bag)))
|
||||||
end
|
end
|
||||||
yield()
|
yield()
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -176,7 +176,7 @@ scene.widgetList={
|
|||||||
WIDGET.newKey{name="refresh", x=300,y=620,w=140,h=140,font=35,code=fetchRoom,hide=function()return fetchTimer>3.26 end},
|
WIDGET.newKey{name="refresh", x=300,y=620,w=140,h=140,font=35,code=fetchRoom,hide=function()return fetchTimer>3.26 end},
|
||||||
WIDGET.newKey{name="new", x=500,y=620,w=140,h=140,font=20,code=pressKey"n"},
|
WIDGET.newKey{name="new", x=500,y=620,w=140,h=140,font=20,code=pressKey"n"},
|
||||||
WIDGET.newKey{name="new2", x=700,y=620,w=140,h=140,font=20,code=pressKey"m"},
|
WIDGET.newKey{name="new2", x=700,y=620,w=140,h=140,font=20,code=pressKey"m"},
|
||||||
WIDGET.newKey{name="join", x=900,y=620,w=140,h=140,font=40,code=pressKey"return",hide=function()return #NET.roomList==0 or NET.getlock('enterRoom') end},
|
WIDGET.newKey{name="join", x=900,y=620,w=140,h=140,font=40,code=pressKey"return",hide=function()return #NET.roomList==0 or NET.getlock('enterRoom')end},
|
||||||
WIDGET.newButton{name="back", x=1140,y=640,w=170,h=80,font=40,code=backScene},
|
WIDGET.newButton{name="back", x=1140,y=640,w=170,h=80,font=40,code=backScene},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user