Skip to content

Commit

Permalink
修allclearGenerator._shuffleSeq可能生成无法用hold调整回原序列的错误
Browse files Browse the repository at this point in the history
  • Loading branch information
MrZ626 committed Sep 23, 2024
1 parent 97dcb1c commit c7e1ca1
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions assets/game/mechanicLib/brik/allclearGenerator.lua
Original file line number Diff line number Diff line change
Expand Up @@ -181,11 +181,17 @@ local function printSeq(s)
print(table.concat(s))
end
function allclearGenerator._shuffleSeq(P,seq,holdSlot)
local backup=TABLE.copy(seq)
local pickArea=holdSlot or P.settings.holdSlot+1
for i=1,#seq-1 do
local pick=P:random(pickArea)
if pick>1 then
seq[i],seq[pick]=seq[pick],seq[i]
local pointers={}
for i=1,pickArea do pointers[i]=i end

for i=1,#backup do
local pick=P:random(#pointers)
seq[pointers[pick]]=backup[i]
pointers[pick]=i+#pointers
if pointers[pick]>#backup then
table.remove(pointers,pick)
end
end
end
Expand Down

0 comments on commit c7e1ca1

Please sign in to comment.