--created & coded by Swag local s,id=GetID() function s.initial_effect(c) local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetTarget(s.st) e1:SetOperation(s.sa) e1:SetCountLimit(1,id) c:RegisterEffect(e1) local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_ACTIVATE) e2:SetCode(EVENT_FREE_CHAIN) e2:SetCondition(function(e,tp) return Duel.IsExistingMatchingCard(aux.AND(aux.OR(s.thfilter,aux.NOT(Card.IsAbleToHand)),Card.IsFaceup),tp,LOCATION_MZONE,0,1,nil) end) e2:SetTarget(s.spt) e2:SetOperation(s.spo) e2:SetCountLimit(1,id+1000) c:RegisterEffect(e2) end function s.thfilter(c) return c:IsSetCard(0x412) and c:IsType(TYPE_MONSTER) and c:IsAbleToHand() end function s.st(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.thfilter,tp,LOCATION_DECK,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) end function s.sa(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local tc=Duel.GetFirstTarget() local g=Duel.SelectMatchingCard(tp,s.thfilter,tp,LOCATION_DECK,0,1,1,nil) if #g>0 then Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,g) end end function s.diffilter(c,att,rac) return c:IsFaceup() and c:IsAttribute(att) and c:IsRace(rac) end function s.ssfilter(c,e,tp) return c:IsSetCard(0x412) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) and not Duel.IsExistingMatchingCard(s.diffilter,tp,LOCATION_MZONE,0,1,nil,c:GetAttribute(),c:GetRace()) end function s.spt(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.ssfilter,tp,LOCATION_DECK,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK) end function s.spo(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local tc=Duel.SelectMatchingCard(tp,s.ssfilter,tp,LOCATION_DECK,0,1,1,nil,e,tp) if #tc>0 then Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP) end end