function c40933398.initial_effect(c) --fusion material c:EnableReviveLimit() aux.AddFusionProcCodeFun(c,57731460,aux.FilterBoolFunction(Card.IsFusionSetCard,0x19),1,true,true) --spsummon condition local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e1:SetCode(EFFECT_SPSUMMON_CONDITION) e1:SetValue(c40933398.splimit) c:RegisterEffect(e1) --special summon rule local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetCode(EFFECT_SPSUMMON_PROC) e2:SetProperty(EFFECT_FLAG_UNCOPYABLE) e2:SetRange(LOCATION_EXTRA) e2:SetCondition(c40933398.sprcon) e2:SetOperation(c40933398.sprop) c:RegisterEffect(e2) --negate local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(40933398,0)) e3:SetCategory(CATEGORY_NEGATE+CATEGORY_DESTROY) e3:SetType(EFFECT_TYPE_QUICK_O) e3:SetCode(EVENT_CHAINING) e3:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DAMAGE_CAL) e3:SetRange(LOCATION_MZONE) e3:SetCondition(c40933398.discon) e3:SetCost(c40933398.discost) e3:SetTarget(c40933398.distg) e3:SetOperation(c40933398.disop) c:RegisterEffect(e3) --Revive local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(40933398,1)) e4:SetType(EFFECT_TYPE_TRIGGER_O+EFFECT_TYPE_FIELD) e4:SetCategory(CATEGORY_SPECIAL_SUMMON) e4:SetCode(EVENT_PHASE+PHASE_END) e4:SetRange(LOCATION_GRAVE) e4:SetCountLimit(1) e4:SetTarget(c40933398.sumtg) e4:SetOperation(c40933398.sumop) c:RegisterEffect(e4) --Special local e5=Effect.CreateEffect(c) e5:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_TOGRAVE) e5:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e5:SetCode(EVENT_ATTACK_ANNOUNCE) e5:SetRange(LOCATION_MZONE) e5:SetTarget(c40933398.sptg) e5:SetOperation(c40933398.spop) c:RegisterEffect(e5) --special summon local e6=Effect.CreateEffect(c) e6:SetDescription(aux.Stringid(40933398,4)) e6:SetCategory(CATEGORY_SPECIAL_SUMMON) e6:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e6:SetCode(EVENT_PHASE+PHASE_BATTLE) e6:SetRange(LOCATION_MZONE) e6:SetCondition(c40933398.spcon2) e6:SetCost(c40933398.spcost2) e6:SetTarget(c40933398.sptg2) e6:SetOperation(c40933398.spop2) c:RegisterEffect(e6) end function c40933398.splimit(e,se,sp,st) return e:GetHandler():GetLocation()~=LOCATION_EXTRA end function c40933398.spfilter1(c,tp) return c:IsFusionCode(57731460) and c:IsAbleToDeckOrExtraAsCost() and c:IsCanBeFusionMaterial(nil,true) and Duel.IsExistingMatchingCard(c40933398.spfilter2,tp,LOCATION_MZONE,0,1,c) end function c40933398.spfilter2(c) return c:IsFusionSetCard(0x19) and c:IsCanBeFusionMaterial() and c:IsAbleToDeckOrExtraAsCost() end function c40933398.sprcon(e,c) if c==nil then return true end local tp=c:GetControler() return Duel.GetLocationCount(tp,LOCATION_MZONE)>-2 and Duel.IsExistingMatchingCard(c40933398.spfilter1,tp,LOCATION_ONFIELD,0,1,nil,tp) end function c40933398.sprop(e,tp,eg,ep,ev,re,r,rp,c) Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(40933398,2)) local g1=Duel.SelectMatchingCard(tp,c40933398.spfilter1,tp,LOCATION_ONFIELD,0,1,1,nil,tp) Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(40933398,3)) local g2=Duel.SelectMatchingCard(tp,c40933398.spfilter2,tp,LOCATION_MZONE,0,1,1,g1:GetFirst()) g1:Merge(g2) local tc=g1:GetFirst() while tc do if not tc:IsFaceup() then Duel.ConfirmCards(1-tp,tc) end tc=g1:GetNext() end Duel.SendtoDeck(g1,nil,2,REASON_COST) end function c40933398.discon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsStatus(STATUS_BATTLE_DESTROYED) then return false end return ep~=tp and re:IsActiveType(TYPE_MONSTER) and Duel.IsChainNegatable(ev) end function c40933398.discost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():IsReleasable() end Duel.Release(e:GetHandler(),REASON_COST) end function c40933398.distg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_NEGATE,eg,1,0,0) if re:GetHandler():IsDestructable() and re:GetHandler():IsRelateToEffect(re) then Duel.SetOperationInfo(0,CATEGORY_DESTROY,eg,1,0,0) end end function c40933398.disop(e,tp,eg,ep,ev,re,r,rp) Duel.NegateActivation(ev) if re:GetHandler():IsRelateToEffect(re) then Duel.Destroy(eg,REASON_EFFECT) end e:GetHandler():RegisterFlagEffect(40933398,RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END,0,0) end function c40933398.sumtg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and c:GetFlagEffect(40933398)>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,0,0) end function c40933398.sumop(e,tp,eg,ep,ev,re,r,rp) if e:GetHandler():IsRelateToEffect(e) then Duel.SpecialSummon(e:GetHandler(),0,tp,tp,false,false,POS_FACEUP) end end function c40933398.filter(c,e,tp) return c:IsSetCard(0x19) and c:IsType(TYPE_MONSTER)and c:IsAbleToGrave() and Duel.IsExistingMatchingCard(c40933398.filter2,tp,LOCATION_GRAVE,0,1,nil,e,tp,c:GetCode()) end function c40933398.filter2(c,e,tp,code) return c:IsSetCard(0x19) and c:IsType(TYPE_MONSTER) and c:IsCanBeSpecialSummoned(e,130,tp,false,false) and not c:IsCode(code) end function c40933398.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(c40933398.filter,tp,LOCATION_DECK,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,tp,LOCATION_DECK) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_GRAVE) end function c40933398.spop(e,tp,eg,ep,ev,re,r,rp) local g1=Duel.GetMatchingGroup(c40933398.filter,tp,LOCATION_DECK,0,nil,e,tp) local g2=Duel.GetMatchingGroup(c40933398.filter2,tp,LOCATION_GRAVE,0,nil,e,tp) if g1:GetCount()>0 and g2:GetCount()>0 then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local sg1=g1:Select(tp,1,1,nil) g2:Remove(Card.IsCode,nil,sg1:GetFirst():GetCode()) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local sg2=g2:Select(tp,1,1,nil) Duel.SendtoGrave(sg1,nil,REASON_EFFECT) local tc=sg2:GetFirst() if tc then Duel.SpecialSummon(tc,120,tp,tp,true,false,POS_FACEUP) tc:RegisterFlagEffect(tc:GetOriginalCode(),RESET_EVENT+RESETS_STANDARD+RESET_DISABLE,0,0) end end end function c40933398.spcon2(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():GetBattledGroupCount()>0 end function c40933398.spcost2(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return c:IsAbleToExtraAsCost() end Duel.SendtoDeck(c,nil,0,REASON_COST) end function c40933398.sfilter(c,e,tp) return not c:IsCode(57731460) and c:IsSetCard(0x19) and c:IsType(TYPE_MONSTER) and c:IsCanBeSpecialSummoned(e,120,tp,false,false) end function c40933398.sptg2(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>-1 and Duel.IsExistingMatchingCard(c40933398.sfilter,tp,LOCATION_DECK,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK) end function c40933398.spop2(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,c40933398.sfilter,tp,LOCATION_DECK,0,1,1,nil,e,tp) local tc=g:GetFirst() if tc then Duel.SpecialSummon(tc,120,tp,tp,false,false,POS_FACEUP) tc:RegisterFlagEffect(tc:GetOriginalCode(),RESET_EVENT+0x1ff0000,0,0) end end