--Etherveil Sorceror local cid,id=GetID() function cid.initial_effect(c) --search local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH+CATEGORY_REMOVE) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetCode(EVENT_SUMMON_SUCCESS) e2:SetCountLimit(1,id) e2:SetCost(cid.rmcost) e2:SetTarget(cid.rmtg) e2:SetOperation(cid.rmop) c:RegisterEffect(e2) local e2x=e2:Clone() e2x:SetCode(EVENT_SPSUMMON_SUCCESS) c:RegisterEffect(e2x) --to hand local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,1)) e3:SetCategory(CATEGORY_TOHAND) e3:SetType(EFFECT_TYPE_IGNITION) e3:SetProperty(EFFECT_FLAG_CARD_TARGET) e3:SetRange(LOCATION_MZONE) e3:SetCountLimit(1,id+10000) e3:SetCondition (cid.tdcon1) e3:SetCost(cid.thcost) e3:SetTarget(cid.thtg) e3:SetOperation(cid.thop) c:RegisterEffect(e3) local e3x=e3:Clone() e3x:SetType(EFFECT_TYPE_QUICK_O) e3x:SetCode(EVENT_FREE_CHAIN) e3x:SetCondition(cid.tdcon2) c:RegisterEffect(e3x) end function cid.tdcon1(e,tp,eg,ep,ev,re,r,rp) return not Duel.IsPlayerAffectedByEffect(tp,21022007) end function cid.tdcon2(e,tp,eg,ep,ev,re,r,rp) return Duel.IsPlayerAffectedByEffect(tp,21022007) end function cid.rmfilter(c,atk) return c:IsSetCard(0x312) and c:IsAbleToHand() end function cid.rmcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(Card.IsAbleToRemoveAsCost,tp,LOCATION_HAND,0,1,nil,POS_FACEDOWN) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectMatchingCard(tp,Card.IsAbleToRemoveAsCost,tp,LOCATION_HAND,0,1,1,nil,POS_FACEDOWN) if #g>0 then Duel.Remove(g,POS_FACEDOWN,REASON_COST) end end function cid.rmtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(cid.rmfilter,tp,LOCATION_DECK,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) end function cid.rmop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectMatchingCard(tp,cid.rmfilter,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 function cid.thfilter(c) return c:IsSetCard(0x312) and c:IsType(TYPE_SPELL+TYPE_TRAP) and c:IsAbleToHand() end function cid.thcost(e,tp,eg,ep,ev,re,r,rp,chk) local g=Duel.GetDecktopGroup(tp,3) if chk==0 then return g:FilterCount(Card.IsAbleToRemoveAsCost,nil,POS_FACEDOWN)==3 end Duel.DisableShuffleCheck() Duel.Remove(g,POS_FACEDOWN,REASON_COST) end function cid.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and cid.thfilter(chkc) end if chk==0 then return Duel.IsExistingTarget(cid.thfilter,tp,LOCATION_GRAVE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectTarget(tp,aux.NecroValleyFilter(cid.thfilter),tp,LOCATION_GRAVE,0,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,1,0,0) end function cid.thop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.SendtoHand(tc,nil,REASON_EFFECT) end end