Commit c917ffb3 authored by edo9300's avatar edo9300 Committed by mercury233

Added mg and sg to the fusion filters (#874)

parent decc7d1d
--ペア・サイクロイド --ペア・サイクロイド
function c16114248.initial_effect(c) function c16114248.initial_effect(c)
c:EnableReviveLimit() c:EnableReviveLimit()
--fusion material aux.AddFusionProcFunRep(c,c16114248.ffilter,2,true)
--direct attack
local e1=Effect.CreateEffect(c) local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE) e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e1:SetCode(EFFECT_DIRECT_ATTACK)
e1:SetCode(EFFECT_FUSION_MATERIAL)
e1:SetCondition(c16114248.fscon)
e1:SetOperation(c16114248.fsop)
c:RegisterEffect(e1) c:RegisterEffect(e1)
--direct attack
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_DIRECT_ATTACK)
c:RegisterEffect(e2)
end
function c16114248.filter(c,fc)
return c:IsRace(RACE_MACHINE) and not c:IsHasEffect(6205579) and c:IsCanBeFusionMaterial(fc)
end
function c16114248.spfilter(c,mg)
return mg:IsExists(c16114248.spfilter2,1,c,c)
end
function c16114248.spfilter2(c,mc)
return c:IsFusionCode(mc:GetFusionCode())
end
function c16114248.fscon(e,g,gc)
if g==nil then return true end
local mg=g:Filter(c16114248.filter,gc,e:GetHandler())
if gc then return c16114248.filter(gc,e:GetHandler()) and c16114248.spfilter(gc,mg) end
return mg:IsExists(c16114248.spfilter,1,nil,mg)
end end
function c16114248.fsop(e,tp,eg,ep,ev,re,r,rp,gc) function c16114248.ffilter(c,fc,sub,mg,sg)
local mg=eg:Filter(c16114248.filter,gc,e:GetHandler()) return c:IsRace(RACE_MACHINE) and (not sg or sg:FilterCount(aux.TRUE,c)==0 or sg:IsExists(Card.IsFusionCode,1,c,c:GetFusionCode()))
local g1=nil
local mc=gc
if not gc then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FMATERIAL)
g1=mg:FilterSelect(tp,c16114248.spfilter,1,1,nil,mg)
mc=g1:GetFirst()
end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FMATERIAL)
local g2=mg:FilterSelect(tp,c16114248.spfilter2,1,1,mc,mc)
if g1 then g2:Merge(g1) end
Duel.SetFusionMaterial(g2)
end end
--彼岸の巡礼者 ダンテ --彼岸の巡礼者 ダンテ
function c18386170.initial_effect(c) function c18386170.initial_effect(c)
c:EnableReviveLimit() c:EnableReviveLimit()
--fusion material aux.AddFusionProcFunRep(c,c18386170.ffilter,3,true)
--special summon condition
local e1=Effect.CreateEffect(c) local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE) e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_FUSION_MATERIAL) e1:SetCode(EFFECT_SPSUMMON_CONDITION)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e1:SetCondition(c18386170.fscon) e1:SetValue(aux.fuslimit)
e1:SetOperation(c18386170.fsop)
c:RegisterEffect(e1) c:RegisterEffect(e1)
--special summon condition --cannot be target
local e2=Effect.CreateEffect(c) local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE) e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_SPSUMMON_CONDITION) e2:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET)
e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e2:SetValue(aux.fuslimit) e2:SetRange(LOCATION_MZONE)
e2:SetValue(c18386170.tgval)
c:RegisterEffect(e2) c:RegisterEffect(e2)
--cannot be target --draw
local e3=Effect.CreateEffect(c) local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_SINGLE) e3:SetCategory(CATEGORY_DRAW)
e3:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET) e3:SetType(EFFECT_TYPE_QUICK_O)
e3:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e3:SetCode(EVENT_FREE_CHAIN)
e3:SetRange(LOCATION_MZONE) e3:SetRange(LOCATION_MZONE)
e3:SetValue(c18386170.tgval) e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e3:SetCountLimit(1)
e3:SetCost(c18386170.drcost)
e3:SetTarget(c18386170.drtg)
e3:SetOperation(c18386170.drop)
c:RegisterEffect(e3) c:RegisterEffect(e3)
--draw --handes
local e4=Effect.CreateEffect(c) local e4=Effect.CreateEffect(c)
e4:SetCategory(CATEGORY_DRAW) e4:SetCategory(CATEGORY_HANDES)
e4:SetType(EFFECT_TYPE_QUICK_O) e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e4:SetCode(EVENT_FREE_CHAIN) e4:SetCode(EVENT_TO_GRAVE)
e4:SetRange(LOCATION_MZONE) e4:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY)
e4:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e4:SetCondition(c18386170.hdcon)
e4:SetCountLimit(1) e4:SetTarget(c18386170.hdtg)
e4:SetCost(c18386170.drcost) e4:SetOperation(c18386170.hdop)
e4:SetTarget(c18386170.drtg)
e4:SetOperation(c18386170.drop)
c:RegisterEffect(e4) c:RegisterEffect(e4)
--handes end
local e5=Effect.CreateEffect(c) function c18386170.ffilter(c,fc,sub,mg,sg)
e5:SetCategory(CATEGORY_HANDES) return c:IsFusionSetCard(0xb1) and (not sg or not sg:IsExists(Card.IsFusionCode,1,c,c:GetFusionCode()))
e5:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e5:SetCode(EVENT_TO_GRAVE)
e5:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY)
e5:SetCondition(c18386170.hdcon)
e5:SetTarget(c18386170.hdtg)
e5:SetOperation(c18386170.hdop)
c:RegisterEffect(e5)
end end
function c18386170.tgval(e,re,rp) function c18386170.tgval(e,re,rp)
return rp~=e:GetHandlerPlayer() return rp~=e:GetHandlerPlayer() and not re:GetHandler():IsImmuneToEffect(e)
end end
function c18386170.cfilter(c) function c18386170.cfilter(c)
return c:IsSetCard(0xb1) and c:IsAbleToGraveAsCost() return c:IsSetCard(0xb1) and c:IsAbleToGraveAsCost()
...@@ -80,40 +76,4 @@ function c18386170.hdop(e,tp,eg,ep,ev,re,r,rp) ...@@ -80,40 +76,4 @@ function c18386170.hdop(e,tp,eg,ep,ev,re,r,rp)
if g:GetCount()==0 then return end if g:GetCount()==0 then return end
local sg=g:RandomSelect(tp,1) local sg=g:RandomSelect(tp,1)
Duel.SendtoGrave(sg,REASON_EFFECT) Duel.SendtoGrave(sg,REASON_EFFECT)
end end
function c18386170.ffilter(c,fc) \ No newline at end of file
return c:IsFusionSetCard(0xb1) and not c:IsHasEffect(6205579) and c:IsCanBeFusionMaterial(fc)
end
function c18386170.fselect(c,mg,sg,tp,fc)
if sg:IsExists(Card.IsCode,1,nil,c:GetCode()) then return false end
sg:AddCard(c)
local res=false
if sg:GetCount()==3 then
res=Duel.GetLocationCountFromEx(tp,tp,sg,fc)>0
else
res=mg:IsExists(c18386170.fselect,1,sg,mg,sg,tp,fc)
end
sg:RemoveCard(c)
return res
end
function c18386170.fscon(e,g,gc,chkf)
if g==nil then return true end
local c=e:GetHandler()
local tp=c:GetControler()
local mg=g:Filter(c18386170.ffilter,nil,c)
local sg=Group.CreateGroup()
if gc then return c18386170.ffilter(gc,c) and c18386170.fselect(gc,mg,sg,tp,c) end
return mg:IsExists(c18386170.fselect,1,sg,mg,sg,tp,c)
end
function c18386170.fsop(e,tp,eg,ep,ev,re,r,rp,gc,chkf)
local c=e:GetHandler()
local mg=eg:Filter(c18386170.ffilter,nil,c)
local sg=Group.CreateGroup()
if gc then sg:AddCard(gc) end
repeat
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FMATERIAL)
local g=mg:FilterSelect(tp,c18386170.fselect,1,1,sg,mg,sg,tp,c)
sg:Merge(g)
until sg:GetCount()==3
Duel.SetFusionMaterial(sg)
end
...@@ -455,7 +455,7 @@ function Auxiliary.AddFusionProcMix(c,sub,insf,...) ...@@ -455,7 +455,7 @@ function Auxiliary.AddFusionProcMix(c,sub,insf,...)
local mat={} local mat={}
for i=1,#val do for i=1,#val do
if type(val[i])=='function' then if type(val[i])=='function' then
fun[i]=function(c) return val[i](c) and not c:IsHasEffect(6205579) end fun[i]=function(c,fc,sub,mg,sg) return val[i](c,fc,sub,mg,sg) and not c:IsHasEffect(6205579) end
else else
if sub then if sub then
fun[i]=function(c,fc,sub) return c:IsFusionCode(val[i]) or (sub and c:CheckFusionSubstitute(fc)) end fun[i]=function(c,fc,sub) return c:IsFusionCode(val[i]) or (sub and c:CheckFusionSubstitute(fc)) end
...@@ -531,15 +531,15 @@ function Auxiliary.FCheckMix(c,mg,sg,fc,sub,fun1,fun2,...) ...@@ -531,15 +531,15 @@ function Auxiliary.FCheckMix(c,mg,sg,fc,sub,fun1,fun2,...)
if fun2 then if fun2 then
sg:AddCard(c) sg:AddCard(c)
local res=false local res=false
if fun1(c,fc,false) then if fun1(c,fc,false,mg,sg) then
res=mg:IsExists(Auxiliary.FCheckMix,1,sg,mg,sg,fc,sub,fun2,...) res=mg:IsExists(Auxiliary.FCheckMix,1,sg,mg,sg,fc,sub,fun2,...)
elseif sub and fun1(c,fc,true) then elseif sub and fun1(c,fc,true,mg,sg) then
res=mg:IsExists(Auxiliary.FCheckMix,1,sg,mg,sg,fc,false,fun2,...) res=mg:IsExists(Auxiliary.FCheckMix,1,sg,mg,sg,fc,false,fun2,...)
end end
sg:RemoveCard(c) sg:RemoveCard(c)
return res return res
else else
return fun1(c,fc,sub) return fun1(c,fc,sub,mg,sg)
end end
end end
--if sg1 is subset of sg2 then not Auxiliary.FCheckAdditional(tp,sg1,fc) -> not Auxiliary.FCheckAdditional(tp,sg2,fc) --if sg1 is subset of sg2 then not Auxiliary.FCheckAdditional(tp,sg1,fc) -> not Auxiliary.FCheckAdditional(tp,sg2,fc)
...@@ -568,7 +568,7 @@ function Auxiliary.AddFusionProcMixRep(c,sub,insf,fun1,minc,maxc,...) ...@@ -568,7 +568,7 @@ function Auxiliary.AddFusionProcMixRep(c,sub,insf,fun1,minc,maxc,...)
local mat={} local mat={}
for i=1,#val do for i=1,#val do
if type(val[i])=='function' then if type(val[i])=='function' then
fun[i]=function(c) return val[i](c) and not c:IsHasEffect(6205579) end fun[i]=function(c,fc,sub,mg,sg) return val[i](c,fc,sub,mg,sg) and not c:IsHasEffect(6205579) end
else else
if sub then if sub then
fun[i]=function(c,fc,sub) return c:IsFusionCode(val[i]) or (sub and c:CheckFusionSubstitute(fc)) end fun[i]=function(c,fc,sub) return c:IsFusionCode(val[i]) or (sub and c:CheckFusionSubstitute(fc)) end
...@@ -638,15 +638,15 @@ function Auxiliary.FCheckMixRep(sg,g,fc,sub,chkf,fun1,minc,maxc,fun2,...) ...@@ -638,15 +638,15 @@ function Auxiliary.FCheckMixRep(sg,g,fc,sub,chkf,fun1,minc,maxc,fun2,...)
if fun2 then if fun2 then
return sg:IsExists(Auxiliary.FCheckMixRepFilter,1,g,sg,g,fc,sub,chkf,fun1,minc,maxc,fun2,...) return sg:IsExists(Auxiliary.FCheckMixRepFilter,1,g,sg,g,fc,sub,chkf,fun1,minc,maxc,fun2,...)
else else
local ct1=sg:FilterCount(fun1,g,fc,sub) local ct1=sg:FilterCount(fun1,g,fc,sub,mg,sg)
local ct2=sg:FilterCount(fun1,g,fc,false) local ct2=sg:FilterCount(fun1,g,fc,false,mg,sg)
return ct1==sg:GetCount()-g:GetCount() and ct1-ct2<=1 return ct1==sg:GetCount()-g:GetCount() and ct1-ct2<=1
end end
end end
function Auxiliary.FCheckMixRepFilter(c,sg,g,fc,sub,chkf,fun1,minc,maxc,fun2,...) function Auxiliary.FCheckMixRepFilter(c,sg,g,fc,sub,chkf,fun1,minc,maxc,fun2,...)
if fun2(c,fc,sub) then if fun2(c,fc,sub,mg,sg) then
g:AddCard(c) g:AddCard(c)
local sub=sub and fun2(c,fc,false) local sub=sub and fun2(c,fc,false,mg,sg)
local res=Auxiliary.FCheckMixRep(sg,g,fc,sub,chkf,fun1,minc,maxc,...) local res=Auxiliary.FCheckMixRep(sg,g,fc,sub,chkf,fun1,minc,maxc,...)
g:RemoveCard(c) g:RemoveCard(c)
return res return res
...@@ -661,9 +661,9 @@ function Auxiliary.FCheckMixRepGoal(tp,sg,fc,sub,chkf,fun1,minc,maxc,...) ...@@ -661,9 +661,9 @@ function Auxiliary.FCheckMixRepGoal(tp,sg,fc,sub,chkf,fun1,minc,maxc,...)
end end
function Auxiliary.FCheckMixRepTemplate(c,cond,tp,mg,sg,g,fc,sub,chkf,fun1,minc,maxc,...) function Auxiliary.FCheckMixRepTemplate(c,cond,tp,mg,sg,g,fc,sub,chkf,fun1,minc,maxc,...)
for i,f in ipairs({...}) do for i,f in ipairs({...}) do
if f(c,fc,sub) then if f(c,fc,sub,mg,sg) then
g:AddCard(c) g:AddCard(c)
local sub=sub and f(c,fc,false) local sub=sub and f(c,fc,false,mg,sg)
local t={...} local t={...}
table.remove(t,i) table.remove(t,i)
local res=cond(tp,mg,sg,g,fc,sub,chkf,fun1,minc,maxc,table.unpack(t)) local res=cond(tp,mg,sg,g,fc,sub,chkf,fun1,minc,maxc,table.unpack(t))
...@@ -672,9 +672,9 @@ function Auxiliary.FCheckMixRepTemplate(c,cond,tp,mg,sg,g,fc,sub,chkf,fun1,minc, ...@@ -672,9 +672,9 @@ function Auxiliary.FCheckMixRepTemplate(c,cond,tp,mg,sg,g,fc,sub,chkf,fun1,minc,
end end
end end
if maxc>0 then if maxc>0 then
if fun1(c,fc,sub) then if fun1(c,fc,sub,mg,sg) then
g:AddCard(c) g:AddCard(c)
local sub=sub and fun1(c,fc,false) local sub=sub and fun1(c,fc,false,mg,sg)
local res=cond(tp,mg,sg,g,fc,sub,chkf,fun1,minc-1,maxc-1,...) local res=cond(tp,mg,sg,g,fc,sub,chkf,fun1,minc-1,maxc-1,...)
g:RemoveCard(c) g:RemoveCard(c)
if res then return true end if res then return true end
...@@ -703,16 +703,16 @@ function Auxiliary.FCheckSelectMixRep(tp,mg,sg,g,fc,sub,chkf,fun1,minc,maxc,...) ...@@ -703,16 +703,16 @@ function Auxiliary.FCheckSelectMixRep(tp,mg,sg,g,fc,sub,chkf,fun1,minc,maxc,...)
end end
function Auxiliary.FCheckSelectMixRepAll(c,tp,mg,sg,g,fc,sub,chkf,fun1,minc,maxc,fun2,...) function Auxiliary.FCheckSelectMixRepAll(c,tp,mg,sg,g,fc,sub,chkf,fun1,minc,maxc,fun2,...)
if fun2 then if fun2 then
if fun2(c,fc,sub) then if fun2(c,fc,sub,mg,sg) then
g:AddCard(c) g:AddCard(c)
local sub=sub and fun2(c,fc,false) local sub=sub and fun2(c,fc,false,mg,sg)
local res=Auxiliary.FCheckSelectMixRep(tp,mg,sg,g,fc,sub,chkf,fun1,minc,maxc,...) local res=Auxiliary.FCheckSelectMixRep(tp,mg,sg,g,fc,sub,chkf,fun1,minc,maxc,...)
g:RemoveCard(c) g:RemoveCard(c)
return res return res
end end
elseif maxc>0 and fun1(c,fc,sub) then elseif maxc>0 and fun1(c,fc,sub,mg,sg) then
g:AddCard(c) g:AddCard(c)
local sub=sub and fun1(c,fc,false) local sub=sub and fun1(c,fc,false,mg,sg)
local res=Auxiliary.FCheckSelectMixRep(tp,mg,sg,g,fc,sub,chkf,fun1,minc-1,maxc-1) local res=Auxiliary.FCheckSelectMixRep(tp,mg,sg,g,fc,sub,chkf,fun1,minc-1,maxc-1)
g:RemoveCard(c) g:RemoveCard(c)
return res return res
......
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