--Mysterious Star Dragon function c53313922.initial_effect(c) --xyz summon aux.AddXyzProcedure(c,aux.FilterBoolFunction(Card.IsSetCard,0xcf6),7,2,nil,nil,99) c:EnableReviveLimit() --If this card is Xyz Summoned: You can target cards on the field equal to the number of materials attached to this card, -1; destroy them. local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetCode(EVENT_SPSUMMON_SUCCESS) e2:SetRange(LOCATION_MZONE) e2:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DELAY) e2:SetCategory(CATEGORY_TOGRAVE) e2:SetCondition(function(e) return e:GetHandler():IsSummonType(SUMMON_TYPE_XYZ) end) e2:SetTarget(c53313922.tgtg) e2:SetOperation(c53313922.tgop) c:RegisterEffect(e2) --You can detach 2 materials from this card, then target 1 face-up monster your opponent controls; its ATK becomes half its current ATK, and if it does, this card gains that lost ATK and negate that target's effects. local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_IGNITION) e3:SetRange(LOCATION_MZONE) e3:SetProperty(EFFECT_FLAG_CARD_TARGET) e3:SetCategory(CATEGORY_ATKCHANGE+CATEGORY_DEFCHANGE+CATEGORY_DISABLE) e3:SetCost(c53313922.cost) e3:SetTarget(c53313922.target) e3:SetOperation(c53313922.operation) c:RegisterEffect(e3) end function c53313922.tgtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) local ct=e:GetHandler():GetOverlayCount()-1 if chkc then return ct==1 and chkc:IsOnField() end if chk==0 then return Duel.IsExistingTarget(nil,tp,0,LOCATION_ONFIELD,ct,nil) end Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(53313922,2)) local g=Duel.SelectTarget(tp,nil,tp,0,LOCATION_ONFIELD,ct,ct,nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,ct,0,0) end function c53313922.tgop(e,tp,eg,ep,ev,re,r,rp) local tg=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS) local sg=tg:Filter(Card.IsRelateToEffect,nil,e) if sg:GetCount()>0 then Duel.Destroy(sg,REASON_EFFECT) end end function c53313922.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 c53313922.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(1-tp) and chkc:IsFaceup() end if chk==0 then return Duel.IsExistingTarget(Card.IsFaceup,tp,0,LOCATION_MZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP) Duel.SelectTarget(tp,Card.IsFaceup,tp,0,LOCATION_MZONE,1,1,nil) end function c53313922.operation(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=Duel.GetFirstTarget() if tc:IsFaceup() and tc:IsRelateToEffect(e) and not tc:IsImmuneToEffect(e) then local atk=c:GetAttack() local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE) e3:SetCode(EFFECT_SET_ATTACK_FINAL) e3:SetReset(RESET_EVENT+0x1fe0000) e3:SetValue(math.ceil(atk/2)) tc:RegisterEffect(e3) if c:IsRelateToEffect(e) and c:IsFaceup() then local e5=Effect.CreateEffect(c) e5:SetType(EFFECT_TYPE_SINGLE) e5:SetCode(EFFECT_UPDATE_ATTACK) e5:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e5:SetReset(RESET_EVENT+0x1fe0000) e5:SetValue(math.ceil(atk/2)) c:RegisterEffect(e5) Duel.NegateRelatedChain(tc,RESET_TURN_SET) local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_DISABLE) e1:SetReset(RESET_EVENT+0x1fe0000) tc:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EFFECT_DISABLE_EFFECT) e2:SetValue(RESET_TURN_SET) tc:RegisterEffect(e2) end end end