--Evolution-Moonlit Recovery function c249001081.initial_effect(c) --activate local e0=Effect.CreateEffect(c) e0:SetType(EFFECT_TYPE_ACTIVATE) e0:SetCode(EVENT_FREE_CHAIN) c:RegisterEffect(e0) --spsummon local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(76209339,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_QUICK_O) e1:SetCode(EVENT_FREE_CHAIN) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetRange(LOCATION_SZONE) e1:SetCountLimit(1,249001081) e1:SetTarget(c249001081.sptg) e1:SetOperation(c249001081.spop) c:RegisterEffect(e1) local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(19310321,0)) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetCode(EVENT_FREE_CHAIN) e2:SetRange(LOCATION_GRAVE) e2:SetCost(aux.bfgcost) e2:SetTarget(c249001081.target) e2:SetOperation(c249001081.activate) c:RegisterEffect(e2) end function c249001081.filter(c,e,tp) return c:IsSetCard(0xC048) and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP_DEFENSE) end function c249001081.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and c249001081.filter(chkc,e,tp) end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingTarget(c249001081.filter,tp,LOCATION_GRAVE,0,1,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectTarget(tp,c249001081.filter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0) end function c249001081.spop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP_DEFENSE)~=0 then local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_LEAVE_FIELD_REDIRECT) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetReset(RESET_EVENT+RESETS_REDIRECT) e1:SetValue(LOCATION_DECKSHF) tc:RegisterEffect(e1,true) end end function c249001081.filter1(c) return c:IsFaceup() and c:IsType(TYPE_XYZ) end function c249001081.filter2(c) return c:IsSetCard(0xC048) and c:IsCanOverlay() end function c249001081.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return false end if chk==0 then return Duel.IsExistingTarget(c249001081.filter1,tp,LOCATION_MZONE,0,1,nil) and Duel.IsExistingTarget(c249001081.filter2,tp,LOCATION_GRAVE,0,1,e:GetHandler()) end Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(249001081,1)) local g1=Duel.SelectTarget(tp,c249001081.filter1,tp,LOCATION_MZONE,0,1,1,nil) e:SetLabelObject(g1:GetFirst()) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_XMATERIAL) local g2=Duel.SelectTarget(tp,c249001081.filter2,tp,LOCATION_GRAVE,0,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_LEAVE_GRAVE,g2,1,0,0) end function c249001081.activate(e,tp,eg,ep,ev,re,r,rp) local tc=e:GetLabelObject() if tc:IsFacedown() or not tc:IsRelateToEffect(e) or tc:IsImmuneToEffect(e) then return end local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS):Filter(Card.IsRelateToEffect,tc,e) if g:GetCount()>0 then Duel.Overlay(tc,g) end end