name: Gold
card_text: If your opponent Normal or Special Summons a monster(s): Target 1 of those monsters; reveal 3 "Gold Pride" monsters from your Deck, your opponent randomly picks 1 for you to Special Summon, shuffle the rest into your Deck, then destroy the targeted monster.
external_ids: local SETCARD_ID_0 = 0x192 --Gold
  
lua: local SETCARD_ID_0 = 0x192 --Gold
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_DESTROY + CATEGORY_SPECIAL_SUMMON)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetProperty(EFFECT_FLAG_DELAY + EFFECT_FLAG_CARD_TARGET)
  	e1:SetCode(EVENT_SUMMON_SUCCESS)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.activate)
  	c:RegisterEffect(e1)
  	local e2 = e1:Clone()
  	e2:SetCode(EVENT_SPSUMMON_SUCCESS)
  	c:RegisterEffect(e2)
  end
  function s.dgfilter(c, e, tp)
  	return c:IsSummonPlayer(1 - tp) and c:IsLocation(LOCATION_MZONE) and c:IsCanBeEffectTarget(e)
  end
  function s.spfilter(c, e, tp)
  	return c:IsSetCard(SETCARD_ID_0) and c:IsCanBeSpecialSummoned(e, 0, tp, false, false)
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return eg:IsContains(chkc) and s.dgfilter(chkc, e, tp)
  	end
  	local sg = Duel.GetMatchingGroup(s.spfilter, tp, LOCATION_DECK, 0, nil, e, tp)
  	if chk == 0 then
  		return eg:IsExists(s.dgfilter, 1, nil, e, tp) and #sg >= 3 and Duel.GetLocationCount(tp, LOCATION_MZONE) > 0
  	end
  	local dg = eg
  	if #eg > 1 then
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_DESTROY)
  		dg = eg:FilterSelect(tp, s.dgfilter, 1, 1, nil, e, tp)
  	end
  	Duel.SetTargetCard(dg)
  	Duel.SetOperationInfo(0, CATEGORY_DESTROY, dg, 1, 0, 0)
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, nil, 1, tp, LOCATION_DECK)
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	local g = Duel.GetMatchingGroup(s.spfilter, tp, LOCATION_DECK, 0, nil, e, tp)
  	if #g < 3 or Duel.GetLocationCount(tp, LOCATION_MZONE) <= 0 then
  		return
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_CONFIRM)
  	local sg = g:Select(tp, 3, 3, nil)
  	Duel.ConfirmCards(1 - tp, sg)
  	Duel.ShuffleDeck(tp)
  	local cg = sg:RandomSelect(1 - tp, 1)
  	if Duel.SpecialSummon(cg, 0, tp, tp, false, false, POS_FACEUP) ~= 0 then
  		local tc = Duel.GetFirstTarget()
  		if tc:IsRelateToEffect(e) then
  			Duel.BreakEffect()
  			Duel.Destroy(tc, REASON_EFFECT)
  		end
  	end
  end
  
  
source_text: Gold
  If your opponent Normal or Special Summons a monster(s): Target 1 of those monsters; reveal 3 "Gold Pride" monsters from your Deck, your opponent randomly picks 1 for you to Special Summon, shuffle the rest into your Deck, then destroy the targeted monster.
target_text: -- Gold
  local SETCARD_ID_0 = 0x192 --Gold
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_DESTROY + CATEGORY_SPECIAL_SUMMON)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetProperty(EFFECT_FLAG_DELAY + EFFECT_FLAG_CARD_TARGET)
  	e1:SetCode(EVENT_SUMMON_SUCCESS)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.activate)
  	c:RegisterEffect(e1)
  	local e2 = e1:Clone()
  	e2:SetCode(EVENT_SPSUMMON_SUCCESS)
  	c:RegisterEffect(e2)
  end
  function s.dgfilter(c, e, tp)
  	return c:IsSummonPlayer(1 - tp) and c:IsLocation(LOCATION_MZONE) and c:IsCanBeEffectTarget(e)
  end
  function s.spfilter(c, e, tp)
  	return c:IsSetCard(SETCARD_ID_0) and c:IsCanBeSpecialSummoned(e, 0, tp, false, false)
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return eg:IsContains(chkc) and s.dgfilter(chkc, e, tp)
  	end
  	local sg = Duel.GetMatchingGroup(s.spfilter, tp, LOCATION_DECK, 0, nil, e, tp)
  	if chk == 0 then
  		return eg:IsExists(s.dgfilter, 1, nil, e, tp) and #sg >= 3 and Duel.GetLocationCount(tp, LOCATION_MZONE) > 0
  	end
  	local dg = eg
  	if #eg > 1 then
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_DESTROY)
  		dg = eg:FilterSelect(tp, s.dgfilter, 1, 1, nil, e, tp)
  	end
  	Duel.SetTargetCard(dg)
  	Duel.SetOperationInfo(0, CATEGORY_DESTROY, dg, 1, 0, 0)
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, nil, 1, tp, LOCATION_DECK)
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	local g = Duel.GetMatchingGroup(s.spfilter, tp, LOCATION_DECK, 0, nil, e, tp)
  	if #g < 3 or Duel.GetLocationCount(tp, LOCATION_MZONE) <= 0 then
  		return
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_CONFIRM)
  	local sg = g:Select(tp, 3, 3, nil)
  	Duel.ConfirmCards(1 - tp, sg)
  	Duel.ShuffleDeck(tp)
  	local cg = sg:RandomSelect(1 - tp, 1)
  	if Duel.SpecialSummon(cg, 0, tp, tp, false, false, POS_FACEUP) ~= 0 then
  		local tc = Duel.GetFirstTarget()
  		if tc:IsRelateToEffect(e) then
  			Duel.BreakEffect()
  			Duel.Destroy(tc, REASON_EFFECT)
  		end
  	end
  end
  
  