name: Danger!
card_text: You can reveal this card in your hand; your opponent randomly chooses 1 card from your entire hand, then you discard the chosen card. Then, if the discarded card was not "Danger! Mothman!", Special Summon 1 "Danger! Mothman!" from your hand, and if you do, draw 1 card. If this card is discarded: You can have both players draw 1 card, then both players discard 1 card. You can only use this effect of "Danger! Mothman!" once per turn.
lua: local s, id, o = GetID()
  function s.initial_effect(c)
  	--special summon
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_SPECIAL_SUMMON + CATEGORY_HANDES + CATEGORY_DRAW)
  	e1:SetType(EFFECT_TYPE_IGNITION)
  	e1:SetRange(LOCATION_HAND)
  	e1:SetCost(s.spcost)
  	e1:SetTarget(s.sptg)
  	e1:SetOperation(s.spop)
  	c:RegisterEffect(e1)
  	--draw and discard
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 1))
  	e2:SetCategory(CATEGORY_HANDES + CATEGORY_DRAW)
  	e2:SetProperty(EFFECT_FLAG_DELAY + EFFECT_FLAG_DAMAGE_STEP)
  	e2:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e2:SetCode(EVENT_DISCARD)
  	e2:SetCountLimit(1, id)
  	e2:SetTarget(s.drtg)
  	e2:SetOperation(s.drop)
  	c:RegisterEffect(e2)
  end
  function s.spcost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return not e:GetHandler():IsPublic()
  	end
  end
  function s.spfilter(c, e, tp)
  	return c:IsCode(id) and c:IsCanBeSpecialSummoned(e, 0, tp, false, false)
  end
  function s.sptg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(Card.IsDiscardable, tp, LOCATION_HAND, 0, 1, nil, REASON_EFFECT)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_HANDES, nil, 0, tp, 1)
  end
  function s.spop(e, tp, eg, ep, ev, re, r, rp)
  	local g = Duel.GetFieldGroup(tp, LOCATION_HAND, 0)
  	if #g < 1 then
  		return
  	end
  	local tc = g:RandomSelect(1 - tp, 1):GetFirst()
  	if tc and Duel.SendtoGrave(tc, REASON_DISCARD + REASON_EFFECT) ~= 0 and not tc:IsCode(id) and Duel.GetLocationCount(tp, LOCATION_MZONE) > 0 then
  		local spg = Duel.GetMatchingGroup(s.spfilter, tp, LOCATION_HAND, 0, nil, e, tp)
  		if spg:GetCount() <= 0 then
  			return
  		end
  		local sg = spg
  		if spg:GetCount() ~= 1 then
  			Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
  			sg = spg:Select(tp, 1, 1, nil)
  		end
  		Duel.BreakEffect()
  		if Duel.SpecialSummon(sg, 0, tp, tp, false, false, POS_FACEUP) ~= 0 then
  			Duel.Draw(tp, 1, REASON_EFFECT)
  		end
  	end
  end
  function s.drtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsPlayerCanDraw(tp, 1) and Duel.IsPlayerCanDraw(1 - tp, 1)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_HANDES, nil, 0, PLAYER_ALL, 1)
  	Duel.SetOperationInfo(0, CATEGORY_DRAW, nil, 0, PLAYER_ALL, 1)
  end
  function s.drop(e, tp, eg, ep, ev, re, r, rp)
  	local h1 = Duel.Draw(tp, 1, REASON_EFFECT)
  	local h2 = Duel.Draw(1 - tp, 1, REASON_EFFECT)
  	if h1 > 0 or h2 > 0 then
  		Duel.BreakEffect()
  	end
  	if h1 > 0 then
  		Duel.ShuffleHand(tp)
  		Duel.DiscardHand(tp, aux.TRUE, 1, 1, REASON_EFFECT + REASON_DISCARD)
  	end
  	if h2 > 0 then
  		Duel.ShuffleHand(1 - tp)
  		Duel.DiscardHand(1 - tp, aux.TRUE, 1, 1, REASON_EFFECT + REASON_DISCARD)
  	end
  end
  
  
source_text: Danger!
  You can reveal this card in your hand; your opponent randomly chooses 1 card from your entire hand, then you discard the chosen card. Then, if the discarded card was not "Danger! Mothman!", Special Summon 1 "Danger! Mothman!" from your hand, and if you do, draw 1 card. If this card is discarded: You can have both players draw 1 card, then both players discard 1 card. You can only use this effect of "Danger! Mothman!" once per turn.
target_text: -- Danger!
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--special summon
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_SPECIAL_SUMMON + CATEGORY_HANDES + CATEGORY_DRAW)
  	e1:SetType(EFFECT_TYPE_IGNITION)
  	e1:SetRange(LOCATION_HAND)
  	e1:SetCost(s.spcost)
  	e1:SetTarget(s.sptg)
  	e1:SetOperation(s.spop)
  	c:RegisterEffect(e1)
  	--draw and discard
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 1))
  	e2:SetCategory(CATEGORY_HANDES + CATEGORY_DRAW)
  	e2:SetProperty(EFFECT_FLAG_DELAY + EFFECT_FLAG_DAMAGE_STEP)
  	e2:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e2:SetCode(EVENT_DISCARD)
  	e2:SetCountLimit(1, id)
  	e2:SetTarget(s.drtg)
  	e2:SetOperation(s.drop)
  	c:RegisterEffect(e2)
  end
  function s.spcost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return not e:GetHandler():IsPublic()
  	end
  end
  function s.spfilter(c, e, tp)
  	return c:IsCode(id) and c:IsCanBeSpecialSummoned(e, 0, tp, false, false)
  end
  function s.sptg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(Card.IsDiscardable, tp, LOCATION_HAND, 0, 1, nil, REASON_EFFECT)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_HANDES, nil, 0, tp, 1)
  end
  function s.spop(e, tp, eg, ep, ev, re, r, rp)
  	local g = Duel.GetFieldGroup(tp, LOCATION_HAND, 0)
  	if #g < 1 then
  		return
  	end
  	local tc = g:RandomSelect(1 - tp, 1):GetFirst()
  	if tc and Duel.SendtoGrave(tc, REASON_DISCARD + REASON_EFFECT) ~= 0 and not tc:IsCode(id) and Duel.GetLocationCount(tp, LOCATION_MZONE) > 0 then
  		local spg = Duel.GetMatchingGroup(s.spfilter, tp, LOCATION_HAND, 0, nil, e, tp)
  		if spg:GetCount() <= 0 then
  			return
  		end
  		local sg = spg
  		if spg:GetCount() ~= 1 then
  			Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
  			sg = spg:Select(tp, 1, 1, nil)
  		end
  		Duel.BreakEffect()
  		if Duel.SpecialSummon(sg, 0, tp, tp, false, false, POS_FACEUP) ~= 0 then
  			Duel.Draw(tp, 1, REASON_EFFECT)
  		end
  	end
  end
  function s.drtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsPlayerCanDraw(tp, 1) and Duel.IsPlayerCanDraw(1 - tp, 1)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_HANDES, nil, 0, PLAYER_ALL, 1)
  	Duel.SetOperationInfo(0, CATEGORY_DRAW, nil, 0, PLAYER_ALL, 1)
  end
  function s.drop(e, tp, eg, ep, ev, re, r, rp)
  	local h1 = Duel.Draw(tp, 1, REASON_EFFECT)
  	local h2 = Duel.Draw(1 - tp, 1, REASON_EFFECT)
  	if h1 > 0 or h2 > 0 then
  		Duel.BreakEffect()
  	end
  	if h1 > 0 then
  		Duel.ShuffleHand(tp)
  		Duel.DiscardHand(tp, aux.TRUE, 1, 1, REASON_EFFECT + REASON_DISCARD)
  	end
  	if h2 > 0 then
  		Duel.ShuffleHand(1 - tp)
  		Duel.DiscardHand(1 - tp, aux.TRUE, 1, 1, REASON_EFFECT + REASON_DISCARD)
  	end
  end
  
  