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