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)
c:EnableReviveLimit()
--fusion material
aux.AddFusionProcFunRep(c,c16114248.ffilter,2,true)
--direct attack
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e1:SetCode(EFFECT_FUSION_MATERIAL)
e1:SetCondition(c16114248.fscon)
e1:SetOperation(c16114248.fsop)
e1:SetCode(EFFECT_DIRECT_ATTACK)
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
function c16114248.fsop(e,tp,eg,ep,ev,re,r,rp,gc)
local mg=eg:Filter(c16114248.filter,gc,e:GetHandler())
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)
function c16114248.ffilter(c,fc,sub,mg,sg)
return c:IsRace(RACE_MACHINE) and (not sg or sg:FilterCount(aux.TRUE,c)==0 or sg:IsExists(Card.IsFusionCode,1,c,c:GetFusionCode()))
end
--彼岸の巡礼者 ダンテ
function c18386170.initial_effect(c)
c:EnableReviveLimit()
--fusion material
aux.AddFusionProcFunRep(c,c18386170.ffilter,3,true)
--special summon condition
local e1=Effect.CreateEffect(c)
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:SetCondition(c18386170.fscon)
e1:SetOperation(c18386170.fsop)
e1:SetValue(aux.fuslimit)
c:RegisterEffect(e1)
--special summon condition
--cannot be target
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_SPSUMMON_CONDITION)
e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e2:SetValue(aux.fuslimit)
e2:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET)
e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e2:SetRange(LOCATION_MZONE)
e2:SetValue(c18386170.tgval)
c:RegisterEffect(e2)
--cannot be target
--draw
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_SINGLE)
e3:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET)
e3:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e3:SetCategory(CATEGORY_DRAW)
e3:SetType(EFFECT_TYPE_QUICK_O)
e3:SetCode(EVENT_FREE_CHAIN)
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)
--draw
--handes
local e4=Effect.CreateEffect(c)
e4:SetCategory(CATEGORY_DRAW)
e4:SetType(EFFECT_TYPE_QUICK_O)
e4:SetCode(EVENT_FREE_CHAIN)
e4:SetRange(LOCATION_MZONE)
e4:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e4:SetCountLimit(1)
e4:SetCost(c18386170.drcost)
e4:SetTarget(c18386170.drtg)
e4:SetOperation(c18386170.drop)
e4:SetCategory(CATEGORY_HANDES)
e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e4:SetCode(EVENT_TO_GRAVE)
e4:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY)
e4:SetCondition(c18386170.hdcon)
e4:SetTarget(c18386170.hdtg)
e4:SetOperation(c18386170.hdop)
c:RegisterEffect(e4)
--handes
local e5=Effect.CreateEffect(c)
e5:SetCategory(CATEGORY_HANDES)
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
function c18386170.ffilter(c,fc,sub,mg,sg)
return c:IsFusionSetCard(0xb1) and (not sg or not sg:IsExists(Card.IsFusionCode,1,c,c:GetFusionCode()))
end
function c18386170.tgval(e,re,rp)
return rp~=e:GetHandlerPlayer()
return rp~=e:GetHandlerPlayer() and not re:GetHandler():IsImmuneToEffect(e)
end
function c18386170.cfilter(c)
return c:IsSetCard(0xb1) and c:IsAbleToGraveAsCost()
......@@ -81,39 +77,3 @@ function c18386170.hdop(e,tp,eg,ep,ev,re,r,rp)
local sg=g:RandomSelect(tp,1)
Duel.SendtoGrave(sg,REASON_EFFECT)
end
\ No newline at end of file
function c18386170.ffilter(c,fc)
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,...)
local mat={}
for i=1,#val do
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
if sub then
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,...)
if fun2 then
sg:AddCard(c)
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,...)
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,...)
end
sg:RemoveCard(c)
return res
else
return fun1(c,fc,sub)
return fun1(c,fc,sub,mg,sg)
end
end
--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,...)
local mat={}
for i=1,#val do
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
if sub then
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,...)
if fun2 then
return sg:IsExists(Auxiliary.FCheckMixRepFilter,1,g,sg,g,fc,sub,chkf,fun1,minc,maxc,fun2,...)
else
local ct1=sg:FilterCount(fun1,g,fc,sub)
local ct2=sg:FilterCount(fun1,g,fc,false)
local ct1=sg:FilterCount(fun1,g,fc,sub,mg,sg)
local ct2=sg:FilterCount(fun1,g,fc,false,mg,sg)
return ct1==sg:GetCount()-g:GetCount() and ct1-ct2<=1
end
end
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)
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,...)
g:RemoveCard(c)
return res
......@@ -661,9 +661,9 @@ function Auxiliary.FCheckMixRepGoal(tp,sg,fc,sub,chkf,fun1,minc,maxc,...)
end
function Auxiliary.FCheckMixRepTemplate(c,cond,tp,mg,sg,g,fc,sub,chkf,fun1,minc,maxc,...)
for i,f in ipairs({...}) do
if f(c,fc,sub) then
if f(c,fc,sub,mg,sg) then
g:AddCard(c)
local sub=sub and f(c,fc,false)
local sub=sub and f(c,fc,false,mg,sg)
local t={...}
table.remove(t,i)
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,
end
end
if maxc>0 then
if fun1(c,fc,sub) then
if fun1(c,fc,sub,mg,sg) then
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,...)
g:RemoveCard(c)
if res then return true end
......@@ -703,16 +703,16 @@ function Auxiliary.FCheckSelectMixRep(tp,mg,sg,g,fc,sub,chkf,fun1,minc,maxc,...)
end
function Auxiliary.FCheckSelectMixRepAll(c,tp,mg,sg,g,fc,sub,chkf,fun1,minc,maxc,fun2,...)
if fun2 then
if fun2(c,fc,sub) then
if fun2(c,fc,sub,mg,sg) then
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,...)
g:RemoveCard(c)
return res
end
elseif maxc>0 and fun1(c,fc,sub) then
elseif maxc>0 and fun1(c,fc,sub,mg,sg) then
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)
g:RemoveCard(c)
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