--created & coded by Lyris, art by Yu Cheng Hong --天剣主タ七ラ local s,id,o=GetID() function s.initial_effect(c) local e0=Effect.CreateEffect(c) e0:SetType(EFFECT_TYPE_SINGLE) e0:SetCode(EFFECT_PIERCE) c:RegisterEffect(e0) local e2=Effect.CreateEffect(c) e2:SetCategory(CATEGORY_DRAW+CATEGORY_TODECK) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetCountLimit(1,id) e2:SetProperty(EFFECT_FLAG_DELAY) e2:SetCode(EVENT_SUMMON_SUCCESS) e2:SetTarget(s.target) e2:SetOperation(s.operation) c:RegisterEffect(e2) local e3=e2:Clone() e3:SetCode(EVENT_FLIP_SUMMON_SUCCESS) c:RegisterEffect(e3) local e4=e2:Clone() e4:SetCode(EVENT_SPSUMMON_SUCCESS) c:RegisterEffect(e4) local e5=Effect.CreateEffect(c) e5:SetType(EFFECT_TYPE_QUICK_O+EFFECT_TYPE_XMATERIAL) e5:SetCode(EVENT_FREE_CHAIN) e5:SetRange(LOCATION_MZONE) e5:SetCountLimit(1) e5:SetDescription(1111) e5:SetProperty(EFFECT_FLAG_CARD_TARGET) e5:SetCategory(CATEGORY_POSITION+CATEGORY_TODECK) e5:SetHintTiming(0,TIMINGS_CHECK_MONSTER) e5:SetCost(s.cost) e5:SetTarget(s.tdtg) e5:SetOperation(s.tdop) c:RegisterEffect(e5) end function s.filter(c) return c:IsSetCard(0xbb2) and c:IsAbleToDeck() end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_GRAVE+LOCATION_HAND,0,3,nil) end local g=Duel.GetMatchingGroup(s.filter,tp,LOCATION_GRAVE+LOCATION_HAND,0,nil) Duel.SetOperationInfo(0,CATEGORY_TODECK,g,3,0,0) Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1) end function s.operation(e,tp,eg,ep,ev,re,r,rp,chk) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) local g=Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_GRAVE+LOCATION_HAND,0,3,3,nil) Duel.ConfirmCards(1-tp,g) if g:IsExists(Card.IsLocation,1,nil,LOCATION_HAND) then Duel.ShuffleHand(tp) end Duel.SendtoDeck(g,nil,2,REASON_EFFECT) if g:IsExists(Card.IsLocation,1,nil,LOCATION_DECK) then Duel.ShuffleDeck(tp) end if g:FilterCount(Card.IsLocation,nil,LOCATION_DECK+LOCATION_EXTRA)==3 then Duel.Draw(tp,1,REASON_EFFECT) end end function s.dfilter(c) return s.filter(c) and c:IsType(TYPE_MONSTER) end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return c:CheckRemoveOverlayCard(tp,1,REASON_COST) end c:RemoveOverlayCard(tp,1,1,REASON_COST) 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.dfilter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.dfilter,tp,LOCATION_GRAVE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) local g=Duel.SelectTarget(tp,s.dfilter,tp,LOCATION_GRAVE,0,1,99,nil) Duel.SetOperationInfo(0,CATEGORY_TODECK,g,#g,0,0) end function s.tdop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS):Filter(Card.IsRelateToEffect,nil,e) Duel.SendtoDeck(g,nil,SEQ_DECKSHUFFLE,REASON_EFFECT) local ct=g:FilterCount(aux.NOT(Card.IsLocation),nil,LOCATION_GRAVE) local tg=Duel.GetMatchingGroup(Card.IsCanTurnSet,tp,LOCATION_MZONE,LOCATION_MZONE,nil) if ct>0 and #tg>0 and Duel.SelectYesNo(tp,1111) then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_POSCHANGE) local sg=tg:Select(tp,1,ct,nil) Duel.HintSelection(sg) Duel.ChangePosition(sg,POS_FACEDOWN_DEFENSE) end end