--Goldvale Moondancer local m=88015 local cm=_G["c"..m] function cm.initial_effect(c) c:SetSPSummonOnce(m) aux.AddLinkProcedure(c,aux.FilterBoolFunction(Card.IsLinkSetCard,0xff9),2,2) c:EnableReviveLimit() local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(44509529,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_QUICK_O) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCode(EVENT_FREE_CHAIN) e1:SetRange(LOCATION_MZONE) e1:SetCondition(cm.spcon) e1:SetHintTiming(0,TIMING_BATTLE_START+TIMING_END_PHASE) e1:SetCost(cm.spcost) e1:SetTarget(cm.sptg) e1:SetOperation(cm.spop) c:RegisterEffect(e1) local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetCode(EFFECT_INDESTRUCTABLE_EFFECT) e2:SetProperty(EFFECT_FLAG_SET_AVAILABLE) e2:SetRange(LOCATION_MZONE) e2:SetTargetRange(LOCATION_MZONE,LOCATION_MZONE) e2:SetTarget(cm.indtg) e2:SetValue(1) c:RegisterEffect(e2) local e3=e2:Clone() e3:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET) c:RegisterEffect(e3) local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(8802510,0)) e4:SetCategory(CATEGORY_SEARCH+CATEGORY_TOHAND) e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e4:SetProperty(EFFECT_FLAG_DELAY) e4:SetRange(LOCATION_MZONE) e4:SetCode(EVENT_REMOVE) e4:SetCountLimit(1) e4:SetCondition(cm.regcon) e4:SetTarget(cm.regtg) e4:SetOperation(cm.regop) c:RegisterEffect(e4) end function cm.spcon(e,tp,eg,ep,ev,re,r,rp) return Duel.IsExistingMatchingCard(cm.cfilter,tp,LOCATION_REMOVED,0,2,nil) end function cm.indtg(e,c) return e:GetHandler():GetLinkedGroup():IsContains(c) end function cm.spcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():IsAbleToExtraAsCost() end Duel.SendtoDeck(e:GetHandler(),nil,0,REASON_COST) end function cm.spfilter(c,e,tp) return c:IsSetCard(0xff9) and c:IsCanBeEffectTarget(e) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function cm.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return false end local g=Duel.GetMatchingGroup(cm.spfilter,tp,LOCATION_REMOVED,2,nil,e,tp) if chk==0 then return Duel.GetMZoneCount(tp,e:GetHandler())>1 and not Duel.IsPlayerAffectedByEffect(tp,59822133) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g1=g:Select(tp,1,1,nil) g:Remove(Card.IsCode,nil,g1:GetFirst():GetCode()) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g2=g:Select(tp,1,1,nil) g1:Merge(g2) Duel.SetTargetCard(g1) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g1,2,0,0) end function cm.spop(e,tp,eg,ep,ev,re,r,rp) local ft=Duel.GetLocationCount(tp,LOCATION_MZONE) local tg=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS) local g=tg:Filter(Card.IsRelateToEffect,nil,e) if g:GetCount()==0 or ft<=0 or (g:GetCount()>1 and Duel.IsPlayerAffectedByEffect(tp,59822133)) then return end if ft0 then Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,g) end end