From b7e2835c1afaeec2d9bc6e13790e50bcf1534d6c Mon Sep 17 00:00:00 2001 From: MrZ626 <1046101471@qq.com> Date: Fri, 30 Oct 2020 20:40:27 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BA=8F=E5=88=97=E7=94=9F=E6=88=90=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- parts/player.lua | 85 +++++++++++++++++++++++++++++++++--------------- 1 file changed, 58 insertions(+), 27 deletions(-) diff --git a/parts/player.lua b/parts/player.lua index 9cf00b0a..05e67d4d 100644 --- a/parts/player.lua +++ b/parts/player.lua @@ -1171,24 +1171,31 @@ local prepareSequence do P:getNext(bag[rnd(#bag)]) freshMethod.rnd(P) end, - his4=function(P) - P.his={} - freshMethod.his4(P) - end, fixed=function(P) local bag=P.gameEnv.bag - for i=1,#bag do - P:getNext(bag[i]) + local L=#bag + for i=1,L do + P.seqData[i]=bag[L+1-i] + end + while #P.next<6 do + if P.seqData[1]then + P:getNext(rem(P.seqData)) + else + break + end end end, } freshMethod={ none=NULL, bag=function(P) + local bag=P.seqData while #P.next<6 do - local bag0,bag=P.gameEnv.bag,{} - for i=1,#bag0 do bag[i]=bag0[i]end - repeat P:getNext(rem(bag,P:RND(#bag)))until not bag[1] + if #bag==0 then--Copy a new bag + local bag0=P.gameEnv.bag + for i=1,#bag0 do bag[i]=bag0[i]end + end + P:getNext(rem(bag,P:RND(#bag))) end end, his4=function(P) @@ -1200,9 +1207,9 @@ local prepareSequence do repeat i=bag[P:RND(L)] j=j+1 - until i~=P.his[1]and i~=P.his[2]and i~=P.his[3]and i~=P.his[4]or j==4 + until i~=P.seqData[1]and i~=P.seqData[2]and i~=P.seqData[3]and i~=P.seqData[4]or j==4 + P.seqData[n]=i P:getNext(i) - P.his[n]=i end end end, @@ -1221,30 +1228,50 @@ local prepareSequence do end end, reverb=function(P) + local seq=P.seqData while #P.next<6 do - local bag0,bag=P.gameEnv.bag,{} - for i=1,#bag0 do bag[i]=bag0[i]end - repeat - local r=rem(bag,P:RND(#bag)) - local p=1 + if #seq==0 then + local bag0=P.gameEnv.bag + for i=1,#bag0 do seq[i]=bag0[i]end + local bag={} repeat - P:getNext(r) - p=p-.15-rnd() - until p<0 - until not bag[1] + local r=rem(seq,P:RND(#bag)) + local p=1 + repeat + ins(bag,r) + p=p-.15-P:RND() + until p<0 + until #seq==0 + for i=1,#bag do + seq[i]=bag[i] + end + end + P:getNext(rem(seq)) end end, loop=function(P) while #P.next<6 do - local bag=P.gameEnv.bag - for i=1,#bag do - P:getNext(bag[i]) + if #P.seqData==0 then + local bag=P.gameEnv.bag + local L=#bag + for i=1,L do + P.seqData[i]=bag[L+1-i] + end end + P:getNext(rem(P.seqData)) end end, fixed=function(P) - if P.cur or P.hd then return end - P:lose() + while #P.next<6 do + if P.seqData[1]then + P:getNext(rem(P.seqData)) + else + print(P.cur) + print(P.hd) + if not(P.cur or P.hd)then P:lose()end + return + end + end end, } function prepareSequence(P)--Call freshPrepare and set newNext @@ -1375,6 +1402,7 @@ local function newEmptyPlayer(id,x,y,size) -- P.curX,P.curY,P.imgY,P.minY=0,0,0,0--x,y,ghostY P.holded=false P.next={} + P.seqData={} P.freshTime=0 P.spinLast=false @@ -1895,13 +1923,16 @@ function player.hold(P,ifpre) P.ctrlCount=0 end - P.holded=P.gameEnv.oncehold P.spinLast=false P.spinSeq=0 P.cur,P.hd=H,C--Swap hold - H,C=P.hd,P.cur + + if P.next[1]or C then--Make hold available in fixed sequence + P.holded=P.gameEnv.oncehold + end + if H then local hid=P.hd.id P.hd.bk=blocks[hid][P.gameEnv.face[hid]]