--Dolphin --Automate ID local scard,s_id=GetID() function scard.initial_effect(c) Card.IsMantra=Card.IsMantra or (function(tc) return tc:IsSetCard(0x7d0) or (tc:GetCode()>30200 and tc:GetCode()<30230) end) --Search local e1=Effect.CreateEffect(c) e1:Desc(0) e1:SetCategory(CATEGORIES_SEARCH) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_TO_GRAVE) e1:SetProperty(EFFECT_FLAG_DDD) e1:SetCondition(scard.dcon) e1:SetTarget(scard.target) e1:SetOperation(scard.operation) e1:SetCountLimit(1,s_id) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetProperty(EFFECT_FLAG_DELAY) e2:SetCode(EVENT_DESTROYED) e2:SetCondition(scard.d2con) c:RegisterEffect(e2) end function scard.dcon(e,tp,eg,ep,ev,re,r,rp) if not re then return false end local c=e:GetHandler() return re:IsActiveType(TYPE_MONSTER) and c:IsReason(REASON_EFFECT|REASON_COST) and c:GetPreviousLocation()&LOCATION_DECK==0 end function scard.d2con(e,tp,eg,ep,ev,re,r,rp) return r&(REASON_EFFECT+REASON_BATTLE)~=0 end function scard.filter(c) return c:IsMantra() and c:IsAbleToHand() and not c:IsCode(s_id) end function scard.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(scard.filter,tp,LOCATION_DECK,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) end function scard.operation(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectMatchingCard(tp,scard.filter,tp,LOCATION_DECK,0,1,1,nil) if #g>0 then Duel.Search(g,tp) end end