Commit 129c46e8 authored by Vury Leo's avatar Vury Leo Committed by wind2009

Add 烙印 to new fusion + pass e tp to matfilter

parent 7e547aeb
--白の烙印 --白の烙印
function c34995106.initial_effect(c) local s,id,o=GetID()
function s.initial_effect(c)
aux.AddCodeList(c,68468459) aux.AddCodeList(c,68468459)
--Activate --Activate
local e1=Effect.CreateEffect(c) local e1=FusionSpell.CreateSummonEffect(c,{
e1:SetDescription(aux.Stringid(34995106,0)) post_select_mat_location=LOCATION_GRAVE,
additional_fcheck=s.fcheck,
extra_target=s.extra_target
})
e1:SetDescription(aux.Stringid(id,0))
e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_FUSION_SUMMON+CATEGORY_REMOVE) e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_FUSION_SUMMON+CATEGORY_REMOVE)
e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCountLimit(1,id)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCountLimit(1,34995106)
e1:SetTarget(c34995106.target)
e1:SetOperation(c34995106.activate)
c:RegisterEffect(e1) c:RegisterEffect(e1)
--to grave --to grave
local e2=Effect.CreateEffect(c) local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e2:SetCode(EVENT_TO_GRAVE) e2:SetCode(EVENT_TO_GRAVE)
e2:SetCondition(c34995106.regcon) e2:SetCondition(s.regcon)
e2:SetOperation(c34995106.regop) e2:SetOperation(s.regop)
c:RegisterEffect(e2) c:RegisterEffect(e2)
--set --set
local e3=Effect.CreateEffect(c) local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(34995106,1)) e3:SetDescription(aux.Stringid(id,1))
e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e3:SetCode(EVENT_PHASE+PHASE_END) e3:SetCode(EVENT_PHASE+PHASE_END)
e3:SetRange(LOCATION_GRAVE) e3:SetRange(LOCATION_GRAVE)
e3:SetCountLimit(1,34995107) e3:SetCountLimit(1,id+o)
e3:SetCondition(c34995106.setcon) e3:SetCondition(s.setcon)
e3:SetTarget(c34995106.settg) e3:SetTarget(s.settg)
e3:SetOperation(c34995106.setop) e3:SetOperation(s.setop)
c:RegisterEffect(e3) c:RegisterEffect(e3)
end end
function c34995106.filter1(c,e)
return c:IsType(TYPE_MONSTER) and c:IsAbleToRemove() and c:IsCanBeFusionMaterial() and not c:IsImmuneToEffect(e) --- @type FUSION_FGCHECK_FUNCTION
end function s.fcheck(tp,mg,fc,mg_all)
function c34995106.filter2(c,e) --- Must include a Dragon monster
return not c:IsImmuneToEffect(e) if not mg_all:IsExists(function(c) return c:IsRace(RACE_DRAGON) end,1,nil) then
end return false
function c34995106.spfilter(c,e,tp,m,f,chkf)
return (not f or f(c))
and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_FUSION,tp,false,false) and c:CheckFusionMaterial(m,nil,chkf)
end
function c34995106.chkfilter(c,tp)
return c:IsControler(tp) and c:IsCode(68468459)
end
function c34995106.exfilter(c,tp)
return c:IsControler(tp) and c:IsLocation(LOCATION_GRAVE)
end
function c34995106.fcheck(tp,sg,fc)
if sg:IsExists(c34995106.chkfilter,1,nil,tp) then
return sg:IsExists(Card.IsRace,1,nil,RACE_DRAGON)
else
return sg:IsExists(Card.IsRace,1,nil,RACE_DRAGON) and not sg:IsExists(c34995106.exfilter,1,nil,tp)
end end
end --- if using Grave, must use own "Fallen of Albaz"
function c34995106.target(e,tp,eg,ep,ev,re,r,rp,chk) local has_grave=mg:IsExists(function(c) return c:IsLocation(LOCATION_GRAVE) end,1,nil)
if chk==0 then if has_grave==true then
local chkf=tp if not mg_all:IsExists(function(c) return c:IsControler(tp) and c:IsFusionCode(68468459) end,1,nil) then
local mg1=Duel.GetFusionMaterial(tp):Filter(c34995106.filter2,nil,e) return false
local mg2=Duel.GetMatchingGroup(c34995106.filter1,tp,LOCATION_GRAVE,0,nil,e)
if mg1:IsExists(c34995106.chkfilter,1,nil,tp) and mg2:GetCount()>0 or mg2:IsExists(c34995106.chkfilter,1,nil,tp) then
mg1:Merge(mg2)
end end
aux.FCheckAdditional=c34995106.fcheck
local res=Duel.IsExistingMatchingCard(c34995106.spfilter,tp,LOCATION_EXTRA,0,1,nil,e,tp,mg1,nil,chkf)
if not res then
local ce=Duel.GetChainMaterial(tp)
if ce~=nil then
local fgroup=ce:GetTarget()
local mg3=fgroup(ce,e,tp)
local mf=ce:GetValue()
res=Duel.IsExistingMatchingCard(c34995106.spfilter,tp,LOCATION_EXTRA,0,1,nil,e,tp,mg3,mf,chkf)
end
end
aux.FCheckAdditional=nil
return res
end end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA) return true
Duel.SetOperationInfo(0,CATEGORY_REMOVE,nil,0,tp,LOCATION_GRAVE)
end end
function c34995106.activate(e,tp,eg,ep,ev,re,r,rp)
local chkf=tp function s.extra_target(e,tp,eg,ep,ev,re,r,rp,chk)
local mg1=Duel.GetFusionMaterial(tp):Filter(c34995106.filter2,nil,e) if chk==0 then
local mg2=Duel.GetMatchingGroup(c34995106.filter1,tp,LOCATION_GRAVE,0,nil,e) return true
if mg1:IsExists(c34995106.chkfilter,1,nil,tp) and mg2:GetCount()>0 or mg2:IsExists(c34995106.chkfilter,1,nil,tp) then
mg1:Merge(mg2)
end
aux.FCheckAdditional=c34995106.fcheck
local sg1=Duel.GetMatchingGroup(c34995106.spfilter,tp,LOCATION_EXTRA,0,nil,e,tp,mg1,nil,chkf)
local mg3=nil
local sg2=nil
local ce=Duel.GetChainMaterial(tp)
if ce~=nil then
local fgroup=ce:GetTarget()
mg3=fgroup(ce,e,tp)
local mf=ce:GetValue()
sg2=Duel.GetMatchingGroup(c34995106.spfilter,tp,LOCATION_EXTRA,0,nil,e,tp,mg3,mf,chkf)
end
if sg1:GetCount()>0 or (sg2~=nil and sg2:GetCount()>0) then
local sg=sg1:Clone()
if sg2 then sg:Merge(sg2) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local tg=sg:Select(tp,1,1,nil)
local tc=tg:GetFirst()
if sg1:IsContains(tc) and (sg2==nil or not sg2:IsContains(tc) or not Duel.SelectYesNo(tp,ce:GetDescription())) then
local mat1=Duel.SelectFusionMaterial(tp,tc,mg1,nil,chkf)
tc:SetMaterial(mat1)
local mat2=mat1:Filter(Card.IsLocation,nil,LOCATION_GRAVE)
mat1:Sub(mat2)
Duel.SendtoGrave(mat1,REASON_EFFECT+REASON_MATERIAL+REASON_FUSION)
Duel.Remove(mat2,POS_FACEUP,REASON_EFFECT+REASON_MATERIAL+REASON_FUSION)
Duel.BreakEffect()
Duel.SpecialSummon(tc,SUMMON_TYPE_FUSION,tp,tp,false,false,POS_FACEUP)
else
local mat2=Duel.SelectFusionMaterial(tp,tc,mg3,nil,chkf)
local fop=ce:GetOperation()
fop(ce,e,tp,tc,mat2)
end
tc:CompleteProcedure()
end end
aux.FCheckAdditional=nil Duel.SetOperationInfo(0,CATEGORY_REMOVE,nil,0,tp,LOCATION_GRAVE)
end end
function c34995106.regcon(e,tp,eg,ep,ev,re,r,rp)
function s.regcon(e,tp,eg,ep,ev,re,r,rp)
local code1,code2=Duel.GetChainInfo(ev,CHAININFO_TRIGGERING_CODE,CHAININFO_TRIGGERING_CODE2) local code1,code2=Duel.GetChainInfo(ev,CHAININFO_TRIGGERING_CODE,CHAININFO_TRIGGERING_CODE2)
return e:GetHandler():IsReason(REASON_COST) and re and re:IsActivated() and (code1==68468459 or code2==68468459) return e:GetHandler():IsReason(REASON_COST) and re and re:IsActivated() and (code1==68468459 or code2==68468459)
end end
function c34995106.regop(e,tp,eg,ep,ev,re,r,rp)
function s.regop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler() local c=e:GetHandler()
c:RegisterFlagEffect(34995106,RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END,0,1) c:RegisterFlagEffect(id,RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END,0,1)
end end
function c34995106.setcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():GetFlagEffect(34995106)>0 function s.setcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():GetFlagEffect(id)>0
end end
function c34995106.settg(e,tp,eg,ep,ev,re,r,rp,chk)
function s.settg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsSSetable() end if chk==0 then return e:GetHandler():IsSSetable() end
Duel.SetOperationInfo(0,CATEGORY_LEAVE_GRAVE,e:GetHandler(),1,0,0) Duel.SetOperationInfo(0,CATEGORY_LEAVE_GRAVE,e:GetHandler(),1,0,0)
end end
function c34995106.setop(e,tp,eg,ep,ev,re,r,rp)
function s.setop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler() local c=e:GetHandler()
if c:IsRelateToEffect(e) then if c:IsRelateToEffect(e) then
Duel.SSet(tp,c) Duel.SSet(tp,c)
......
--烙印融合 --烙印融合
function c44362883.initial_effect(c) local s,id,o=GetID()
function s.initial_effect(c)
aux.AddCodeList(c,68468459) aux.AddCodeList(c,68468459)
--Activate --Activate
local e1=Effect.CreateEffect(c) local e1=FusionSpell.CreateSummonEffect(c,{
fusfilter=s.fusfilter,
pre_select_mat_location=LOCATION_HAND|LOCATION_DECK|LOCATION_MZONE,
additional_fcheck=s.fcheck
})
e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_FUSION_SUMMON+CATEGORY_DECKDES) e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_FUSION_SUMMON+CATEGORY_DECKDES)
e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCountLimit(1,id+EFFECT_COUNT_CODE_OATH)
e1:SetCode(EVENT_FREE_CHAIN) e1:SetCost(s.cost)
e1:SetCountLimit(1,44362883+EFFECT_COUNT_CODE_OATH)
e1:SetCost(c44362883.cost)
e1:SetTarget(c44362883.target)
e1:SetOperation(c44362883.activate)
c:RegisterEffect(e1) c:RegisterEffect(e1)
Duel.AddCustomActivityCounter(44362883,ACTIVITY_SPSUMMON,c44362883.counterfilter) Duel.AddCustomActivityCounter(id,ACTIVITY_SPSUMMON,s.counterfilter)
end end
function c44362883.counterfilter(c)
function s.counterfilter(c)
return not c:IsSummonLocation(LOCATION_EXTRA) or c:IsType(TYPE_FUSION) return not c:IsSummonLocation(LOCATION_EXTRA) or c:IsType(TYPE_FUSION)
end end
function c44362883.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetCustomActivityCount(44362883,tp,ACTIVITY_SPSUMMON)==0 end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetCustomActivityCount(id,tp,ACTIVITY_SPSUMMON)==0 end
local e1=Effect.CreateEffect(e:GetHandler()) local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD) e1:SetType(EFFECT_TYPE_FIELD)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_OATH) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_OATH)
e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
e1:SetReset(RESET_PHASE+PHASE_END) e1:SetReset(RESET_PHASE+PHASE_END)
e1:SetTargetRange(1,0) e1:SetTargetRange(1,0)
e1:SetTarget(c44362883.splimit) e1:SetTarget(s.splimit)
Duel.RegisterEffect(e1,tp) Duel.RegisterEffect(e1,tp)
end end
function c44362883.splimit(e,c)
function s.splimit(e,c)
return c:IsLocation(LOCATION_EXTRA) and not c:IsType(TYPE_FUSION) return c:IsLocation(LOCATION_EXTRA) and not c:IsType(TYPE_FUSION)
end end
function c44362883.filter0(c)
return c:IsType(TYPE_MONSTER) and c:IsCanBeFusionMaterial() and c:IsAbleToGrave() function s.fusfilter(c)
return aux.IsMaterialListCode(c,68468459)==true
end end
function c44362883.filter1(c,e)
return not c:IsImmuneToEffect(e) --- @type FUSION_FGCHECK_FUNCTION
end function s.fcheck(tp,mg,fc,mg_all)
function c44362883.filter2(c,e,tp,m,f,chkf) if #mg_all>2 then
if not (c:IsType(TYPE_FUSION) and aux.IsMaterialListCode(c,68468459) and (not f or f(c)) return false
and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_FUSION,tp,false,false)) then return false end
aux.FCheckAdditional=c.branded_fusion_check or c44362883.fcheck
local res=c:CheckFusionMaterial(m,nil,chkf)
aux.FCheckAdditional=nil
return res
end
function c44362883.fcheck(tp,sg,fc)
return sg:GetCount()<=2 and sg:IsExists(Card.IsFusionCode,1,nil,68468459)
end
function c44362883.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then
local chkf=tp
local mg1=Duel.GetFusionMaterial(tp)
local mg2=Duel.GetMatchingGroup(c44362883.filter0,tp,LOCATION_DECK,0,nil)
mg1:Merge(mg2)
local res=Duel.IsExistingMatchingCard(c44362883.filter2,tp,LOCATION_EXTRA,0,1,nil,e,tp,mg1,nil,chkf)
if not res then
local ce=Duel.GetChainMaterial(tp)
if ce~=nil then
local fgroup=ce:GetTarget()
local mg2=fgroup(ce,e,tp)
local mf=ce:GetValue()
res=Duel.IsExistingMatchingCard(c44362883.filter2,tp,LOCATION_EXTRA,0,1,nil,e,tp,mg2,mf,chkf)
end
end
return res
end end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA) if fc.branded_fusion_check~=nil then
end if fc.branded_fusion_check(tp,mg_all,fc)==false then
function c44362883.activate(e,tp,eg,ep,ev,re,r,rp) return false
local chkf=tp end
local mg1=Duel.GetFusionMaterial(tp):Filter(c44362883.filter1,nil,e) else
local mg2=Duel.GetMatchingGroup(c44362883.filter0,tp,LOCATION_DECK,0,nil) if not mg_all:IsExists(function(c) return c:IsFusionCode(68468459) end,1,nil) then
mg1:Merge(mg2) return false
local sg1=Duel.GetMatchingGroup(c44362883.filter2,tp,LOCATION_EXTRA,0,nil,e,tp,mg1,nil,chkf)
local mg3=nil
local sg2=nil
local ce=Duel.GetChainMaterial(tp)
if ce~=nil then
local fgroup=ce:GetTarget()
mg3=fgroup(ce,e,tp)
local mf=ce:GetValue()
sg2=Duel.GetMatchingGroup(c44362883.filter2,tp,LOCATION_EXTRA,0,nil,e,tp,mg3,mf,chkf)
end
if sg1:GetCount()>0 or (sg2~=nil and sg2:GetCount()>0) then
local sg=sg1:Clone()
if sg2 then sg:Merge(sg2) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local tg=sg:Select(tp,1,1,nil)
local tc=tg:GetFirst()
if sg1:IsContains(tc) and (sg2==nil or not sg2:IsContains(tc) or not Duel.SelectYesNo(tp,ce:GetDescription())) then
aux.FCheckAdditional=tc.branded_fusion_check or c44362883.fcheck
local mat1=Duel.SelectFusionMaterial(tp,tc,mg1,nil,chkf)
aux.FCheckAdditional=nil
tc:SetMaterial(mat1)
Duel.SendtoGrave(mat1,REASON_EFFECT+REASON_MATERIAL+REASON_FUSION)
Duel.BreakEffect()
Duel.SpecialSummon(tc,SUMMON_TYPE_FUSION,tp,tp,false,false,POS_FACEUP)
else
local mat2=Duel.SelectFusionMaterial(tp,tc,mg3,nil,chkf)
local fop=ce:GetOperation()
fop(ce,e,tp,tc,mat2)
end end
tc:CompleteProcedure()
end end
return true
end end
--烙印追放 --烙印追放
function c6763530.initial_effect(c) local s,id,o=GetID()
function s.initial_effect(c)
local e0=FusionSpell.CreateSummonEffect(c,{
fusfilter=s.fusfilter,
matfilter=aux.NecroValleyFilter(),
pre_select_mat_location=LOCATION_MZONE,
pre_select_mat_opponent_location=LOCATION_MZONE,
mat_operation_code_map={
{ [LOCATION_REMOVED]=FusionSpell.FUSION_OPERATION_GRAVE },
{ [0xff]=FusionSpell.FUSION_OPERATION_BANISH }
}
})
--activate --activate
local e1=Effect.CreateEffect(c) local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_FUSION_SUMMON) e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_FUSION_SUMMON)
e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN) e1:SetCode(EVENT_FREE_CHAIN)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetCountLimit(1,6763530+EFFECT_COUNT_CODE_OATH) e1:SetCountLimit(1,id+EFFECT_COUNT_CODE_OATH)
e1:SetHintTiming(0,TIMINGS_CHECK_MONSTER+TIMING_END_PHASE) e1:SetHintTiming(0,TIMINGS_CHECK_MONSTER+TIMING_END_PHASE)
e1:SetTarget(c6763530.target) e1:SetTarget(s.target)
e1:SetOperation(c6763530.activate) e1:SetOperation(s.activate)
e1:SetLabelObject(e0)
c:RegisterEffect(e1) c:RegisterEffect(e1)
end end
function c6763530.filter(c,e,tp)
function s.filter(c,e,tp)
return (c:IsSetCard(0x164) or c:IsType(TYPE_FUSION) and c:IsLevelAbove(8)) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) return (c:IsSetCard(0x164) or c:IsType(TYPE_FUSION) and c:IsLevelAbove(8)) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end end
function c6763530.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and c6763530.filter(chkc,e,tp) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and s.filter(chkc,e,tp) end
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingTarget(c6763530.filter,tp,LOCATION_GRAVE,0,1,nil,e,tp) end and Duel.IsExistingTarget(s.filter,tp,LOCATION_GRAVE,0,1,nil,e,tp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectTarget(tp,c6763530.filter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp) local g=Duel.SelectTarget(tp,s.filter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0)
end end
function c6763530.filter0(c,e)
return c:IsOnField() and c:IsAbleToRemove() and not c:IsImmuneToEffect(e) function s.fusfilter(c)
return c:IsLevelAbove(8)
end end
function c6763530.filter1(c,e)
return c:IsFaceup() and c:IsCanBeFusionMaterial() and c:IsAbleToRemove() and not c:IsImmuneToEffect(e) function s.activate(e,tp,eg,ep,ev,re,r,rp)
end
function c6763530.filter2(c,e,tp,m,f,chkf)
return c:IsType(TYPE_FUSION) and c:IsLevelAbove(8) and (not f or f(c))
and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_FUSION,tp,false,false) and c:CheckFusionMaterial(m,nil,chkf)
end
function c6763530.activate(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end
local tc=Duel.GetFirstTarget() local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) and Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP)>0 and tc:IsLocation(LOCATION_MZONE) then if tc:IsRelateToEffect(e) and Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP)>0 and tc:IsLocation(LOCATION_MZONE) then
local chkf=tp local fusion_effect=e:GetLabelObject()
local mg1=Duel.GetFusionMaterial(tp):Filter(c6763530.filter0,nil,e) if fusion_effect:GetTarget()(e,tp,eg,ep,ev,re,r,rp,0) and Duel.SelectYesNo(tp,aux.Stringid(id,0)) then
local mg2=Duel.GetMatchingGroup(c6763530.filter1,tp,0,LOCATION_MZONE,nil,e)
mg1:Merge(mg2)
local sg1=Duel.GetMatchingGroup(c6763530.filter2,tp,LOCATION_EXTRA,0,nil,e,tp,mg1,nil,chkf)
local mg3=nil
local sg2=nil
local ce=Duel.GetChainMaterial(tp)
if ce~=nil then
local fgroup=ce:GetTarget()
mg3=fgroup(ce,e,tp)
local mf=ce:GetValue()
sg2=Duel.GetMatchingGroup(c6763530.filter2,tp,LOCATION_EXTRA,0,nil,e,tp,mg3,mf,chkf)
end
if (sg1:GetCount()>0 or (sg2~=nil and sg2:GetCount()>0)) and Duel.SelectYesNo(tp,aux.Stringid(6763530,0)) then
Duel.BreakEffect() Duel.BreakEffect()
local sg=sg1:Clone() fusion_effect:GetOperation()(e,tp,eg,ep,ev,re,r,rp)
if sg2 then sg:Merge(sg2) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local tg=sg:Select(tp,1,1,nil)
local tc=tg:GetFirst()
if sg1:IsContains(tc) and (sg2==nil or not sg2:IsContains(tc) or not Duel.SelectYesNo(tp,ce:GetDescription())) then
local mat1=Duel.SelectFusionMaterial(tp,tc,mg1,nil,chkf)
tc:SetMaterial(mat1)
Duel.Remove(mat1,POS_FACEUP,REASON_EFFECT+REASON_MATERIAL+REASON_FUSION)
Duel.BreakEffect()
Duel.SpecialSummon(tc,SUMMON_TYPE_FUSION,tp,tp,false,false,POS_FACEUP)
else
local mat2=Duel.SelectFusionMaterial(tp,tc,mg3,nil,chkf)
local fop=ce:GetOperation()
fop(ce,e,tp,tc,mat2)
end
tc:CompleteProcedure()
end end
end end
end end
--アルバスの落胤 --アルバスの落胤
function c68468459.initial_effect(c) local s,id,o=GetID()
function s.initial_effect(c)
--fusion summon --fusion summon
local e1=Effect.CreateEffect(c) local e1=FusionSpell.CreateSummonEffect(c,{
e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_FUSION_SUMMON) matfilter=s.matfilter,
pre_select_mat_location=LOCATION_MZONE,
pre_select_mat_opponent_location=LOCATION_MZONE,
gc=s.gc
})
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e1:SetProperty(EFFECT_FLAG_DELAY) e1:SetProperty(EFFECT_FLAG_DELAY)
e1:SetCode(EVENT_SUMMON_SUCCESS) e1:SetCode(EVENT_SUMMON_SUCCESS)
e1:SetCountLimit(1,68468459) e1:SetRange(LOCATION_MZONE)
e1:SetCondition(c68468459.condition) e1:SetCountLimit(1,id)
e1:SetCost(c68468459.cost) e1:SetCondition(s.condition)
e1:SetTarget(c68468459.target) e1:SetCost(s.cost)
e1:SetOperation(c68468459.activate)
c:RegisterEffect(e1) c:RegisterEffect(e1)
local e2=e1:Clone() local e2=e1:Clone()
e2:SetCode(EVENT_SPSUMMON_SUCCESS) e2:SetCode(EVENT_SPSUMMON_SUCCESS)
c:RegisterEffect(e2) c:RegisterEffect(e2)
end end
function c68468459.condition(e,tp,eg,ep,ev,re,r,rp)
function s.condition(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetCurrentPhase()&(PHASE_DAMAGE+PHASE_DAMAGE_CAL)==0 return Duel.GetCurrentPhase()&(PHASE_DAMAGE+PHASE_DAMAGE_CAL)==0
end end
function c68468459.cost(e,tp,eg,ep,ev,re,r,rp,chk)
function s.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(Card.IsDiscardable,tp,LOCATION_HAND,0,1,e:GetHandler()) end if chk==0 then return Duel.IsExistingMatchingCard(Card.IsDiscardable,tp,LOCATION_HAND,0,1,e:GetHandler()) end
Duel.DiscardHand(tp,Card.IsDiscardable,1,1,REASON_COST+REASON_DISCARD) Duel.DiscardHand(tp,Card.IsDiscardable,1,1,REASON_COST+REASON_DISCARD)
end end
function c68468459.filter0(c)
return c:IsFaceup() and c:IsCanBeFusionMaterial() function s.matfilter(c,e,tp)
end if c:IsOnField() and c:IsControler(tp) and c~=e:GetHandler() then
function c68468459.filter1(c,e) return false
return not c:IsImmuneToEffect(e)
end
function c68468459.filter2(c,e,tp,m,f,gc,chkf)
return c:IsType(TYPE_FUSION) and (not f or f(c))
and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_FUSION,tp,false,false) and c:CheckFusionMaterial(m,gc,chkf)
end
function c68468459.chkfilter(c,tp)
return c:IsOnField() and c:IsControler(tp)
end
function c68468459.fcheck(c)
return function(tp,sg,fc)
return not sg:IsExists(c68468459.chkfilter,1,c,tp)
end
end
function c68468459.target(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then
local chkf=tp
local mg1=Duel.GetFusionMaterial(tp):Filter(Card.IsOnField,nil)
local mg2=Duel.GetMatchingGroup(c68468459.filter0,tp,0,LOCATION_MZONE,nil)
if mg2:GetCount()>0 then
mg1:Merge(mg2)
end
aux.FCheckAdditional=c68468459.fcheck(c)
local res=Duel.IsExistingMatchingCard(c68468459.filter2,tp,LOCATION_EXTRA,0,1,nil,e,tp,mg1,nil,c,chkf)
if not res then
local ce=Duel.GetChainMaterial(tp)
if ce~=nil then
local fgroup=ce:GetTarget()
local mg3=fgroup(ce,e,tp)
local mf=ce:GetValue()
res=Duel.IsExistingMatchingCard(c68468459.filter2,tp,LOCATION_EXTRA,0,1,nil,e,tp,mg3,mf,c,chkf)
end
end
aux.FCheckAdditional=nil
return res and c:IsRelateToEffect(e)
end end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA) return true
end end
function c68468459.activate(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler() function s.gc(e)
local chkf=tp return e:GetHandler()
if Duel.GetCurrentPhase()&(PHASE_DAMAGE+PHASE_DAMAGE_CAL)~=0 then return end
if not c:IsRelateToEffect(e) or c:IsImmuneToEffect(e) then return end
local mg1=Duel.GetFusionMaterial(tp):Filter(Card.IsOnField,nil):Filter(c68468459.filter1,nil,e)
local mg2=Duel.GetMatchingGroup(c68468459.filter0,tp,0,LOCATION_MZONE,nil):Filter(c68468459.filter1,nil,e)
if mg2:GetCount()>0 then
mg1:Merge(mg2)
end
aux.FCheckAdditional=c68468459.fcheck(c)
local sg1=Duel.GetMatchingGroup(c68468459.filter2,tp,LOCATION_EXTRA,0,nil,e,tp,mg1,nil,c,chkf)
local mg3=nil
local sg2=nil
local ce=Duel.GetChainMaterial(tp)
if ce~=nil then
local fgroup=ce:GetTarget()
mg3=fgroup(ce,e,tp)
local mf=ce:GetValue()
sg2=Duel.GetMatchingGroup(c68468459.filter2,tp,LOCATION_EXTRA,0,nil,e,tp,mg3,mf,c,chkf)
end
if sg1:GetCount()>0 or (sg2~=nil and sg2:GetCount()>0) then
local sg=sg1:Clone()
if sg2 then sg:Merge(sg2) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local tg=sg:Select(tp,1,1,nil)
local tc=tg:GetFirst()
if sg1:IsContains(tc) and (sg2==nil or not sg2:IsContains(tc) or not Duel.SelectYesNo(tp,ce:GetDescription())) then
local mat1=Duel.SelectFusionMaterial(tp,tc,mg1,c,chkf)
tc:SetMaterial(mat1)
Duel.SendtoGrave(mat1,REASON_EFFECT+REASON_MATERIAL+REASON_FUSION)
Duel.BreakEffect()
Duel.SpecialSummon(tc,SUMMON_TYPE_FUSION,tp,tp,false,false,POS_FACEUP)
else
local mat2=Duel.SelectFusionMaterial(tp,tc,mg3,c,chkf)
local fop=ce:GetOperation()
fop(ce,e,tp,tc,mat2)
end
tc:CompleteProcedure()
end
aux.FCheckAdditional=nil
end end
--赫の烙印 --赫の烙印
function c82738008.initial_effect(c) local s,id,o=GetID()
function s.initial_effect(c)
aux.AddCodeList(c,68468459) aux.AddCodeList(c,68468459)
--- fusion effect
local e0=FusionSpell.CreateSummonEffect(c,{
fusfilter=s.fusfilter,
matfilter=aux.NecroValleyFilter(),
mat_operation_code_map={
{ [LOCATION_REMOVED]=FusionSpell.FUSION_OPERATION_GRAVE },
{ [0xff]=FusionSpell.FUSION_OPERATION_BANISH }
},
stage_x_operation=s.stage_x_operation
})
--Activate --Activate
local e1=Effect.CreateEffect(c) local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SPECIAL_SUMMON+CATEGORY_FUSION_SUMMON) e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SPECIAL_SUMMON+CATEGORY_FUSION_SUMMON)
e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN) e1:SetCode(EVENT_FREE_CHAIN)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetCountLimit(1,82738008+EFFECT_COUNT_CODE_OATH) e1:SetCountLimit(1,id+EFFECT_COUNT_CODE_OATH)
e1:SetTarget(c82738008.target) e1:SetTarget(s.target)
e1:SetOperation(c82738008.activate) e1:SetOperation(s.activate)
e1:SetLabelObject(e0)
c:RegisterEffect(e1) c:RegisterEffect(e1)
end end
function c82738008.filter(c)
function s.filter(c)
return (c:IsSetCard(0x164) and c:IsType(TYPE_MONSTER) or c:IsCode(68468459)) and c:IsAbleToHand() return (c:IsSetCard(0x164) and c:IsType(TYPE_MONSTER) or c:IsCode(68468459)) and c:IsAbleToHand()
end end
function c82738008.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and c82738008.filter(chkc) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chk==0 then return Duel.IsExistingTarget(c82738008.filter,tp,LOCATION_GRAVE,0,1,nil) end if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and s.filter(chkc) end
if chk==0 then return Duel.IsExistingTarget(s.filter,tp,LOCATION_GRAVE,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectTarget(tp,c82738008.filter,tp,LOCATION_GRAVE,0,1,1,nil) local g=Duel.SelectTarget(tp,s.filter,tp,LOCATION_GRAVE,0,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,1,0,0) Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,1,0,0)
end end
function c82738008.filter1(c,e)
return c:IsAbleToRemove() and not c:IsImmuneToEffect(e) function s.fusfilter(c)
return c:IsLevelAbove(8)
end end
function c82738008.filter2(c,e,tp,m,f,chkf)
return c:IsType(TYPE_FUSION) and c:IsLevelAbove(8) and (not f or f(c)) function s.activate(e,tp,eg,ep,ev,re,r,rp)
and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_FUSION,tp,false,false) and c:CheckFusionMaterial(m,nil,chkf)
end
function c82738008.activate(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget() local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) and Duel.SendtoHand(tc,nil,REASON_EFFECT)>0 and tc:IsLocation(LOCATION_HAND) then if tc:IsRelateToEffect(e) and Duel.SendtoHand(tc,nil,REASON_EFFECT)>0 and tc:IsLocation(LOCATION_HAND) then
local chkf=tp local fusion_effect=e:GetLabelObject()
local mg1=Duel.GetFusionMaterial(tp):Filter(c82738008.filter1,nil,e) if fusion_effect:GetTarget()(e,tp,eg,ep,ev,re,r,rp,0) and Duel.SelectYesNo(tp,aux.Stringid(id,0)) then
local sg1=Duel.GetMatchingGroup(c82738008.filter2,tp,LOCATION_EXTRA,0,nil,e,tp,mg1,nil,chkf)
local mg2=nil
local sg2=nil
local ce=Duel.GetChainMaterial(tp)
if ce~=nil then
local fgroup=ce:GetTarget()
mg2=fgroup(ce,e,tp)
local mf=ce:GetValue()
sg2=Duel.GetMatchingGroup(c82738008.filter2,tp,LOCATION_EXTRA,0,nil,e,tp,mg2,mf,chkf)
end
if (sg1:GetCount()>0 or (sg2~=nil and sg2:GetCount()>0)) and Duel.SelectYesNo(tp,aux.Stringid(82738008,0)) then
Duel.BreakEffect() Duel.BreakEffect()
Duel.ShuffleHand(tp) Duel.ShuffleHand(tp)
local sg=sg1:Clone() fusion_effect:GetOperation()(e,tp,eg,ep,ev,re,r,rp)
if sg2 then sg:Merge(sg2) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local tg=sg:Select(tp,1,1,nil)
local tc=tg:GetFirst()
if sg1:IsContains(tc) and (sg2==nil or not sg2:IsContains(tc) or not Duel.SelectYesNo(tp,ce:GetDescription())) then
local mat1=Duel.SelectFusionMaterial(tp,tc,mg1,nil,chkf)
tc:SetMaterial(mat1)
Duel.Remove(mat1,POS_FACEUP,REASON_EFFECT+REASON_MATERIAL+REASON_FUSION)
Duel.BreakEffect()
Duel.SpecialSummon(tc,SUMMON_TYPE_FUSION,tp,tp,false,false,POS_FACEUP)
else
local mat2=Duel.SelectFusionMaterial(tp,tc,mg2,nil,chkf)
local fop=ce:GetOperation()
fop(ce,e,tp,tc,mat2)
end
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetCode(EFFECT_CANNOT_DIRECT_ATTACK)
e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END)
tc:RegisterEffect(e1)
tc:CompleteProcedure()
end end
end end
end end
--- @type FUSION_SPELL_STAGE_X_CALLBACK_FUNCTION
function s.stage_x_operation(e,tc,tp,stage)
if stage==FusionSpell.STAGE_BEFORE_SUMMON_COMPLETE then
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetCode(EFFECT_CANNOT_DIRECT_ATTACK)
e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END)
tc:RegisterEffect(e1)
end
end
--烙印竜アルビオン --烙印竜アルビオン
function c87746184.initial_effect(c) local s,id,o=GetID()
function s.initial_effect(c)
--fusion material --fusion material
c:EnableReviveLimit() c:EnableReviveLimit()
aux.AddFusionProcCodeFun(c,68468459,aux.FilterBoolFunction(Card.IsFusionAttribute,ATTRIBUTE_LIGHT),1,true,true) aux.AddFusionProcCodeFun(c,68468459,aux.FilterBoolFunction(Card.IsFusionAttribute,ATTRIBUTE_LIGHT),1,true,true)
--fusion summon --fusion summon
local e1=Effect.CreateEffect(c) local e1=FusionSpell.CreateSummonEffect(c,{
e1:SetDescription(aux.Stringid(87746184,0)) fusfilter=s.fusfilter,
pre_select_mat_location=LOCATION_HAND|LOCATION_MZONE|LOCATION_GRAVE,
mat_operation_code_map={
{ [LOCATION_REMOVED]=FusionSpell.FUSION_OPERATION_GRAVE },
{ [0xff]=FusionSpell.FUSION_OPERATION_BANISH }
}
})
e1:SetDescription(aux.Stringid(id,0))
e1:SetCategory(CATEGORY_REMOVE+CATEGORY_SPECIAL_SUMMON+CATEGORY_FUSION_SUMMON) e1:SetCategory(CATEGORY_REMOVE+CATEGORY_SPECIAL_SUMMON+CATEGORY_FUSION_SUMMON)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetCode(EVENT_SPSUMMON_SUCCESS)
e1:SetRange(LOCATION_MZONE)
e1:SetProperty(EFFECT_FLAG_DELAY) e1:SetProperty(EFFECT_FLAG_DELAY)
e1:SetCountLimit(1,87746184) e1:SetCountLimit(1,id)
e1:SetCondition(c87746184.condition) e1:SetCondition(s.condition)
e1:SetTarget(c87746184.target)
e1:SetOperation(c87746184.activate)
c:RegisterEffect(e1) c:RegisterEffect(e1)
--to grave --to grave
local e2=Effect.CreateEffect(c) local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e2:SetCode(EVENT_TO_GRAVE) e2:SetCode(EVENT_TO_GRAVE)
e2:SetOperation(c87746184.regop) e2:SetOperation(s.regop)
c:RegisterEffect(e2) c:RegisterEffect(e2)
--to hand/set --to hand/set
local e3=Effect.CreateEffect(c) local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(87746184,1)) e3:SetDescription(aux.Stringid(id,1))
e3:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e3:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH)
e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e3:SetCode(EVENT_PHASE+PHASE_END) e3:SetCode(EVENT_PHASE+PHASE_END)
e3:SetRange(LOCATION_GRAVE) e3:SetRange(LOCATION_GRAVE)
e3:SetCountLimit(1,87746185) e3:SetCountLimit(1,87746185)
e3:SetCondition(c87746184.thcon) e3:SetCondition(s.thcon)
e3:SetTarget(c87746184.thtg) e3:SetTarget(s.thtg)
e3:SetOperation(c87746184.thop) e3:SetOperation(s.thop)
c:RegisterEffect(e3) c:RegisterEffect(e3)
end end
function c87746184.branded_fusion_check(tp,sg,fc)
return aux.gffcheck(sg,Card.IsFusionCode,68468459,Card.IsFusionAttribute,ATTRIBUTE_LIGHT) function s.branded_fusion_check(tp,sg,fc)
return aux.gffcheck(sg,Card.IsFusionCode,68468459,function(c) return c:IsFusionAttribute(ATTRIBUTE_LIGHT) and (not c:IsHasEffect(6205579)) end)
end end
function c87746184.condition(e,tp,eg,ep,ev,re,r,rp)
function s.condition(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsSummonType(SUMMON_TYPE_FUSION) and Duel.GetCurrentPhase()&(PHASE_DAMAGE+PHASE_DAMAGE_CAL)==0 return e:GetHandler():IsSummonType(SUMMON_TYPE_FUSION) and Duel.GetCurrentPhase()&(PHASE_DAMAGE+PHASE_DAMAGE_CAL)==0
end end
function c87746184.filter1(c,e)
return c:IsAbleToRemove() and not c:IsImmuneToEffect(e) function s.fusfilter(c)
return c:IsLevelBelow(8) and not c:IsCode(id)
end end
function c87746184.filter2(c,e,tp,m,f,chkf)
return c:IsType(TYPE_FUSION) and c:IsLevelBelow(8) and not c:IsCode(87746184) and (not f or f(c)) function s.regop(e,tp,eg,ep,ev,re,r,rp)
and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_FUSION,tp,false,false) and c:CheckFusionMaterial(m,nil,chkf)
end
function c87746184.filter3(c,e)
return c:IsType(TYPE_MONSTER) and c:IsCanBeFusionMaterial() and c:IsAbleToRemove() and not c:IsImmuneToEffect(e)
end
function c87746184.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then
local chkf=tp
local mg1=Duel.GetFusionMaterial(tp):Filter(c87746184.filter1,nil,e)
local mg2=Duel.GetMatchingGroup(c87746184.filter3,tp,LOCATION_GRAVE,0,nil,e)
mg1:Merge(mg2)
local res=Duel.IsExistingMatchingCard(c87746184.filter2,tp,LOCATION_EXTRA,0,1,nil,e,tp,mg1,nil,chkf)
if not res then
local ce=Duel.GetChainMaterial(tp)
if ce~=nil then
local fgroup=ce:GetTarget()
local mg3=fgroup(ce,e,tp)
local mf=ce:GetValue()
res=Duel.IsExistingMatchingCard(c87746184.filter2,tp,LOCATION_EXTRA,0,1,nil,e,tp,mg3,mf,chkf)
end
end
return res
end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA)
Duel.SetOperationInfo(0,CATEGORY_REMOVE,nil,1,tp,LOCATION_ONFIELD+LOCATION_HAND+LOCATION_GRAVE)
end
function c87746184.activate(e,tp,eg,ep,ev,re,r,rp)
local chkf=tp
if Duel.GetCurrentPhase()&(PHASE_DAMAGE+PHASE_DAMAGE_CAL)~=0 then return end
local mg1=Duel.GetFusionMaterial(tp):Filter(c87746184.filter1,nil,e)
local mg2=Duel.GetMatchingGroup(c87746184.filter3,tp,LOCATION_GRAVE,0,nil,e)
mg1:Merge(mg2)
local sg1=Duel.GetMatchingGroup(c87746184.filter2,tp,LOCATION_EXTRA,0,nil,e,tp,mg1,nil,chkf)
local mg3=nil
local sg2=nil
local ce=Duel.GetChainMaterial(tp)
if ce~=nil then
local fgroup=ce:GetTarget()
mg3=fgroup(ce,e,tp)
local mf=ce:GetValue()
sg2=Duel.GetMatchingGroup(c87746184.filter2,tp,LOCATION_EXTRA,0,nil,e,tp,mg3,mf,chkf)
end
if sg1:GetCount()>0 or (sg2~=nil and sg2:GetCount()>0) then
local sg=sg1:Clone()
if sg2 then sg:Merge(sg2) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local tg=sg:Select(tp,1,1,nil)
local tc=tg:GetFirst()
if sg1:IsContains(tc) and (sg2==nil or not sg2:IsContains(tc) or not Duel.SelectYesNo(tp,ce:GetDescription())) then
local mat1=Duel.SelectFusionMaterial(tp,tc,mg1,nil,chkf)
tc:SetMaterial(mat1)
Duel.Remove(mat1,POS_FACEUP,REASON_EFFECT+REASON_MATERIAL+REASON_FUSION)
Duel.BreakEffect()
Duel.SpecialSummon(tc,SUMMON_TYPE_FUSION,tp,tp,false,false,POS_FACEUP)
else
local mat2=Duel.SelectFusionMaterial(tp,tc,mg3,nil,chkf)
local fop=ce:GetOperation()
fop(ce,e,tp,tc,mat2)
end
tc:CompleteProcedure()
end
end
function c87746184.regop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler() local c=e:GetHandler()
c:RegisterFlagEffect(87746184,RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END,0,1) c:RegisterFlagEffect(id,RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END,0,1)
end end
function c87746184.thcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():GetFlagEffect(87746184)>0 function s.thcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():GetFlagEffect(id)>0
end end
function c87746184.thfilter(c)
function s.thfilter(c)
if not (c:IsSetCard(0x15d) and c:IsType(TYPE_SPELL+TYPE_TRAP)) then return false end if not (c:IsSetCard(0x15d) and c:IsType(TYPE_SPELL+TYPE_TRAP)) then return false end
return c:IsAbleToHand() or c:IsSSetable() return c:IsAbleToHand() or c:IsSSetable()
end end
function c87746184.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c87746184.thfilter,tp,LOCATION_DECK,0,1,nil) end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(s.thfilter,tp,LOCATION_DECK,0,1,nil) end
end end
function c87746184.thop(e,tp,eg,ep,ev,re,r,rp)
function s.thop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_OPERATECARD) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_OPERATECARD)
local g=Duel.SelectMatchingCard(tp,c87746184.thfilter,tp,LOCATION_DECK,0,1,1,nil) local g=Duel.SelectMatchingCard(tp,s.thfilter,tp,LOCATION_DECK,0,1,1,nil)
local tc=g:GetFirst() local tc=g:GetFirst()
if tc then if tc then
if tc:IsAbleToHand() and (not tc:IsSSetable() or Duel.SelectOption(tp,1190,1153)==0) then if tc:IsAbleToHand() and (not tc:IsSSetable() or Duel.SelectOption(tp,1190,1153)==0) then
......
...@@ -13,16 +13,15 @@ function s.initial_effect(c) ...@@ -13,16 +13,15 @@ function s.initial_effect(c)
e1:SetOperation(s.spop) e1:SetOperation(s.spop)
c:RegisterEffect(e1) c:RegisterEffect(e1)
--fusion summon --fusion summon
local e2=Effect.CreateEffect(c) local e2=FusionSpell.CreateSummonEffect(c,{
e2:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_FUSION_SUMMON) fusfilter=s.fusfilter
})
e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetType(EFFECT_TYPE_QUICK_O)
e2:SetCode(EVENT_FREE_CHAIN) e2:SetCode(EVENT_FREE_CHAIN)
e2:SetRange(LOCATION_MZONE) e2:SetRange(LOCATION_MZONE)
e2:SetHintTiming(0,TIMING_MAIN_END) e2:SetHintTiming(0,TIMING_MAIN_END)
e2:SetCountLimit(1,id+o) e2:SetCountLimit(1,id+o)
e2:SetCondition(s.condition) e2:SetCondition(s.condition)
e2:SetTarget(s.target)
e2:SetOperation(s.operation)
c:RegisterEffect(e2) c:RegisterEffect(e2)
--to hand --to hand
local e3=Effect.CreateEffect(c) local e3=Effect.CreateEffect(c)
...@@ -44,98 +43,54 @@ function s.initial_effect(c) ...@@ -44,98 +43,54 @@ function s.initial_effect(c)
Duel.RegisterEffect(ge1,0) Duel.RegisterEffect(ge1,0)
end end
end end
function s.spcfilter(c) function s.spcfilter(c)
return c:IsCode(68468459) and (c:IsFaceup() or c:IsLocation(LOCATION_GRAVE)) return c:IsCode(68468459) and (c:IsFaceup() or c:IsLocation(LOCATION_GRAVE))
end end
function s.spcon(e,tp,eg,ep,ev,re,r,rp) function s.spcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.IsExistingMatchingCard(s.spcfilter,tp,LOCATION_ONFIELD+LOCATION_GRAVE,0,1,nil) return Duel.IsExistingMatchingCard(s.spcfilter,tp,LOCATION_ONFIELD+LOCATION_GRAVE,0,1,nil)
end end
function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler() local c=e:GetHandler()
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,0,0) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,0,0)
end end
function s.spop(e,tp,eg,ep,ev,re,r,rp) function s.spop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler() local c=e:GetHandler()
if c:IsRelateToEffect(e) then Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP) end if c:IsRelateToEffect(e) then Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP) end
end end
function s.condition(e,tp,eg,ep,ev,re,r,rp) function s.condition(e,tp,eg,ep,ev,re,r,rp)
local ph=Duel.GetCurrentPhase() local ph=Duel.GetCurrentPhase()
return ph==PHASE_MAIN1 or ph==PHASE_MAIN2 return ph==PHASE_MAIN1 or ph==PHASE_MAIN2
end end
function s.filter1(c,e)
return not c:IsImmuneToEffect(e) function s.fusfilter(c)
end return c:IsLevelAbove(8)
function s.filter2(c,e,tp,m,f,chkf)
return c:IsType(TYPE_FUSION) and c:IsLevelAbove(8) and (not f or f(c))
and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_FUSION,tp,false,false) and c:CheckFusionMaterial(m,nil,chkf)
end
function s.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then
local chkf=tp
local mg1=Duel.GetFusionMaterial(tp)
local res=Duel.IsExistingMatchingCard(s.filter2,tp,LOCATION_EXTRA,0,1,nil,e,tp,mg1,nil,chkf)
if not res then
local ce=Duel.GetChainMaterial(tp)
if ce~=nil then
local fgroup=ce:GetTarget()
local mg2=fgroup(ce,e,tp)
local mf=ce:GetValue()
res=Duel.IsExistingMatchingCard(s.filter2,tp,LOCATION_EXTRA,0,1,nil,e,tp,mg2,mf,chkf)
end
end
return res
end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA)
end
function s.operation(e,tp,eg,ep,ev,re,r,rp)
local chkf=tp
local mg1=Duel.GetFusionMaterial(tp):Filter(s.filter1,nil,e)
local sg1=Duel.GetMatchingGroup(s.filter2,tp,LOCATION_EXTRA,0,nil,e,tp,mg1,nil,chkf)
local mg2=nil
local sg2=nil
local ce=Duel.GetChainMaterial(tp)
if ce~=nil then
local fgroup=ce:GetTarget()
mg2=fgroup(ce,e,tp)
local mf=ce:GetValue()
sg2=Duel.GetMatchingGroup(s.filter2,tp,LOCATION_EXTRA,0,nil,e,tp,mg2,mf,chkf)
end
if #sg1>0 or (sg2~=nil and #sg2>0) then
local sg=sg1:Clone()
if sg2 then sg:Merge(sg2) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local tg=sg:Select(tp,1,1,nil)
local tc=tg:GetFirst()
if sg1:IsContains(tc) and (sg2==nil or not sg2:IsContains(tc) or not Duel.SelectYesNo(tp,ce:GetDescription())) then
local mat1=Duel.SelectFusionMaterial(tp,tc,mg1,nil,chkf)
tc:SetMaterial(mat1)
Duel.SendtoGrave(mat1,REASON_EFFECT+REASON_MATERIAL+REASON_FUSION)
Duel.BreakEffect()
Duel.SpecialSummon(tc,SUMMON_TYPE_FUSION,tp,tp,false,false,POS_FACEUP)
else
local mat2=Duel.SelectFusionMaterial(tp,tc,mg2,nil,chkf)
local fop=ce:GetOperation()
fop(ce,e,tp,tc,mat2)
end
tc:CompleteProcedure()
end
end end
function s.checkfilter(c,tp) function s.checkfilter(c,tp)
return c:IsType(TYPE_FUSION) and c:IsControler(tp) return c:IsType(TYPE_FUSION) and c:IsControler(tp)
end end
function s.checkop(e,tp,eg,ep,ev,re,r,rp) function s.checkop(e,tp,eg,ep,ev,re,r,rp)
if eg:IsExists(s.checkfilter,1,nil,0) then Duel.RegisterFlagEffect(0,id,RESET_PHASE+PHASE_END,0,1) end if eg:IsExists(s.checkfilter,1,nil,0) then Duel.RegisterFlagEffect(0,id,RESET_PHASE+PHASE_END,0,1) end
if eg:IsExists(s.checkfilter,1,nil,1) then Duel.RegisterFlagEffect(1,id,RESET_PHASE+PHASE_END,0,1) end if eg:IsExists(s.checkfilter,1,nil,1) then Duel.RegisterFlagEffect(1,id,RESET_PHASE+PHASE_END,0,1) end
end end
function s.thcon(e,tp,eg,ep,ev,re,r,rp) function s.thcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetFlagEffect(tp,id)>0 return Duel.GetFlagEffect(tp,id)>0
end end
function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk) function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsAbleToHand() end if chk==0 then return e:GetHandler():IsAbleToHand() end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,e:GetHandler(),1,0,0) Duel.SetOperationInfo(0,CATEGORY_TOHAND,e:GetHandler(),1,0,0)
end end
function s.thop(e,tp,eg,ep,ev,re,r,rp) function s.thop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler() local c=e:GetHandler()
if c:IsRelateToEffect(e) then if c:IsRelateToEffect(e) then
......
...@@ -2270,7 +2270,7 @@ FusionSpell = {} ...@@ -2270,7 +2270,7 @@ FusionSpell = {}
--- Optional filter for valid Fusion Materials. --- Optional filter for valid Fusion Materials.
--- Use only under strong constraints (e.g., D-Fusion effects). --- Use only under strong constraints (e.g., D-Fusion effects).
--- If some card can not be used even under Chain Material or EXTRA_FUSION_MATERIAL, use this filter. --- If some card can not be used even under Chain Material or EXTRA_FUSION_MATERIAL, use this filter.
--- @field matfilter? fun(c:Card):boolean --- @field matfilter? fun(c:Card,e:Effect,tp:integer):boolean
--- Location(s) to look for materials before knowing which ones will be used. --- Location(s) to look for materials before knowing which ones will be used.
--- Defaults to `LOCATION_HAND | LOCATION_MZONE`. --- Defaults to `LOCATION_HAND | LOCATION_MZONE`.
--- @field pre_select_mat_location? integer|fun():integer --- @field pre_select_mat_location? integer|fun():integer
...@@ -2433,7 +2433,7 @@ function FusionSpell.CreateSummonEffect(c,opts) ...@@ -2433,7 +2433,7 @@ function FusionSpell.CreateSummonEffect(c,opts)
end end
---@param fusfilter fun(c:Card):boolean filter for the monster to be Fusion Summoned ---@param fusfilter fun(c:Card):boolean filter for the monster to be Fusion Summoned
---@param matfilter fun(c:Card):boolean filter for the materials, use it only under very strong limitation like D-Fusion. ---@param matfilter fun(c:Card,e:Effect,tp:integer):boolean filter for the materials, use it only under very strong limitation like D-Fusion.
---@param pre_select_mat_location integer|FUSION_SPELL_PRE_SELECT_MAT_LOCATION_FUNCTION location where to find the materials before known the materials ---@param pre_select_mat_location integer|FUSION_SPELL_PRE_SELECT_MAT_LOCATION_FUNCTION location where to find the materials before known the materials
---@param mat_operation_code_map {[integer]:FUSION_OPERATION_CODE}[] operation code to do for the materials, it will be check in order ---@param mat_operation_code_map {[integer]:FUSION_OPERATION_CODE}[] operation code to do for the materials, it will be check in order
---@param post_select_mat_location integer location where to find the materials after known the materials ---@param post_select_mat_location integer location where to find the materials after known the materials
...@@ -2503,7 +2503,7 @@ function FusionSpell.GetSummonTarget( ...@@ -2503,7 +2503,7 @@ function FusionSpell.GetSummonTarget(
end end
---@param fusfilter fun(c:Card):boolean filter for the monster to be Fusion Summoned ---@param fusfilter fun(c:Card):boolean filter for the monster to be Fusion Summoned
---@param matfilter fun(c:Card):boolean filter for the materials, use it only under very strong limitation like D-フュージョン. ---@param matfilter fun(c:Card,e:Effect,tp:integer):boolean filter for the materials, use it only under very strong limitation like D-Fusion.
---@param pre_select_mat_location integer|FUSION_SPELL_PRE_SELECT_MAT_LOCATION_FUNCTION location where to find the materials before known the materials ---@param pre_select_mat_location integer|FUSION_SPELL_PRE_SELECT_MAT_LOCATION_FUNCTION location where to find the materials before known the materials
---@param mat_operation_code_map {[integer]:FUSION_OPERATION_CODE}[] operation code to do for the materials, it will be check in order ---@param mat_operation_code_map {[integer]:FUSION_OPERATION_CODE}[] operation code to do for the materials, it will be check in order
---@param post_select_mat_location integer location where to find the materials after known the materials ---@param post_select_mat_location integer location where to find the materials after known the materials
...@@ -2613,7 +2613,7 @@ function FusionSpell.GetSummonOperation( ...@@ -2613,7 +2613,7 @@ function FusionSpell.GetSummonOperation(
--- use chain material effect --- use chain material effect
---@type function ---@type function
local chain_material_filter=fusion_effect:GetTarget() local chain_material_filter=fusion_effect:GetTarget()
local chain_mg=chain_material_filter(fusion_effect,e,tp):Filter(aux.NecroValleyFilter(matfilter),nil) local chain_mg=chain_material_filter(fusion_effect,e,tp):Filter(aux.NecroValleyFilter(function(c) return matfilter(c,e,tp) end),nil)
assert(#chain_mg>0, "we are trying to apply a chain material, but it has no possible material") assert(#chain_mg>0, "we are trying to apply a chain material, but it has no possible material")
aux.FCheckAdditional=FusionSpell.GetFusionSpellFCheckAdditionalFunctionForChainMaterial(additional_fcheck) aux.FCheckAdditional=FusionSpell.GetFusionSpellFCheckAdditionalFunctionForChainMaterial(additional_fcheck)
aux.FGoalCheckAdditional=FusionSpell.GetFusionSpellFGoalCheckAdditionalFunctionForChainMaterial(additional_fgoalcheck) aux.FGoalCheckAdditional=FusionSpell.GetFusionSpellFGoalCheckAdditionalFunctionForChainMaterial(additional_fgoalcheck)
...@@ -2791,7 +2791,7 @@ end ...@@ -2791,7 +2791,7 @@ end
---@param tc Card the target card to summon ---@param tc Card the target card to summon
---@param tp integer the triggering player ---@param tp integer the triggering player
---@param e Effect the fusion effect ---@param e Effect the fusion effect
---@param matfilter fun(c:Card):boolean filter for the materials, use it only under very strong limitation like D-Fusion. ---@param matfilter fun(c:Card,e:Effect,tp:integer):boolean filter for the materials, use it only under very strong limitation like D-Fusion.
---@param pre_select_mat_location integer|FUSION_SPELL_PRE_SELECT_MAT_LOCATION_FUNCTION location where to find the materials before known the materials ---@param pre_select_mat_location integer|FUSION_SPELL_PRE_SELECT_MAT_LOCATION_FUNCTION location where to find the materials before known the materials
---@param mat_operation_code_map {[integer]:FUSION_OPERATION_CODE}[] operation code to do for the materials, it will be check in order ---@param mat_operation_code_map {[integer]:FUSION_OPERATION_CODE}[] operation code to do for the materials, it will be check in order
---@param post_select_mat_location integer location where to find the materials after known the materials ---@param post_select_mat_location integer location where to find the materials after known the materials
...@@ -2824,7 +2824,7 @@ function FusionSpell.GetMaterialsGroupForTargetCard( ...@@ -2824,7 +2824,7 @@ function FusionSpell.GetMaterialsGroupForTargetCard(
end end
--- filter by the strong material filter, target card can not be fusion material of itself --- filter by the strong material filter, target card can not be fusion material of itself
mg=mg:Filter(matfilter,tc) mg=mg:Filter(function(c) return matfilter(c,e,tp) end,tc)
--- filter out card can not be affected by effect --- filter out card can not be affected by effect
mg=mg:Filter(aux.NOT(Card.IsImmuneToEffect),nil,e) mg=mg:Filter(aux.NOT(Card.IsImmuneToEffect),nil,e)
--- filter out card that are facedown banished --- filter out card that are facedown banished
...@@ -2858,7 +2858,7 @@ function FusionSpell.GetOperationCodeByMaterialLocation(location,mat_operation_c ...@@ -2858,7 +2858,7 @@ function FusionSpell.GetOperationCodeByMaterialLocation(location,mat_operation_c
end end
---@param fusfilter fun(c:Card,tp:integer):boolean ---@param fusfilter fun(c:Card,tp:integer):boolean
---@param matfilter fun(c:Card,tp:integer):boolean ---@param matfilter fun(c:Card,e:Effect,tp:integer):boolean filter for the materials, use it only under very strong limitation like D-Fusion.
---@param pre_select_mat_location integer|function location where to find the materials before known the materials (default LOCATION_HAND|LOCATION_MZONE) ---@param pre_select_mat_location integer|function location where to find the materials before known the materials (default LOCATION_HAND|LOCATION_MZONE)
---@param pre_select_mat_opponent_location integer|FUSION_SPELL_PRE_SELECT_MAT_LOCATION_FUNCTION location where to find the materials before known the materials on opponent location ---@param pre_select_mat_opponent_location integer|FUSION_SPELL_PRE_SELECT_MAT_LOCATION_FUNCTION location where to find the materials before known the materials on opponent location
---@param gc fun(e:Effect):Card|nil ---@param gc fun(e:Effect):Card|nil
...@@ -2877,8 +2877,9 @@ function FusionSpell.SummonTargetFilter(c,fusfilter,matfilter,e,tp,pre_select_ma ...@@ -2877,8 +2877,9 @@ function FusionSpell.SummonTargetFilter(c,fusfilter,matfilter,e,tp,pre_select_ma
return res return res
end end
---@return {[Effect]:Group} effect_targets_map Return a map of different chain material to potiential fusion targets ---@param matfilter fun(c:Card,e:Effect,tp:integer):boolean filter for the materials, use it only under very strong limitation like D-Fusion.
---@param gc fun(e:Effect):Card|nil ---@param gc fun(e:Effect):Card|nil
---@return {[Effect]:Group} effect_targets_map Return a map of different chain material to potiential fusion targets
function FusionSpell.ListChainMaterialSummonTargets(e,tp,fusfilter,matfilter,additional_fcheck,additional_fgoalcheck,fuslocation,sumtype,sumpos,gc) function FusionSpell.ListChainMaterialSummonTargets(e,tp,fusfilter,matfilter,additional_fcheck,additional_fgoalcheck,fuslocation,sumtype,sumpos,gc)
local chain_material_effects={Duel.IsPlayerAffectedByEffect(tp,EFFECT_CHAIN_MATERIAL)} local chain_material_effects={Duel.IsPlayerAffectedByEffect(tp,EFFECT_CHAIN_MATERIAL)}
---@type {[Effect]:Group} ---@type {[Effect]:Group}
...@@ -2887,7 +2888,7 @@ function FusionSpell.ListChainMaterialSummonTargets(e,tp,fusfilter,matfilter,add ...@@ -2887,7 +2888,7 @@ function FusionSpell.ListChainMaterialSummonTargets(e,tp,fusfilter,matfilter,add
---@type function ---@type function
local chain_material_filter=ce:GetTarget() local chain_material_filter=ce:GetTarget()
---@type Group ---@type Group
local chain_mg=chain_material_filter(ce,e,tp):Filter(matfilter,nil) local chain_mg=chain_material_filter(ce,e,tp):Filter(function(c) return matfilter(c,e,tp) end,nil)
if #chain_mg>0 then if #chain_mg>0 then
local ce_fusfilter=ce:GetValue() local ce_fusfilter=ce:GetValue()
local ce_sg=Duel.GetMatchingGroup(function(c) local ce_sg=Duel.GetMatchingGroup(function(c)
...@@ -2901,15 +2902,16 @@ function FusionSpell.ListChainMaterialSummonTargets(e,tp,fusfilter,matfilter,add ...@@ -2901,15 +2902,16 @@ function FusionSpell.ListChainMaterialSummonTargets(e,tp,fusfilter,matfilter,add
return chain_material_targets return chain_material_targets
end end
---@return boolean res return whether there is a valid target for any chain material effect ---@param matfilter fun(c:Card,e:Effect,tp:integer):boolean filter for the materials, use it only under very strong limitation like D-Fusion.
---@param gc fun(e:Effect):Card|nil ---@param gc fun(e:Effect):Card|nil
---@return boolean res return whether there is a valid target for any chain material effect
function FusionSpell.IsExistsChainMaterialSummonTargets(e,tp,fusfilter,matfilter,additional_fcheck,additional_fgoalcheck,fuslocation,sumtype,sumpos,gc) function FusionSpell.IsExistsChainMaterialSummonTargets(e,tp,fusfilter,matfilter,additional_fcheck,additional_fgoalcheck,fuslocation,sumtype,sumpos,gc)
local chain_material_effects={Duel.IsPlayerAffectedByEffect(tp,EFFECT_CHAIN_MATERIAL)} local chain_material_effects={Duel.IsPlayerAffectedByEffect(tp,EFFECT_CHAIN_MATERIAL)}
---@type {[Effect]:Group} ---@type {[Effect]:Group}
for _,ce in ipairs(chain_material_effects) do for _,ce in ipairs(chain_material_effects) do
---@type function ---@type function
local chain_material_filter=ce:GetTarget() local chain_material_filter=ce:GetTarget()
local chain_mg=chain_material_filter(ce,e,tp):Filter(matfilter,nil) local chain_mg=chain_material_filter(ce,e,tp):Filter(function(c) return matfilter(c,e,tp) end,nil)
if #chain_mg>0 then if #chain_mg>0 then
local ce_fusfilter=ce:GetValue() local ce_fusfilter=ce:GetValue()
local res=Duel.IsExistingMatchingCard(function(c) local res=Duel.IsExistingMatchingCard(function(c)
......
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