Archnemeses
Cannot be Normal Summoned/Set. Must first be Special Summoned (from your hand) by banishing 3 monsters with different Types from your GY and/or face-up field. Cannot be destroyed by card effects. You can declare 1 Monster Type on the field; destroy all monsters on the field with that Type, also until the end of the next turn, neither player can Special Summon monsters with that Type. You can only use this effect of "Archnemeses Eschatos" once per turn.
local s, id, o = GetID()
function s.initial_effect(c)
	c:EnableReviveLimit()
	--special summon
	local e1 = Effect.CreateEffect(c)
	e1:SetType(EFFECT_TYPE_FIELD)
	e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_UNCOPYABLE)
	e1:SetCode(EFFECT_SPSUMMON_PROC)
	e1:SetRange(LOCATION_HAND)
	e1:SetCondition(s.sprcon)
	e1:SetTarget(s.sprtg)
	e1:SetOperation(s.sprop)
	c:RegisterEffect(e1)
	--immune
	local e2 = Effect.CreateEffect(c)
	e2:SetType(EFFECT_TYPE_SINGLE)
	e2:SetCode(EFFECT_INDESTRUCTABLE_EFFECT)
	e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
	e2:SetRange(LOCATION_MZONE)
	e2:SetValue(1)
	c:RegisterEffect(e2)
	--destroy
	local e3 = Effect.CreateEffect(c)
	e3:SetDescription(aux.Stringid(id, 0))
	e3:SetCategory(CATEGORY_DESTROY)
	e3:SetType(EFFECT_TYPE_IGNITION)
	e3:SetRange(LOCATION_MZONE)
	e3:SetCountLimit(1, id)
	e3:SetTarget(s.destg)
	e3:SetOperation(s.desop)
	c:RegisterEffect(e3)
end
function s.sprfilter(c)
	return (c:IsFaceup() or c:IsLocation(LOCATION_GRAVE)) and c:IsAbleToRemoveAsCost() and c:IsType(TYPE_MONSTER)
end
function s.fselect(g, tp)
	return Duel.GetMZoneCount(tp, g) > 0 and g:GetClassCount(Card.GetRace) == #g
end
function s.sprcon(e, c)
	if c == nil then
		return true
	end
	local tp = c:GetControler()
	local rg = Duel.GetMatchingGroup(s.sprfilter, tp, LOCATION_MZONE + LOCATION_GRAVE, 0, nil)
	return rg:CheckSubGroup(s.fselect, 3, 3, tp)
end
function s.sprtg(e, tp, eg, ep, ev, re, r, rp, chk, c)
	local rg = Duel.GetMatchingGroup(s.sprfilter, tp, LOCATION_MZONE + LOCATION_GRAVE, 0, nil)
	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_REMOVE)
	local sg = rg:SelectSubGroup(tp, s.fselect, true, 3, 3, tp)
	if sg then
		sg:KeepAlive()
		e:SetLabelObject(sg)
		return true
	else
		return false
	end
end
function s.sprop(e, tp, eg, ep, ev, re, r, rp, c)
	local g = e:GetLabelObject()
	Duel.Remove(g, POS_FACEUP, REASON_SPSUMMON)
	g:DeleteGroup()
end
function s.desfilter(c, race)
	return c:IsFaceup() and c:IsRace(race)
end
function s.destg(e, tp, eg, ep, ev, re, r, rp, chk)
	if chk == 0 then
		return Duel.IsExistingMatchingCard(Card.IsFaceup, tp, LOCATION_MZONE, LOCATION_MZONE, 1, nil)
	end
	local g = Duel.GetMatchingGroup(Card.IsFaceup, tp, LOCATION_MZONE, LOCATION_MZONE, nil)
	local tc = g:GetFirst()
	local race = 0
	while tc do
		race = race | tc:GetRace()
		tc = g:GetNext()
	end
	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_RACE)
	local rc = Duel.AnnounceRace(tp, 1, race)
	e:SetLabel(rc)
	local dg = Duel.GetMatchingGroup(s.desfilter, tp, LOCATION_MZONE, LOCATION_MZONE, nil, rc)
	Duel.SetOperationInfo(0, CATEGORY_DESTROY, dg, dg:GetCount(), 0, 0)
end
function s.desop(e, tp, eg, ep, ev, re, r, rp)
	local race = e:GetLabel()
	local dg = Duel.GetMatchingGroup(s.desfilter, tp, LOCATION_MZONE, LOCATION_MZONE, nil, race)
	if dg:GetCount() > 0 then
		Duel.Destroy(dg, REASON_EFFECT)
	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, 1)
	e1:SetLabel(race)
	e1:SetTarget(s.splimit)
	e1:SetReset(RESET_PHASE + PHASE_END, 2)
	Duel.RegisterEffect(e1, tp)
end
function s.splimit(e, c)
	return c:IsRace(e:GetLabel())
end


Archnemeses
Cannot be Normal Summoned/Set. Must first be Special Summoned (from your hand) by banishing 3 monsters with different Types from your GY and/or face-up field. Cannot be destroyed by card effects. You can declare 1 Monster Type on the field; destroy all monsters on the field with that Type, also until the end of the next turn, neither player can Special Summon monsters with that Type. You can only use this effect of "Archnemeses Eschatos" once per turn.
-- Archnemeses
local s, id, o = GetID()
function s.initial_effect(c)
	c:EnableReviveLimit()
	--special summon
	local e1 = Effect.CreateEffect(c)
	e1:SetType(EFFECT_TYPE_FIELD)
	e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_UNCOPYABLE)
	e1:SetCode(EFFECT_SPSUMMON_PROC)
	e1:SetRange(LOCATION_HAND)
	e1:SetCondition(s.sprcon)
	e1:SetTarget(s.sprtg)
	e1:SetOperation(s.sprop)
	c:RegisterEffect(e1)
	--immune
	local e2 = Effect.CreateEffect(c)
	e2:SetType(EFFECT_TYPE_SINGLE)
	e2:SetCode(EFFECT_INDESTRUCTABLE_EFFECT)
	e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
	e2:SetRange(LOCATION_MZONE)
	e2:SetValue(1)
	c:RegisterEffect(e2)
	--destroy
	local e3 = Effect.CreateEffect(c)
	e3:SetDescription(aux.Stringid(id, 0))
	e3:SetCategory(CATEGORY_DESTROY)
	e3:SetType(EFFECT_TYPE_IGNITION)
	e3:SetRange(LOCATION_MZONE)
	e3:SetCountLimit(1, id)
	e3:SetTarget(s.destg)
	e3:SetOperation(s.desop)
	c:RegisterEffect(e3)
end
function s.sprfilter(c)
	return (c:IsFaceup() or c:IsLocation(LOCATION_GRAVE)) and c:IsAbleToRemoveAsCost() and c:IsType(TYPE_MONSTER)
end
function s.fselect(g, tp)
	return Duel.GetMZoneCount(tp, g) > 0 and g:GetClassCount(Card.GetRace) == #g
end
function s.sprcon(e, c)
	if c == nil then
		return true
	end
	local tp = c:GetControler()
	local rg = Duel.GetMatchingGroup(s.sprfilter, tp, LOCATION_MZONE + LOCATION_GRAVE, 0, nil)
	return rg:CheckSubGroup(s.fselect, 3, 3, tp)
end
function s.sprtg(e, tp, eg, ep, ev, re, r, rp, chk, c)
	local rg = Duel.GetMatchingGroup(s.sprfilter, tp, LOCATION_MZONE + LOCATION_GRAVE, 0, nil)
	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_REMOVE)
	local sg = rg:SelectSubGroup(tp, s.fselect, true, 3, 3, tp)
	if sg then
		sg:KeepAlive()
		e:SetLabelObject(sg)
		return true
	else
		return false
	end
end
function s.sprop(e, tp, eg, ep, ev, re, r, rp, c)
	local g = e:GetLabelObject()
	Duel.Remove(g, POS_FACEUP, REASON_SPSUMMON)
	g:DeleteGroup()
end
function s.desfilter(c, race)
	return c:IsFaceup() and c:IsRace(race)
end
function s.destg(e, tp, eg, ep, ev, re, r, rp, chk)
	if chk == 0 then
		return Duel.IsExistingMatchingCard(Card.IsFaceup, tp, LOCATION_MZONE, LOCATION_MZONE, 1, nil)
	end
	local g = Duel.GetMatchingGroup(Card.IsFaceup, tp, LOCATION_MZONE, LOCATION_MZONE, nil)
	local tc = g:GetFirst()
	local race = 0
	while tc do
		race = race | tc:GetRace()
		tc = g:GetNext()
	end
	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_RACE)
	local rc = Duel.AnnounceRace(tp, 1, race)
	e:SetLabel(rc)
	local dg = Duel.GetMatchingGroup(s.desfilter, tp, LOCATION_MZONE, LOCATION_MZONE, nil, rc)
	Duel.SetOperationInfo(0, CATEGORY_DESTROY, dg, dg:GetCount(), 0, 0)
end
function s.desop(e, tp, eg, ep, ev, re, r, rp)
	local race = e:GetLabel()
	local dg = Duel.GetMatchingGroup(s.desfilter, tp, LOCATION_MZONE, LOCATION_MZONE, nil, race)
	if dg:GetCount() > 0 then
		Duel.Destroy(dg, REASON_EFFECT)
	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, 1)
	e1:SetLabel(race)
	e1:SetTarget(s.splimit)
	e1:SetReset(RESET_PHASE + PHASE_END, 2)
	Duel.RegisterEffect(e1, tp)
end
function s.splimit(e, c)
	return c:IsRace(e:GetLabel())
end

