--[[ Rota the Circular Fairy Rota la Fata Circolare Card Author: D1G1TAL Scripted by: XGlitchy30 ]] local s,id=GetID() function s.initial_effect(c) --You can Special Summon this card (from your hand) by discarding 1 Plant or Insect monster. local e1=Effect.CreateEffect(c) e1:Desc(0) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_SPSUMMON_PROC) e1:SetProperty(EFFECT_FLAG_UNCOPYABLE) e1:SetRange(LOCATION_HAND) e1:SetCondition(s.spcon1) e1:SetTarget(s.sptg1) e1:SetOperation(s.spop1) c:RegisterEffect(e1) --You can target 1 Plant or Insect monster in your GY; shuffle it into the Deck, and if you do, send 1 Plant or Insect Tuner from your Deck to the GY, except "Rota the Circular Fairy". local e2=Effect.CreateEffect(c) e2:Desc(1) e2:SetCategory(CATEGORY_TODECK|CATEGORY_TOGRAVE) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetRange(LOCATION_MZONE) e2:HOPT() e2:SetTarget(s.tdtg) e2:SetOperation(s.tdop) c:RegisterEffect(e2) --If this card is sent from the field to the GY: You can target 1 Plant or Insect Tuner in your GY, except "Rota the Circular Fairy"; Special Summon it. local e3=Effect.CreateEffect(c) e3:Desc(2) e3:SetCategory(CATEGORY_SPECIAL_SUMMON) e3:SetType(EFFECT_TYPE_SINGLE|EFFECT_TYPE_TRIGGER_O) e3:SetProperty(EFFECT_FLAG_DELAY|EFFECT_FLAG_CARD_TARGET) e3:SetCode(EVENT_TO_GRAVE) e3:SHOPT() e3:SetCondition(s.spcon2) e3:SetTarget(s.sptg2) e3:SetOperation(s.spop2) c:RegisterEffect(e3) end --E1 function s.spfilter(c) return c:IsMonster() and c:IsRace(RACE_PLANT|RACE_INSECT) and c:IsDiscardable() end function s.spcon1(e,c) if c==nil then return true end local tp=c:GetControler() local rg=Duel.GetMatchingGroup(s.spfilter,tp,LOCATION_HAND,0,c) return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and #rg>0 end function s.sptg1(e,tp,eg,ep,ev,re,r,rp,c) local c=e:GetHandler() local g=nil local g=Duel.Select(HINTMSG_DISCARD,false,tp,s.spfilter,tp,LOCATION_HAND,0,1,1,c) if #g>0 then g:KeepAlive() e:SetLabelObject(g) return true end return false end function s.spop1(e,tp,eg,ep,ev,re,r,rp,c) local g=e:GetLabelObject() if not g then return end Duel.SendtoGrave(g,REASON_COST|REASON_DISCARD) g:DeleteGroup() end --E2 function s.tdfilter(c,tp) return c:IsMonster() and c:IsRace(RACE_PLANT|RACE_INSECT) and c:IsAbleToDeck() and Duel.IsExists(false,s.tgfilter,tp,LOCATION_DECK,0,1,nil,c) end function s.tgfilter(c) return c:IsMonster(TYPE_TUNER) and c:IsRace(RACE_PLANT|RACE_INSECT) and c:IsAbleToGrave() and not c:IsCode(id) end function s.tdtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and s.tdfilter(chkc,tp) end if chk==0 then return Duel.IsExists(true,s.tdfilter,tp,LOCATION_GRAVE,0,1,nil,tp) end local g=Duel.Select(HINTMSG_TODECK,true,tp,s.tdfilter,tp,LOCATION_GRAVE,0,1,1,nil,tp) Duel.SetCardOperationInfo(g,CATEGORY_TODECK) Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,tp,LOCATION_DECK) end function s.tdop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToChain() and Duel.ShuffleIntoDeck(tc)>0 then local g=Duel.Select(HINTMSG_TOGRAVE,false,tp,s.tgfilter,tp,LOCATION_DECK,0,1,1,nil) if #g>0 then Duel.SendtoGrave(g,REASON_EFFECT) end end end --E3 function s.spcon2(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsPreviousLocation(LOCATION_ONFIELD) end function s.filter(c,e,tp) return c:IsMonster(TYPE_TUNER) and c:IsRace(RACE_PLANT|RACE_INSECT) and not c:IsCode(id) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.sptg2(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and s.filter(chkc,e,tp) end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingTarget(s.filter,tp,LOCATION_GRAVE,0,1,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectTarget(tp,s.filter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0) end function s.spop2(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToChain() then Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP) end end