--动物朋友 北狐 function c33700054.initial_effect(c) c33700054[c]={} local effect_list=c33700054[c] --tohand local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(3841833,0)) e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_HAND) e1:SetCost(c33700054.cost) e1:SetTarget(c33700054.target) e1:SetOperation(c33700054.operation) c:RegisterEffect(e1) --draw local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(33700054,0)) e2:SetCategory(CATEGORY_DRAW) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetCode(EVENT_BATTLE_DAMAGE) e2:SetLabel(3) effect_list[3]=e2 e2:SetCondition(c33700054.drcon) e2:SetTarget(c33700054.drtg) e2:SetOperation(c33700054.drop) c:RegisterEffect(e2) --tohand local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(33700054,2)) e3:SetCategory(CATEGORY_TOHAND) e3:SetType(EFFECT_TYPE_IGNITION) e3:SetRange(LOCATION_MZONE) e3:SetProperty(EFFECT_FLAG_CARD_TARGET) e3:SetCountLimit(1) e3:SetLabel(22) effect_list[22]=e3 e3:SetCondition(c33700054.effcon2) e3:SetTarget(c33700054.htg) e3:SetOperation(c33700054.hop) c:RegisterEffect(e3) --tograve local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(33700054,1)) e4:SetType(EFFECT_TYPE_QUICK_F) e4:SetRange(LOCATION_MZONE) e4:SetCode(EVENT_CHAINING) e4:SetCountLimit(1) e4:SetLabel(7) effect_list[7]=e4 e4:SetCondition(c33700054.effcon) e4:SetOperation(c33700054.op) c:RegisterEffect(e4) end function c33700054.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():IsDiscardable() end Duel.SendtoGrave(e:GetHandler(),REASON_COST+REASON_DISCARD) end function c33700054.thfilter(c) return c:IsSetCard(0x442) and c:IsType(TYPE_MONSTER) and c:IsAbleToHand() and not c:IsCode(33700054) end function c33700054.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(c33700054.thfilter,tp,LOCATION_DECK,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) end function c33700054.operation(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectMatchingCard(tp,c33700054.thfilter,tp,LOCATION_DECK,0,1,1,nil) if g:GetCount()>0 then Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,g) local tc=g:GetFirst() if tc:IsLocation(LOCATION_HAND) then local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetCode(EFFECT_CANNOT_ACTIVATE) e1:SetTargetRange(1,0) e1:SetValue(c33700054.aclimit) e1:SetLabelObject(tc) e1:SetReset(RESET_PHASE+PHASE_END) Duel.RegisterEffect(e1,tp) end end end function c33700054.aclimit(e,re,tp) local tc=e:GetLabelObject() return re:GetHandler():IsCode(tc:GetCode()) and not re:GetHandler():IsImmuneToEffect(e) end function c33700054.jfilter(c) return c:GetCode()==33700090 and c:IsFaceup() and not c:IsDisabled() end function c33700054.drcon(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(c33700054.confiltert,tp,LOCATION_GRAVE,0,nil) return (g:GetClassCount(Card.GetCode)>=e:GetLabel() or e:GetLabel()==33700090) and ep==1-tp end function c33700054.confilter(c) return c:IsSetCard(0x442) and c:IsFaceup() and c:IsType(TYPE_MONSTER) end function c33700054.drtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetTargetPlayer(tp) Duel.SetTargetParam(1) Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1) end function c33700054.drop(e,tp,eg,ep,ev,re,r,rp) local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM) Duel.Draw(p,d,REASON_EFFECT) end function c33700054.effcon(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(c33700054.confilter,tp,LOCATION_GRAVE,0,nil) return (g:GetClassCount(Card.GetCode)>=e:GetLabel() or e:GetLabel()==33700090) and not e:GetHandler():IsStatus(STATUS_BATTLE_DESTROYED) and re:IsHasType(EFFECT_TYPE_ACTIVATE) and re:IsActiveType(TYPE_TRAP+TYPE_SPELL) and not re:IsActiveType(TYPE_CONTINUOUS) and re:GetHandler():IsSetCard(0x442) end function c33700054.effcon2(e) local g=Duel.GetMatchingGroup(c33700054.confilter,e:GetHandlerPlayer(),LOCATION_GRAVE,0,nil) return g:GetClassCount(Card.GetCode)>=e:GetLabel() end function c33700054.thfilter2(c) return aux.IsCodeListed(c,33700056) and c:IsType(TYPE_SPELL) and c:IsAbleToHand() end function c33700054.htg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_GRAVE+LOCATION_REMOVED) and chkc:IsControler(tp) and c33700054.thfilter(chkc) end if chk==0 then return Duel.IsExistingTarget(c33700054.thfilter2,tp,LOCATION_GRAVE+LOCATION_REMOVED,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectTarget(tp,c33700054.thfilter2,tp,LOCATION_GRAVE+LOCATION_REMOVED,0,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_TOHAND,g:GetFirst(),1,tp,LOCATION_GRAVE+LOCATION_REMOVED) end function c33700054.hop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.SendtoHand(tc,nil,REASON_EFFECT) end end function c33700054.op(e,tp,eg,ep,ev,re,r,rp) if re:GetHandler():IsRelateToEffect(re) then local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) e1:SetCode(EVENT_TO_GRAVE) e1:SetOperation(c33700054.thop) e1:SetReset(RESET_EVENT+0x17a0000) re:GetHandler():RegisterEffect(e1) end end function c33700054.thop(e,tp,eg,ep,ev,re,r,rp) if not e:GetHandler():IsHasEffect(EFFECT_NECRO_VALLEY) then Duel.SendtoHand(e:GetHandler(),tp,REASON_EFFECT) end end