--Zodiakieri of the Gibbous Moon function c9945565.initial_effect(c) c:EnableReviveLimit() --ExRitual local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE+EFFECT_FLAG_UNCOPYABLE+EFFECT_FLAG_IGNORE_IMMUNE) e1:SetCode(EFFECT_REMOVE_TYPE) e1:SetRange(LOCATION_ONFIELD+LOCATION_GRAVE+LOCATION_EXTRA+LOCATION_REMOVED+LOCATION_OVERLAY) e1:SetValue(TYPE_FUSION) c:RegisterEffect(e1) --Set local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(9945565,0)) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_DELAY) e2:SetCode(EVENT_SPSUMMON_SUCCESS) e2:SetTarget(c9945565.settg) e2:SetCondition(c9945565.setcon) e2:SetCountLimit(1,9945565) e2:SetOperation(c9945565.setop) c:RegisterEffect(e2) --atkup local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE) e3:SetCode(EFFECT_UPDATE_ATTACK) e3:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e3:SetRange(LOCATION_MZONE) e3:SetCondition(c9945565.atkcon) e3:SetValue(1000) c:RegisterEffect(e3) --Unaffected by Opponent Card Effects local e4=Effect.CreateEffect(c) e4:SetType(EFFECT_TYPE_SINGLE) e4:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e4:SetRange(LOCATION_MZONE) e4:SetCode(EFFECT_IMMUNE_EFFECT) e4:SetCondition(c9945565.limcon) e4:SetValue(c9945565.unval) c:RegisterEffect(e4) --negate atk and end bp local e5=Effect.CreateEffect(c) e5:SetDescription(aux.Stringid(9945565,1)) e5:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e5:SetCode(EVENT_ATTACK_ANNOUNCE) e5:SetRange(LOCATION_MZONE) e5:SetCondition(c9945565.condition) e5:SetCost(c9945565.cost) e5:SetOperation(c9945565.operation) c:RegisterEffect(e5) --return local e6=Effect.CreateEffect(c) e6:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) e6:SetCode(EVENT_SPSUMMON_SUCCESS) e6:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e6:SetOperation(c9945565.retreg) c:RegisterEffect(e6) --Revive local e7=Effect.CreateEffect(c) e7:SetDescription(aux.Stringid(9945565,2)) e7:SetType(EFFECT_TYPE_TRIGGER_F+EFFECT_TYPE_FIELD) e7:SetCategory(CATEGORY_SPECIAL_SUMMON) e7:SetCode(EVENT_PHASE+PHASE_STANDBY) e7:SetLabelObject(e6) e7:SetCountLimit(1) e7:SetCondition(c9945565.spcon) e7:SetTarget(c9945565.sumtg) e7:SetOperation(c9945565.sumop) c:RegisterEffect(e7) end function c9945565.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(c9945565.retcon) e1:SetTarget(c9945565.rettg) e1:SetOperation(c9945565.retop) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) c:RegisterEffect(e2) end function c9945565.setcon(e,tp,eg,ep,ev,re,r,rp) return bit.band(e:GetHandler():GetSummonType(),SUMMON_TYPE_RITUAL)==SUMMON_TYPE_RITUAL end function c9945565.setfilter(c) return c:IsCode(9945560) and c:IsSSetable() end function c9945565.settg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_SZONE)>0 and Duel.IsExistingMatchingCard(c9945565.setfilter,tp,LOCATION_EXTRA,0,1,nil) end end function c9945565.setop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SET) local g=Duel.SelectMatchingCard(tp,c9945565.setfilter,tp,LOCATION_EXTRA,0,1,1,nil) if g:GetCount()>0 then Duel.SSet(tp,g:GetFirst()) Duel.ConfirmCards(1-tp,g) end end function c9945565.atkcon(e) return Duel.GetTurnPlayer()==e:GetHandlerPlayer() end function c9945565.limcon(e,tp,eg,ep,ev,re,r,rp) local ph=Duel.GetCurrentPhase() return (ph==PHASE_BATTLE) end function c9945565.unval(e,te) return te:GetOwnerPlayer()~=e:GetHandlerPlayer() end function c9945565.condition(e,tp,eg,ep,ev,re,r,rp) return Duel.GetAttacker():IsControler(1-tp) end function c9945565.ngfilter(c) return c:IsSetCard(0x12D7) and c:IsFaceup() and c:IsAbleToHandAsCost() end function c9945565.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():GetFlagEffect(9945566)==0 and Duel.IsExistingMatchingCard(c9945565.ngfilter,tp,LOCATION_MZONE,0,1,e:GetHandler()) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RTOHAND) local g=Duel.SelectMatchingCard(tp,c9945565.ngfilter,tp,LOCATION_MZONE,0,1,1,e:GetHandler()) Duel.SendtoHand(g,nil,REASON_COST) e:GetHandler():RegisterFlagEffect(9945566,RESET_CHAIN,0,1) end function c9945565.operation(e,tp,eg,ep,ev,re,r,rp) if Duel.NegateAttack() then Duel.SkipPhase(1-tp,PHASE_BATTLE,RESET_PHASE+PHASE_BATTLE,1) end end function c9945565.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 c9945565.retfilter(c,e,tp) return c:IsSetCard(0x12D7) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function c9945565.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(c9945565.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 c9945565.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) if c:IsLocation(LOCATION_EXTRA) and c:IsPreviousLocation(LOCATION_MZONE) then if Duel.GetTurnPlayer()==tp and Duel.GetCurrentPhase()==PHASE_STANDBY then e:SetLabel(Duel.GetTurnCount()) c:RegisterFlagEffect(9945565,RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_STANDBY+RESET_SELF_TURN,0,2) else e:SetLabel(0) c:RegisterFlagEffect(9945565,RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_STANDBY+RESET_SELF_TURN,0,1) end end local g=Duel.SelectMatchingCard(tp,c9945565.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 function c9945565.spcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return e:GetLabelObject():GetLabel()~=Duel.GetTurnCount() and tp==Duel.GetTurnPlayer() and c:GetFlagEffect(9945565)>0 end function c9945565.sumtg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and c:IsCanBeSpecialSummoned(e,0,tp,true,true) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0) c:ResetFlagEffect(9945565) end function c9945565.sumop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) then return end if Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)==0 and Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then Duel.SendtoGrave(c,REASON_RULE) end end