再优化玩家的cancel方法
This commit is contained in:
@@ -797,21 +797,19 @@ end
|
|||||||
function Player.cancel(P,N)--Cancel Garbage
|
function Player.cancel(P,N)--Cancel Garbage
|
||||||
local off=0--Lines offseted
|
local off=0--Lines offseted
|
||||||
local bf=P.atkBuffer
|
local bf=P.atkBuffer
|
||||||
for _, A in ipairs(bf) do
|
for i=1,#bf do
|
||||||
if bf.sum <= 0 then break end
|
if bf.sum==0 or N==0 then break end
|
||||||
|
local A=bf[i]
|
||||||
if not A.sent then
|
if not A.sent then
|
||||||
local O=min(A.amount,N)--Cur Offset
|
local O=min(A.amount,N)--Cur Offset
|
||||||
off, bf.sum = off + O, bf.sum - O
|
if N<A.amount then
|
||||||
if N >= A.amount then
|
|
||||||
A.sent, A.time = true, 0
|
|
||||||
else
|
|
||||||
A.amount=A.amount-O
|
A.amount=A.amount-O
|
||||||
end
|
|
||||||
if N <= A.amount then
|
|
||||||
break
|
|
||||||
else
|
else
|
||||||
N = N - O
|
A.sent,A.time=true,0
|
||||||
end
|
end
|
||||||
|
off=off+O
|
||||||
|
bf.sum=bf.sum-O
|
||||||
|
N=N-O
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return off
|
return off
|
||||||
|
|||||||
Reference in New Issue
Block a user