--Crescent Moon function c9945555.initial_effect(c) --ExSpell local e0=Effect.CreateEffect(c) e0:SetType(EFFECT_TYPE_SINGLE) e0:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e0:SetCode(EFFECT_REMOVE_TYPE) e0:SetRange(LOCATION_ONFIELD+LOCATION_GRAVE+LOCATION_EXTRA+LOCATION_REMOVED+LOCATION_OVERLAY) e0:SetValue(TYPE_FUSION) c:RegisterEffect(e0) --Cannot Trigger local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_CANNOT_TRIGGER) e1:SetCondition(c9945555.condition) c:RegisterEffect(e1) --activate local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_ACTIVATE) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetCode(EVENT_FREE_CHAIN) e2:SetCountLimit(1,9945555+EFFECT_COUNT_CODE_OATH) e2:SetTarget(c9945555.target) e2:SetOperation(c9945555.operation) c:RegisterEffect(e2) --Set local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(9945555,0)) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e3:SetProperty(EFFECT_FLAG_DELAY) e3:SetCode(EVENT_DESTROYED) e3:SetTarget(c9945555.settg) e3:SetCountLimit(1,9945556) e3:SetOperation(c9945555.setop) c:RegisterEffect(e3) end function c9945555.condition(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return not (c:IsLocation(LOCATION_GRAVE) and c:IsPreviousLocation(LOCATION_HAND+LOCATION_ONFIELD) and c:IsReason(REASON_DESTROY)) end function c9945555.filter(c,e,tp) return c:IsSetCard(0x12D7) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function c9945555.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(c9945555.filter,tp,LOCATION_HAND+LOCATION_GRAVE,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND+LOCATION_GRAVE) end function c9945555.operation(e,tp,eg,ep,ev,re,r,rp) local ft=Duel.GetLocationCount(tp,LOCATION_MZONE) if ft<=0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) if Duel.IsPlayerAffectedByEffect(tp,59822133) then ft=1 end local g=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(c9945555.filter),tp,LOCATION_HAND+LOCATION_GRAVE,0,1,ft,nil,e,tp) if g:GetCount()>0 then local fid=e:GetHandler():GetFieldID() local tc=g:GetFirst() while tc do Duel.SpecialSummonStep(tc,0,tp,tp,false,false,POS_FACEUP) local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_CANNOT_BE_LINK_MATERIAL) e1:SetValue(c9945555.matlimit) e1:SetReset(RESET_EVENT+0x1fe0000) tc:RegisterEffect(e1,true) local e2=e1:Clone() e2:SetCode(EFFECT_CANNOT_BE_XYZ_MATERIAL) tc:RegisterEffect(e2,true) local e3=e1:Clone() e3:SetCode(EFFECT_CANNOT_BE_SYNCHRO_MATERIAL) tc:RegisterEffect(e3,true) local e4=e1:Clone() e4:SetCode(EFFECT_CANNOT_BE_FUSION_MATERIAL) tc:RegisterEffect(e4,true) local e5=Effect.CreateEffect(e:GetHandler()) e5:SetType(EFFECT_TYPE_SINGLE) e5:SetCode(EFFECT_DISABLE) e5:SetReset(RESET_EVENT+0x1fe0000) tc:RegisterEffect(e5,true) local e6=Effect.CreateEffect(e:GetHandler()) e6:SetType(EFFECT_TYPE_SINGLE) e6:SetCode(EFFECT_DISABLE_EFFECT) e6:SetReset(RESET_EVENT+0x1fe0000) tc:RegisterEffect(e6,true) tc:RegisterFlagEffect(9945555,RESET_EVENT+0x1fe0000,0,1,fid) tc:RegisterFlagEffect(0,RESET_EVENT+0x1fe0000,EFFECT_FLAG_CLIENT_HINT,1,0,aux.Stringid(9945555,1)) tc=g:GetNext() end Duel.SpecialSummonComplete() g:KeepAlive() local e3=Effect.CreateEffect(e:GetHandler()) e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e3:SetCode(EVENT_PHASE+PHASE_END) e3:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE) e3:SetCountLimit(1) e3:SetLabel(fid) e3:SetLabelObject(g) e3:SetCondition(c9945555.retcon) e3:SetOperation(c9945555.retop) Duel.RegisterEffect(e3,tp) end end function c9945555.matlimit(e,c) if not c then return false end return not c:IsSetCard(0x12D7) end function c9945555.retfilter(c,fid) return c:GetFlagEffectLabel(9945555)==fid end function c9945555.retcon(e,tp,eg,ep,ev,re,r,rp) local g=e:GetLabelObject() if not g:IsExists(c9945555.retfilter,1,nil,e:GetLabel()) then g:DeleteGroup() e:Reset() return false else return true end end function c9945555.retop(e,tp,eg,ep,ev,re,r,rp) local g=e:GetLabelObject() local tg=g:Filter(c9945555.retfilter,nil,e:GetLabel()) Duel.SendtoDeck(tg,nil,2,REASON_EFFECT) end function c9945555.setfilter(c) return c:IsSetCard(0x12D7) and c:IsType(TYPE_SPELL+TYPE_TRAP) and c:IsSSetable() end function c9945555.settg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_SZONE)>0 and Duel.IsExistingMatchingCard(c9945555.setfilter,tp,LOCATION_DECK,0,1,nil) end end function c9945555.setop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SET) local g=Duel.SelectMatchingCard(tp,c9945555.setfilter,tp,LOCATION_DECK,0,1,1,nil) if g:GetCount()>0 then Duel.SSet(tp,g:GetFirst()) Duel.ConfirmCards(1-tp,g) end end