name: Shield
card_text: When this card is Summoned, it is changed to Defense Position. Then, send 1 card from the top of your opponent's Deck to the Graveyard for each face-up Insect-Type monster you control.
lua: local s, id, o = GetID()
  function s.initial_effect(c)
  	--deckdes
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_POSITION + CATEGORY_DECKDES)
  	e1:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_F)
  	e1:SetCode(EVENT_SUMMON_SUCCESS)
  	e1:SetCondition(s.condition)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.operation)
  	c:RegisterEffect(e1)
  	local e2 = e1:Clone()
  	e2:SetCode(EVENT_FLIP_SUMMON_SUCCESS)
  	c:RegisterEffect(e2)
  	local e3 = e1:Clone()
  	e3:SetCode(EVENT_SPSUMMON_SUCCESS)
  	c:RegisterEffect(e3)
  end
  function s.condition(e, tp, eg, ep, ev, re, r, rp)
  	return e:GetHandler():IsPosition(POS_FACEUP_ATTACK)
  end
  function s.filter(c)
  	return c:IsFaceup() and c:IsRace(RACE_INSECT)
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return true
  	end
  	local ct = Duel.GetMatchingGroupCount(s.filter, tp, LOCATION_MZONE, 0, nil)
  	Duel.SetOperationInfo(0, CATEGORY_DECKDES, nil, 0, 1 - tp, ct)
  end
  function s.operation(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if c:IsRelateToEffect(e) and c:IsPosition(POS_FACEUP_ATTACK) and Duel.ChangePosition(c, POS_FACEUP_DEFENSE) ~= 0 then
  		local ct = Duel.GetMatchingGroupCount(s.filter, tp, LOCATION_MZONE, 0, nil)
  		if ct > 0 then
  			Duel.BreakEffect()
  			Duel.DiscardDeck(1 - tp, ct, REASON_EFFECT)
  		end
  	end
  end
  
  
source_text: Shield
  When this card is Summoned, it is changed to Defense Position. Then, send 1 card from the top of your opponent's Deck to the Graveyard for each face-up Insect-Type monster you control.
target_text: -- Shield
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--deckdes
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_POSITION + CATEGORY_DECKDES)
  	e1:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_F)
  	e1:SetCode(EVENT_SUMMON_SUCCESS)
  	e1:SetCondition(s.condition)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.operation)
  	c:RegisterEffect(e1)
  	local e2 = e1:Clone()
  	e2:SetCode(EVENT_FLIP_SUMMON_SUCCESS)
  	c:RegisterEffect(e2)
  	local e3 = e1:Clone()
  	e3:SetCode(EVENT_SPSUMMON_SUCCESS)
  	c:RegisterEffect(e3)
  end
  function s.condition(e, tp, eg, ep, ev, re, r, rp)
  	return e:GetHandler():IsPosition(POS_FACEUP_ATTACK)
  end
  function s.filter(c)
  	return c:IsFaceup() and c:IsRace(RACE_INSECT)
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return true
  	end
  	local ct = Duel.GetMatchingGroupCount(s.filter, tp, LOCATION_MZONE, 0, nil)
  	Duel.SetOperationInfo(0, CATEGORY_DECKDES, nil, 0, 1 - tp, ct)
  end
  function s.operation(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if c:IsRelateToEffect(e) and c:IsPosition(POS_FACEUP_ATTACK) and Duel.ChangePosition(c, POS_FACEUP_DEFENSE) ~= 0 then
  		local ct = Duel.GetMatchingGroupCount(s.filter, tp, LOCATION_MZONE, 0, nil)
  		if ct > 0 then
  			Duel.BreakEffect()
  			Duel.DiscardDeck(1 - tp, ct, REASON_EFFECT)
  		end
  	end
  end
  
  