--Nightmarch Ennigmaterial --Script by XGlitchy30 local cid,id=GetID() function cid.initial_effect(c) --stop attack local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DRAW) e1:SetType(EFFECT_TYPE_QUICK_O) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetRange(LOCATION_HAND) e1:SetCode(EVENT_BE_BATTLE_TARGET) e1:SetCondition(cid.stopcon) e1:SetCost(cid.stopcost) e1:SetTarget(cid.stoptg) e1:SetOperation(cid.stopop) c:RegisterEffect(e1) --disable local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_DISABLE+CATEGORY_DESTROY) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetCode(EVENT_BECOME_TARGET) e2:SetRange(LOCATION_GRAVE) e2:SetCountLimit(1,id) e2:SetCondition(cid.discon) e2:SetCost(aux.bfgcost) e2:SetTarget(cid.distg) e2:SetOperation(cid.disop) c:RegisterEffect(e2) end --filters function cid.disfilter(c) return c:IsFaceup() and c:IsSetCard(0xead) end --stop attack function cid.stopcon(e,tp,eg,ep,ev,re,r,rp) local d=Duel.GetAttackTarget() return d:IsFaceup() and d:IsSetCard(0xead) and d:IsType(TYPE_MONSTER) and not e:GetHandler():IsStatus(STATUS_CHAINING) end function cid.stopcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():IsDiscardable() end Duel.SendtoGrave(e:GetHandler(),REASON_COST+REASON_DISCARD) end function cid.stoptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) local tg=Duel.GetAttacker() if chkc then return chkc==tg end if chk==0 then return tg:IsOnField() and tg:IsCanBeEffectTarget(e) and Duel.IsPlayerCanDraw(tp,1) end Duel.SetTargetCard(tg) Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1) end function cid.stopop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if not tc:IsRelateToEffect(e) then return end Duel.NegateAttack() Duel.BreakEffect() Duel.Draw(tp,1,REASON_EFFECT) end --disable function cid.discon(e,tp,eg,ep,ev,re,r,rp) return re and eg:IsExists(cid.disfilter,1,nil) and Duel.IsChainDisablable(ev) end function cid.distg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_DISABLE,eg,1,0,0) if re:GetHandler():IsDestructable() and re:GetHandler():IsRelateToEffect(re) then Duel.SetOperationInfo(0,CATEGORY_DESTROY,re:GetHandler(),1,0,0) end end function cid.disop(e,tp,eg,ep,ev,re,r,rp) if Duel.NegateEffect(ev) and re:GetHandler():IsRelateToEffect(re) then Duel.Destroy(re:GetHandler(),REASON_EFFECT) end end