--Mysterious Space Dragon function c53313925.initial_effect(c) c:EnableReviveLimit() --Materials: 2+ Level 8 monsters aux.AddXyzProcedure(c,nil,8,2,c53313925.alternatesum,aux.Stringid(53313925,0),99) --If this card is Xyz Summoned using 2+ "Mysterious" monsters with different names: You can destroy all monsters your opponent controls. local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_DESTROY) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetProperty(EFFECT_FLAG_DELAY) e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetCondition(c53313925.descon) e1:SetTarget(c53313925.destg) e1:SetOperation(c53313925.desop) c:RegisterEffect(e1) --Once per turn (Quick Effect): You can detach 2 materials from this card and target 1 "Mysterious" monster you control; banish 1 monster from your GY, and if you do, that target gains the banished monster's original effects until the end of this turn. local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetCode(EVENT_FREE_CHAIN) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetCategory(CATEGORY_REMOVE) e2:SetCost(c53313925.cost) e2:SetTarget(c53313925.target) e2:SetOperation(c53313925.activate) c:RegisterEffect(e2) --Once per turn: You can discard 1 card; add 1 "Mysterious" S/T from your Deck to your hand. local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_IGNITION) e3:SetRange(LOCATION_MZONE) e3:SetCountLimit(1) e3:SetCategory(CATEGORY_SEARCH+CATEGORY_TOHAND) e3:SetCost(c53313925.thcost) e3:SetTarget(c53313925.thtg) e3:SetOperation(c53313925.thop) c:RegisterEffect(e3) end function c53313925.alternatesum(c) return c:IsFaceup() and c:IsRank(7) end function c53313925.descon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return c:IsSummonType(SUMMON_TYPE_XYZ) and c:GetMaterial():Filter(Card.IsSetCard,nil,0xcf6):GetClassCount(Card.GetCode)>1 end function c53313925.destg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(aux.TRUE,tp,0,LOCATION_MZONE,1,nil) end local g=Duel.GetMatchingGroup(aux.TRUE,tp,0,LOCATION_MZONE,nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,g:GetCount(),0,0) end function c53313925.desop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(aux.TRUE,tp,0,LOCATION_MZONE,nil) if g:GetCount()>0 then Duel.Destroy(g,REASON_EFFECT) end end function c53313925.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():CheckRemoveOverlayCard(tp,2,REASON_COST) end e:GetHandler():RemoveOverlayCard(tp,2,2,REASON_COST) end function c53313925.cfilter(c) return c:IsFaceup() and c:IsSetCard(0xcf6) end function c53313925.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and c53313925.cfilter(chkc) end if chk==0 then return Duel.IsExistingTarget(c53313925.cfilter,tp,LOCATION_MZONE,0,1,nil,tp) and Duel.IsExistingMatchingCard(aux.AND(aux.FilterBoolFunction(Card.IsType,TYPE_MONSTER),aux.FilterBoolFunction(Card.IsAbleToRemove)),tp,LOCATION_GRAVE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP) Duel.SelectTarget(tp,c53313925.cfilter,tp,LOCATION_MZONE,0,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_REMOVE,nil,1,tp,LOCATION_GRAVE) end function c53313925.activate(e,tp,eg,ep,ev,re,r,rp) local c=Duel.GetFirstTarget() if not c:IsRelateToEffect(e) or c:IsFacedown() then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectMatchingCard(tp,aux.AND(aux.FilterBoolFunction(Card.IsType,TYPE_MONSTER),aux.FilterBoolFunction(Card.IsAbleToRemove)),tp,LOCATION_GRAVE,0,1,1,nil) local tc=g:GetFirst() if tc and Duel.Remove(tc,POS_FACEUP,REASON_EFFECT)>0 and tc:IsLocation(LOCATION_REMOVED) then c:CopyEffect(tc:GetOriginalCode(),RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END) end end function c53313925.thcost(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 Duel.DiscardHand(tp,Card.IsDiscardable,1,1,REASON_COST+REASON_DISCARD) end function c53313925.thfilter(c) return c:IsType(TYPE_SPELL+TYPE_TRAP) and c:IsSetCard(0xcf6) and c:IsAbleToHand() end function c53313925.thtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(c53313925.thfilter,tp,LOCATION_DECK,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) end function c53313925.thop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectMatchingCard(tp,c53313925.thfilter,tp,LOCATION_DECK,0,1,1,nil) if g:GetCount()>0 then Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,g) end end