--Mantra Dog --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) --ToHand local e1=Effect.CreateEffect(c) e1:Desc(0) e1:SetCategory(CATEGORY_TOHAND) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_GRAVE) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCost(scard.thcost) e1:SetTarget(scard.thtg) e1:SetOperation(scard.thop) e1:SetCountLimit(1,s_id) c:RegisterEffect(e1) end function scard.thcost(e,tp,eg,ep,ev,re,r,rp,chk) e:SetLabel(1) if chk==0 then return e:GetHandler():IsAbleToRemoveAsCost() end Duel.Remove(e:GetHandler(),POS_FACEUP,REASON_COST) end function scard.thfilter(c) return c:IsMantra() and c:IsAbleToHand() end function scard.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and scard.thfilter(chkc) end if chk==0 then local exc if e:GetLabel()==1 then exc=e:GetHandler() end e:SetLabel(0) return Duel.IsExistingTarget(scard.thfilter,tp,LOCATION_GRAVE,0,1,exc) end e:SetLabel(0) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectTarget(tp,scard.thfilter,tp,LOCATION_GRAVE,0,1,1,nil) Duel.SetCardOperationInfo(g,CATEGORY_TOHAND) end function scard.thop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc and tc:IsRelateToChain() then Duel.Search(tc,tp) end end