--机空援护 资讯操作 function c40009042.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:SetCountLimit(1,40009042) e1:SetTarget(c40009042.target) e1:SetOperation(c40009042.activate) c:RegisterEffect(e1) --to hand local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(40009042,0)) e3:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e3:SetType(EFFECT_TYPE_IGNITION) e3:SetRange(LOCATION_GRAVE) e3:SetCost(c40009042.cost) e3:SetTarget(c40009042.thtg) e3:SetOperation(c40009042.thop) c:RegisterEffect(e3) end function c40009042.filter2(c) return c:IsSetCard(0xf13) and c:IsType(TYPE_SPELL+TYPE_TRAP) and c:IsAbleToHand() and not c:IsCode(40009042) end function c40009042.filter1(c) return c:IsCode(40009035) and c:IsAbleToHand() end function c40009042.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chk==0 then return Duel.IsExistingMatchingCard(c40009042.filter2,tp,LOCATION_DECK,0,1,nil) and Duel.IsExistingMatchingCard(c40009042.filter1,tp,LOCATION_DECK,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) end function c40009042.activate(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g1=Duel.SelectMatchingCard(tp,c40009042.filter2,tp,LOCATION_DECK,0,1,1,nil) local g2=Duel.SelectMatchingCard(tp,c40009042.filter1,tp,LOCATION_DECK,0,1,1,nil) local g=g1+g2 if g:GetCount()>0 then Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,g) end end function c40009042.cfilter(c) return c:IsSetCard(0xf13) and c:IsFaceup() and c:IsAbleToGraveAsCost() end function c40009042.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(c40009042.cfilter,tp,LOCATION_ONFIELD,0,2,nil) and e:GetHandler():IsAbleToRemoveAsCost() end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectMatchingCard(tp,c40009042.cfilter,tp,LOCATION_ONFIELD,0,2,2,nil) Duel.SendtoGrave(g,REASON_COST) Duel.Remove(e:GetHandler(),POS_FACEUP,REASON_COST) end function c40009042.thfilter(c) return c:IsSetCard(0xf13) and c:IsType(TYPE_QUICKPLAY) and c:IsAbleToHand() end function c40009042.thtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(c40009042.thfilter,tp,LOCATION_GRAVE,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_GRAVE) end function c40009042.thop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(c40009042.thfilter,tp,LOCATION_GRAVE,0,nil) if g:GetCount()<=0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local sg1=g:SelectSubGroup(tp,aux.dncheck,false,1,2) Duel.SendtoHand(sg1,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,sg1) end