Task模块全部改用协程

This commit is contained in:
MrZ626
2020-12-04 16:09:17 +08:00
parent 6f49341ba5
commit 98629be450
21 changed files with 607 additions and 474 deletions

View File

@@ -1,20 +1,23 @@
local max=math.max
return{
color=COLOR.red,
env={
drop=30,lock=45,
freshLimit=10,
task=function(P)
if not(P.control and SCN.cur=="play")then return end
P.modeData.counter=P.modeData.counter+1
if P.modeData.counter>=max(60,150-P.modeData.event)and P.atkBuffer.sum<20 then
local t=max(60,90-P.modeData.event)
P.atkBuffer[#P.atkBuffer+1]={pos=P:RND(10),amount=4,countdown=t,cd0=t,time=0,sent=false,lv=3}
P.atkBuffer.sum=P.atkBuffer.sum+4
P.stat.recv=P.stat.recv+4
if P.modeData.event==60 then P:showTextF(text.maxspeed,0,-140,100,"appear",.6)end
P.modeData.counter=0
P.modeData.event=P.modeData.event+1
while true do
coroutine.yield()
if P.control and SCN.cur=="play"then
P.modeData.counter=P.modeData.counter+1
if P.modeData.counter>=math.max(60,150-P.modeData.event)and P.atkBuffer.sum<20 then
local t=math.max(60,90-P.modeData.event)
P.atkBuffer[#P.atkBuffer+1]={pos=P:RND(10),amount=4,countdown=t,cd0=t,time=0,sent=false,lv=3}
P.atkBuffer.sum=P.atkBuffer.sum+4
P.stat.recv=P.stat.recv+4
if P.modeData.event==60 then P:showTextF(text.maxspeed,0,-140,100,"appear",.6)end
P.modeData.counter=0
P.modeData.event=P.modeData.event+1
end
end
end
end,
bg="glow",bgm="storm",