name: Utopic
card_text: (This card is always treated as a "Zubaba", "Gagaga", "Gogogo", and "Dododo" card.)
  During your Main Phase: You can Special Summon up to 1 each "Zubaba", "Gagaga", "Gogogo", and/or "Dododo" monster(s) from your hand in Defense Position, except "Utopic Onomatopoeia", also you cannot Special Summon from the Extra Deck for the rest of this turn, except Xyz Monsters. You can only use this effect of "Utopic Onomatopoeia" once per turn.
external_ids: local CARD_ID_0 = 59822133 --Blue-Eyes Spirit Dragon
  local SETCARD_ID_0 = 0x54 --Gagaga
  
lua: local CARD_ID_0 = 59822133 --Blue-Eyes Spirit Dragon
  local SETCARD_ID_0 = 0x54 --Gagaga
  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)
  	e1:SetType(EFFECT_TYPE_IGNITION)
  	e1:SetCountLimit(1, id)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetTarget(s.sptg)
  	e1:SetOperation(s.spop)
  	c:RegisterEffect(e1)
  end
  s.combination2 = {}
  s.combination2[1] = aux.CreateChecks(Card.IsSetCard, { 0x54, 0x59 })
  s.combination2[2] = aux.CreateChecks(Card.IsSetCard, { 0x54, 0x82 })
  s.combination2[3] = aux.CreateChecks(Card.IsSetCard, { 0x54, 0x8f })
  s.combination2[4] = aux.CreateChecks(Card.IsSetCard, { 0x59, 0x82 })
  s.combination2[5] = aux.CreateChecks(Card.IsSetCard, { 0x59, 0x8f })
  s.combination2[6] = aux.CreateChecks(Card.IsSetCard, { 0x82, 0x8f })
  s.combination3 = {}
  s.combination3[1] = aux.CreateChecks(Card.IsSetCard, { 0x59, 0x82, 0x8f })
  s.combination3[2] = aux.CreateChecks(Card.IsSetCard, { 0x54, 0x82, 0x8f })
  s.combination3[3] = aux.CreateChecks(Card.IsSetCard, { 0x54, 0x59, 0x8f })
  s.combination3[4] = aux.CreateChecks(Card.IsSetCard, { 0x54, 0x59, 0x82 })
  s.combination4 = aux.CreateChecks(Card.IsSetCard, { 0x54, 0x59, 0x82, 0x8f })
  function s.spfilter(c, e, tp)
  	return c:IsSetCard(SETCARD_ID_0, 0x59, 0x82, 0x8f) and not 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.GetLocationCount(tp, LOCATION_MZONE) > 0 and Duel.IsExistingMatchingCard(s.spfilter, tp, LOCATION_HAND, 0, 1, nil, e, tp)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, nil, 1, tp, LOCATION_HAND)
  end
  function s.gcheck(g)
  	if #g == 1 then
  		return true
  	elseif #g == 2 then
  		return g:CheckSubGroupEach(s.combination2[1])
  			or g:CheckSubGroupEach(s.combination2[2])
  			or g:CheckSubGroupEach(s.combination2[3])
  			or g:CheckSubGroupEach(s.combination2[4])
  			or g:CheckSubGroupEach(s.combination2[5])
  			or g:CheckSubGroupEach(s.combination2[6])
  	elseif #g == 3 then
  		return g:CheckSubGroupEach(s.combination3[1]) or g:CheckSubGroupEach(s.combination3[2]) or g:CheckSubGroupEach(s.combination3[3]) or g:CheckSubGroupEach(s.combination3[4])
  	elseif #g == 4 then
  		return g:CheckSubGroupEach(s.combination4)
  	end
  end
  function s.spop(e, tp, eg, ep, ev, re, r, rp)
  	local g = Duel.GetMatchingGroup(s.spfilter, tp, LOCATION_HAND, 0, nil, e, tp)
  	local ft = Duel.GetLocationCount(tp, LOCATION_MZONE)
  	if ft > 0 and #g > 0 then
  		if Duel.IsPlayerAffectedByEffect(tp, CARD_ID_0) then
  			ft = 1
  		end
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
  		local sg = g:SelectSubGroup(tp, s.gcheck, false, 1, math.min(4, ft))
  		Duel.SpecialSummon(sg, 0, tp, tp, false, false, POS_FACEUP_DEFENSE)
  	end
  	local e1 = Effect.CreateEffect(e:GetHandler())
  	e1:SetType(EFFECT_TYPE_FIELD)
  	e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  	e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
  	e1:SetTargetRange(1, 0)
  	e1:SetTarget(s.splimit)
  	e1:SetReset(RESET_PHASE + PHASE_END)
  	Duel.RegisterEffect(e1, tp)
  end
  function s.splimit(e, c, sump, sumtype, sumpos, targetp, se)
  	return not c:IsType(TYPE_XYZ) and c:IsLocation(LOCATION_EXTRA)
  end
  
  
source_text: Utopic
  (This card is always treated as a "Zubaba", "Gagaga", "Gogogo", and "Dododo" card.)
  During your Main Phase: You can Special Summon up to 1 each "Zubaba", "Gagaga", "Gogogo", and/or "Dododo" monster(s) from your hand in Defense Position, except "Utopic Onomatopoeia", also you cannot Special Summon from the Extra Deck for the rest of this turn, except Xyz Monsters. You can only use this effect of "Utopic Onomatopoeia" once per turn.
target_text: -- Utopic
  local CARD_ID_0 = 59822133 --Blue-Eyes Spirit Dragon
  local SETCARD_ID_0 = 0x54 --Gagaga
  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)
  	e1:SetType(EFFECT_TYPE_IGNITION)
  	e1:SetCountLimit(1, id)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetTarget(s.sptg)
  	e1:SetOperation(s.spop)
  	c:RegisterEffect(e1)
  end
  s.combination2 = {}
  s.combination2[1] = aux.CreateChecks(Card.IsSetCard, { 0x54, 0x59 })
  s.combination2[2] = aux.CreateChecks(Card.IsSetCard, { 0x54, 0x82 })
  s.combination2[3] = aux.CreateChecks(Card.IsSetCard, { 0x54, 0x8f })
  s.combination2[4] = aux.CreateChecks(Card.IsSetCard, { 0x59, 0x82 })
  s.combination2[5] = aux.CreateChecks(Card.IsSetCard, { 0x59, 0x8f })
  s.combination2[6] = aux.CreateChecks(Card.IsSetCard, { 0x82, 0x8f })
  s.combination3 = {}
  s.combination3[1] = aux.CreateChecks(Card.IsSetCard, { 0x59, 0x82, 0x8f })
  s.combination3[2] = aux.CreateChecks(Card.IsSetCard, { 0x54, 0x82, 0x8f })
  s.combination3[3] = aux.CreateChecks(Card.IsSetCard, { 0x54, 0x59, 0x8f })
  s.combination3[4] = aux.CreateChecks(Card.IsSetCard, { 0x54, 0x59, 0x82 })
  s.combination4 = aux.CreateChecks(Card.IsSetCard, { 0x54, 0x59, 0x82, 0x8f })
  function s.spfilter(c, e, tp)
  	return c:IsSetCard(SETCARD_ID_0, 0x59, 0x82, 0x8f) and not 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.GetLocationCount(tp, LOCATION_MZONE) > 0 and Duel.IsExistingMatchingCard(s.spfilter, tp, LOCATION_HAND, 0, 1, nil, e, tp)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, nil, 1, tp, LOCATION_HAND)
  end
  function s.gcheck(g)
  	if #g == 1 then
  		return true
  	elseif #g == 2 then
  		return g:CheckSubGroupEach(s.combination2[1])
  			or g:CheckSubGroupEach(s.combination2[2])
  			or g:CheckSubGroupEach(s.combination2[3])
  			or g:CheckSubGroupEach(s.combination2[4])
  			or g:CheckSubGroupEach(s.combination2[5])
  			or g:CheckSubGroupEach(s.combination2[6])
  	elseif #g == 3 then
  		return g:CheckSubGroupEach(s.combination3[1]) or g:CheckSubGroupEach(s.combination3[2]) or g:CheckSubGroupEach(s.combination3[3]) or g:CheckSubGroupEach(s.combination3[4])
  	elseif #g == 4 then
  		return g:CheckSubGroupEach(s.combination4)
  	end
  end
  function s.spop(e, tp, eg, ep, ev, re, r, rp)
  	local g = Duel.GetMatchingGroup(s.spfilter, tp, LOCATION_HAND, 0, nil, e, tp)
  	local ft = Duel.GetLocationCount(tp, LOCATION_MZONE)
  	if ft > 0 and #g > 0 then
  		if Duel.IsPlayerAffectedByEffect(tp, CARD_ID_0) then
  			ft = 1
  		end
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
  		local sg = g:SelectSubGroup(tp, s.gcheck, false, 1, math.min(4, ft))
  		Duel.SpecialSummon(sg, 0, tp, tp, false, false, POS_FACEUP_DEFENSE)
  	end
  	local e1 = Effect.CreateEffect(e:GetHandler())
  	e1:SetType(EFFECT_TYPE_FIELD)
  	e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  	e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
  	e1:SetTargetRange(1, 0)
  	e1:SetTarget(s.splimit)
  	e1:SetReset(RESET_PHASE + PHASE_END)
  	Duel.RegisterEffect(e1, tp)
  end
  function s.splimit(e, c, sump, sumtype, sumpos, targetp, se)
  	return not c:IsType(TYPE_XYZ) and c:IsLocation(LOCATION_EXTRA)
  end
  
  