Commit 504dfc05 authored by GuGu's avatar GuGu

Update nef.lua

parent 64ef0c3e
Pipeline #35014 passed with stage
in 15 seconds
......@@ -1370,6 +1370,46 @@ if not Nef.PLCounter then
Duel.RegisterEffect(e1, tp)
end
function class.AddWithPhaseReset(tp,code,num,phase,resetnum,resetcount,resettp,othercon)
class.Add(tp,code,num)
if phase==nil then return end
if resetnum==nil then resetnum=(class._n[tp][code] or 0) end
if resetcount==nil then resetcount=0 end
local e1=Effect.GlobalEffect()
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_PHASE+phase)
e1:SetCountLimit(1)
if resettp==nil then
e1:SetLabel(Duel.GetTurnCount())
else
e1:SetLabel(Duel.GetTurnCount(resettp))
end
if othercon==nil then
e1:SetCondition(class.resetcon(code,resetnum,resetcount,resettp))
else
e1:SetCondition(othercon)
end
e1:SetOperation(class.resetop(code,resetnum))
Duel.RegisterEffect(e1,tp)
end
function class.resetcon(code,resetnum,resetcount,resettp)
return function(e,tp,eg,ep,ev,re,r,rp)
if resettp==nil then
return Duel.GetTurnCount()>=e:GetLabel()+resetcount
else
return Duel.GetTurnCount(resettp)>=e:GetLabel()+resetcount and Duel.GetTurnPlayer()==resettp
end
end
end
function class.resetop(code,resetnum)
return function(e,tp,eg,ep,ev,re,r,rp)
local num=class.Get(tp,code)
class.Add(tp,code,resetnum-num)
e:Reset()
end
end
function class.Get(tp, code)
return class._n[tp][code] or 0
end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment