name: A
card_text: When an opponent's monster declares an attack: Your opponent chooses 1 random card from your hand, then if it is a monster that can be Special Summoned, Special Summon it. Otherwise, send it to the GY.
lua: local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_ATTACK_ANNOUNCE)
  	e1:SetCondition(s.condition)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.activate)
  	c:RegisterEffect(e1)
  end
  function s.condition(e, tp, eg, ep, ev, re, r, rp)
  	return tp ~= Duel.GetTurnPlayer()
  end
  function s.spfilter(c, e, tp)
  	return c:IsCanBeSpecialSummoned(e, 0, tp, false, false)
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.GetLocationCount(tp, LOCATION_MZONE) > 0 and Duel.IsExistingMatchingCard(s.spfilter, tp, LOCATION_HAND, 0, 1, nil, e, tp)
  	end
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	if Duel.GetLocationCount(tp, LOCATION_MZONE) <= 0 or not Duel.IsPlayerCanSpecialSummon(tp) then
  		return
  	end
  	local g = Duel.GetFieldGroup(tp, LOCATION_HAND, 0)
  	local sg = g:RandomSelect(1 - tp, 1)
  	local tc = sg:GetFirst()
  	if tc then
  		Duel.ConfirmCards(1 - tp, tc)
  		if tc:IsCanBeSpecialSummoned(e, 0, tp, false, false) then
  			Duel.SpecialSummon(tc, 0, tp, tp, false, false, POS_FACEUP)
  		else
  			Duel.SendtoGrave(tc, REASON_EFFECT)
  		end
  	end
  end
  
  
source_text: A
  When an opponent's monster declares an attack: Your opponent chooses 1 random card from your hand, then if it is a monster that can be Special Summoned, Special Summon it. Otherwise, send it to the GY.
target_text: -- A
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_ATTACK_ANNOUNCE)
  	e1:SetCondition(s.condition)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.activate)
  	c:RegisterEffect(e1)
  end
  function s.condition(e, tp, eg, ep, ev, re, r, rp)
  	return tp ~= Duel.GetTurnPlayer()
  end
  function s.spfilter(c, e, tp)
  	return c:IsCanBeSpecialSummoned(e, 0, tp, false, false)
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.GetLocationCount(tp, LOCATION_MZONE) > 0 and Duel.IsExistingMatchingCard(s.spfilter, tp, LOCATION_HAND, 0, 1, nil, e, tp)
  	end
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	if Duel.GetLocationCount(tp, LOCATION_MZONE) <= 0 or not Duel.IsPlayerCanSpecialSummon(tp) then
  		return
  	end
  	local g = Duel.GetFieldGroup(tp, LOCATION_HAND, 0)
  	local sg = g:RandomSelect(1 - tp, 1)
  	local tc = sg:GetFirst()
  	if tc then
  		Duel.ConfirmCards(1 - tp, tc)
  		if tc:IsCanBeSpecialSummoned(e, 0, tp, false, false) then
  			Duel.SpecialSummon(tc, 0, tp, tp, false, false, POS_FACEUP)
  		else
  			Duel.SendtoGrave(tc, REASON_EFFECT)
  		end
  	end
  end
  
  