diff --git a/parts/ai.lua b/parts/ai.lua index b8d56dd2..56813f82 100644 --- a/parts/ai.lua +++ b/parts/ai.lua @@ -272,7 +272,7 @@ return{ --Check if time to change target 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) end end @@ -315,7 +315,7 @@ return{ --Check if time to change target 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) end end diff --git a/parts/modes/attacker_h.lua b/parts/modes/attacker_h.lua index 30b5d123..fd002917 100644 --- a/parts/modes/attacker_h.lua +++ b/parts/modes/attacker_h.lua @@ -12,12 +12,12 @@ return{ local D=P.modeData if D.wave<20 then 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:RND(3,8)),amount=10,countdown=t,cd0=t,time=0,sent=false,lv=4}) + 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:RND(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(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 diff --git a/parts/modes/attacker_u.lua b/parts/modes/attacker_u.lua index 0e558500..6d4e9742 100644 --- a/parts/modes/attacker_u.lua +++ b/parts/modes/attacker_u.lua @@ -12,16 +12,16 @@ return{ local s local t=800-10*D.wave--800~700~600~500 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: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(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:RND(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(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:RND(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(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 diff --git a/parts/modes/backfire_h.lua b/parts/modes/backfire_h.lua index 1f6e059e..bbab2c78 100644 --- a/parts/modes/backfire_h.lua +++ b/parts/modes/backfire_h.lua @@ -5,7 +5,7 @@ return{ freshLimit=15, dropPiece=function(P) 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 if P.stat.atk>=100 then P:win('finish') diff --git a/parts/modes/backfire_l.lua b/parts/modes/backfire_l.lua index 4529c113..3851d227 100644 --- a/parts/modes/backfire_l.lua +++ b/parts/modes/backfire_l.lua @@ -5,7 +5,7 @@ return{ freshLimit=15, dropPiece=function(P) 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 if P.stat.atk>=100 then P:win('finish') diff --git a/parts/modes/backfire_n.lua b/parts/modes/backfire_n.lua index d588b12d..1bb2957e 100644 --- a/parts/modes/backfire_n.lua +++ b/parts/modes/backfire_n.lua @@ -4,7 +4,7 @@ return{ drop=30,lock=60, dropPiece=function(P) 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 if P.stat.atk>=100 then P:win('finish') diff --git a/parts/modes/backfire_u.lua b/parts/modes/backfire_u.lua index 9158bcaa..d0f46c2b 100644 --- a/parts/modes/backfire_u.lua +++ b/parts/modes/backfire_u.lua @@ -5,7 +5,7 @@ return{ freshLimit=10, dropPiece=function(P) 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 if P.stat.atk>=100 then P:win('finish') diff --git a/parts/modes/c4wtrain_l.lua b/parts/modes/c4wtrain_l.lua index 086b3867..aaf2dcd1 100644 --- a/parts/modes/c4wtrain_l.lua +++ b/parts/modes/c4wtrain_l.lua @@ -37,18 +37,18 @@ return{ P.visTime[i]=FREEROW.get(20) for x=4,7 do F[i][x]=0 end end - if P:RND()<.6 then + if P.holeRND:random()<.6 then local initCell={11,14,12,13,21,24} for _=1,3 do - _=rem(initCell,P:RND(#initCell)) + _=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:RND(5,8)) - rem(initCell,P:RND(1,4)) + rem(initCell,P.holeRND:random(5,8)) + rem(initCell,P.holeRND:random(1,4)) for _=1,6 do - _=rem(initCell,P:RND(#initCell)) + _=rem(initCell,P.holeRND:random(#initCell)) F[math.floor(_/10)][3+_%10]=20 end end diff --git a/parts/modes/c4wtrain_n.lua b/parts/modes/c4wtrain_n.lua index de54f51c..23a71f02 100644 --- a/parts/modes/c4wtrain_n.lua +++ b/parts/modes/c4wtrain_n.lua @@ -35,18 +35,18 @@ return{ P.visTime[i]=FREEROW.get(20) for x=4,7 do F[i][x]=0 end end - if P:RND()<.6 then + if P.holeRND:random()<.6 then local initCell={11,14,12,13,21,24} for _=1,3 do - _=rem(initCell,P:RND(#initCell)) + _=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:RND(5,8)) - rem(initCell,P:RND(1,4)) + rem(initCell,P.holeRND:random(5,8)) + rem(initCell,P.holeRND:random(1,4)) for _=1,6 do - _=rem(initCell,P:RND(#initCell)) + _=rem(initCell,P.holeRND:random(#initCell)) F[math.floor(_/10)][3+_%10]=20 end end diff --git a/parts/modes/defender_l.lua b/parts/modes/defender_l.lua index a6758e2c..0b996900 100644 --- a/parts/modes/defender_l.lua +++ b/parts/modes/defender_l.lua @@ -16,7 +16,7 @@ return{ if D.counter>=t then D.counter=0 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 P.atkBufferSum=P.atkBufferSum+4 P.stat.recv=P.stat.recv+4 diff --git a/parts/modes/defender_n.lua b/parts/modes/defender_n.lua index e9c78f4d..dfbe51ad 100644 --- a/parts/modes/defender_n.lua +++ b/parts/modes/defender_n.lua @@ -16,7 +16,7 @@ return{ if D.counter>=t then D.counter=0 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 P.atkBufferSum=P.atkBufferSum+3 P.stat.recv=P.stat.recv+3 diff --git a/parts/modes/drought_l.lua b/parts/modes/drought_l.lua index 4973a383..16471492 100644 --- a/parts/modes/drought_l.lua +++ b/parts/modes/drought_l.lua @@ -71,7 +71,7 @@ return{ end FREEROW.discard(height) - P:getNext(wei[P:RND(#wei)]) + P:getNext(wei[P.seqRND:random(#wei)]) end end end, diff --git a/parts/modes/infinite_dig.lua b/parts/modes/infinite_dig.lua index 28126133..fa6d043c 100644 --- a/parts/modes/infinite_dig.lua +++ b/parts/modes/infinite_dig.lua @@ -9,7 +9,7 @@ local function check_rise(P) end end for _=1,8-L do - P:garbageRise(13,1,generateLine(P:RND(10))) + P:garbageRise(13,1,generateLine(P.holeRND:random(10))) end else if L==0 then @@ -17,7 +17,7 @@ local function check_rise(P) SFX.play('clear') BG.send(26) for _=1,8 do - P:garbageRise(13,1,generateLine(P:RND(10))) + P:garbageRise(13,1,generateLine(P.holeRND:random(10))) end else BG.send(#P.clearedRow) @@ -38,7 +38,7 @@ return{ PLY.newPlayer(1) local P=PLAYERS[1] for _=1,8 do - P:garbageRise(13,1,generateLine(P:RND(10))) + P:garbageRise(13,1,generateLine(P.holeRND:random(10))) end P.fieldBeneath=0 end, diff --git a/parts/modes/master_phantasm.lua b/parts/modes/master_phantasm.lua index ea0b30e7..f9b0389b 100644 --- a/parts/modes/master_phantasm.lua +++ b/parts/modes/master_phantasm.lua @@ -45,17 +45,17 @@ return{ end end for _=1,5 do - P.field[i][P:RND(10)]=0 + 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:RND()>.9 then + if P.holeRND:random()>.9 then P.field[i][j]=math.random(16) end end - P.field[i][P:RND(10)]=0 + P.field[i][P.holeRND:random(10)]=0 end P.field[i].garbage=true end diff --git a/parts/modes/pctrain_l.lua b/parts/modes/pctrain_l.lua index aab1def3..ac2469ce 100644 --- a/parts/modes/pctrain_l.lua +++ b/parts/modes/pctrain_l.lua @@ -11,7 +11,7 @@ local function task_PC(P) D.counter=D.counter+1 if D.counter==26 then 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 @@ -23,8 +23,8 @@ local function check(P) end else local type=P.stat.pc<10 and 4 or 5 - local L=PClist[type][P:RND(#PClist[type])] - local symmetry=P:RND()>.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) diff --git a/parts/modes/pctrain_n.lua b/parts/modes/pctrain_n.lua index c72a63c3..bc0b29c3 100644 --- a/parts/modes/pctrain_n.lua +++ b/parts/modes/pctrain_n.lua @@ -13,7 +13,7 @@ local function task_PC(P) D.counter=D.counter+1 if D.counter==26 then local base=PCbase[D.type] - P:pushLineList(base[P:RND(#base)],D.symmetry) + P:pushLineList(base[P.holeRND:random(#base)],D.symmetry) end YIELD() end @@ -26,8 +26,8 @@ local function check(P) end else local type=PCtype[P.stat.pc+1]or 3 - local L=PClist[type][P:RND(#PClist[type])] - local symmetry=P:RND()>.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) diff --git a/parts/modes/survivor_e.lua b/parts/modes/survivor_e.lua index f65f4749..727ccc6f 100644 --- a/parts/modes/survivor_e.lua +++ b/parts/modes/survivor_e.lua @@ -10,7 +10,7 @@ return{ 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: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.stat.recv=P.stat.recv+1 if D.wave==45 then P:showTextF(text.maxspeed,0,-140,100,'appear',.6)end diff --git a/parts/modes/survivor_h.lua b/parts/modes/survivor_h.lua index 51011756..05349d28 100644 --- a/parts/modes/survivor_h.lua +++ b/parts/modes/survivor_h.lua @@ -12,10 +12,10 @@ return{ 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: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 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 end P.atkBufferSum=P.atkBufferSum+s diff --git a/parts/modes/survivor_l.lua b/parts/modes/survivor_l.lua index b2d2aeec..71c962de 100644 --- a/parts/modes/survivor_l.lua +++ b/parts/modes/survivor_l.lua @@ -11,7 +11,7 @@ return{ 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: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.stat.recv=P.stat.recv+4 if D.wave==60 then P:showTextF(text.maxspeed,0,-140,100,'appear',.6)end diff --git a/parts/modes/survivor_n.lua b/parts/modes/survivor_n.lua index 97d9902c..2973a76e 100644 --- a/parts/modes/survivor_n.lua +++ b/parts/modes/survivor_n.lua @@ -12,10 +12,10 @@ return{ 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:RND(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==2 and{line=generateLine(P:RND(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==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 diff --git a/parts/modes/survivor_u.lua b/parts/modes/survivor_u.lua index a29a484a..44a6f2a7 100644 --- a/parts/modes/survivor_u.lua +++ b/parts/modes/survivor_u.lua @@ -13,10 +13,10 @@ return{ 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:RND(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: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: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=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:showTextF(text.maxspeed,0,-140,100,'appear',.6)end diff --git a/parts/player/init.lua b/parts/player/init.lua index 9844a160..bd530a74 100644 --- a/parts/player/init.lua +++ b/parts/player/init.lua @@ -111,7 +111,10 @@ local function newEmptyPlayer(id,mini) P.draw=ply_draw.norm 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.alive=true diff --git a/parts/player/player.lua b/parts/player/player.lua index 8b42fcd3..decc6968 100644 --- a/parts/player/player.lua +++ b/parts/player/player.lua @@ -121,10 +121,6 @@ end ---------------------------------------------------- ---------------------------------------------------- -function Player:RND(a,b) - local R=self.randGen - return R:random(a,b) -end function Player:newTask(code,...) local thread=coroutine.create(code) resume(thread,self,...) @@ -227,11 +223,11 @@ end function Player:getHolePos()--Get a good garbage-line hole position if self.garbageBeneath==0 then - return generateLine(self:RND(10)) + return generateLine(self.holeRND:random(10)) else - local p=self:RND(10) + local p=self.holeRND:random(10) if self.field[1][p]<=0 then - return generateLine(self:RND(10)) + return generateLine(self.holeRND:random(10)) end return generateLine(p) end @@ -1336,7 +1332,7 @@ do--Player.drop(self)--Place piece local M=#self.atker if M>0 then 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 else T=randomTarget(self) @@ -1349,7 +1345,7 @@ do--Player.drop(self)--Place piece T=randomTarget(self) end if T then - self:attack(T,send,sendTime,generateLine(self:RND(10))) + self:attack(T,send,sendTime,generateLine(self.atkRND:random(10))) end 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.life>0 and not force then self:revive()return end self:die() - local i=TABLE.find(PLY_ALIVE,self) - if i then rem(PLY_ALIVE,i)end + local p=TABLE.find(PLY_ALIVE,self)if p then rem(PLY_ALIVE,p)end self.result='lose' if GAME.modeEnv.royaleMode then self:changeAtk() diff --git a/parts/player/seqGenerators.lua b/parts/player/seqGenerators.lua index 86ef00b1..0ad1108a 100644 --- a/parts/player/seqGenerators.lua +++ b/parts/player/seqGenerators.lua @@ -5,6 +5,7 @@ local yield=YIELD local seqGenerators={ none=function()while true do yield()end end, bag=function(P,seq0) + local rndGen=P.seqRND local len=#seq0 local bag={} while true do @@ -14,12 +15,13 @@ local seqGenerators={ bag[i]=seq0[len-i+1] end end - P:getNext(rem(bag,P:RND(#bag))) + P:getNext(rem(bag,rndGen:random(#bag))) end yield() end end, his=function(P,seq0) + local rndGen=P.seqRND local len=#seq0 local hisLen=ceil(len*.5) local history=TABLE.new(0,hisLen) @@ -27,7 +29,7 @@ local seqGenerators={ while #P.nextQueue<6 do local r for _=1,hisLen do--Reroll up to [hisLen] times - r=P:RND(len) + r=rndGen:random(len) for i=1,hisLen do if r==history[i]then goto CONTINUE_rollAgain @@ -43,6 +45,7 @@ local seqGenerators={ end end, hisPool=function(P,seq0) + local rndGen=P.seqRND local len=#seq0 local hisLen=ceil(len*.5) 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 pool={}for i=1,len do for _=1,5 do ins(pool,i)end end--5 times indexes of seq0 local function poolPick() - local r=P:RND(poolLen) + local r=rndGen:random(poolLen) local res=pool[r] --Find droughtest(s) minoes @@ -72,7 +75,7 @@ local seqGenerators={ --Update pool -- print("Rem "..res) - pool[r]=droughtList[P:RND(#droughtList)] + pool[r]=droughtList[rndGen:random(#droughtList)] -- print("Add "..pool[r]) return res @@ -105,6 +108,7 @@ local seqGenerators={ end end, c2=function(P,seq0) + local rndGen=P.seqRND local len=#seq0 local weight={} for i=1,len do weight[i]=0 end @@ -113,7 +117,7 @@ local seqGenerators={ while #P.nextQueue<6 do local maxK=1 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 maxK=i end @@ -127,13 +131,14 @@ local seqGenerators={ rnd=function(P,seq0) if #seq0==1 then local i=seq0[1] - while true do P:getNext(i) yield() end + while true do P:getNext(i)yield()end else + local rndGen=P.seqRND local len=#seq0 local last=0 while true 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 P:getNext(seq0[r]) last=r @@ -143,32 +148,34 @@ local seqGenerators={ end end, mess=function(P,seq0) + local rndGen=P.seqRND while true do while #P.nextQueue<6 do - P:getNext(seq0[P:RND(#seq0)]) + P:getNext(seq0[rndGen:random(#seq0)]) end yield() end end, reverb=function(P,seq0) + local rndGen=P.seqRND local bufferSeq,bag={},{} while true do while #P.nextQueue<6 do if #bag==0 then for i=1,#seq0 do bufferSeq[i]=seq0[i]end repeat - local r=rem(bufferSeq,P:RND(#bag)) + local r=rem(bufferSeq,rndGen:random(#bag)) local p=1 repeat ins(bag,r) - p=p-.15-P:RND() + p=p-.15-rndGen:random() until p<0 until #bufferSeq==0 for i=1,#bag do bufferSeq[i]=bag[i] end end - P:getNext(rem(bag,P:RND(#bag))) + P:getNext(rem(bag,rndGen:random(#bag))) end yield() end diff --git a/parts/scenes/net_rooms.lua b/parts/scenes/net_rooms.lua index 4341a1bc..6d44a669 100644 --- a/parts/scenes/net_rooms.lua +++ b/parts/scenes/net_rooms.lua @@ -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="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="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}, }