--妖精竜 エンシェント local cid,id=GetID() function cid.initial_effect(c) --synchro summon aux.AddSynchroProcedure(c,aux.FilterBoolFunction(Card.IsSetCard,0xcd01),aux.NonTuner(nil),1) c:EnableReviveLimit() --change name local e0=Effect.CreateEffect(c) e0:SetType(EFFECT_TYPE_SINGLE) e0:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e0:SetCode(EFFECT_ADD_CODE) e0:SetRange(LOCATION_MZONE+LOCATION_GRAVE) e0:SetValue(25862681) c:RegisterEffect(e0) --setchain local de0=Effect.CreateEffect(c) de0:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) de0:SetCode(EVENT_CHAINING) de0:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) de0:SetRange(LOCATION_MZONE) de0:SetOperation(cid.chop1) c:RegisterEffect(de0) local de2=Effect.CreateEffect(c) de2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) de2:SetCode(EVENT_CHAIN_SOLVED) de2:SetRange(LOCATION_MZONE) de2:SetOperation(cid.chop2) c:RegisterEffect(de2) --spsummon local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_CHAIN_END) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1,id) e1:SetCondition(cid.spcon) e1:SetTarget(cid.sptg) e1:SetOperation(cid.spop) c:RegisterEffect(e1) de0:SetLabelObject(e1) de2:SetLabelObject(e1) --destroy local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_DESTROY+CATEGORY_DRAW) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetRange(LOCATION_MZONE) e2:SetCondition(cid.condition) e2:SetTarget(cid.drawtg) e2:SetOperation(cid.drawop) e2:SetCountLimit(1,id+100) c:RegisterEffect(e2) end --SETCHAIN function cid.chop1(e,tp,eg,ep,ev,re,r,rp) e:GetLabelObject():SetLabel(0) end function cid.chop2(e,tp,eg,ep,ev,re,r,rp) if rp==1-tp or not re:IsHasType(EFFECT_TYPE_ACTIVATE) or not re:IsActiveType(TYPE_SPELL) or not re:IsActiveType(TYPE_FIELD) then return end e:GetLabelObject():SetLabel(1) end --SPSUMMON function cid.spcon(e,tp,eg,ep,ev,re,r,rp) return e:GetLabel()==1 end function cid.spfilter(c,e,tp) return c:IsSetCard(0xcd01) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function cid.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(cid.spfilter,tp,LOCATION_DECK,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK) end function cid.spop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)>0 then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,cid.spfilter,tp,LOCATION_DECK,0,1,1,nil,e,tp) if g:GetFirst() and Duel.SpecialSummonStep(g:GetFirst(),0,tp,tp,false,false,POS_FACEUP) then local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_LEAVE_FIELD_REDIRECT) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetReset(RESET_EVENT+RESETS_REDIRECT) e1:SetValue(LOCATION_REMOVED) g:GetFirst():RegisterEffect(e1,true) end Duel.SpecialSummonComplete() end end --DESTROY function cid.condition(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsPosition(POS_FACEUP_DEFENSE) end function cid.drawtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(1-tp) end if chk==0 then return Duel.IsPlayerCanDraw(tp,1) and Duel.IsExistingTarget(aux.TRUE,tp,0,LOCATION_MZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectTarget(tp,aux.TRUE,tp,0,LOCATION_MZONE,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0) Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1) end function cid.drawop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and Duel.Destroy(tc,REASON_EFFECT)>0 then Duel.Draw(tp,1,REASON_EFFECT) end end