--Magicalia the Majestic Magical Girl local s,id=GetID() function s.initial_effect(c) --fusion material c:EnableReviveLimit() aux.AddFusionProcCode2(c,77222578,77222579,true,true) --Once per chain, when your opponent activates a card or effect (Quick Effect): You can shuffle 1 of your banished "Magicalia" Normal Spells that meets its activation conditions into the Deck; --this effect becomes that Spell's effect when that card is activated. local e1=Effect.CreateEffect(c) e1:SetDescription(1105) e1:SetType(EFFECT_TYPE_QUICK_O) e1:SetCode(EVENT_CHAINING) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1,EFFECT_COUNT_CODE_CHAIN) e1:SetCondition(s.tdcon) e1:SetCost(s.tdcost) e1:SetOperation(s.tdop) c:RegisterEffect(e1) --During the Main Phase (Quick Effect): You can return this card you control to the Extra Deck; Special Summon 1 "Magicalia the Glorious Magical Girl" and 1 "Magicalia's Majestic Unicorn" from your GY or among your banished cards. local e2=Effect.CreateEffect(c) e2:SetDescription(2) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetCode(EVENT_FREE_CHAIN) e2:SetHintTiming(0,TIMING_MAIN_END|TIMINGS_CHECK_MONSTER|TIMING_SUMMON) e2:SetRange(LOCATION_MZONE) e2:SetCondition(s.spcon) e2:SetCost(s.spcost) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) end function s.tdcon(e,tp,eg,ep,ev,re,r,rp) return rp==1-tp end function s.filter(c) return c:GetType()==TYPE_SPELL and c:IsSetCard(0x722) and c:IsAbleToDeckAsCost() and c:CheckActivateEffect(false,true,true)~=nil end function s.tdcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_REMOVED,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) local g=Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_REMOVED,0,1,1,nil) local te,ceg,cep,cev,cre,cr,crp=g:GetFirst():CheckActivateEffect(false,true,true) Duel.HintSelection(g) Duel.SendtoDeck(g,nil,SEQ_DECKSHUFFLE,REASON_COST) e:SetProperty(te:GetProperty()) local tg=te:GetTarget() if tg then tg(e,tp,ceg,cep,cev,cre,cr,crp,1) end te:SetLabelObject(e:GetLabelObject()) e:SetLabelObject(te) Duel.ClearOperationInfo(0) end function s.tdop(e,tp,eg,ep,ev,re,r,rp) local te=e:GetLabelObject() if not te then return end e:SetLabelObject(te:GetLabelObject()) local op=te:GetOperation() if op then op(e,tp,eg,ep,ev,re,r,rp) end end function s.spcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return Duel.IsMainPhase() end function s.spcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():IsAbleToExtraAsCost() end Duel.SendtoDeck(e:GetHandler(),nil,SEQ_DECKTOP,REASON_COST) end function s.spfilter(c,e,tp) return c:IsCode(77222578,77222579) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) and c:IsFaceup() end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then local ft=Duel.GetLocationCount(tp,LOCATION_MZONE) if ft<1 or Duel.IsPlayerAffectedByEffect(tp,59822133) then return false end local g=Duel.GetMatchingGroup(s.spfilter,tp,LOCATION_REMOVED,0,nil,e,tp) return g:CheckSubGroup(aux.dncheck,2,2) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,2,tp,LOCATION_REMOVED) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local ft=Duel.GetLocationCount(tp,LOCATION_MZONE) if ft<2 or Duel.IsPlayerAffectedByEffect(tp,59822133) then return end local g=Duel.GetMatchingGroup(s.spfilter,tp,LOCATION_REMOVED,0,nil,e,tp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local sg=g:SelectSubGroup(tp,aux.dncheck,false,2,2) if not sg then return end local tc=sg:GetFirst() for tc in aux.Next(sg) do Duel.SpecialSummonStep(tc,0,tp,tp,false,false,POS_FACEUP) end Duel.SpecialSummonComplete() end