Commit 43152911 authored by Vury Leo's avatar Vury Leo Committed by wind2009

Add 魔玩具 to new fusion + fix gc moved issue

parent ebea093b
--エッジインプ・サイズ --エッジインプ・サイズ
function c29280589.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:SetDescription(aux.Stringid(29280589,0)) fusfilter=s.fusfilter,
e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_FUSION_SUMMON) gc=s.gc
})
e1:SetDescription(aux.Stringid(id,0))
e1:SetType(EFFECT_TYPE_QUICK_O) e1:SetType(EFFECT_TYPE_QUICK_O)
e1:SetCode(EVENT_FREE_CHAIN) e1:SetCode(EVENT_FREE_CHAIN)
e1:SetRange(LOCATION_HAND) e1:SetRange(LOCATION_HAND)
e1:SetHintTiming(0,TIMINGS_CHECK_MONSTER+TIMING_MAIN_END) e1:SetHintTiming(0,TIMINGS_CHECK_MONSTER+TIMING_MAIN_END)
e1:SetCountLimit(1,29280589) e1:SetCountLimit(1,id)
e1:SetCondition(c29280589.condition) e1:SetCondition(s.condition)
e1:SetCost(c29280589.cost) e1:SetCost(s.cost)
e1:SetTarget(c29280589.target)
e1:SetOperation(c29280589.activate)
c:RegisterEffect(e1) c:RegisterEffect(e1)
--Destroy replace --Destroy replace
local e2=Effect.CreateEffect(c) local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e2:SetCode(EFFECT_DESTROY_REPLACE) e2:SetCode(EFFECT_DESTROY_REPLACE)
e2:SetRange(LOCATION_GRAVE) e2:SetRange(LOCATION_GRAVE)
e2:SetCountLimit(1,29280590) e2:SetCountLimit(1,id+o)
e2:SetTarget(c29280589.reptg) e2:SetTarget(s.reptg)
e2:SetValue(c29280589.repval) e2:SetValue(s.repval)
c:RegisterEffect(e2) c:RegisterEffect(e2)
end end
function c29280589.condition(e,tp,eg,ep,ev,re,r,rp)
return (Duel.GetCurrentPhase()==PHASE_MAIN1 or Duel.GetCurrentPhase()==PHASE_MAIN2) and Duel.GetTurnPlayer()==1-tp function s.condition(e,tp,eg,ep,ev,re,r,rp)
return Duel.IsMainPhase() and Duel.GetTurnPlayer()==1-tp
end end
function c29280589.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 not e:GetHandler():IsPublic() end if chk==0 then return not e:GetHandler():IsPublic() end
end end
function c29280589.filter1(c,e)
return not c:IsImmuneToEffect(e) function s.fusfilter(c)
return c:IsSetCard(0xad)
end end
function c29280589.filter2(c,e,tp,m,f,gc,chkf)
return c:IsType(TYPE_FUSION) and c:IsSetCard(0xad) and (not f or f(c)) function s.gc(e)
and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_FUSION,tp,false,false) and c:CheckFusionMaterial(m,gc,chkf) return e:GetHandler()
end end
function c29280589.target(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler() function s.repfilter(c,tp)
if chk==0 then
local chkf=tp
local mg1=Duel.GetFusionMaterial(tp)
local res=Duel.IsExistingMatchingCard(c29280589.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 mg2=fgroup(ce,e,tp)
local mf=ce:GetValue()
res=Duel.IsExistingMatchingCard(c29280589.filter2,tp,LOCATION_EXTRA,0,1,nil,e,tp,mg2,mf,c,chkf)
end
end
return res
end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA)
end
function c29280589.activate(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local chkf=tp
if not c:IsRelateToEffect(e) or c:IsImmuneToEffect(e) then return end
local mg1=Duel.GetFusionMaterial(tp):Filter(c29280589.filter1,nil,e)
local sg1=Duel.GetMatchingGroup(c29280589.filter2,tp,LOCATION_EXTRA,0,nil,e,tp,mg1,nil,c,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(c29280589.filter2,tp,LOCATION_EXTRA,0,nil,e,tp,mg2,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,mg2,c,chkf)
local fop=ce:GetOperation()
fop(ce,e,tp,tc,mat2)
end
tc:CompleteProcedure()
end
end
function c29280589.repfilter(c,tp)
return c:IsLocation(LOCATION_MZONE) and c:IsControler(tp) and c:IsFaceup() and c:IsType(TYPE_FUSION) and c:IsSetCard(0xad) return c:IsLocation(LOCATION_MZONE) and c:IsControler(tp) and c:IsFaceup() and c:IsType(TYPE_FUSION) and c:IsSetCard(0xad)
and c:IsReason(REASON_EFFECT+REASON_BATTLE) and not c:IsReason(REASON_REPLACE) and c:IsReason(REASON_EFFECT+REASON_BATTLE) and not c:IsReason(REASON_REPLACE)
end end
function c29280589.reptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsAbleToRemove() and eg:IsExists(c29280589.repfilter,1,nil,tp) end function s.reptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsAbleToRemove() and eg:IsExists(s.repfilter,1,nil,tp) end
if Duel.SelectEffectYesNo(tp,e:GetHandler(),96) then if Duel.SelectEffectYesNo(tp,e:GetHandler(),96) then
Duel.Remove(e:GetHandler(),POS_FACEUP,REASON_EFFECT) Duel.Remove(e:GetHandler(),POS_FACEUP,REASON_EFFECT)
return true return true
else return false end else return false end
end end
function c29280589.repval(e,c)
return c29280589.repfilter(c,e:GetHandlerPlayer()) function s.repval(e,c)
return s.repfilter(c,e:GetHandlerPlayer())
end end
--デストーイ・ファクトリー --デストーイ・ファクトリー
function c43698897.initial_effect(c) local s,id,o=GetID()
function s.initial_effect(c)
aux.AddCodeList(c,6077601)
--Activate --Activate
local e1=Effect.CreateEffect(c) local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN) e1:SetCode(EVENT_FREE_CHAIN)
c:RegisterEffect(e1) c:RegisterEffect(e1)
--spsummon --spsummon
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_IGNITION) e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetRange(LOCATION_SZONE) e2:SetRange(LOCATION_SZONE)
e2:SetCountLimit(1,43698897) e2:SetCountLimit(1,id)
e2:SetCost(c43698897.spcost) e2:SetCost(s.spcost)
e2:SetTarget(c43698897.sptg)
e2:SetOperation(c43698897.spop)
c:RegisterEffect(e2) c:RegisterEffect(e2)
--tohand --tohand
local e3=Effect.CreateEffect(c) local e3=Effect.CreateEffect(c)
...@@ -22,88 +23,39 @@ function c43698897.initial_effect(c) ...@@ -22,88 +23,39 @@ function c43698897.initial_effect(c)
e3:SetCode(EVENT_TO_GRAVE) e3:SetCode(EVENT_TO_GRAVE)
e3:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DELAY) e3:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DELAY)
e3:SetCountLimit(1,43698898) e3:SetCountLimit(1,43698898)
e3:SetTarget(c43698897.thtg) e3:SetTarget(s.thtg)
e3:SetOperation(c43698897.thop) e3:SetOperation(s.thop)
c:RegisterEffect(e3) c:RegisterEffect(e3)
end end
function c43698897.spfilter(c)
function s.spfilter(c)
return c:IsSetCard(0x46) and c:IsType(TYPE_SPELL) and c:IsAbleToRemoveAsCost() return c:IsSetCard(0x46) and c:IsType(TYPE_SPELL) and c:IsAbleToRemoveAsCost()
end end
function c43698897.spcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c43698897.spfilter,tp,LOCATION_GRAVE,0,1,nil) end function s.spcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_GRAVE,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g=Duel.SelectMatchingCard(tp,c43698897.spfilter,tp,LOCATION_GRAVE,0,1,1,nil) local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_GRAVE,0,1,1,nil)
Duel.Remove(g,POS_FACEUP,REASON_COST) Duel.Remove(g,POS_FACEUP,REASON_COST)
end end
function c43698897.filter1(c,e)
return not c:IsImmuneToEffect(e) function s.fusfilter(c)
return c:IsSetCard(0xad)
end end
function c43698897.filter2(c,e,tp,m,f,chkf)
return c:IsType(TYPE_FUSION) and c:IsSetCard(0xad) and (not f or f(c)) function s.thfilter(c)
and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_FUSION,tp,false,false) and c:CheckFusionMaterial(m,nil,chkf)
end
function c43698897.sptg(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(c43698897.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(c43698897.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 c43698897.spop(e,tp,eg,ep,ev,re,r,rp)
local chkf=tp
local mg1=Duel.GetFusionMaterial(tp):Filter(c43698897.filter1,nil,e)
local sg1=Duel.GetMatchingGroup(c43698897.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(c43698897.filter2,tp,LOCATION_EXTRA,0,nil,e,tp,mg2,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.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
function c43698897.thfilter(c)
return c:IsFaceup() and c:IsCode(6077601) and c:IsAbleToHand() return c:IsFaceup() and c:IsCode(6077601) and c:IsAbleToHand()
end end
function c43698897.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_REMOVED) and c43698897.thfilter(chkc) end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chk==0 then return Duel.IsExistingTarget(c43698897.thfilter,tp,LOCATION_REMOVED,0,1,nil) end if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_REMOVED) and s.thfilter(chkc) end
if chk==0 then return Duel.IsExistingTarget(s.thfilter,tp,LOCATION_REMOVED,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectTarget(tp,c43698897.thfilter,tp,LOCATION_REMOVED,0,1,1,nil) local g=Duel.SelectTarget(tp,s.thfilter,tp,LOCATION_REMOVED,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 c43698897.thop(e,tp,eg,ep,ev,re,r,rp)
function s.thop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget() local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) then if tc:IsRelateToEffect(e) then
Duel.SendtoHand(tc,nil,REASON_EFFECT) Duel.SendtoHand(tc,nil,REASON_EFFECT)
......
--魔玩具融合 --魔玩具融合
function c6077601.initial_effect(c) local s,id,o=GetID()
function s.initial_effect(c)
--Activate --Activate
local e1=Effect.CreateEffect(c) local e1=FusionSpell.CreateSummonEffect(c,{
fusfilter=s.fusfilter,
pre_select_mat_location=LOCATION_MZONE|LOCATION_GRAVE,
mat_operation_code_map={
{ [LOCATION_REMOVED]=FusionSpell.FUSION_OPERATION_GRAVE },
{ [0xff]=FusionSpell.FUSION_OPERATION_BANISH }
},
extra_target=s.extra_target
})
e1:SetCategory(CATEGORY_REMOVE+CATEGORY_SPECIAL_SUMMON+CATEGORY_FUSION_SUMMON) e1:SetCategory(CATEGORY_REMOVE+CATEGORY_SPECIAL_SUMMON+CATEGORY_FUSION_SUMMON)
e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCountLimit(1,id+EFFECT_COUNT_CODE_OATH)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCountLimit(1,6077601+EFFECT_COUNT_CODE_OATH)
e1:SetTarget(c6077601.target)
e1:SetOperation(c6077601.activate)
c:RegisterEffect(e1) c:RegisterEffect(e1)
end end
function c6077601.filter0(c)
return c:IsOnField() and c:IsAbleToRemove() function s.fusfilter(c)
return c:IsSetCard(0xad)
end end
function c6077601.filter1(c,e)
return c:IsOnField() and c:IsAbleToRemove() and not c:IsImmuneToEffect(e) function s.extra_target(e,tp,eg,ep,ev,re,r,rp,chk)
end
function c6077601.filter2(c,e,tp,m,f,chkf)
return c:IsType(TYPE_FUSION) and c:IsSetCard(0xad) and (not f or f(c))
and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_FUSION,tp,false,false) and c:CheckFusionMaterial(m,nil,chkf)
end
function c6077601.filter3(c)
return c:IsType(TYPE_MONSTER) and c:IsCanBeFusionMaterial() and c:IsAbleToRemove()
end
function c6077601.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then if chk==0 then
local chkf=tp return true
local mg1=Duel.GetFusionMaterial(tp):Filter(c6077601.filter0,nil)
local mg2=Duel.GetMatchingGroup(c6077601.filter3,tp,LOCATION_GRAVE,0,nil)
mg1:Merge(mg2)
local res=Duel.IsExistingMatchingCard(c6077601.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(c6077601.filter2,tp,LOCATION_EXTRA,0,1,nil,e,tp,mg3,mf,chkf)
end
end
return res
end end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA)
Duel.SetOperationInfo(0,CATEGORY_REMOVE,nil,1,tp,LOCATION_ONFIELD+LOCATION_GRAVE) Duel.SetOperationInfo(0,CATEGORY_REMOVE,nil,1,tp,LOCATION_ONFIELD+LOCATION_GRAVE)
end end
function c6077601.activate(e,tp,eg,ep,ev,re,r,rp)
local chkf=tp
local mg1=Duel.GetFusionMaterial(tp):Filter(c6077601.filter1,nil,e)
local mg2=Duel.GetMatchingGroup(c6077601.filter3,tp,LOCATION_GRAVE,0,nil)
mg1:Merge(mg2)
local sg1=Duel.GetMatchingGroup(c6077601.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(c6077601.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 c65331686.initial_effect(c) local s,id,o=GetID()
function s.initial_effect(c)
aux.AddCodeList(c,24094653)
--search --search
local e1=Effect.CreateEffect(c) local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(65331686,0)) e1:SetDescription(aux.Stringid(id,0))
e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e1:SetCode(EVENT_SUMMON_SUCCESS) e1:SetCode(EVENT_SUMMON_SUCCESS)
e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP) e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP)
e1:SetCountLimit(1,65331686) e1:SetCountLimit(1,id)
e1:SetCondition(c65331686.thcon) e1:SetCondition(s.thcon)
e1:SetTarget(c65331686.thtg) e1:SetTarget(s.thtg)
e1:SetOperation(c65331686.thop) e1:SetOperation(s.thop)
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)
--spsummon --fusion summon
local e3=Effect.CreateEffect(c) local e3=FusionSpell.CreateSummonEffect(c,{
e3:SetDescription(aux.Stringid(65331686,1)) fusfilter=s.fusfilter
e3:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_FUSION_SUMMON) })
e3:SetDescription(aux.Stringid(id,1))
e3:SetType(EFFECT_TYPE_IGNITION) e3:SetType(EFFECT_TYPE_IGNITION)
e3:SetRange(LOCATION_MZONE) e3:SetRange(LOCATION_MZONE)
e3:SetCountLimit(1,65331686) e3:SetCountLimit(1,id)
e3:SetCost(c65331686.cost) e3:SetCost(s.cost)
e3:SetTarget(c65331686.target)
e3:SetOperation(c65331686.operation)
c:RegisterEffect(e3) c:RegisterEffect(e3)
end end
function c65331686.thcon(e,tp,eg,ep,ev,re,r,rp)
function s.thcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsPreviousLocation(LOCATION_HAND) return e:GetHandler():IsPreviousLocation(LOCATION_HAND)
end end
function c65331686.thfilter(c)
function s.thfilter(c)
return c:IsCode(24094653) and c:IsAbleToHand() return c:IsCode(24094653) and c:IsAbleToHand()
end end
function c65331686.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c65331686.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
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK)
end end
function c65331686.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_ATOHAND) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,c65331686.thfilter,tp,LOCATION_DECK,0,1,1,nil) local g=Duel.SelectMatchingCard(tp,s.thfilter,tp,LOCATION_DECK,0,1,1,nil)
if g:GetCount()>0 then if g:GetCount()>0 then
Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.SendtoHand(g,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,g) Duel.ConfirmCards(1-tp,g)
end end
end end
function c65331686.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.CheckLPCost(tp,500) end if chk==0 then return Duel.CheckLPCost(tp,500) end
Duel.PayLPCost(tp,500) Duel.PayLPCost(tp,500)
end end
function c65331686.filter1(c,e)
return not c:IsImmuneToEffect(e) function s.fusfilter(c)
end return c:IsSetCard(0xad)
function c65331686.filter2(c,e,tp,m,f,chkf)
return c:IsType(TYPE_FUSION) and c:IsSetCard(0xad) and (not f or f(c))
and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_FUSION,tp,false,false) and c:CheckFusionMaterial(m,nil,chkf)
end
function c65331686.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(c65331686.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(c65331686.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 c65331686.operation(e,tp,eg,ep,ev,re,r,rp)
local chkf=tp
local mg1=Duel.GetFusionMaterial(tp):Filter(c65331686.filter1,nil,e)
local sg1=Duel.GetMatchingGroup(c65331686.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(c65331686.filter2,tp,LOCATION_EXTRA,0,nil,e,tp,mg2,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.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
...@@ -2508,223 +2508,226 @@ function FusionSpell.GetSummonOperation( ...@@ -2508,223 +2508,226 @@ function FusionSpell.GetSummonOperation(
gc gc
) )
return function(e,tp,eg,ep,ev,re,r,rp) return function(e,tp,eg,ep,ev,re,r,rp)
local fusion_targets=Group.CreateGroup() -- if gc is gone, terminate
local sg=Duel.GetMatchingGroup( if gc(e)==nil or gc(e):IsRelateToEffect(e) then
FusionSpell.SummonTargetFilter,tp,fuslocation,0,nil, local fusion_targets=Group.CreateGroup()
--- FusionSpell.SummonTargetFilter param local sg=Duel.GetMatchingGroup(
fusfilter,aux.NecroValleyFilter(matfilter),e,tp,pre_select_mat_location,mat_operation_code_map,post_select_mat_location,additional_fcheck,additional_fgoalcheck,sumtype,sumpos,pre_select_mat_opponent_location,gc) FusionSpell.SummonTargetFilter,tp,fuslocation,0,nil,
fusion_targets:Merge(sg) --- FusionSpell.SummonTargetFilter param
--- check for chain material targets fusfilter,aux.NecroValleyFilter(matfilter),e,tp,pre_select_mat_location,mat_operation_code_map,post_select_mat_location,additional_fcheck,additional_fgoalcheck,sumtype,sumpos,pre_select_mat_opponent_location,gc)
local ce_sgs={} fusion_targets:Merge(sg)
if sumtype&SUMMON_TYPE_FUSION~=0 then --- check for chain material targets
ce_sgs=FusionSpell.ListChainMaterialSummonTargets(e,tp,fusfilter,aux.NecroValleyFilter(matfilter),additional_fcheck,additional_fgoalcheck,fuslocation,sumtype,sumpos,gc) local ce_sgs={}
--- add chain material targets if sumtype&SUMMON_TYPE_FUSION~=0 then
for _,ce_sg in pairs(ce_sgs) do ce_sgs=FusionSpell.ListChainMaterialSummonTargets(e,tp,fusfilter,aux.NecroValleyFilter(matfilter),additional_fcheck,additional_fgoalcheck,fuslocation,sumtype,sumpos,gc)
fusion_targets:Merge(ce_sg) --- add chain material targets
for _,ce_sg in pairs(ce_sgs) do
fusion_targets:Merge(ce_sg)
end
end end
end
local tc=nil local tc=nil
if #fusion_targets>0 then if #fusion_targets>0 then
local materials=Group.CreateGroup() local materials=Group.CreateGroup()
local fusion_effect=nil local fusion_effect=nil
local fusion_succeeded=false local fusion_succeeded=false
while #materials==0 do while #materials==0 do
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
tc=fusion_targets:Select(tp,1,1,nil):GetFirst() tc=fusion_targets:Select(tp,1,1,nil):GetFirst()
---@type Effect[] ---@type Effect[]
local avaliable_fusion_effect = {} local avaliable_fusion_effect = {}
if sg:IsContains(tc) then if sg:IsContains(tc) then
table.insert(avaliable_fusion_effect,e) table.insert(avaliable_fusion_effect,e)
end
for ce, ce_sg in pairs(ce_sgs) do
if ce_sg:IsContains(tc) then
table.insert(avaliable_fusion_effect,ce)
end end
end for ce, ce_sg in pairs(ce_sgs) do
assert(#avaliable_fusion_effect>0, "Selected a target card that has 0 fusion effect") if ce_sg:IsContains(tc) then
fusion_effect=avaliable_fusion_effect[1] table.insert(avaliable_fusion_effect,ce)
if #avaliable_fusion_effect>1 then
fusion_effect=FusionSpell.MultiFusionEffectPrompt(avaliable_fusion_effect)
end
if fusion_effect==e then
--- use fusion spell effect
local mg=FusionSpell.GetMaterialsGroupForTargetCard(
tc,
tp,
e,
aux.NecroValleyFilter(matfilter),
pre_select_mat_location,
mat_operation_code_map,
post_select_mat_location,
sumtype,
pre_select_mat_opponent_location)
aux.FCheckAdditional=FusionSpell.GetFusionSpellFCheckAdditionalFunction(additional_fcheck,tp,tc,pre_select_mat_location,post_select_mat_location,pre_select_mat_opponent_location)
aux.FGoalCheckAdditional=FusionSpell.GetFusionSpellFGoalCheckAdditionalFunction(additional_fgoalcheck,tp,tc,pre_select_mat_location)
materials=Duel.SelectFusionMaterial(tp,tc,mg,gc(e),tp)
aux.FCheckAdditional=nil
aux.FGoalCheckAdditional=nil
else
--- use chain material effect
---@type function
local chain_material_filter=fusion_effect:GetTarget()
local chain_mg=chain_material_filter(fusion_effect,e,tp):Filter(aux.NecroValleyFilter(matfilter),nil)
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.FGoalCheckAdditional=FusionSpell.GetFusionSpellFGoalCheckAdditionalFunctionForChainMaterial(additional_fgoalcheck)
materials=Duel.SelectFusionMaterial(tp,tc,chain_mg,gc(e),tp)
aux.FCheckAdditional=nil
aux.FGoalCheckAdditional=nil
end
end
assert(tc~=nil)
assert(fusion_effect~=nil)
if #materials>0 then
local materials_from_spell_card=Group.CreateGroup()
if fusion_effect==e then
--- fusion with fusion spell
tc:SetMaterial(materials)
---@type {[Effect]:true}
local applied_extra_effects={}
---@type {[FUSION_OPERATION_FUNCTION]:Group}
local material_grouped_by_op={}
local materials_with_one_material_effect=materials:Filter(function(mc) return (#FusionSpell.GetMaterialEffects(mc,tp,tc,pre_select_mat_location,post_select_mat_location,pre_select_mat_opponent_location))==1 end,nil)
for material in aux.Next(materials_with_one_material_effect) do
--For material that can be material only by 1 effect, either fusion spell or extra material effect, do the operation on it.
local fusion_operation=nil
local material_effect=FusionSpell.GetMaterialEffects(material,tp,tc,pre_select_mat_location,post_select_mat_location,pre_select_mat_opponent_location)[1]
if material_effect==true then
local fusion_operation_code=FusionSpell.GetOperationCodeByMaterialLocation(material:GetLocation(),mat_operation_code_map)
fusion_operation=FusionSpell.GetFusionOperationByCode(fusion_operation_code)
materials_from_spell_card:AddCard(material)
else
-- extra material effects
--- pay the operation cost, only valid in 影牢の呪縛 as of 2025 May
local material_cost=material_effect:GetCost()
if material_cost~=nil then
material_cost(material_effect,tp,eg,ep,ev,re,r,rp)
end
local fusion_operation_code=material_effect:GetOperation()()
fusion_operation=FusionSpell.GetFusionOperationByCode(fusion_operation_code,material:GetLocation(),mat_operation_code_map)
applied_extra_effects[material_effect]=true
end end
assert(fusion_operation~=nil)
material_grouped_by_op[fusion_operation]=material_grouped_by_op[fusion_operation] or Group.CreateGroup()
material_grouped_by_op[fusion_operation]:AddCard(material)
end end
local materials_with_two_material_effect=materials:Filter(function(mc) return (#FusionSpell.GetMaterialEffects(mc,tp,tc,pre_select_mat_location,post_select_mat_location,pre_select_mat_opponent_location))==2 end,nil) assert(#avaliable_fusion_effect>0, "Selected a target card that has 0 fusion effect")
assert(#materials_with_one_material_effect+#materials_with_two_material_effect==#materials, "We can not have one material have zero/3+ material effect yet") fusion_effect=avaliable_fusion_effect[1]
--For material that can be material by multiple effect, ask user which to apply. if #avaliable_fusion_effect>1 then
--As of 2025 May, if a material could be used as extra material, it must be able to be used as fusion spell material. The code below is based on this assumption. fusion_effect=FusionSpell.MultiFusionEffectPrompt(avaliable_fusion_effect)
-- If we have Aiラブ融合 + 影牢の呪縛 or 多層融合 + アマゾネスの秘術 in same archetype, is code would fail in some scenario. end
--First, group them by extra_material_effect if fusion_effect==e then
---@type {[Effect]:Group} --- use fusion spell effect
local material_grouped_by_extra_material_effect={} local mg=FusionSpell.GetMaterialsGroupForTargetCard(
for material in aux.Next(materials_with_two_material_effect) do tc,
local material_effect=FusionSpell.GetExtraMaterialEffect(material,tp,tc,pre_select_mat_location) tp,
assert(material_effect~=nil, "We can not have a material w/o extra material effect when it has 2 options") e,
material_grouped_by_extra_material_effect[material_effect]=material_grouped_by_extra_material_effect[material_effect] or Group.CreateGroup() aux.NecroValleyFilter(matfilter),
material_grouped_by_extra_material_effect[material_effect]:AddCard(material) pre_select_mat_location,
mat_operation_code_map,
post_select_mat_location,
sumtype,
pre_select_mat_opponent_location)
aux.FCheckAdditional=FusionSpell.GetFusionSpellFCheckAdditionalFunction(additional_fcheck,tp,tc,pre_select_mat_location,post_select_mat_location,pre_select_mat_opponent_location)
aux.FGoalCheckAdditional=FusionSpell.GetFusionSpellFGoalCheckAdditionalFunction(additional_fgoalcheck,tp,tc,pre_select_mat_location)
materials=Duel.SelectFusionMaterial(tp,tc,mg,gc(e),tp)
aux.FCheckAdditional=nil
aux.FGoalCheckAdditional=nil
else
--- use chain material effect
---@type function
local chain_material_filter=fusion_effect:GetTarget()
local chain_mg=chain_material_filter(fusion_effect,e,tp):Filter(aux.NecroValleyFilter(matfilter),nil)
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.FGoalCheckAdditional=FusionSpell.GetFusionSpellFGoalCheckAdditionalFunctionForChainMaterial(additional_fgoalcheck)
materials=Duel.SelectFusionMaterial(tp,tc,chain_mg,gc(e),tp)
aux.FCheckAdditional=nil
aux.FGoalCheckAdditional=nil
end end
end
---For each group, let user select the material that apply the extra material effect. assert(tc~=nil)
for material_effect,grouped_materials in pairs(material_grouped_by_extra_material_effect) do assert(fusion_effect~=nil)
Duel.Hint(HINT_SELECTMSG,tp,material_effect:GetDescription())
local extra_material_limit=#grouped_materials if #materials>0 then
--- in case of アマゾネスの秘術 or 影牢の呪縛, limit the maximuim number to choose local materials_from_spell_card=Group.CreateGroup()
local material_effect_material_count_limit=({material_effect:GetLabel()})[1] if fusion_effect==e then
if material_effect_material_count_limit~= 0 then --- fusion with fusion spell
extra_material_limit=material_effect_material_count_limit tc:SetMaterial(materials)
end ---@type {[Effect]:true}
local materials_to_apply=grouped_materials:Select(tp,0,extra_material_limit,nil) local applied_extra_effects={}
local rest_materials=grouped_materials-materials_to_apply ---@type {[FUSION_OPERATION_FUNCTION]:Group}
if #rest_materials>0 then local material_grouped_by_op={}
for material in aux.Next(rest_materials) do
local materials_with_one_material_effect=materials:Filter(function(mc) return (#FusionSpell.GetMaterialEffects(mc,tp,tc,pre_select_mat_location,post_select_mat_location,pre_select_mat_opponent_location))==1 end,nil)
for material in aux.Next(materials_with_one_material_effect) do
--For material that can be material only by 1 effect, either fusion spell or extra material effect, do the operation on it.
local fusion_operation=nil
local material_effect=FusionSpell.GetMaterialEffects(material,tp,tc,pre_select_mat_location,post_select_mat_location,pre_select_mat_opponent_location)[1]
if material_effect==true then
local fusion_operation_code=FusionSpell.GetOperationCodeByMaterialLocation(material:GetLocation(),mat_operation_code_map) local fusion_operation_code=FusionSpell.GetOperationCodeByMaterialLocation(material:GetLocation(),mat_operation_code_map)
local fusion_operation=FusionSpell.GetFusionOperationByCode(fusion_operation_code) fusion_operation=FusionSpell.GetFusionOperationByCode(fusion_operation_code)
material_grouped_by_op[fusion_operation]=material_grouped_by_op[fusion_operation] or Group.CreateGroup()
material_grouped_by_op[fusion_operation]:AddCard(material)
materials_from_spell_card:AddCard(material) materials_from_spell_card:AddCard(material)
end else
end -- extra material effects
if #materials_to_apply>0 then
applied_extra_effects[material_effect]=true
local fusion_operation_code=material_effect:GetOperation()()
for material in aux.Next(materials_to_apply) do
local fusion_operation=FusionSpell.GetFusionOperationByCode(fusion_operation_code,material:GetLocation(),mat_operation_code_map)
assert(fusion_operation~=nil)
--- pay the operation cost, only valid in 影牢の呪縛 as of 2025 May --- pay the operation cost, only valid in 影牢の呪縛 as of 2025 May
local material_cost=material_effect:GetCost() local material_cost=material_effect:GetCost()
if material_cost~=nil then if material_cost~=nil then
material_cost(material_effect,tp,eg,ep,ev,re,r,rp) material_cost(material_effect,tp,eg,ep,ev,re,r,rp)
end end
material_grouped_by_op[fusion_operation]=material_grouped_by_op[fusion_operation] or Group.CreateGroup() local fusion_operation_code=material_effect:GetOperation()()
material_grouped_by_op[fusion_operation]:AddCard(material) fusion_operation=FusionSpell.GetFusionOperationByCode(fusion_operation_code,material:GetLocation(),mat_operation_code_map)
applied_extra_effects[material_effect]=true
end end
assert(fusion_operation~=nil)
material_grouped_by_op[fusion_operation]=material_grouped_by_op[fusion_operation] or Group.CreateGroup()
material_grouped_by_op[fusion_operation]:AddCard(material)
end
local materials_with_two_material_effect=materials:Filter(function(mc) return (#FusionSpell.GetMaterialEffects(mc,tp,tc,pre_select_mat_location,post_select_mat_location,pre_select_mat_opponent_location))==2 end,nil)
assert(#materials_with_one_material_effect+#materials_with_two_material_effect==#materials, "We can not have one material have zero/3+ material effect yet")
--For material that can be material by multiple effect, ask user which to apply.
--As of 2025 May, if a material could be used as extra material, it must be able to be used as fusion spell material. The code below is based on this assumption.
-- If we have Aiラブ融合 + 影牢の呪縛 or 多層融合 + アマゾネスの秘術 in same archetype, is code would fail in some scenario.
--First, group them by extra_material_effect
---@type {[Effect]:Group}
local material_grouped_by_extra_material_effect={}
for material in aux.Next(materials_with_two_material_effect) do
local material_effect=FusionSpell.GetExtraMaterialEffect(material,tp,tc,pre_select_mat_location)
assert(material_effect~=nil, "We can not have a material w/o extra material effect when it has 2 options")
material_grouped_by_extra_material_effect[material_effect]=material_grouped_by_extra_material_effect[material_effect] or Group.CreateGroup()
material_grouped_by_extra_material_effect[material_effect]:AddCard(material)
end end
end
-- before do the operations to the materials, hint the opponent selected materials ---For each group, let user select the material that apply the extra material effect.
local confirm_materials=materials:Filter(function(c) return c:IsLocation(LOCATION_HAND|LOCATION_EXTRA|LOCATION_DECK) or c:IsFacedown() end,nil) for material_effect,grouped_materials in pairs(material_grouped_by_extra_material_effect) do
if #confirm_materials>0 then Duel.Hint(HINT_SELECTMSG,tp,material_effect:GetDescription())
Duel.ConfirmCards(1-tp,confirm_materials) local extra_material_limit=#grouped_materials
end --- in case of アマゾネスの秘術 or 影牢の呪縛, limit the maximuim number to choose
Duel.HintSelection(materials-confirm_materials) local material_effect_material_count_limit=({material_effect:GetLabel()})[1]
if material_effect_material_count_limit~= 0 then
extra_material_limit=material_effect_material_count_limit
end
local materials_to_apply=grouped_materials:Select(tp,0,extra_material_limit,nil)
local rest_materials=grouped_materials-materials_to_apply
if #rest_materials>0 then
for material in aux.Next(rest_materials) do
local fusion_operation_code=FusionSpell.GetOperationCodeByMaterialLocation(material:GetLocation(),mat_operation_code_map)
local fusion_operation=FusionSpell.GetFusionOperationByCode(fusion_operation_code)
material_grouped_by_op[fusion_operation]=material_grouped_by_op[fusion_operation] or Group.CreateGroup()
material_grouped_by_op[fusion_operation]:AddCard(material)
materials_from_spell_card:AddCard(material)
end
end
if #materials_to_apply>0 then
applied_extra_effects[material_effect]=true
local fusion_operation_code=material_effect:GetOperation()()
for material in aux.Next(materials_to_apply) do
local fusion_operation=FusionSpell.GetFusionOperationByCode(fusion_operation_code,material:GetLocation(),mat_operation_code_map)
assert(fusion_operation~=nil)
--- pay the operation cost, only valid in 影牢の呪縛 as of 2025 May
local material_cost=material_effect:GetCost()
if material_cost~=nil then
material_cost(material_effect,tp,eg,ep,ev,re,r,rp)
end
material_grouped_by_op[fusion_operation]=material_grouped_by_op[fusion_operation] or Group.CreateGroup()
material_grouped_by_op[fusion_operation]:AddCard(material)
end
end
end
local operated_material_count=0 -- before do the operations to the materials, hint the opponent selected materials
-- perform operations on grouped materials local confirm_materials=materials:Filter(function(c) return c:IsLocation(LOCATION_HAND|LOCATION_EXTRA|LOCATION_DECK) or c:IsFacedown() end,nil)
for operation,grouped_materials in pairs(material_grouped_by_op) do if #confirm_materials>0 then
operated_material_count=operated_material_count+operation(grouped_materials,tp) Duel.ConfirmCards(1-tp,confirm_materials)
end end
Duel.HintSelection(materials-confirm_materials)
local operated_material_count=0
-- perform operations on grouped materials
for operation,grouped_materials in pairs(material_grouped_by_op) do
operated_material_count=operated_material_count+operation(grouped_materials,tp)
end
-- mark effect as used once. if count limit reached, reset the effect
for effect,_ in pairs(applied_extra_effects) do
--- hint opponent that this effect is applied
Duel.Hint(HINT_OPSELECTED,1-tp,effect:GetDescription())
effect:UseCountLimit(tp)
if effect:CheckCountLimit(tp)==false then
effect:Reset()
end
end
-- check if all materials are moved successfully (ラピッド・トリガー)
fusion_succeeded=(operated_material_count==#materials)
-- mark effect as used once. if count limit reached, reset the effect if fusion_succeeded==true then
for effect,_ in pairs(applied_extra_effects) do Duel.BreakEffect()
Duel.SpecialSummonStep(tc,SUMMON_TYPE_FUSION,tp,tp,false,false,sumpos)
end
else
--- hint opponent that this effect is applied --- hint opponent that this effect is applied
Duel.Hint(HINT_OPSELECTED,1-tp,effect:GetDescription()) Duel.Hint(HINT_OPSELECTED,1-tp,fusion_effect:GetDescription())
effect:UseCountLimit(tp)
if effect:CheckCountLimit(tp)==false then --- fusion with chain material
effect:Reset() fusion_effect:GetOperation()(e,e,tp,tc,materials,sumtype,sumpos)
--- use the chain material effect, reset if exhausted
fusion_effect:UseCountLimit(tp)
if fusion_effect:CheckCountLimit(tp)==false then
fusion_effect:Reset()
end end
end
-- check if all materials are moved successfully (ラピッド・トリガー) -- for chain material effects as of 2025 May it always succeeds
fusion_succeeded=(operated_material_count==#materials) fusion_succeeded=true
end
if fusion_succeeded==true then if fusion_succeeded==true then
Duel.BreakEffect() stage_x_operation(e,tc,tp,FusionSpell.STAGE_BEFORE_SUMMON_COMPLETE,materials_from_spell_card,materials)
Duel.SpecialSummonStep(tc,SUMMON_TYPE_FUSION,tp,tp,false,false,sumpos) Duel.SpecialSummonComplete()
stage_x_operation(e,tc,tp,FusionSpell.STAGE_BEFORE_PROCEDURE_COMPLETE,materials_from_spell_card,materials)
tc:CompleteProcedure()
stage_x_operation(e,tc,tp,FusionSpell.STAGE_AT_SUMMON_OPERATION_FINISH,materials_from_spell_card,materials)
end end
else
--- hint opponent that this effect is applied
Duel.Hint(HINT_OPSELECTED,1-tp,fusion_effect:GetDescription())
--- fusion with chain material
fusion_effect:GetOperation()(e,e,tp,tc,materials,sumtype,sumpos)
--- use the chain material effect, reset if exhausted
fusion_effect:UseCountLimit(tp)
if fusion_effect:CheckCountLimit(tp)==false then
fusion_effect:Reset()
end
-- for chain material effects as of 2025 May it always succeeds
fusion_succeeded=true
end
if fusion_succeeded==true then
stage_x_operation(e,tc,tp,FusionSpell.STAGE_BEFORE_SUMMON_COMPLETE,materials_from_spell_card,materials)
Duel.SpecialSummonComplete()
stage_x_operation(e,tc,tp,FusionSpell.STAGE_BEFORE_PROCEDURE_COMPLETE,materials_from_spell_card,materials)
tc:CompleteProcedure()
stage_x_operation(e,tc,tp,FusionSpell.STAGE_AT_SUMMON_OPERATION_FINISH,materials_from_spell_card,materials)
end end
end end
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