--created by Lyris, coded by Lyris & Discord \ XGlitchy30 --半物質のリッチ local s,id,o=GetID() function s.initial_effect(c) local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_SPSUMMON_PROC) e1:SetProperty(EFFECT_FLAG_UNCOPYABLE) e1:SetRange(LOCATION_HAND) e1:SetCondition(s.spcon) e1:SetOperation(s.spop) c:RegisterEffect(e1) local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1,id) e2:SetCategory(CATEGORY_REMOVE) e2:SetTarget(s.rmtg) e2:SetOperation(s.rmop) c:RegisterEffect(e2) end function s.spfilter(c) return c:IsFaceup() and c:IsSetCard(0xf87) and c:IsAbleToDeckOrExtraAsCost() end function s.spcon(e,c) if c==nil then return true end local tp=c:GetControler() local ft=Duel.GetLocationCount(tp,LOCATION_MZONE) return ft>0 and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_REMOVED,0,1,nil) end function s.spop(e,tp,eg,ep,ev,re,r,rp,c) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_REMOVED,0,1,1,nil) Duel.HintSelection(g) Duel.SendtoDeck(g,nil,SEQ_DECKSHUFFLE,REASON_COST) end function s.cfilter(c) return c:IsFaceup() and c:IsType(TYPE_SPATIAL) and c:IsAbleToRemove() end function s.filter(c) return c:IsType(TYPE_SPELL+TYPE_TRAP) and c:IsAbleToRemove() end function s.rmtg(e,tp,eg,ep,ev,re,r,rp,chk) local sg=Duel.GetMatchingGroup(s.cfilter,tp,LOCATION_MZONE,0,nil) local og=Duel.GetMatchingGroup(s.filter,tp,0,LOCATION_ONFIELD,nil) if chk==0 then return #sg>0 and #og>0 end Duel.SetOperationInfo(0,CATEGORY_REMOVE,sg+og,2,0,0) end function s.rmop(e,tp,eg,ep,ev,re,r,rp) local sg=Duel.GetMatchingGroup(s.cfilter,tp,LOCATION_MZONE,0,nil) local og=Duel.GetMatchingGroup(s.filter,tp,0,LOCATION_ONFIELD,nil) if #sg==0 or #og==0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=sg:Select(tp,1,1,nil) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) g:Merge(og:Select(tp,1,1,nil)) Duel.HintSelection(g) Duel.Remove(g,POS_FACEUP,REASON_EFFECT) end