--Zodiakieri of the Glistening Skies function c9945600.initial_effect(c) c:EnableReviveLimit() aux.AddLinkProcedure(c,aux.FilterBoolFunction(Card.IsSetCard,0x12D7),2) --Set local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(9945600,0)) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetProperty(EFFECT_FLAG_DELAY) e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetCondition(c9945600.setcon) e1:SetTarget(c9945600.settg) e1:SetCountLimit(1,9945600) e1:SetOperation(c9945600.setop) c:RegisterEffect(e1) --Destroy local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(9945600,1)) e2:SetCategory(CATEGORY_DESTROY+CATEGORY_DISABLE) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetCode(EVENT_FREE_CHAIN) e2:SetCountLimit(1,9945601) e2:SetRange(LOCATION_MZONE) e2:SetTarget(c9945600.destg) e2:SetOperation(c9945600.desop) c:RegisterEffect(e2) --Return local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) e3:SetCode(EVENT_SPSUMMON_SUCCESS) e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e3:SetOperation(c9945600.retreg) c:RegisterEffect(e3) end function c9945600.setcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsSummonType(SUMMON_TYPE_LINK) end function c9945600.setfilter(c) return c:IsSetCard(0x12D7) and c:IsType(TYPE_SPELL+TYPE_TRAP) and c:IsSSetable() end function c9945600.settg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_SZONE)>0 and Duel.IsExistingMatchingCard(c9945600.setfilter,tp,LOCATION_GRAVE,0,1,nil) end end function c9945600.setop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SET) local g=Duel.SelectMatchingCard(tp,c9945600.setfilter,tp,LOCATION_GRAVE,0,1,1,nil) if g:GetCount()>0 then local tc=g:GetFirst() Duel.SSet(tp,tc) local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_LEAVE_FIELD_REDIRECT) e1:SetReset(RESET_EVENT+RESETS_REDIRECT) e1:SetValue(LOCATION_DECKSHF) tc:RegisterEffect(e1,true) end end function c9945600.destg(e,tp,eg,ep,ev,re,r,rp,chk) local g=Duel.GetMatchingGroup(nil,tp,0,LOCATION_ONFIELD,nil) local g2=Duel.GetMatchingGroup(nil,tp,LOCATION_ONFIELD,0,nil) if chk==0 then return #g>0 and #g2>0 end Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0) Duel.SetChainLimit(c9945600.chlimit) end function c9945600.chlimit(e,ep,tp) return tp~=ep end function c9945600.desop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectMatchingCard(tp,nil,tp,0,LOCATION_ONFIELD,1,1,nil) local g2=Duel.SelectMatchingCard(tp,nil,tp,LOCATION_ONFIELD,0,1,1,nil) if #g>0 and #g2>0 then Duel.HintSelection(g) Duel.HintSelection(g2) g:Merge(g2) Duel.Destroy(g,REASON_EFFECT) Duel.BreakEffect() local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_DISABLE) e1:SetReset(RESET_EVENT+0x1ff0000+RESET_PHASE+PHASE_END,2) c:RegisterEffect(e1) local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_DISABLE_EFFECT) e2:SetReset(RESET_EVENT+0x1ff0000+RESET_PHASE+PHASE_END,2) c:RegisterEffect(e2) --cannot be target local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE) e3:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e3:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET) e3:SetRange(LOCATION_MZONE) e3:SetValue(1) e3:SetReset(RESET_EVENT+0x1ff0000+RESET_PHASE+PHASE_END,2) c:RegisterEffect(e3) end end function c9945600.retreg(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F) e1:SetDescription(1104) e1:SetCategory(CATEGORY_TODECK+CATEGORY_SPECIAL_SUMMON) e1:SetCode(EVENT_PHASE+PHASE_END) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1) e1:SetReset(RESET_EVENT+0x1ee0000+RESET_PHASE+PHASE_END) e1:SetCondition(c9945600.retcon) e1:SetTarget(c9945600.rettg) e1:SetOperation(c9945600.retop) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) c:RegisterEffect(e2) end function c9945600.retcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not bit.band(e:GetHandler():GetSummonType(),SUMMON_TYPE_RITUAL)==SUMMON_TYPE_RITUAL or c:IsHasEffect(EFFECT_SPIRIT_DONOT_RETURN) then return false end if e:IsHasType(EFFECT_TYPE_TRIGGER_F) then return not c:IsHasEffect(EFFECT_SPIRIT_MAYNOT_RETURN) and Duel.GetTurnPlayer()==tp else return c:IsHasEffect(EFFECT_SPIRIT_MAYNOT_RETURN) and Duel.GetTurnPlayer()==tp end end function c9945600.retfilter(c,e,tp) return c:IsSetCard(0x12D7) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function c9945600.rettg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then if e:IsHasType(EFFECT_TYPE_TRIGGER_F) then return true else return Duel.GetLocationCount(tp,LOCATION_MZONE)>-1 and Duel.IsExistingMatchingCard(c9945600.retfilter,tp,LOCATION_DECK,0,1,nil,e,tp) end end Duel.SetOperationInfo(0,CATEGORY_TODECK,e:GetHandler(),1,0,0) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK) end function c9945600.retop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) and c:IsFaceup() and Duel.GetLocationCount(tp,LOCATION_MZONE)>-1 then Duel.SendtoDeck(c,nil,2,REASON_EFFECT) local g=Duel.SelectMatchingCard(tp,c9945600.retfilter,tp,LOCATION_DECK,0,1,1,nil,e,tp) if g:GetCount()>0 then Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) end end end