name: Destruction
card_text: Send 3 cards from the top of your Deck to the Graveyard, and take 1000 damage for each Spell or Trap Card sent to the Graveyard this way.
lua: local s, id, o = GetID()
  function s.initial_effect(c)
  	--discard deck
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCategory(CATEGORY_DECKDES + CATEGORY_DAMAGE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  	e1:SetTarget(s.distg)
  	e1:SetOperation(s.disop)
  	c:RegisterEffect(e1)
  end
  function s.distg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsPlayerCanDiscardDeck(tp, 3)
  	end
  	Duel.SetTargetPlayer(tp)
  	Duel.SetTargetParam(3)
  	Duel.SetOperationInfo(0, CATEGORY_DECKDES, nil, 0, tp, 3)
  end
  function s.filter(c)
  	return c:IsLocation(LOCATION_GRAVE) and c:IsType(TYPE_SPELL + TYPE_TRAP)
  end
  function s.disop(e, tp, eg, ep, ev, re, r, rp)
  	local p, val = Duel.GetChainInfo(0, CHAININFO_TARGET_PLAYER, CHAININFO_TARGET_PARAM)
  	Duel.DiscardDeck(p, val, REASON_EFFECT)
  	local g = Duel.GetOperatedGroup()
  	local ct = g:FilterCount(s.filter, nil)
  	if ct > 0 then
  		Duel.Damage(tp, ct * 1000, REASON_EFFECT)
  	end
  end
  
  
source_text: Destruction
  Send 3 cards from the top of your Deck to the Graveyard, and take 1000 damage for each Spell or Trap Card sent to the Graveyard this way.
target_text: -- Destruction
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--discard deck
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCategory(CATEGORY_DECKDES + CATEGORY_DAMAGE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  	e1:SetTarget(s.distg)
  	e1:SetOperation(s.disop)
  	c:RegisterEffect(e1)
  end
  function s.distg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsPlayerCanDiscardDeck(tp, 3)
  	end
  	Duel.SetTargetPlayer(tp)
  	Duel.SetTargetParam(3)
  	Duel.SetOperationInfo(0, CATEGORY_DECKDES, nil, 0, tp, 3)
  end
  function s.filter(c)
  	return c:IsLocation(LOCATION_GRAVE) and c:IsType(TYPE_SPELL + TYPE_TRAP)
  end
  function s.disop(e, tp, eg, ep, ev, re, r, rp)
  	local p, val = Duel.GetChainInfo(0, CHAININFO_TARGET_PLAYER, CHAININFO_TARGET_PARAM)
  	Duel.DiscardDeck(p, val, REASON_EFFECT)
  	local g = Duel.GetOperatedGroup()
  	local ct = g:FilterCount(s.filter, nil)
  	if ct > 0 then
  		Duel.Damage(tp, ct * 1000, REASON_EFFECT)
  	end
  end
  
  