Spell
Send 3 "Ancient Gear" cards you control to the Graveyard. You can Special Summon up to 1 "Ancient Gear Golem" from your hand and 1 from your Deck, ignoring the Summoning conditions. Then, destroy all monsters you control except "Ancient Gear Golems". You cannot Normal Summon or Set until the end of your next turn.
local CARD_ID_0 = 59822133 --Blue-Eyes Spirit Dragon
local CARD_ID_1 = 83104731 --Ancient Gear Golem
local SETCARD_ID_0 = 0x7 --Ancient

local CARD_ID_0 = 59822133 --Blue-Eyes Spirit Dragon
local CARD_ID_1 = 83104731 --Ancient Gear Golem
local SETCARD_ID_0 = 0x7 --Ancient
local s, id, o = GetID()
function s.initial_effect(c)
	aux.AddCodeList(c, CARD_ID_1)
	--Activate
	local e1 = Effect.CreateEffect(c)
	e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
	e1:SetType(EFFECT_TYPE_ACTIVATE)
	e1:SetCode(EVENT_FREE_CHAIN)
	e1:SetCost(s.cost)
	e1:SetTarget(s.target)
	e1:SetOperation(s.activate)
	c:RegisterEffect(e1)
end
function s.cfilter(c)
	return c:IsFaceup() and c:IsSetCard(SETCARD_ID_0) and c:IsAbleToGraveAsCost()
end
function s.cost(e, tp, eg, ep, ev, re, r, rp, chk)
	local tg = Duel.GetMatchingGroup(s.cfilter, tp, LOCATION_ONFIELD, 0, nil)
	if chk == 0 then
		e:SetLabel(1)
		return tg:CheckSubGroup(aux.mzctcheck, 3, 3, tp)
	end
	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TOGRAVE)
	local g = tg:SelectSubGroup(tp, aux.mzctcheck, false, 3, 3, tp)
	Duel.SendtoGrave(g, REASON_COST)
end
function s.filter(c, e, tp)
	return c:IsCode(CARD_ID_1) and c:IsCanBeSpecialSummoned(e, 0, tp, true, false)
end
function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
	if chk == 0 then
		if e:GetLabel() == 0 and Duel.GetLocationCount(tp, LOCATION_MZONE) <= 0 then
			return false
		end
		e:SetLabel(0)
		return Duel.IsExistingMatchingCard(s.filter, tp, LOCATION_HAND + LOCATION_DECK, 0, 1, nil, e, tp)
	end
	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, nil, 1, tp, LOCATION_HAND + LOCATION_DECK)
end
function s.dfilter(c)
	return c:IsFacedown() or not c:IsCode(CARD_ID_1)
end
function s.fselect(g)
	return g:GetClassCount(Card.GetLocation) == g:GetCount()
end
function s.activate(e, tp, eg, ep, ev, re, r, rp)
	local ft = math.min((Duel.GetLocationCount(tp, LOCATION_MZONE)), 2)
	local g = Duel.GetMatchingGroup(s.filter, tp, LOCATION_HAND + LOCATION_DECK, 0, nil, e, tp)
	if ft > 0 and g:GetCount() > 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.fselect, false, 1, ft)
		if sg and Duel.SpecialSummon(sg, 0, tp, tp, true, false, POS_FACEUP) > 0 then
			local dg = Duel.GetMatchingGroup(s.dfilter, tp, LOCATION_MZONE, 0, nil)
			if dg:GetCount() > 0 then
				Duel.BreakEffect()
				Duel.Destroy(dg, REASON_EFFECT)
			end
		end
	end
	local e1 = Effect.CreateEffect(e:GetHandler())
	e1:SetType(EFFECT_TYPE_FIELD)
	e1:SetCode(EFFECT_CANNOT_SUMMON)
	e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
	e1:SetReset(RESET_SELF_TURN + RESET_PHASE + PHASE_END, 2)
	e1:SetTargetRange(1, 0)
	Duel.RegisterEffect(e1, tp)
	local e2 = e1:Clone()
	e2:SetCode(EFFECT_CANNOT_MSET)
	Duel.RegisterEffect(e2, tp)
end


Spell
Send 3 "Ancient Gear" cards you control to the Graveyard. You can Special Summon up to 1 "Ancient Gear Golem" from your hand and 1 from your Deck, ignoring the Summoning conditions. Then, destroy all monsters you control except "Ancient Gear Golems". You cannot Normal Summon or Set until the end of your next turn.
-- Spell
local CARD_ID_0 = 59822133 --Blue-Eyes Spirit Dragon
local CARD_ID_1 = 83104731 --Ancient Gear Golem
local SETCARD_ID_0 = 0x7 --Ancient
local s, id, o = GetID()
function s.initial_effect(c)
	aux.AddCodeList(c, CARD_ID_1)
	--Activate
	local e1 = Effect.CreateEffect(c)
	e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
	e1:SetType(EFFECT_TYPE_ACTIVATE)
	e1:SetCode(EVENT_FREE_CHAIN)
	e1:SetCost(s.cost)
	e1:SetTarget(s.target)
	e1:SetOperation(s.activate)
	c:RegisterEffect(e1)
end
function s.cfilter(c)
	return c:IsFaceup() and c:IsSetCard(SETCARD_ID_0) and c:IsAbleToGraveAsCost()
end
function s.cost(e, tp, eg, ep, ev, re, r, rp, chk)
	local tg = Duel.GetMatchingGroup(s.cfilter, tp, LOCATION_ONFIELD, 0, nil)
	if chk == 0 then
		e:SetLabel(1)
		return tg:CheckSubGroup(aux.mzctcheck, 3, 3, tp)
	end
	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TOGRAVE)
	local g = tg:SelectSubGroup(tp, aux.mzctcheck, false, 3, 3, tp)
	Duel.SendtoGrave(g, REASON_COST)
end
function s.filter(c, e, tp)
	return c:IsCode(CARD_ID_1) and c:IsCanBeSpecialSummoned(e, 0, tp, true, false)
end
function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
	if chk == 0 then
		if e:GetLabel() == 0 and Duel.GetLocationCount(tp, LOCATION_MZONE) <= 0 then
			return false
		end
		e:SetLabel(0)
		return Duel.IsExistingMatchingCard(s.filter, tp, LOCATION_HAND + LOCATION_DECK, 0, 1, nil, e, tp)
	end
	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, nil, 1, tp, LOCATION_HAND + LOCATION_DECK)
end
function s.dfilter(c)
	return c:IsFacedown() or not c:IsCode(CARD_ID_1)
end
function s.fselect(g)
	return g:GetClassCount(Card.GetLocation) == g:GetCount()
end
function s.activate(e, tp, eg, ep, ev, re, r, rp)
	local ft = math.min((Duel.GetLocationCount(tp, LOCATION_MZONE)), 2)
	local g = Duel.GetMatchingGroup(s.filter, tp, LOCATION_HAND + LOCATION_DECK, 0, nil, e, tp)
	if ft > 0 and g:GetCount() > 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.fselect, false, 1, ft)
		if sg and Duel.SpecialSummon(sg, 0, tp, tp, true, false, POS_FACEUP) > 0 then
			local dg = Duel.GetMatchingGroup(s.dfilter, tp, LOCATION_MZONE, 0, nil)
			if dg:GetCount() > 0 then
				Duel.BreakEffect()
				Duel.Destroy(dg, REASON_EFFECT)
			end
		end
	end
	local e1 = Effect.CreateEffect(e:GetHandler())
	e1:SetType(EFFECT_TYPE_FIELD)
	e1:SetCode(EFFECT_CANNOT_SUMMON)
	e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
	e1:SetReset(RESET_SELF_TURN + RESET_PHASE + PHASE_END, 2)
	e1:SetTargetRange(1, 0)
	Duel.RegisterEffect(e1, tp)
	local e2 = e1:Clone()
	e2:SetCode(EFFECT_CANNOT_MSET)
	Duel.RegisterEffect(e2, tp)
end

