--Ryujin local cid,id=GetID() function cid.initial_effect(c) --spirit return aux.EnableSpiritReturn(c,EVENT_SUMMON_SUCCESS,EVENT_SPSUMMON_SUCCESS,EVENT_FLIP_SUMMON_SUCCESS,EVENT_FLIP) --cannot special summon local e1=Effect.CreateEffect(c) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_SPSUMMON_CONDITION) e1:SetValue(aux.FALSE) c:RegisterEffect(e1) --search local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_DELAY) e2:SetCode(EVENT_SUMMON_SUCCESS) e2:SetTarget(cid.target) e2:SetOperation(cid.activate) c:RegisterEffect(e2) local e3=e2:Clone() e3:SetCode(EVENT_SPSUMMON_SUCCESS) e3:SetCondition(cid.rmcon) c:RegisterEffect(e3) --battle indestructable local e4=Effect.CreateEffect(c) e4:SetType(EFFECT_TYPE_SINGLE) e4:SetCode(EFFECT_INDESTRUCTABLE_BATTLE) e4:SetValue(1) c:RegisterEffect(e4) --Intercept local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(19665973,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_ATTACK_ANNOUNCE) e1:SetRange(LOCATION_HAND) e1:SetCondition(cid.thcon) e1:SetTarget(cid.thtg) e1:SetOperation(cid.thop) c:RegisterEffect(e1) end function cid.rmcon(e,tp,eg,ep,ev,re,r,rp) return re and re:IsActiveType(TYPE_MONSTER) and re:GetHandler()==e:GetHandler() end function cid.filter(c) return (c:IsType(TYPE_SPIRIT) or c:GetType()==0x82) and c:IsAbleToHand() end function cid.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(cid.filter,tp,LOCATION_DECK,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) end function cid.activate(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectMatchingCard(tp,cid.filter,tp,LOCATION_DECK,0,1,1,nil) if g:GetCount()>0 then Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,g) end end function cid.thcon(e,tp,eg,ep,ev,re,r,rp) local at=Duel.GetAttacker() return at:GetControler()~=tp and Duel.GetAttackTarget()==nil end function cid.thtg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and c:IsCanBeSpecialSummoned(e,0,tp,true,false) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,0,0) end function cid.thop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) then Duel.SpecialSummon(c,0,tp,tp,true,false,POS_FACEUP) end end