--Dark Sorcerer of the Scarlet Red --Created and Scripted by Swaggy local m=193185415 local cm=_G["c"..m] function cm.initial_effect(c) --to hand or grave local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(m,0)) e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH+CATEGORY_TOGRAVE) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetProperty(EFFECT_FLAG_DELAY) e1:SetCode(EVENT_SUMMON_SUCCESS) e1:SetCountLimit(1,m) e1:SetTarget(cm.setg) e1:SetOperation(cm.seop) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EVENT_SPSUMMON_SUCCESS) c:RegisterEffect(e2) local e3=Effect.CreateEffect(c) e3:SetCategory(CATEGORY_TOGRAVE) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e3:SetCode(EVENT_TO_GRAVE) e3:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DELAY) e3:SetCountLimit(1,m+100) e3:SetCondition(cm.milcon) e3:SetTarget(cm.miltg) e3:SetOperation(cm.milop) c:RegisterEffect(e3) end function cm.cfilter(c) return c:IsSetCard(0xd78) and (c:IsAbleToHand() or c:IsAbleToGrave()) and not c:IsCode(m) end function cm.setg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(cm.cfilter,tp,LOCATION_DECK,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,tp,LOCATION_DECK) end function cm.seop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(m,2)) local g=Duel.SelectMatchingCard(tp,cm.cfilter,tp,LOCATION_DECK,0,1,1,nil) if g:GetCount()>0 then local tc=g:GetFirst() if tc and tc:IsAbleToHand() and (not tc:IsAbleToGrave() or Duel.SelectOption(tp,1190,1191)==0) then Duel.SendtoHand(tc,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,tc) else Duel.SendtoGrave(tc,REASON_EFFECT) end end end function cm.milcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsReason(REASON_EFFECT) and re and re:GetHandler():IsSetCard(0xd78) end function cm.miltg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetFieldGroupCount(tp,LOCATION_DECK,0)>2 end end function cm.filter(c) return c:IsAbleToGrave() end function cm.milop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetFieldGroupCount(tp,LOCATION_DECK,0)<3 then return end local g=Duel.GetDecktopGroup(tp,3) Duel.ConfirmCards(tp,g) if g:IsExists(cm.filter,1,nil) then local sg=g:FilterSelect(tp,cm.filter,1,1,nil) Duel.DisableShuffleCheck() Duel.SendtoGrave(sg,REASON_EFFECT) else Duel.ShuffleDeck(tp) end end