Saber
Destroy a number of face-up cards on the field equal to the number of face-up Attack Position "X-Saber" monsters you control.
local SETCARD_ID_0 = 0x100d --X-Saber

local SETCARD_ID_0 = 0x100d --X-Saber
local s, id, o = GetID()
function s.initial_effect(c)
	--Activate
	local e1 = Effect.CreateEffect(c)
	e1:SetCategory(CATEGORY_DESTROY)
	e1:SetType(EFFECT_TYPE_ACTIVATE)
	e1:SetCode(EVENT_FREE_CHAIN)
	e1:SetTarget(s.target)
	e1:SetOperation(s.activate)
	c:RegisterEffect(e1)
end
function s.filter(c)
	return c:IsFaceup()
end
function s.cfilter(c)
	return c:IsFaceup() and c:IsAttackPos() and c:IsSetCard(SETCARD_ID_0)
end
function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
	local c = e:GetHandler()
	if chk == 0 then
		local ct = Duel.GetMatchingGroupCount(s.cfilter, tp, LOCATION_MZONE, 0, nil)
		e:SetLabel(ct)
		return Duel.IsExistingMatchingCard(s.filter, tp, LOCATION_ONFIELD, LOCATION_ONFIELD, ct, c)
	end
	local ct = e:GetLabel()
	local sg = Duel.GetMatchingGroup(s.filter, tp, LOCATION_ONFIELD, LOCATION_ONFIELD, c)
	Duel.SetOperationInfo(0, CATEGORY_DESTROY, sg, ct, 0, 0)
end
function s.activate(e, tp, eg, ep, ev, re, r, rp)
	local ct = Duel.GetMatchingGroupCount(s.cfilter, tp, LOCATION_MZONE, 0, nil)
	local g = Duel.GetMatchingGroup(s.filter, tp, LOCATION_ONFIELD, LOCATION_ONFIELD, aux.ExceptThisCard(e))
	if g:GetCount() >= ct then
		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_DESTROY)
		local sg = g:Select(tp, ct, ct, nil)
		Duel.HintSelection(sg)
		Duel.Destroy(sg, REASON_EFFECT)
	end
end


Saber
Destroy a number of face-up cards on the field equal to the number of face-up Attack Position "X-Saber" monsters you control.
-- Saber
local SETCARD_ID_0 = 0x100d --X-Saber
local s, id, o = GetID()
function s.initial_effect(c)
	--Activate
	local e1 = Effect.CreateEffect(c)
	e1:SetCategory(CATEGORY_DESTROY)
	e1:SetType(EFFECT_TYPE_ACTIVATE)
	e1:SetCode(EVENT_FREE_CHAIN)
	e1:SetTarget(s.target)
	e1:SetOperation(s.activate)
	c:RegisterEffect(e1)
end
function s.filter(c)
	return c:IsFaceup()
end
function s.cfilter(c)
	return c:IsFaceup() and c:IsAttackPos() and c:IsSetCard(SETCARD_ID_0)
end
function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
	local c = e:GetHandler()
	if chk == 0 then
		local ct = Duel.GetMatchingGroupCount(s.cfilter, tp, LOCATION_MZONE, 0, nil)
		e:SetLabel(ct)
		return Duel.IsExistingMatchingCard(s.filter, tp, LOCATION_ONFIELD, LOCATION_ONFIELD, ct, c)
	end
	local ct = e:GetLabel()
	local sg = Duel.GetMatchingGroup(s.filter, tp, LOCATION_ONFIELD, LOCATION_ONFIELD, c)
	Duel.SetOperationInfo(0, CATEGORY_DESTROY, sg, ct, 0, 0)
end
function s.activate(e, tp, eg, ep, ev, re, r, rp)
	local ct = Duel.GetMatchingGroupCount(s.cfilter, tp, LOCATION_MZONE, 0, nil)
	local g = Duel.GetMatchingGroup(s.filter, tp, LOCATION_ONFIELD, LOCATION_ONFIELD, aux.ExceptThisCard(e))
	if g:GetCount() >= ct then
		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_DESTROY)
		local sg = g:Select(tp, ct, ct, nil)
		Duel.HintSelection(sg)
		Duel.Destroy(sg, REASON_EFFECT)
	end
end

