name: Dovelgus,
card_text: You can only control 1 "Dovelgus, Generaider Boss of Iron". (Quick Effect): You can Tribute any number of "Generaider" monsters and/or Machine monsters; Special Summon, from your hand, in Defense Position, exactly that many "Generaider" monsters and/or Machine monsters, all with different names from each other and from the Tributed monsters. You can only use this effect of "Dovelgus, Generaider Boss of Iron" once per turn.
external_ids: local CARD_ID_0 = 59822133 --Blue-Eyes Spirit Dragon
  local SETCARD_ID_0 = 0x134 --Generaider
  
lua: local CARD_ID_0 = 59822133 --Blue-Eyes Spirit Dragon
  local SETCARD_ID_0 = 0x134 --Generaider
  local s, id, o = GetID()
  function s.initial_effect(c)
  	c:SetUniqueOnField(1, 0, id)
  	--special summon
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
  	e1:SetType(EFFECT_TYPE_QUICK_O)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetCountLimit(1, id)
  	e1:SetCost(s.spcost)
  	e1:SetTarget(s.sptg)
  	e1:SetOperation(s.spop)
  	c:RegisterEffect(e1)
  end
  function s.spfilter(c, e, tp, ...)
  	return (c:IsSetCard(SETCARD_ID_0) or c:IsRace(RACE_MACHINE)) and c:IsCanBeSpecialSummoned(e, 0, tp, false, false, POS_FACEUP_DEFENSE) and not c:IsCode(...)
  end
  function s.costfilter1(c, e, tp)
  	return (c:IsSetCard(SETCARD_ID_0) or c:IsRace(RACE_MACHINE)) and Duel.GetMZoneCount(tp, c) > 0 and Duel.IsExistingMatchingCard(s.spfilter, tp, LOCATION_HAND, 0, 1, nil, e, tp, c:GetCode())
  end
  function s.costfilter2(c, e, tp)
  	return (c:IsSetCard(SETCARD_ID_0) or c:IsRace(RACE_MACHINE)) and Duel.IsExistingMatchingCard(s.spfilter, tp, LOCATION_HAND, 0, 1, nil, e, tp, c:GetCode())
  end
  function s.fselect(g, e, tp)
  	local code = {}
  	for tc in aux.Next(g) do
  		table.insert(code, tc:GetCode())
  	end
  	local sg = Duel.GetMatchingGroup(s.spfilter, tp, LOCATION_HAND, 0, nil, e, tp, table.unpack(code))
  	if sg:GetClassCount(Card.GetCode) >= g:GetCount() and Duel.GetMZoneCount(tp, g) >= g:GetCount() then
  		return Duel.CheckReleaseGroup(tp, aux.IsInGroup, #g, nil, g)
  	else
  		return false
  	end
  end
  function s.spcost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.CheckReleaseGroup(tp, s.costfilter1, 1, nil, e, tp)
  	end
  	local rg = Duel.GetReleaseGroup(tp):Filter(s.costfilter2, nil, e, tp)
  	local ft = Duel.GetMZoneCount(tp, rg)
  	if Duel.IsPlayerAffectedByEffect(tp, CARD_ID_0) then
  		ft = 1
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_RELEASE)
  	local sg = rg:SelectSubGroup(tp, s.fselect, false, 1, ft, e, tp)
  	local code = {}
  	for tc in aux.Next(sg) do
  		table.insert(code, tc:GetCode())
  	end
  	e:SetLabel(table.unpack(code))
  	aux.UseExtraReleaseCount(sg, tp)
  	Duel.Release(sg, REASON_COST)
  end
  function s.sptg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return true
  	end
  	local code = { e:GetLabel() }
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, nil, #code, tp, LOCATION_HAND)
  end
  function s.spop(e, tp, eg, ep, ev, re, r, rp)
  	local code = { e:GetLabel() }
  	local ft = Duel.GetLocationCount(tp, LOCATION_MZONE)
  	if ft > 1 and Duel.IsPlayerAffectedByEffect(tp, CARD_ID_0) then
  		ft = 1
  	end
  	if ft < #code then
  		return
  	end
  	local sg = Duel.GetMatchingGroup(s.spfilter, tp, LOCATION_HAND, 0, nil, e, tp, table.unpack(code))
  	if sg:GetCount() == 0 then
  		return
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
  	local tg = sg:SelectSubGroup(tp, aux.dncheck, false, #code, #code)
  	if tg and tg:GetCount() > 0 then
  		Duel.SpecialSummon(tg, 0, tp, tp, false, false, POS_FACEUP_DEFENSE)
  	end
  end
  
  
source_text: Dovelgus,
  You can only control 1 "Dovelgus, Generaider Boss of Iron". (Quick Effect): You can Tribute any number of "Generaider" monsters and/or Machine monsters; Special Summon, from your hand, in Defense Position, exactly that many "Generaider" monsters and/or Machine monsters, all with different names from each other and from the Tributed monsters. You can only use this effect of "Dovelgus, Generaider Boss of Iron" once per turn.
target_text: -- Dovelgus,
  local CARD_ID_0 = 59822133 --Blue-Eyes Spirit Dragon
  local SETCARD_ID_0 = 0x134 --Generaider
  local s, id, o = GetID()
  function s.initial_effect(c)
  	c:SetUniqueOnField(1, 0, id)
  	--special summon
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
  	e1:SetType(EFFECT_TYPE_QUICK_O)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetCountLimit(1, id)
  	e1:SetCost(s.spcost)
  	e1:SetTarget(s.sptg)
  	e1:SetOperation(s.spop)
  	c:RegisterEffect(e1)
  end
  function s.spfilter(c, e, tp, ...)
  	return (c:IsSetCard(SETCARD_ID_0) or c:IsRace(RACE_MACHINE)) and c:IsCanBeSpecialSummoned(e, 0, tp, false, false, POS_FACEUP_DEFENSE) and not c:IsCode(...)
  end
  function s.costfilter1(c, e, tp)
  	return (c:IsSetCard(SETCARD_ID_0) or c:IsRace(RACE_MACHINE)) and Duel.GetMZoneCount(tp, c) > 0 and Duel.IsExistingMatchingCard(s.spfilter, tp, LOCATION_HAND, 0, 1, nil, e, tp, c:GetCode())
  end
  function s.costfilter2(c, e, tp)
  	return (c:IsSetCard(SETCARD_ID_0) or c:IsRace(RACE_MACHINE)) and Duel.IsExistingMatchingCard(s.spfilter, tp, LOCATION_HAND, 0, 1, nil, e, tp, c:GetCode())
  end
  function s.fselect(g, e, tp)
  	local code = {}
  	for tc in aux.Next(g) do
  		table.insert(code, tc:GetCode())
  	end
  	local sg = Duel.GetMatchingGroup(s.spfilter, tp, LOCATION_HAND, 0, nil, e, tp, table.unpack(code))
  	if sg:GetClassCount(Card.GetCode) >= g:GetCount() and Duel.GetMZoneCount(tp, g) >= g:GetCount() then
  		return Duel.CheckReleaseGroup(tp, aux.IsInGroup, #g, nil, g)
  	else
  		return false
  	end
  end
  function s.spcost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.CheckReleaseGroup(tp, s.costfilter1, 1, nil, e, tp)
  	end
  	local rg = Duel.GetReleaseGroup(tp):Filter(s.costfilter2, nil, e, tp)
  	local ft = Duel.GetMZoneCount(tp, rg)
  	if Duel.IsPlayerAffectedByEffect(tp, CARD_ID_0) then
  		ft = 1
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_RELEASE)
  	local sg = rg:SelectSubGroup(tp, s.fselect, false, 1, ft, e, tp)
  	local code = {}
  	for tc in aux.Next(sg) do
  		table.insert(code, tc:GetCode())
  	end
  	e:SetLabel(table.unpack(code))
  	aux.UseExtraReleaseCount(sg, tp)
  	Duel.Release(sg, REASON_COST)
  end
  function s.sptg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return true
  	end
  	local code = { e:GetLabel() }
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, nil, #code, tp, LOCATION_HAND)
  end
  function s.spop(e, tp, eg, ep, ev, re, r, rp)
  	local code = { e:GetLabel() }
  	local ft = Duel.GetLocationCount(tp, LOCATION_MZONE)
  	if ft > 1 and Duel.IsPlayerAffectedByEffect(tp, CARD_ID_0) then
  		ft = 1
  	end
  	if ft < #code then
  		return
  	end
  	local sg = Duel.GetMatchingGroup(s.spfilter, tp, LOCATION_HAND, 0, nil, e, tp, table.unpack(code))
  	if sg:GetCount() == 0 then
  		return
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
  	local tg = sg:SelectSubGroup(tp, aux.dncheck, false, #code, #code)
  	if tg and tg:GetCount() > 0 then
  		Duel.SpecialSummon(tg, 0, tp, tp, false, false, POS_FACEUP_DEFENSE)
  	end
  end
  
  