name: Infernoid
card_text: "Infernoid Onuncu" + "Infernoid Devyaty" + 1+ "Infernoid" monsters
  When this card is Fusion Summoned, you can: Apply these effects, in sequence, based on the number of materials with different names used for this card's Summon;
  ● 3+: Each player sends 3 cards from their Extra Deck to the GY.
  ● 5+: Each player sends the top 3 cards from their Deck to the GY.
  ● 8+: Each player returns up to 3 of their banished cards to the GY.
  ● 10+: Each player sends their entire hand to the GY.
external_ids: local CARD_ID_0 = 14799437 --Infernoid Onuncu
  local CARD_ID_1 = 23440231 --Infernoid Devyaty
  local SETCARD_ID_0 = 0xbb --Infernoid
  
lua: local CARD_ID_0 = 14799437 --Infernoid Onuncu
  local CARD_ID_1 = 23440231 --Infernoid Devyaty
  local SETCARD_ID_0 = 0xbb --Infernoid
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--fusion material
  	c:EnableReviveLimit()
  	aux.AddFusionProcCode2FunRep(c, CARD_ID_0, CARD_ID_1, aux.FilterBoolFunction(Card.IsFusionSetCard, SETCARD_ID_0), 1, 127, true, true)
  	--spsummon success
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 0))
  	e2:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e2:SetCode(EVENT_SPSUMMON_SUCCESS)
  	e2:SetCondition(s.con)
  	e2:SetTarget(s.tg)
  	e2:SetOperation(s.op)
  	c:RegisterEffect(e2)
  	--material check
  	local e3 = Effect.CreateEffect(c)
  	e3:SetType(EFFECT_TYPE_SINGLE)
  	e3:SetCode(EFFECT_MATERIAL_CHECK)
  	e3:SetValue(s.valcheck)
  	e3:SetLabelObject(e2)
  	c:RegisterEffect(e3)
  end
  function s.valcheck(e, c)
  	local ct = e:GetHandler():GetMaterial():GetClassCount(Card.GetCode)
  	e:GetLabelObject():SetLabel(ct)
  end
  function s.con(e, tp, eg, ep, ev, re, r, rp)
  	return e:GetHandler():IsSummonType(SUMMON_TYPE_FUSION)
  end
  function s.tg(e, tp, eg, ep, ev, re, r, rp, chk)
  	local ct = e:GetLabel()
  	local con3, con5, con8, con10 = nil, nil, nil, nil
  	if ct >= 3 then
  		con3 = Duel.IsExistingMatchingCard(Card.IsAbleToGrave, tp, LOCATION_EXTRA, 0, 3, nil) and Duel.IsExistingMatchingCard(Card.IsAbleToGrave, tp, 0, LOCATION_EXTRA, 3, nil)
  	end
  	if ct >= 5 then
  		con5 = Duel.IsPlayerCanDiscardDeck(tp, 3) and Duel.IsPlayerCanDiscardDeck(1 - tp, 3)
  	end
  	if ct >= 8 then
  		con8 = Duel.IsExistingMatchingCard(nil, tp, LOCATION_REMOVED, 0, 1, nil) and Duel.IsExistingMatchingCard(nil, tp, 0, LOCATION_REMOVED, 1, nil)
  	end
  	if ct >= 10 then
  		con10 = Duel.GetFieldGroupCount(tp, LOCATION_HAND, LOCATION_HAND) > 0
  	end
  	if chk == 0 then
  		return con3 or con5 or con8 or con10
  	end
  	local cat = 0
  	if ct >= 3 or ct >= 8 then
  		cat = cat + CATEGORY_TOGRAVE
  	end
  	if ct >= 5 then
  		cat = cat + CATEGORY_DECKDES
  	end
  	if ct >= 10 then
  		cat = cat + CATEGORY_HANDES
  	end
  	e:SetCategory(cat)
  end
  function s.op(e, tp, eg, ep, ev, re, r, rp)
  	local ct = e:GetLabel()
  	if ct >= 3 then
  		local g1 = Duel.GetMatchingGroup(Card.IsAbleToGrave, tp, LOCATION_EXTRA, 0, nil)
  		local sg1 = nil
  		if g1:GetCount() >= 3 then
  			Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TOGRAVE)
  			sg1 = g1:Select(tp, 3, 3, nil)
  		else
  			sg1 = g1
  		end
  		local g2 = Duel.GetMatchingGroup(Card.IsAbleToGrave, tp, 0, LOCATION_EXTRA, nil)
  		local sg2 = nil
  		if g2:GetCount() >= 3 then
  			Duel.Hint(HINT_SELECTMSG, 1 - tp, HINTMSG_TOGRAVE)
  			sg2 = g2:Select(1 - tp, 3, 3, nil)
  		else
  			sg2 = g2
  		end
  		sg1:Merge(sg2)
  		if sg1:GetCount() > 0 then
  			Duel.SendtoGrave(sg1, REASON_EFFECT)
  		end
  	end
  	if ct >= 5 then
  		Duel.BreakEffect()
  		Duel.DiscardDeck(tp, 3, REASON_EFFECT)
  		Duel.DiscardDeck(1 - tp, 3, REASON_EFFECT)
  	end
  	if ct >= 8 then
  		Duel.BreakEffect()
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TOGRAVE)
  		local g1 = Duel.SelectMatchingCard(tp, nil, tp, LOCATION_REMOVED, 0, 1, 3, nil)
  		Duel.Hint(HINT_SELECTMSG, 1 - tp, HINTMSG_TOGRAVE)
  		local g2 = Duel.SelectMatchingCard(1 - tp, nil, 1 - tp, LOCATION_REMOVED, 0, 1, 3, nil)
  		g1:Merge(g2)
  		if g1:GetCount() > 0 then
  			Duel.SendtoGrave(g1, REASON_EFFECT + REASON_RETURN)
  		end
  	end
  	if ct >= 10 then
  		Duel.BreakEffect()
  		local g1 = Duel.GetFieldGroup(tp, LOCATION_HAND, LOCATION_HAND)
  		Duel.SendtoGrave(g1, REASON_EFFECT)
  	end
  end
  
  
source_text: Infernoid
  "Infernoid Onuncu" + "Infernoid Devyaty" + 1+ "Infernoid" monsters
  When this card is Fusion Summoned, you can: Apply these effects, in sequence, based on the number of materials with different names used for this card's Summon;
  ● 3+: Each player sends 3 cards from their Extra Deck to the GY.
  ● 5+: Each player sends the top 3 cards from their Deck to the GY.
  ● 8+: Each player returns up to 3 of their banished cards to the GY.
  ● 10+: Each player sends their entire hand to the GY.
target_text: -- Infernoid
  local CARD_ID_0 = 14799437 --Infernoid Onuncu
  local CARD_ID_1 = 23440231 --Infernoid Devyaty
  local SETCARD_ID_0 = 0xbb --Infernoid
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--fusion material
  	c:EnableReviveLimit()
  	aux.AddFusionProcCode2FunRep(c, CARD_ID_0, CARD_ID_1, aux.FilterBoolFunction(Card.IsFusionSetCard, SETCARD_ID_0), 1, 127, true, true)
  	--spsummon success
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 0))
  	e2:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e2:SetCode(EVENT_SPSUMMON_SUCCESS)
  	e2:SetCondition(s.con)
  	e2:SetTarget(s.tg)
  	e2:SetOperation(s.op)
  	c:RegisterEffect(e2)
  	--material check
  	local e3 = Effect.CreateEffect(c)
  	e3:SetType(EFFECT_TYPE_SINGLE)
  	e3:SetCode(EFFECT_MATERIAL_CHECK)
  	e3:SetValue(s.valcheck)
  	e3:SetLabelObject(e2)
  	c:RegisterEffect(e3)
  end
  function s.valcheck(e, c)
  	local ct = e:GetHandler():GetMaterial():GetClassCount(Card.GetCode)
  	e:GetLabelObject():SetLabel(ct)
  end
  function s.con(e, tp, eg, ep, ev, re, r, rp)
  	return e:GetHandler():IsSummonType(SUMMON_TYPE_FUSION)
  end
  function s.tg(e, tp, eg, ep, ev, re, r, rp, chk)
  	local ct = e:GetLabel()
  	local con3, con5, con8, con10 = nil, nil, nil, nil
  	if ct >= 3 then
  		con3 = Duel.IsExistingMatchingCard(Card.IsAbleToGrave, tp, LOCATION_EXTRA, 0, 3, nil) and Duel.IsExistingMatchingCard(Card.IsAbleToGrave, tp, 0, LOCATION_EXTRA, 3, nil)
  	end
  	if ct >= 5 then
  		con5 = Duel.IsPlayerCanDiscardDeck(tp, 3) and Duel.IsPlayerCanDiscardDeck(1 - tp, 3)
  	end
  	if ct >= 8 then
  		con8 = Duel.IsExistingMatchingCard(nil, tp, LOCATION_REMOVED, 0, 1, nil) and Duel.IsExistingMatchingCard(nil, tp, 0, LOCATION_REMOVED, 1, nil)
  	end
  	if ct >= 10 then
  		con10 = Duel.GetFieldGroupCount(tp, LOCATION_HAND, LOCATION_HAND) > 0
  	end
  	if chk == 0 then
  		return con3 or con5 or con8 or con10
  	end
  	local cat = 0
  	if ct >= 3 or ct >= 8 then
  		cat = cat + CATEGORY_TOGRAVE
  	end
  	if ct >= 5 then
  		cat = cat + CATEGORY_DECKDES
  	end
  	if ct >= 10 then
  		cat = cat + CATEGORY_HANDES
  	end
  	e:SetCategory(cat)
  end
  function s.op(e, tp, eg, ep, ev, re, r, rp)
  	local ct = e:GetLabel()
  	if ct >= 3 then
  		local g1 = Duel.GetMatchingGroup(Card.IsAbleToGrave, tp, LOCATION_EXTRA, 0, nil)
  		local sg1 = nil
  		if g1:GetCount() >= 3 then
  			Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TOGRAVE)
  			sg1 = g1:Select(tp, 3, 3, nil)
  		else
  			sg1 = g1
  		end
  		local g2 = Duel.GetMatchingGroup(Card.IsAbleToGrave, tp, 0, LOCATION_EXTRA, nil)
  		local sg2 = nil
  		if g2:GetCount() >= 3 then
  			Duel.Hint(HINT_SELECTMSG, 1 - tp, HINTMSG_TOGRAVE)
  			sg2 = g2:Select(1 - tp, 3, 3, nil)
  		else
  			sg2 = g2
  		end
  		sg1:Merge(sg2)
  		if sg1:GetCount() > 0 then
  			Duel.SendtoGrave(sg1, REASON_EFFECT)
  		end
  	end
  	if ct >= 5 then
  		Duel.BreakEffect()
  		Duel.DiscardDeck(tp, 3, REASON_EFFECT)
  		Duel.DiscardDeck(1 - tp, 3, REASON_EFFECT)
  	end
  	if ct >= 8 then
  		Duel.BreakEffect()
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TOGRAVE)
  		local g1 = Duel.SelectMatchingCard(tp, nil, tp, LOCATION_REMOVED, 0, 1, 3, nil)
  		Duel.Hint(HINT_SELECTMSG, 1 - tp, HINTMSG_TOGRAVE)
  		local g2 = Duel.SelectMatchingCard(1 - tp, nil, 1 - tp, LOCATION_REMOVED, 0, 1, 3, nil)
  		g1:Merge(g2)
  		if g1:GetCount() > 0 then
  			Duel.SendtoGrave(g1, REASON_EFFECT + REASON_RETURN)
  		end
  	end
  	if ct >= 10 then
  		Duel.BreakEffect()
  		local g1 = Duel.GetFieldGroup(tp, LOCATION_HAND, LOCATION_HAND)
  		Duel.SendtoGrave(g1, REASON_EFFECT)
  	end
  end
  
  