Commit d9777969 authored by nekrozar's avatar nekrozar Committed by DailyShana

use Card.GetFieldId to simplify c7532f0f and ce6dab4d (#1261)

* use Card.GetFieldId
* fix
parent ce6dab4d
......@@ -37,10 +37,6 @@ function c10833828.initial_effect(c)
e4:SetTarget(c10833828.damtg)
e4:SetOperation(c10833828.damop)
c:RegisterEffect(e4)
local ng=Group.CreateGroup()
ng:KeepAlive()
e2:SetLabelObject(ng)
e3:SetLabelObject(ng)
end
function c10833828.spfilter1(c,e,tp)
return c:IsSetCard(0x10af) and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP_DEFENSE)
......@@ -69,13 +65,7 @@ function c10833828.spop1(e,tp,eg,ep,ev,re,r,rp)
e2:SetCode(EFFECT_DISABLE_EFFECT)
e2:SetReset(RESET_EVENT+RESETS_STANDARD)
tc:RegisterEffect(e2,true)
local sg=e:GetLabelObject()
if c:GetFlagEffect(10833828)==0 then
sg:Clear()
c:RegisterFlagEffect(10833828,RESET_EVENT+RESETS_STANDARD,0,1)
end
sg:AddCard(tc)
tc:CreateRelation(c,RESET_EVENT+RESETS_STANDARD)
tc:RegisterFlagEffect(10833828,RESET_EVENT+RESETS_STANDARD,0,1,c:GetFieldId())
end
Duel.SpecialSummonComplete()
end
......@@ -86,25 +76,22 @@ function c10833828.spfilter3(c,e,tp,m,f,chkf)
return c:IsType(TYPE_FUSION) and c:IsRace(RACE_FIEND) and (not f or f(c))
and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_FUSION,tp,false,false) and c:CheckFusionMaterial(m,nil,chkf)
end
function c10833828.spfilter4(c,tc)
return c:IsRelateToCard(tc)
end
function c10833828.fcheck1(g)
function c10833828.fcheck1(fid)
return function(tp,sg,fc)
return sg:IsExists(c10833828.fcheck2,1,nil,g)
return sg:IsExists(c10833828.fcheck2,1,nil,fid)
end
end
function c10833828.fcheck2(c,g)
return g:IsContains(c)
function c10833828.fcheck2(c,fid)
for _,flag in ipairs({c:GetFlagEffectLabel(10833828)}) do
if flag==fid then return true end
end
return false
end
function c10833828.sptg2(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then
local c=e:GetHandler()
local g=e:GetLabelObject():Filter(c10833828.spfilter4,nil,c)
if c:GetFlagEffect(10833828)==0 or g:GetCount()==0 then return false end
local chkf=tp
local mg1=Duel.GetFusionMaterial(tp)
aux.FCheckAdditional=c10833828.fcheck1(g)
aux.FCheckAdditional=c10833828.fcheck1(e:GetHandler():GetFieldID())
local res=Duel.IsExistingMatchingCard(c10833828.spfilter3,tp,LOCATION_EXTRA,0,1,nil,e,tp,mg1,nil,chkf)
if not res then
local ce=Duel.GetChainMaterial(tp)
......@@ -123,12 +110,10 @@ function c10833828.sptg2(e,tp,eg,ep,ev,re,r,rp,chk)
end
function c10833828.spop2(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if not c:IsRelateToEffect(e) or c:GetFlagEffect(10833828)==0 then return end
local g=e:GetLabelObject():Filter(c10833828.spfilter4,nil,e:GetHandler())
if g:GetCount()==0 then return end
if not c:IsRelateToEffect(e) then return end
local chkf=tp
local mg1=Duel.GetFusionMaterial(tp):Filter(c10833828.spfilter2,nil,e)
aux.FCheckAdditional=c10833828.fcheck1(g)
aux.FCheckAdditional=c10833828.fcheck1(c:GetFieldID())
local sg1=Duel.GetMatchingGroup(c10833828.spfilter3,tp,LOCATION_EXTRA,0,nil,e,tp,mg1,nil,chkf)
local mg2=nil
local sg2=nil
......
......@@ -19,31 +19,21 @@ function c4869446.initial_effect(c)
e3:SetTargetRange(LOCATION_MZONE,LOCATION_MZONE)
e3:SetTarget(c4869446.postg)
c:RegisterEffect(e3)
local ng=Group.CreateGroup()
ng:KeepAlive()
e2:SetLabelObject(ng)
e3:SetLabelObject(ng)
end
function c4869446.cfilter(c)
return c:IsFaceup() and c:IsPreviousPosition(POS_FACEDOWN)
end
function c4869446.posop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local sg=e:GetLabelObject()
if c:GetFlagEffect(4869446)==0 then
sg:Clear()
c:RegisterFlagEffect(4869446,RESET_EVENT+RESETS_STANDARD,0,1)
end
local g=eg:Filter(c4869446.cfilter,nil)
local tc=g:GetFirst()
while tc do
sg:AddCard(tc)
tc:CreateRelation(c,RESET_EVENT+RESETS_STANDARD)
tc:RegisterFlagEffect(4869446,RESET_EVENT+RESETS_STANDARD,0,1,e:GetHandler():GetFieldId())
tc=g:GetNext()
end
end
function c4869446.postg(e,c)
local g=e:GetLabelObject()
if e:GetHandler():GetFlagEffect(4869446)==0 or g:GetCount()==0 then return false end
return g:IsContains(c) and c:IsRelateToCard(e:GetHandler())
for _,flag in ipairs({c:GetFlagEffectLabel(4869446)}) do
if flag==e:GetHandler():GetFieldId() then return true end
end
return false
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