name: Digvorzhak,
card_text: 3 Level 5 monsters
  Once per turn: You can detach 1 material from this card; send the top 3 cards of your opponent's Deck to the GY, then, if any monsters were sent to the GY by this effect, destroy cards your opponent controls, up to the number of monsters sent.
lua: local s, id, o = GetID()
  function s.initial_effect(c)
  	--xyz summon
  	aux.AddXyzProcedure(c, nil, 5, 3)
  	c:EnableReviveLimit()
  	--destroy
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_DESTROY + CATEGORY_DECKDES)
  	e1:SetType(EFFECT_TYPE_IGNITION)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetCountLimit(1)
  	e1:SetCost(s.cost)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.operation)
  	c:RegisterEffect(e1)
  end
  function s.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 s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsPlayerCanDiscardDeck(1 - tp, 3)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_DECKDES, nil, 0, 1 - tp, 3)
  end
  function s.cfilter(c)
  	return c:IsLocation(LOCATION_GRAVE) and c:IsType(TYPE_MONSTER)
  end
  function s.operation(e, tp, eg, ep, ev, re, r, rp)
  	Duel.DiscardDeck(1 - tp, 3, REASON_EFFECT)
  	local g = Duel.GetOperatedGroup()
  	local ct = g:FilterCount(s.cfilter, nil)
  	if ct == 0 then
  		return
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_DESTROY)
  	local dg = Duel.SelectMatchingCard(tp, aux.TRUE, tp, 0, LOCATION_ONFIELD, 1, ct, nil)
  	if dg:GetCount() == 0 then
  		return
  	end
  	Duel.BreakEffect()
  	Duel.HintSelection(dg)
  	Duel.Destroy(dg, REASON_EFFECT)
  end
  
  
source_text: Digvorzhak,
  3 Level 5 monsters
  Once per turn: You can detach 1 material from this card; send the top 3 cards of your opponent's Deck to the GY, then, if any monsters were sent to the GY by this effect, destroy cards your opponent controls, up to the number of monsters sent.
target_text: -- Digvorzhak,
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--xyz summon
  	aux.AddXyzProcedure(c, nil, 5, 3)
  	c:EnableReviveLimit()
  	--destroy
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_DESTROY + CATEGORY_DECKDES)
  	e1:SetType(EFFECT_TYPE_IGNITION)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetCountLimit(1)
  	e1:SetCost(s.cost)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.operation)
  	c:RegisterEffect(e1)
  end
  function s.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 s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsPlayerCanDiscardDeck(1 - tp, 3)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_DECKDES, nil, 0, 1 - tp, 3)
  end
  function s.cfilter(c)
  	return c:IsLocation(LOCATION_GRAVE) and c:IsType(TYPE_MONSTER)
  end
  function s.operation(e, tp, eg, ep, ev, re, r, rp)
  	Duel.DiscardDeck(1 - tp, 3, REASON_EFFECT)
  	local g = Duel.GetOperatedGroup()
  	local ct = g:FilterCount(s.cfilter, nil)
  	if ct == 0 then
  		return
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_DESTROY)
  	local dg = Duel.SelectMatchingCard(tp, aux.TRUE, tp, 0, LOCATION_ONFIELD, 1, ct, nil)
  	if dg:GetCount() == 0 then
  		return
  	end
  	Duel.BreakEffect()
  	Duel.HintSelection(dg)
  	Duel.Destroy(dg, REASON_EFFECT)
  end
  
  