--Heroic Tag Out function c249001045.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:SetCost(c249001045.cost) e1:SetTarget(c249001045.target) e1:SetOperation(c249001045.activate) c:RegisterEffect(e1) --Overlay local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(19310321,0)) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetType(EFFECT_TYPE_QUICK_O) e1:SetCode(EVENT_FREE_CHAIN) e1:SetRange(LOCATION_GRAVE) e1:SetCost(aux.bfgcost) e1:SetTarget(c249001045.target2) e1:SetOperation(c249001045.operation2) c:RegisterEffect(e1) end function c249001045.cfilter(c) return c:IsSetCard(0x6F) and c:IsAbleToDeckOrExtraAsCost() end function c249001045.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(c249001045.cfilter,tp,LOCATION_MZONE+LOCATION_HAND,0,1,nil) and Duel.IsPlayerCanDraw(tp,1) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) local g=Duel.SelectMatchingCard(tp,c249001045.cfilter,tp,LOCATION_MZONE+LOCATION_HAND,0,1,1,nil) Duel.SendtoDeck(g,nil,2,REASON_COST) end function c249001045.filter(c) return c:IsSetCard(0x6F) and c:IsType(TYPE_MONSTER) and c:IsAbleToHand() end function c249001045.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(c249001045.filter,tp,LOCATION_DECK,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1) end function c249001045.activate(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectMatchingCard(tp,c249001045.filter,tp,LOCATION_DECK,0,1,1,nil) if g:GetCount()>0 and Duel.SendtoHand(g,nil,REASON_EFFECT)~=0 then Duel.ConfirmCards(1-tp,g) Duel.Draw(tp,1,REASON_EFFECT) local e1=Effect.CreateEffect(e:GetHandler()) e1:SetDescription(aux.Stringid(78364470,0)) e1:SetType(EFFECT_TYPE_FIELD) e1:SetTargetRange(LOCATION_HAND+LOCATION_MZONE,0) e1:SetCode(EFFECT_EXTRA_SUMMON_COUNT) e1:SetTarget(aux.TargetBoolFunction(Card.IsSetCard,0x6F)) e1:SetReset(RESET_PHASE+PHASE_END) Duel.RegisterEffect(e1,tp) end end function c249001045.filter1(c) return c:IsFaceup() and c:IsType(TYPE_XYZ) and c:IsSetCard(0x6F) end function c249001045.filter2(c) return c:IsSetCard(0x76) and c:IsCanOverlay() end function c249001045.target2(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return false end if chk==0 then return Duel.IsExistingTarget(c249001045.filter1,tp,LOCATION_MZONE,0,1,nil) and Duel.IsExistingTarget(c249001045.filter2,tp,LOCATION_GRAVE,0,1,e:GetHandler()) end Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(249001045,1)) local g1=Duel.SelectTarget(tp,c249001045.filter1,tp,LOCATION_MZONE,0,1,1,nil) e:SetLabelObject(g1:GetFirst()) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_XMATERIAL) local g2=Duel.SelectTarget(tp,c249001045.filter2,tp,LOCATION_GRAVE,0,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_LEAVE_GRAVE,g2,2,0,0) end function c249001045.operation2(e,tp,eg,ep,ev,re,r,rp) local tc=e:GetLabelObject() if tc:IsFacedown() or not tc:IsRelateToEffect(e) or tc:IsImmuneToEffect(e) then return end local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS):Filter(Card.IsRelateToEffect,tc,e) if g:GetCount()>0 then Duel.Overlay(tc,g) end end