--TEST 1 local cid,id=GetID() function cid.initial_effect(c) c:SetUniqueOnField(1,0,id) c:EnableReviveLimit() aux.AddFusionProcFunRep(c,aux.FilterBoolFunction(Card.IsSetCard,0xc97),2,true) --Send to GY local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_TOGRAVE) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetCountLimit(1,id) e1:SetTarget(cid.target) e1:SetOperation(cid.gydump) c:RegisterEffect(e1) --copy local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e2:SetCode(EVENT_ADJUST) e2:SetRange(LOCATION_MZONE) e2:SetOperation(cid.operation) c:RegisterEffect(e2) --if destroyed local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,0)) e3:SetCategory(CATEGORY_DAMAGE) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e3:SetCode(EVENT_LEAVE_FIELD) e3:SetCountLimit(1,id+1000) e3:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY) e3:SetCondition(cid.spcon) e3:SetTarget(cid.sptg) e3:SetOperation(cid.spop) c:RegisterEffect(e3) end function cid.tgfilter(c) return c:IsType(TYPE_FUSION) and c:IsAbleToGrave() end function cid.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(cid.tgfilter,tp,LOCATION_EXTRA,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,tp,LOCATION_EXTRA) end function cid.gydump(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectMatchingCard(tp,cid.tgfilter,tp,LOCATION_EXTRA,0,1,1,nil) if g:GetCount()>0 then Duel.SendtoGrave(g,REASON_EFFECT) end end function cid.effilter(c) return c:IsType(TYPE_FUSION) end function cid.operation(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local wg=Duel.GetMatchingGroup(cid.effilter,c:GetControler(),LOCATION_GRAVE,LOCATION_GRAVE,nil) local wbc=wg:GetFirst() while wbc do local code=wbc:GetOriginalCode() if c:IsFaceup() and c:GetFlagEffect(code)==0 then c:CopyEffect(code,RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END,1) c:RegisterFlagEffect(code,RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END,0,1) end wbc=wg:GetNext() end end function cid.spcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return (c:IsReason(REASON_BATTLE) or (c:GetReasonPlayer()==1-tp and c:IsReason(REASON_EFFECT))) and c:IsPreviousPosition(POS_FACEUP) end function cid.cafilter(c) return c:IsSetCard(0x3c97) and c:IsType(TYPE_MONSTER) and c:IsAbleToHand() end function cid.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(cid.cafilter,tp,LOCATION_DECK,0,2,nil) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,2,tp,LOCATION_DECK) end function cid.spop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectMatchingCard(tp,cid.cafilter,tp,LOCATION_DECK,0,2,2,nil) if g:GetCount()>0 then Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.ConfirmCards(2-tp,g) end end