--created & coded by Lyris, art by digitalart69 of DeviantArt --機氷竜アルトリ local s,id,o=GetID() function s.initial_effect(c) local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_QUICK_O) e1:SetCode(EVENT_FREE_CHAIN) e1:SetRange(LOCATION_HAND) e1:SetCountLimit(1,id) e1:SetCategory(CATEGORY_SEARCH+CATEGORY_TOHAND) e1:SetCost(s.cost) e1:SetTarget(s.tg) e1:SetOperation(s.op) c:RegisterEffect(e1) if not s.global_check then s.global_check=true s[0]={} s[1]={} local race=1 while race0 then local rc=1 while rc0 then return false end local tp=sump if targetp then tp=targetp end return s[tp][c:GetRace()] and s[tp][c:GetRace()]>1 end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return c:IsDiscardable() end Duel.SendtoGrave(c,REASON_DISCARD+REASON_COST) end function s.filter(c) return c:IsType(TYPE_MONSTER) and c:IsSetCard(0xd76) and c:IsAbleToHand() end function s.tg(e,tp,eg,ep,ev,re,r,rp,chk) local loc=LOCATION_GRAVE if Duel.GetTurnPlayer()~=tp then loc=LOCATION_DECK end if chk==0 then return Duel.IsExistingMatchingCard(s.filter,tp,loc,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,loc) end function s.op(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if Duel.GetFlagEffect(tp,id)==0 then local rc=1 while rc0 and tc:IsLocation(LOCATION_HAND) and tc:IsPreviousLocation(LOCATION_DECK) then Duel.ConfirmCards(1-tp,tc) local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e1:SetCode(EVENT_PHASE+PHASE_END) e1:SetCountLimit(1) e1:SetLabel(tc:GetCode()) e1:SetOperation(s.epop) e1:SetReset(RESET_PHASE+PHASE_END) Duel.RegisterEffect(e1,tp) end end function s.cfilter(c) return c:GetAttackedCount()==0 end function s.epop(e,tp,eg,ep,ev,re,r,rp) local p=e:GetOwnerPlayer() if Duel.IsExistingMatchingCard(s.cfilter,p,0,LOCATION_MZONE,1,nil) then return end Duel.SendtoGrave(Duel.GetMatchingGroup(Card.IsCode,p,LOCATION_HAND,0,nil,e:GetLabel()),REASON_EFFECT+REASON_DISCARD) end