--ESPergear wracked function c16000040.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetTarget(c16000040.target) e1:SetOperation(c16000040.activate) c:RegisterEffect(e1) --destroy local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(16000040,1)) e2:SetCategory(CATEGORY_TODECK+CATEGORY_DRAW) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetCode(EVENT_FREE_CHAIN) e2:SetRange(LOCATION_GRAVE) --e2:SetHintTiming(0,0x1c0+TIMING_MAIN_END) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetCountLimit(1,16000040) --e2:SetCondition(aux.exccon) e2:SetCost(c16000040.cost2) e2:SetTarget(c16000040.target2) e2:SetOperation(c16000040.operation) c:RegisterEffect(e2) end function c16000040.filter(c) return c:IsSetCard(0x667f) and not c:IsCode(16000040) and c:IsAbleToHand() end function c16000040.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(c16000040.filter,tp,LOCATION_DECK,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) end function c16000040.activate(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectMatchingCard(tp,c16000040.filter,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 c16000040.cost2(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():IsAbleToRemoveAsCost() end Duel.Remove(e:GetHandler(),POS_FACEUP,REASON_COST) end function c16000040.filter2(c) return c:IsSetCard(0x667f) and not c:IsCode(16000040) and c:IsAbleToDeck() end function c16000040.target2(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and c16000040.filter2(chkc) end if chk==0 then return Duel.IsPlayerCanDraw(tp,2) and Duel.IsExistingTarget(c16000040.filter2,tp,LOCATION_GRAVE,0,5,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) local g=Duel.SelectTarget(tp,c16000040.filter2,tp,LOCATION_GRAVE,0,5,5,nil) Duel.SetOperationInfo(0,CATEGORY_TODECK,g,g:GetCount(),0,0) Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,2) end function c16000040.operation(e,tp,eg,ep,ev,re,r,rp) local tg=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS) if not tg or tg:FilterCount(Card.IsRelateToEffect,nil,e)~=5 then return end Duel.SendtoDeck(tg,nil,0,REASON_EFFECT) local g=Duel.GetOperatedGroup() if g:IsExists(Card.IsLocation,1,nil,LOCATION_DECK) then Duel.ShuffleDeck(tp) end local ct=g:FilterCount(Card.IsLocation,nil,LOCATION_DECK+LOCATION_EXTRA) if ct==5 then Duel.BreakEffect() Duel.Draw(tp,2,REASON_EFFECT) end end