加载序列模式代码调整,新增回声序列模式
This commit is contained in:
@@ -1210,52 +1210,16 @@ local function applyGameEnv(P)--Finish gameEnv processing
|
|||||||
end
|
end
|
||||||
|
|
||||||
local prepareSequence do
|
local prepareSequence do
|
||||||
|
local freshMethod
|
||||||
local freshPrepare={
|
local freshPrepare={
|
||||||
none=NULL,
|
|
||||||
bag=function(P)
|
|
||||||
local bag=P.gameEnv.bag
|
|
||||||
local L
|
|
||||||
repeat
|
|
||||||
L={}for i=1,#bag do L[i]=i end
|
|
||||||
repeat P:getNext(bag[rem(L,P:RND(#L))])until not L[1]
|
|
||||||
until #P.next>5
|
|
||||||
end,
|
|
||||||
his4=function(P)
|
|
||||||
local bag=P.gameEnv.bag
|
|
||||||
local L=#bag
|
|
||||||
P.his={bag[P:RND(L)],bag[P:RND(L)],bag[P:RND(L)],bag[P:RND(L)]}
|
|
||||||
for _=1,6 do
|
|
||||||
local i
|
|
||||||
local j=0
|
|
||||||
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==6
|
|
||||||
P:getNext(i)
|
|
||||||
rem(P.his,1)P.his[4]=i
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
rnd=function(P)
|
rnd=function(P)
|
||||||
local bag=P.gameEnv.bag
|
local bag=P.gameEnv.bag
|
||||||
local L=#bag
|
P:getNext(bag[rnd(#bag)])
|
||||||
P:getNext(bag[P:RND(L)])
|
freshMethod.rnd(P)
|
||||||
for i=1,5 do
|
|
||||||
local count=0
|
|
||||||
local i
|
|
||||||
repeat
|
|
||||||
i=bag[P:RND(L)]
|
|
||||||
count=count+1
|
|
||||||
until i~=P.next[#P.next].id or count>=L
|
|
||||||
P:getNext(i)
|
|
||||||
end
|
|
||||||
end,
|
end,
|
||||||
loop=function(P)
|
his4=function(P)
|
||||||
local bag=P.gameEnv.bag
|
P.his={}
|
||||||
repeat
|
freshMethod.his4(P)
|
||||||
for i=1,#bag do
|
|
||||||
P:getNext(bag[i])
|
|
||||||
end
|
|
||||||
until #P.next>5
|
|
||||||
end,
|
end,
|
||||||
fixed=function(P)
|
fixed=function(P)
|
||||||
local bag=P.gameEnv.bag
|
local bag=P.gameEnv.bag
|
||||||
@@ -1264,17 +1228,17 @@ local prepareSequence do
|
|||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
local freshMethod={
|
freshMethod={
|
||||||
none=NULL,
|
none=NULL,
|
||||||
bag=function(P)
|
bag=function(P)
|
||||||
if #P.next<6 then
|
while #P.next<6 do
|
||||||
local bag0,bag=P.gameEnv.bag,{}
|
local bag0,bag=P.gameEnv.bag,{}
|
||||||
for i=1,#bag0 do bag[i]=bag0[i]end
|
for i=1,#bag0 do bag[i]=bag0[i]end
|
||||||
repeat P:getNext(rem(bag,P:RND(#bag)))until not bag[1]
|
repeat P:getNext(rem(bag,P:RND(#bag)))until not bag[1]
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
his4=function(P)
|
his4=function(P)
|
||||||
if #P.next<6 then
|
while #P.next<6 do
|
||||||
local bag=P.gameEnv.bag
|
local bag=P.gameEnv.bag
|
||||||
local L=#bag
|
local L=#bag
|
||||||
for n=1,4 do
|
for n=1,4 do
|
||||||
@@ -1289,12 +1253,11 @@ local prepareSequence do
|
|||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
rnd=function(P)
|
rnd=function(P)
|
||||||
if #P.next<6 then
|
while #P.next<6 do
|
||||||
local bag=P.gameEnv.bag
|
local bag=P.gameEnv.bag
|
||||||
local L=#bag
|
local L=#bag
|
||||||
for i=1,4 do
|
for i=1,4 do
|
||||||
local count=0
|
local count=0
|
||||||
local i
|
|
||||||
repeat
|
repeat
|
||||||
i=bag[P:RND(L)]
|
i=bag[P:RND(L)]
|
||||||
count=count+1
|
count=count+1
|
||||||
@@ -1303,11 +1266,27 @@ local prepareSequence do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
reverb=function(P)
|
||||||
|
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
|
||||||
|
repeat
|
||||||
|
P:getNext(r)
|
||||||
|
p=p-.15-rnd()
|
||||||
|
until p<0
|
||||||
|
until not bag[1]
|
||||||
|
end
|
||||||
|
end,
|
||||||
loop=function(P)
|
loop=function(P)
|
||||||
|
while #P.next<6 do
|
||||||
local bag=P.gameEnv.bag
|
local bag=P.gameEnv.bag
|
||||||
for i=1,#bag do
|
for i=1,#bag do
|
||||||
P:getNext(bag[i])
|
P:getNext(bag[i])
|
||||||
end
|
end
|
||||||
|
end
|
||||||
end,
|
end,
|
||||||
fixed=function(P)
|
fixed=function(P)
|
||||||
if P.cur or P.hd then return end
|
if P.cur or P.hd then return end
|
||||||
@@ -1317,12 +1296,21 @@ local prepareSequence do
|
|||||||
function prepareSequence(P)--Call freshPrepare and set newNext
|
function prepareSequence(P)--Call freshPrepare and set newNext
|
||||||
local ENV=P.gameEnv
|
local ENV=P.gameEnv
|
||||||
if type(ENV.sequence)=="string"then
|
if type(ENV.sequence)=="string"then
|
||||||
freshPrepare[ENV.sequence](P)
|
|
||||||
P.newNext=freshMethod[ENV.sequence]
|
P.newNext=freshMethod[ENV.sequence]
|
||||||
|
if freshPrepare[ENV.sequence]then
|
||||||
|
freshPrepare[ENV.sequence](P)
|
||||||
else
|
else
|
||||||
assert(type(ENV.sequence)=="function"and type(ENV.freshMethod)=="function","wrong sequence generator code")
|
P:newNext()
|
||||||
ENV.sequence(P)
|
end
|
||||||
|
else
|
||||||
|
if type(ENV.freshMethod)=="function"then
|
||||||
|
if ENV.sequence then ENV.sequence(P)end
|
||||||
P.newNext=ENV.freshMethod
|
P.newNext=ENV.freshMethod
|
||||||
|
else
|
||||||
|
LOG.print("Wrong sequence generator code","warn")
|
||||||
|
ENV.sequence="bag"
|
||||||
|
prepareSequence(P)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user