Commit 778d0b34 authored by GuGu's avatar GuGu

Update nef.lua 添加Nef.PLCounter.AddWithPhaseReset

parent 5acf48c1
Pipeline #35018 passed with stage
in 12 seconds
...@@ -366,7 +366,7 @@ function Nef.GetPendSPInfo(c) ...@@ -366,7 +366,7 @@ function Nef.GetPendSPInfo(c)
local pnum = type(mt.pend_num) == "number" and mt.pend_num or mt.pend_num(c) local pnum = type(mt.pend_num) == "number" and mt.pend_num or mt.pend_num(c)
pend_num = math.min(pend_num, pnum) pend_num = math.min(pend_num, pnum)
end end
if mt.pend_filter then if mt.pend_filter then
local f1=pend_filter local f1=pend_filter
local arg=mt.pend_arg or {1} local arg=mt.pend_arg or {1}
local f2_ori=mt.pend_filter local f2_ori=mt.pend_filter
...@@ -1112,7 +1112,7 @@ if not Nef.SeedField then ...@@ -1112,7 +1112,7 @@ if not Nef.SeedField then
--[[ --[[
tp 种子持有者 tp 种子持有者
p seq的玩家 p seq的玩家
seq 相对玩家p目标区域序号 seq 相对玩家p目标区域序号
]] ]]
function class.addSeedWithSeq(e, tp, p, seq) function class.addSeedWithSeq(e, tp, p, seq)
...@@ -1370,30 +1370,29 @@ if not Nef.PLCounter then ...@@ -1370,30 +1370,29 @@ if not Nef.PLCounter then
Duel.RegisterEffect(e1, tp) Duel.RegisterEffect(e1, tp)
end end
function class.AddWithPhaseReset(tp,code,num,phase,resetnum,resetcount,resettp,othercon) function class.AddWithPhaseReset(tp,code,num,te,phase,resetnum,resetcount,resettp,othercon)
if resetnum==nil then resetnum=(class._n[tp][code] or 0) end
class.Add(tp,code,num) class.Add(tp,code,num)
if phase==nil then return end if te==nil or phase==nil then return end
if resetcount==nil then resetcount=0 end if resetcount==nil then resetcount=0 end
local e1=Effect.GlobalEffect() local e1=Effect.CreateEffect(te:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e1:SetCode(EVENT_PHASE+phase) e1:SetCode(EVENT_PHASE+phase)
e1:SetCountLimit(1)
if resettp==nil then if resettp==nil then
e1:SetLabel(Duel.GetTurnCount()) e1:SetLabel(Duel.GetTurnCount())
else else
e1:SetLabel(Duel.GetTurnCount(resettp)) e1:SetLabel(Duel.GetTurnCount(resettp))
end end
if othercon==nil then if othercon==nil then
e1:SetCondition(class.resetcon(code,resetnum,resetcount,resettp)) e1:SetCondition(class.resetcon(resetcount,resettp))
else else
e1:SetCondition(othercon) e1:SetCondition(othercon)
end end
e1:SetOperation(class.resetop(code,resetnum)) e1:SetOperation(class.resetop(code,num,resetnum))
Duel.RegisterEffect(e1,tp) Duel.RegisterEffect(e1,tp)
end end
function class.resetcon(code,resetnum,resetcount,resettp) function class.resetcon(resetcount,resettp)
return function(e,tp,eg,ep,ev,re,r,rp) return function(e,tp,eg,ep,ev,re,r,rp)
if resettp==nil then if resettp==nil then
return Duel.GetTurnCount()>=e:GetLabel()+resetcount return Duel.GetTurnCount()>=e:GetLabel()+resetcount
...@@ -1402,11 +1401,20 @@ if not Nef.PLCounter then ...@@ -1402,11 +1401,20 @@ if not Nef.PLCounter then
end end
end end
end end
function class.resetop(code,resetnum) function class.resetop(code,num,resetnum)
return function(e,tp,eg,ep,ev,re,r,rp) return function(e,tp,eg,ep,ev,re,r,rp)
local num=class.Get(tp,code) if resetnum==nil then
class.Add(tp,code,resetnum-num) local num2=class.Get(tp,code)
e:Reset() if num2-num<0 then num=num2 end
Duel.Hint(HINT_CARD,0,e:GetHandler():GetOriginalCode())
class.Add(tp,code,-num)
e:Reset()
else
local num2=class.Get(tp,code)
Duel.Hint(HINT_CARD,0,e:GetHandler():GetOriginalCode())
class.Add(tp,code,resetnum-num2)
e:Reset()
end
end end
end 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