--created by LeonDuvall, coded by Lyris --Elysia, Magitate Megacyma local s,id,o=GetID() function s.initial_effect(c) aux.AddDoubleSidedProc(c,SIDE_REVERSE,131792002) aux.AddReverseSideProc(c) local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET) e1:SetRange(LOCATION_MZONE) e1:SetTargetRange(LOCATION_MZONE,0) e1:SetTarget(aux.TargetBoolFunction(Card.IsSetCard,0xd16)) e1:SetValue(s.indval) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EFFECT_INDESTRUCTABLE_EFFECT) c:RegisterEffect(e2) local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_QUICK_O) e3:SetCode(EVENT_FREE_CHAIN) e3:SetRange(LOCATION_MZONE) e3:SetCountLimit(1) e3:SetProperty(EFFECT_FLAG_CARD_TARGET) e3:SetCategory(CATEGORY_DESTROY+CATEGORY_RECOVER) e3:SetTarget(s.target) e3:SetOperation(s.operation) c:RegisterEffect(e3) end function s.indval(e,re,rp) return aux.indoval(e,re,rp) and re:IsActiveType(TYPE_MONSTER) end function s.filter(c) return c:IsSetCard(0x1d16) and c:IsAbleToRemoveAsCost() end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsOnField() and chkc:IsControler(1-tp) and chkc:IsType(TYPE_SPELL+TYPE_TRAP) end if chk==0 then return Duel.IsExistingTarget(Card.IsType,tp,0,LOCATION_ONFIELD,1,nil,TYPE_SPELL+TYPE_TRAP) and Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_GRAVE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) Duel.SetOperationInfo(0,CATEGORY_DESTROY,Duel.SelectTarget(tp,Card.IsType,tp,0,LOCATION_ONFIELD,1,1,nil,TYPE_SPELL+TYPE_TRAP),1,0,0) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) Duel.Remove(Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_GRAVE,0,1,1,nil),POS_FACEUP,REASON_COST) Duel.SetOperationInfo(0,CATEGORY_RECOVER,nil,0,tp,1000) end function s.operation(e,tp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and Duel.Destroy(tc,REASON_EFFECT)>0 then Duel.Recover(tp,1000,REASON_EFFECT) end end