--Automate ID local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_NEGATE+CATEGORY_TOHAND) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_BECOME_TARGET) e1:SetCondition(s.condition) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) --destroy local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_DELAY) e2:SetCode(EVENT_TO_GRAVE) e2:SetCondition(s.descon) e2:SetTarget(s.destg) e2:SetOperation(s.desop) e2:SetCountLimit(1,id) c:RegisterEffect(e2) end function s.filter(c,tp) return c:IsFaceup() and c:IsControler(tp) and c:IsLocation(LOCATION_MZONE) and c:IsSetCard(0x301) end function s.condition(e,tp,eg,ep,ev,re,r,rp) return rp~=tp and eg:IsExists(s.filter,1,nil,tp) and Duel.IsChainNegatable(ev) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_NEGATE,eg,1,0,0) if re:GetHandler():IsRelateToEffect(re) then Duel.SetOperationInfo(0,CATEGORY_TOHAND,eg,1,0,0) end end function s.activate(e,tp,eg,ep,ev,re,r,rp) local ec=re:GetHandler() if Duel.NegateActivation(ev) and re:GetHandler():IsRelateToEffect(re) then ec:CancelToGrave() Duel.SendtoHand(ec,nil,REASON_EFFECT) end end function s.descon(e,tp,eg,ep,ev,re,r,rp) return re and re:GetHandler():IsSetCard(0x301) and not re:GetHandler():IsCode(id) end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():IsSSetable() end Duel.SetOperationInfo(0,CATEGORY_LEAVE_GRAVE,e:GetHandler(),1,0,0) end function s.desop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) and c:IsSSetable() then Duel.SSet(tp,c) Duel.ConfirmCards(1-tp,c) end end