name: Snow
card_text: When your opponent's monster declares a direct attack, while you control a card(s) in your Spell & Trap Zone: You can Special Summon this card from your hand, then destroy as many cards in your Spell & Trap Zone as possible, and if you do, inflict 200 damage to your opponent for each destroyed card. You cannot Special Summon any monsters, except Machine monsters.
lua: local s, id, o = GetID()
  function s.initial_effect(c)
  	--spsummon
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_SPECIAL_SUMMON + CATEGORY_DESTROY + CATEGORY_DAMAGE)
  	e1:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_O)
  	e1:SetCode(EVENT_ATTACK_ANNOUNCE)
  	e1:SetRange(LOCATION_HAND)
  	e1:SetCondition(s.spcon)
  	e1:SetTarget(s.sptg)
  	e1:SetOperation(s.spop)
  	c:RegisterEffect(e1)
  	--cannot special summon
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_FIELD)
  	e2:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
  	e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetTargetRange(1, 0)
  	e2:SetTarget(s.splimit)
  	c:RegisterEffect(e2)
  end
  function s.splimit(e, c)
  	return c:GetRace() ~= RACE_MACHINE
  end
  function s.cfilter(c)
  	return c:GetSequence() < 5
  end
  function s.spcon(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.GetAttacker():IsControler(1 - tp) and Duel.GetAttackTarget() == nil and Duel.IsExistingMatchingCard(s.cfilter, tp, LOCATION_SZONE, 0, 1, nil)
  end
  function s.filter(c)
  	return c:GetSequence() < 5
  end
  function s.sptg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.GetLocationCount(tp, LOCATION_MZONE) > 0 and e:GetHandler():IsCanBeSpecialSummoned(e, 0, tp, false, false)
  	end
  	local g = Duel.GetMatchingGroup(s.filter, tp, LOCATION_SZONE, 0, nil)
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, e:GetHandler(), 1, 0, 0)
  	Duel.SetOperationInfo(0, CATEGORY_DESTROY, g, g:GetCount(), 0, 0)
  end
  function s.spop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if not c:IsRelateToEffect(e) then
  		return
  	end
  	if Duel.SpecialSummon(c, 0, tp, tp, false, false, POS_FACEUP) > 0 then
  		local g = Duel.GetMatchingGroup(s.filter, tp, LOCATION_SZONE, 0, nil)
  		if g:GetCount() > 0 then
  			Duel.BreakEffect()
  			local ct = Duel.Destroy(g, REASON_EFFECT)
  			Duel.Damage(1 - tp, ct * 200, REASON_EFFECT)
  		end
  	end
  end
  
  
source_text: Snow
  When your opponent's monster declares a direct attack, while you control a card(s) in your Spell & Trap Zone: You can Special Summon this card from your hand, then destroy as many cards in your Spell & Trap Zone as possible, and if you do, inflict 200 damage to your opponent for each destroyed card. You cannot Special Summon any monsters, except Machine monsters.
target_text: -- Snow
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--spsummon
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_SPECIAL_SUMMON + CATEGORY_DESTROY + CATEGORY_DAMAGE)
  	e1:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_O)
  	e1:SetCode(EVENT_ATTACK_ANNOUNCE)
  	e1:SetRange(LOCATION_HAND)
  	e1:SetCondition(s.spcon)
  	e1:SetTarget(s.sptg)
  	e1:SetOperation(s.spop)
  	c:RegisterEffect(e1)
  	--cannot special summon
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_FIELD)
  	e2:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
  	e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetTargetRange(1, 0)
  	e2:SetTarget(s.splimit)
  	c:RegisterEffect(e2)
  end
  function s.splimit(e, c)
  	return c:GetRace() ~= RACE_MACHINE
  end
  function s.cfilter(c)
  	return c:GetSequence() < 5
  end
  function s.spcon(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.GetAttacker():IsControler(1 - tp) and Duel.GetAttackTarget() == nil and Duel.IsExistingMatchingCard(s.cfilter, tp, LOCATION_SZONE, 0, 1, nil)
  end
  function s.filter(c)
  	return c:GetSequence() < 5
  end
  function s.sptg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.GetLocationCount(tp, LOCATION_MZONE) > 0 and e:GetHandler():IsCanBeSpecialSummoned(e, 0, tp, false, false)
  	end
  	local g = Duel.GetMatchingGroup(s.filter, tp, LOCATION_SZONE, 0, nil)
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, e:GetHandler(), 1, 0, 0)
  	Duel.SetOperationInfo(0, CATEGORY_DESTROY, g, g:GetCount(), 0, 0)
  end
  function s.spop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if not c:IsRelateToEffect(e) then
  		return
  	end
  	if Duel.SpecialSummon(c, 0, tp, tp, false, false, POS_FACEUP) > 0 then
  		local g = Duel.GetMatchingGroup(s.filter, tp, LOCATION_SZONE, 0, nil)
  		if g:GetCount() > 0 then
  			Duel.BreakEffect()
  			local ct = Duel.Destroy(g, REASON_EFFECT)
  			Duel.Damage(1 - tp, ct * 200, REASON_EFFECT)
  		end
  	end
  end
  
  