U.A.
If you control 2 or more "U.A." monsters with different names: Shuffle as many monsters on the field as possible into the Deck, then Special Summon "U.A." monsters from your Deck that have different names from each other, up to the number of cards shuffled into your Main Deck, but those monsters cannot attack this turn. Then your opponent can Special Summon monsters from their Deck, up to the number of cards shuffled into their Main Deck. You can only activate 1 "U.A. Turnover Tactics" per turn.
local CARD_ID_0 = 59822133 --Blue-Eyes Spirit Dragon
local SETCARD_ID_0 = 0xb2 --U.A.

local CARD_ID_0 = 59822133 --Blue-Eyes Spirit Dragon
local SETCARD_ID_0 = 0xb2 --U.A.
local s, id, o = GetID()
function s.initial_effect(c)
	--activate
	local e1 = Effect.CreateEffect(c)
	e1:SetCategory(CATEGORY_TODECK + CATEGORY_SPECIAL_SUMMON)
	e1:SetType(EFFECT_TYPE_ACTIVATE)
	e1:SetCode(EVENT_FREE_CHAIN)
	e1:SetCountLimit(1, id + EFFECT_COUNT_CODE_OATH)
	e1:SetCondition(s.condition)
	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)
end
function s.condition(e, tp, eg, ep, ev, re, r, rp)
	local g = Duel.GetMatchingGroup(s.cfilter, tp, LOCATION_MZONE, 0, nil)
	return g:GetClassCount(Card.GetCode) >= 2
end
function s.filter(c, e, tp)
	return c:IsSetCard(SETCARD_ID_0) and c:IsCanBeSpecialSummoned(e, 0, tp, false, false)
end
function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
	if chk == 0 then
		return Duel.IsExistingMatchingCard(Card.IsAbleToDeck, tp, LOCATION_MZONE, LOCATION_MZONE, 1, nil) and Duel.IsExistingMatchingCard(s.filter, tp, LOCATION_DECK, 0, 1, nil, e, tp)
	end
	local g = Duel.GetMatchingGroup(Card.IsAbleToDeck, tp, LOCATION_MZONE, LOCATION_MZONE, nil)
	Duel.SetOperationInfo(0, CATEGORY_TODECK, g, g:GetCount(), 0, 0)
	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, nil, 1, tp, LOCATION_DECK)
end
function s.locfilter(c, sp)
	return c:IsLocation(LOCATION_DECK) and c:IsControler(sp)
end
function s.activate(e, tp, eg, ep, ev, re, r, rp)
	local tg = Duel.GetMatchingGroup(Card.IsAbleToDeck, tp, LOCATION_MZONE, LOCATION_MZONE, nil)
	Duel.SendtoDeck(tg, nil, SEQ_DECKSHUFFLE, REASON_EFFECT)
	Duel.ShuffleDeck(tp)
	local ct1 = Duel.GetOperatedGroup():FilterCount(s.locfilter, nil, tp)
	local ct2 = Duel.GetOperatedGroup():FilterCount(s.locfilter, nil, 1 - tp)
	if ct1 > Duel.GetLocationCount(tp, LOCATION_MZONE) then
		ct1 = Duel.GetLocationCount(tp, LOCATION_MZONE)
	end
	if ct2 > Duel.GetLocationCount(1 - tp, LOCATION_MZONE) then
		ct2 = Duel.GetLocationCount(1 - tp, LOCATION_MZONE)
	end
	if ct1 <= 0 then
		return
	end
	if Duel.IsPlayerAffectedByEffect(tp, CARD_ID_0) then
		ct1 = 1
	end
	local g = Duel.GetMatchingGroup(s.filter, tp, LOCATION_DECK, 0, nil, e, tp)
	if g:GetCount() == 0 then
		return
	end
	Duel.BreakEffect()
	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
	local sg = g:SelectSubGroup(tp, aux.dncheck, false, 1, ct1)
	local sc = sg:GetFirst()
	while sc do
		if Duel.SpecialSummonStep(sc, 0, tp, tp, false, false, POS_FACEUP) then
			local e1 = Effect.CreateEffect(e:GetHandler())
			e1:SetType(EFFECT_TYPE_SINGLE)
			e1:SetCode(EFFECT_CANNOT_ATTACK)
			e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END)
			sc:RegisterEffect(e1)
		end
		sc = sg:GetNext()
	end
	Duel.SpecialSummonComplete()
	if ct2 > 0 and Duel.IsExistingMatchingCard(Card.IsCanBeSpecialSummoned, tp, 0, LOCATION_DECK, 1, nil, e, 0, 1 - tp, false, false) and Duel.SelectYesNo(1 - tp, aux.Stringid(id, 1)) then
		if Duel.IsPlayerAffectedByEffect(1 - tp, CARD_ID_0) then
			ct2 = 1
		end
		Duel.BreakEffect()
		Duel.Hint(HINT_SELECTMSG, 1 - tp, HINTMSG_SPSUMMON)
		local sg2 = Duel.SelectMatchingCard(1 - tp, Card.IsCanBeSpecialSummoned, tp, 0, LOCATION_DECK, 1, ct2, nil, e, 0, 1 - tp, false, false)
		if sg2:GetCount() > 0 then
			Duel.SpecialSummon(sg2, 0, 1 - tp, 1 - tp, false, false, POS_FACEUP)
		end
	end
end


U.A.
If you control 2 or more "U.A." monsters with different names: Shuffle as many monsters on the field as possible into the Deck, then Special Summon "U.A." monsters from your Deck that have different names from each other, up to the number of cards shuffled into your Main Deck, but those monsters cannot attack this turn. Then your opponent can Special Summon monsters from their Deck, up to the number of cards shuffled into their Main Deck. You can only activate 1 "U.A. Turnover Tactics" per turn.
-- U.A.
local CARD_ID_0 = 59822133 --Blue-Eyes Spirit Dragon
local SETCARD_ID_0 = 0xb2 --U.A.
local s, id, o = GetID()
function s.initial_effect(c)
	--activate
	local e1 = Effect.CreateEffect(c)
	e1:SetCategory(CATEGORY_TODECK + CATEGORY_SPECIAL_SUMMON)
	e1:SetType(EFFECT_TYPE_ACTIVATE)
	e1:SetCode(EVENT_FREE_CHAIN)
	e1:SetCountLimit(1, id + EFFECT_COUNT_CODE_OATH)
	e1:SetCondition(s.condition)
	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)
end
function s.condition(e, tp, eg, ep, ev, re, r, rp)
	local g = Duel.GetMatchingGroup(s.cfilter, tp, LOCATION_MZONE, 0, nil)
	return g:GetClassCount(Card.GetCode) >= 2
end
function s.filter(c, e, tp)
	return c:IsSetCard(SETCARD_ID_0) and c:IsCanBeSpecialSummoned(e, 0, tp, false, false)
end
function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
	if chk == 0 then
		return Duel.IsExistingMatchingCard(Card.IsAbleToDeck, tp, LOCATION_MZONE, LOCATION_MZONE, 1, nil) and Duel.IsExistingMatchingCard(s.filter, tp, LOCATION_DECK, 0, 1, nil, e, tp)
	end
	local g = Duel.GetMatchingGroup(Card.IsAbleToDeck, tp, LOCATION_MZONE, LOCATION_MZONE, nil)
	Duel.SetOperationInfo(0, CATEGORY_TODECK, g, g:GetCount(), 0, 0)
	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, nil, 1, tp, LOCATION_DECK)
end
function s.locfilter(c, sp)
	return c:IsLocation(LOCATION_DECK) and c:IsControler(sp)
end
function s.activate(e, tp, eg, ep, ev, re, r, rp)
	local tg = Duel.GetMatchingGroup(Card.IsAbleToDeck, tp, LOCATION_MZONE, LOCATION_MZONE, nil)
	Duel.SendtoDeck(tg, nil, SEQ_DECKSHUFFLE, REASON_EFFECT)
	Duel.ShuffleDeck(tp)
	local ct1 = Duel.GetOperatedGroup():FilterCount(s.locfilter, nil, tp)
	local ct2 = Duel.GetOperatedGroup():FilterCount(s.locfilter, nil, 1 - tp)
	if ct1 > Duel.GetLocationCount(tp, LOCATION_MZONE) then
		ct1 = Duel.GetLocationCount(tp, LOCATION_MZONE)
	end
	if ct2 > Duel.GetLocationCount(1 - tp, LOCATION_MZONE) then
		ct2 = Duel.GetLocationCount(1 - tp, LOCATION_MZONE)
	end
	if ct1 <= 0 then
		return
	end
	if Duel.IsPlayerAffectedByEffect(tp, CARD_ID_0) then
		ct1 = 1
	end
	local g = Duel.GetMatchingGroup(s.filter, tp, LOCATION_DECK, 0, nil, e, tp)
	if g:GetCount() == 0 then
		return
	end
	Duel.BreakEffect()
	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
	local sg = g:SelectSubGroup(tp, aux.dncheck, false, 1, ct1)
	local sc = sg:GetFirst()
	while sc do
		if Duel.SpecialSummonStep(sc, 0, tp, tp, false, false, POS_FACEUP) then
			local e1 = Effect.CreateEffect(e:GetHandler())
			e1:SetType(EFFECT_TYPE_SINGLE)
			e1:SetCode(EFFECT_CANNOT_ATTACK)
			e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END)
			sc:RegisterEffect(e1)
		end
		sc = sg:GetNext()
	end
	Duel.SpecialSummonComplete()
	if ct2 > 0 and Duel.IsExistingMatchingCard(Card.IsCanBeSpecialSummoned, tp, 0, LOCATION_DECK, 1, nil, e, 0, 1 - tp, false, false) and Duel.SelectYesNo(1 - tp, aux.Stringid(id, 1)) then
		if Duel.IsPlayerAffectedByEffect(1 - tp, CARD_ID_0) then
			ct2 = 1
		end
		Duel.BreakEffect()
		Duel.Hint(HINT_SELECTMSG, 1 - tp, HINTMSG_SPSUMMON)
		local sg2 = Duel.SelectMatchingCard(1 - tp, Card.IsCanBeSpecialSummoned, tp, 0, LOCATION_DECK, 1, ct2, nil, e, 0, 1 - tp, false, false)
		if sg2:GetCount() > 0 then
			Duel.SpecialSummon(sg2, 0, 1 - tp, 1 - tp, false, false, POS_FACEUP)
		end
	end
end

