--created by NeverThisAgain, coded by Lyris local s,id=GetID() function s.initial_effect(c) aux.AddOrigPandemoniumType(c) local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_QUICK_O) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCode(EVENT_FREE_CHAIN) e1:SetRange(LOCATION_SZONE) e1:SetCountLimit(1,id) e1:SetCategory(CATEGORY_TOHAND) e1:SetDescription(1190) e1:SetCondition(aux.PandActCheck) e1:SetTarget(s.thtg) e1:SetOperation(s.thop) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCountLimit(1,id+1000) e2:SetCategory(CATEGORY_DESTROY) e2:SetProperty(0) e2:SetDescription(1124) e2:SetCondition(aux.AND(aux.PandActCheck,function(e,tp) return Duel.GetTurnPlayer()~=tp end)) e2:SetTarget(s.destg) e2:SetOperation(s.desop) c:RegisterEffect(e2) aux.EnablePandemoniumAttribute(c,e1,e2) local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e3:SetCode(EVENT_SUMMON_SUCCESS) e3:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_CARD_TARGET) e3:SetCategory(CATEGORY_TODECK+CATEGORY_DRAW) e3:SetTarget(s.tdtg) e3:SetOperation(s.tdop) c:RegisterEffect(e3) local e4=e3:Clone() e4:SetCode(EVENT_SPSUMMON_SUCCESS) c:RegisterEffect(e4) local e5=Effect.CreateEffect(c) e5:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e5:SetCode(EVENT_TO_GRAVE) e5:SetCountLimit(1,id+2000) e5:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_CARD_TARGET) e5:SetCategory(CATEGORY_DESTROY) e5:SetTarget(s.tg) e5:SetOperation(s.op) c:RegisterEffect(e5) end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and chkc:IsSetCard(0x9fa) and chkc:IsAbleToHand() end if chk==0 then return Duel.IsExistingTarget(aux.AND(Card.IsSetCard,Card.IsAbleToHand),tp,LOCATION_GRAVE,0,1,nil,0x9fa) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) Duel.SetOperationInfo(0,CATEGORY_TOHAND,Duel.SelectTarget(tp,aux.NecroValleyFilter(aux.AND(Card.IsSetCard,Card.IsAbleToHand)),tp,LOCATION_GRAVE,0,1,1,nil,0x9fa),1,0,0) end function s.thop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if e:GetHandler():IsRelateToEffect(e) and tc:IsRelateToEffect(e) then Duel.SendtoHand(tc,nil,REASON_EFFECT) end end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_DESTROY,e:GetHandler(),1,0,0) end function s.desop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) then Duel.Destroy(c,REASON_EFFECT) end end function s.tdfilter(c) return c:IsSetCard(0x9fa) and c:IsAbleToDeck() end function s.tdtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and s.tdfilter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.tdfilter,tp,LOCATION_GRAVE,0,2,nil) and Duel.IsPlayerCanDraw(tp,1) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) local g=Duel.SelectTarget(tp,aux.NecroValleyFilter(s.tdfilter),tp,LOCATION_GRAVE,0,2,2,nil) Duel.SetOperationInfo(0,CATEGORY_TODECK,g,#g,0,0) Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1) end function s.tdop(e,tp,eg,ep,ev,re,r,rp) local tg=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS):Filter(Card.IsRelateToEffect,nil,e) if not tg or #tg==0 or Duel.SendtoDeck(tg,nil,0,REASON_EFFECT)==0 then return end local g=Duel.GetOperatedGroup() for p=tp,1-tp do if g:IsExists(aux.AND(Card.IsControler,Card.IsLocation),1,nil,p,LOCATION_DECK) then Duel.ShuffleDeck(p) end end if g:IsExists(Card.IsLocation,1,nil,LOCATION_DECK+LOCATION_EXTRA) then Duel.BreakEffect() Duel.Draw(tp,1,REASON_EFFECT) end end function s.tg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsOnField() and chkc:IsControler(1-tp) and chkc:IsFaceup() end if chk==0 then return Duel.IsExistingTarget(Card.IsFaceup,tp,0,LOCATION_ONFIELD,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectTarget(tp,Card.IsFaceup,tp,0,LOCATION_ONFIELD,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,#g,0,0) end function s.op(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc and tc:IsRelateToEffect(e) then Duel.Destroy(tc,REASON_EFFECT) end end