--Ripper Ennigmaterial --Script by XGlitchy30 local cid,id=GetID() function cid.initial_effect(c) --spsummon (Double Check?) local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_TRIGGER_O+EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_DELAY) e1:SetCode(EVENT_DESTROYED) e1:SetCondition(function(e,tp,eg) return eg:IsExists(Card.IsSetCard,1,nil,0xead) end) e1:SetTarget(cid.tg) e1:SetOperation(cid.op) c:RegisterEffect(e1) --gain eff local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetType(EFFECT_TYPE_TRIGGER_F+EFFECT_TYPE_SINGLE) e2:SetProperty(EFFECT_FLAG_DAMAGE_STEP) e2:SetCode(EVENT_SUMMON_SUCCESS) e2:SetTarget(cid.effecttg) e2:SetOperation(cid.effectop) c:RegisterEffect(e2) local e2x=e2:Clone() e2x:SetCode(EVENT_SPSUMMON_SUCCESS) c:RegisterEffect(e2x) local e2y=e2:Clone() e2y:SetCode(EVENT_FLIP_SUMMON_SUCCESS) c:RegisterEffect(e2x) end function cid.tg(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,false,false) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,0,0) end function cid.op(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) then Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP) end end --filters function cid.filter(c) return c:IsFaceup() and c:IsType(TYPE_XYZ) and c:IsSetCard(0x2ead) end --gain eff function cid.effecttg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetFieldGroupCount(tp,LOCATION_DECK,0)>0 and Duel.IsExistingMatchingCard(cid.filter,tp,LOCATION_MZONE,0,1,nil) end end function cid.effectop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetFieldGroupCount(tp,LOCATION_DECK,0)<=0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP) local g=Duel.SelectMatchingCard(tp,cid.filter,tp,LOCATION_MZONE,0,1,1,nil) if #g>0 then Duel.HintSelection(g) local td=Duel.GetDecktopGroup(tp,1) Duel.DisableShuffleCheck() Duel.Overlay(g:GetFirst(),td) Duel.BreakEffect() if g:GetFirst():IsFaceup() and g:GetFirst():GetOverlayCount()>=6 then --destroy local e2=Effect.CreateEffect(e:GetHandler()) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_DESTROY) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetRange(LOCATION_MZONE) e2:SetCode(EVENT_FREE_CHAIN) e2:SetCountLimit(1) e2:SetCost(cid.cost) e2:SetTarget(cid.target) e2:SetOperation(cid.operation) e2:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END) g:GetFirst():RegisterEffect(e2) end end end --destroy function cid.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():CheckRemoveOverlayCard(tp,1,REASON_COST) end e:GetHandler():RemoveOverlayCard(tp,1,1,REASON_COST) end function cid.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(1-tp) and chkc:IsType(TYPE_MONSTER) end if chk==0 then return 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) end function cid.operation(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.Destroy(tc,REASON_EFFECT) end end