--Arcarum XVII - LA STELLA --Script by XGlitchy30 local cid,id=GetID() function cid.initial_effect(c) --spsummon self local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_QUICK_O) e1:SetCode(EVENT_FREE_CHAIN) e1:SetRange(LOCATION_GRAVE) e1:SetCountLimit(1,id) e1:SetCondition(cid.spcon) e1:SetCost(cid.spcost) e1:SetTarget(cid.sptg) e1:SetOperation(cid.spop) c:RegisterEffect(e1) --put on decktop local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e2:SetCode(EVENT_PREDRAW) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1,id+100) e2:SetCondition(cid.putcon) e2:SetTarget(cid.puttg) e2:SetOperation(cid.putop) c:RegisterEffect(e2) --search local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,2)) e3:SetCategory(CATEGORY_SEARCH+CATEGORY_TOHAND) e3:SetType(EFFECT_TYPE_IGNITION) e3:SetRange(LOCATION_HAND) e3:SetCountLimit(1,id+200) e3:SetCost(cid.sccost) e3:SetTarget(cid.sctg) e3:SetOperation(cid.scop) c:RegisterEffect(e3) end --filters function cid.cfilter(c,tp) return c:IsFaceup() and c:IsSetCard(0x5477) and c:IsAbleToGraveAsCost() and not c:IsStatus(STATUS_BATTLE_DESTROYED) and Duel.GetMZoneCount(tp,c)>0 end function cid.scfilter(c) return c:IsSetCard(0x5477) and c:IsType(TYPE_SPELL+TYPE_TRAP) and c:IsAbleToHand() end --spsummon self function cid.spcon(e,tp,eg,ep,ev,re,r,rp) return Duel.GetTurnPlayer()~=tp and Duel.GetFieldGroupCount(tp,LOCATION_ONFIELD,0)0 end function cid.puttg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(Card.IsSetCard,tp,LOCATION_DECK,0,1,nil,0x5477) and Duel.GetFieldGroupCount(tp,LOCATION_DECK,0)>1 end end function cid.putop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(34086406,3)) local g=Duel.SelectMatchingCard(tp,Card.IsSetCard,tp,LOCATION_DECK,0,1,1,nil,0x5477) local tc=g:GetFirst() if tc then Duel.ShuffleDeck(tp) Duel.MoveSequence(tc,0) Duel.ConfirmDecktop(tp,1) end end --search function cid.sccost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():IsAbleToGraveAsCost() end Duel.SendtoGrave(e:GetHandler(),REASON_COST) end function cid.sctg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(cid.scfilter,tp,LOCATION_DECK,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) end function cid.scop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectMatchingCard(tp,cid.scfilter,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