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