name: Six
card_text: If you control 3 or more face-up "Six Samurai" monsters, you can activate 1 of these effects:
  ● Destroy all face-up monsters your opponent controls.
  ● Destroy all face-up Spell/Trap Cards your opponent controls.
  ● Destroy all Set Spell/Trap Cards your opponent controls.
external_ids: local SETCARD_ID_0 = 0x103d --Six
  
lua: local SETCARD_ID_0 = 0x103d --Six
  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:SetCondition(s.descon)
  	e1:SetTarget(s.destg)
  	e1:SetOperation(s.desop)
  	c:RegisterEffect(e1)
  end
  function s.confilter(c)
  	return c:IsFaceup() and c:IsSetCard(SETCARD_ID_0)
  end
  function s.descon(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.IsExistingMatchingCard(s.confilter, tp, LOCATION_MZONE, 0, 3, nil)
  end
  function s.filter1(c)
  	return c:IsFaceup()
  end
  function s.filter2(c)
  	return c:IsFaceup() and c:IsType(TYPE_SPELL + TYPE_TRAP)
  end
  function s.filter3(c)
  	return c:IsFacedown()
  end
  function s.destg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.filter1, tp, 0, LOCATION_MZONE, 1, nil)
  			or Duel.IsExistingMatchingCard(s.filter2, tp, 0, LOCATION_ONFIELD, 1, nil)
  			or Duel.IsExistingMatchingCard(s.filter3, tp, 0, LOCATION_SZONE, 1, nil)
  	end
  	local t = {}
  	local p = 1
  	if Duel.IsExistingMatchingCard(s.filter1, tp, 0, LOCATION_MZONE, 1, nil) then
  		t[p] = aux.Stringid(id, 0)
  		p = p + 1
  	end
  	if Duel.IsExistingMatchingCard(s.filter2, tp, 0, LOCATION_ONFIELD, 1, nil) then
  		t[p] = aux.Stringid(id, 1)
  		p = p + 1
  	end
  	if Duel.IsExistingMatchingCard(s.filter3, tp, 0, LOCATION_SZONE, 1, nil) then
  		t[p] = aux.Stringid(id, 2)
  		p = p + 1
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, aux.Stringid(id, 3))
  	local sel = Duel.SelectOption(tp, table.unpack(t)) + 1
  	local opt = t[sel] - aux.Stringid(id, 0)
  	local sg = nil
  	if opt == 0 then
  		sg = Duel.GetMatchingGroup(s.filter1, tp, 0, LOCATION_MZONE, nil)
  	elseif opt == 1 then
  		sg = Duel.GetMatchingGroup(s.filter2, tp, 0, LOCATION_ONFIELD, nil)
  	else
  		sg = Duel.GetMatchingGroup(s.filter3, tp, 0, LOCATION_SZONE, nil)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_DESTROY, sg, sg:GetCount(), 0, 0)
  	e:SetLabel(opt)
  end
  function s.desop(e, tp, eg, ep, ev, re, r, rp)
  	local opt = e:GetLabel()
  	local sg = nil
  	if opt == 0 then
  		sg = Duel.GetMatchingGroup(s.filter1, tp, 0, LOCATION_MZONE, nil)
  	elseif opt == 1 then
  		sg = Duel.GetMatchingGroup(s.filter2, tp, 0, LOCATION_ONFIELD, nil)
  	else
  		sg = Duel.GetMatchingGroup(s.filter3, tp, 0, LOCATION_SZONE, nil)
  	end
  	Duel.Destroy(sg, REASON_EFFECT)
  end
  
  
source_text: Six
  If you control 3 or more face-up "Six Samurai" monsters, you can activate 1 of these effects:
  ● Destroy all face-up monsters your opponent controls.
  ● Destroy all face-up Spell/Trap Cards your opponent controls.
  ● Destroy all Set Spell/Trap Cards your opponent controls.
target_text: -- Six
  local SETCARD_ID_0 = 0x103d --Six
  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:SetCondition(s.descon)
  	e1:SetTarget(s.destg)
  	e1:SetOperation(s.desop)
  	c:RegisterEffect(e1)
  end
  function s.confilter(c)
  	return c:IsFaceup() and c:IsSetCard(SETCARD_ID_0)
  end
  function s.descon(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.IsExistingMatchingCard(s.confilter, tp, LOCATION_MZONE, 0, 3, nil)
  end
  function s.filter1(c)
  	return c:IsFaceup()
  end
  function s.filter2(c)
  	return c:IsFaceup() and c:IsType(TYPE_SPELL + TYPE_TRAP)
  end
  function s.filter3(c)
  	return c:IsFacedown()
  end
  function s.destg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.filter1, tp, 0, LOCATION_MZONE, 1, nil)
  			or Duel.IsExistingMatchingCard(s.filter2, tp, 0, LOCATION_ONFIELD, 1, nil)
  			or Duel.IsExistingMatchingCard(s.filter3, tp, 0, LOCATION_SZONE, 1, nil)
  	end
  	local t = {}
  	local p = 1
  	if Duel.IsExistingMatchingCard(s.filter1, tp, 0, LOCATION_MZONE, 1, nil) then
  		t[p] = aux.Stringid(id, 0)
  		p = p + 1
  	end
  	if Duel.IsExistingMatchingCard(s.filter2, tp, 0, LOCATION_ONFIELD, 1, nil) then
  		t[p] = aux.Stringid(id, 1)
  		p = p + 1
  	end
  	if Duel.IsExistingMatchingCard(s.filter3, tp, 0, LOCATION_SZONE, 1, nil) then
  		t[p] = aux.Stringid(id, 2)
  		p = p + 1
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, aux.Stringid(id, 3))
  	local sel = Duel.SelectOption(tp, table.unpack(t)) + 1
  	local opt = t[sel] - aux.Stringid(id, 0)
  	local sg = nil
  	if opt == 0 then
  		sg = Duel.GetMatchingGroup(s.filter1, tp, 0, LOCATION_MZONE, nil)
  	elseif opt == 1 then
  		sg = Duel.GetMatchingGroup(s.filter2, tp, 0, LOCATION_ONFIELD, nil)
  	else
  		sg = Duel.GetMatchingGroup(s.filter3, tp, 0, LOCATION_SZONE, nil)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_DESTROY, sg, sg:GetCount(), 0, 0)
  	e:SetLabel(opt)
  end
  function s.desop(e, tp, eg, ep, ev, re, r, rp)
  	local opt = e:GetLabel()
  	local sg = nil
  	if opt == 0 then
  		sg = Duel.GetMatchingGroup(s.filter1, tp, 0, LOCATION_MZONE, nil)
  	elseif opt == 1 then
  		sg = Duel.GetMatchingGroup(s.filter2, tp, 0, LOCATION_ONFIELD, nil)
  	else
  		sg = Duel.GetMatchingGroup(s.filter3, tp, 0, LOCATION_SZONE, nil)
  	end
  	Duel.Destroy(sg, REASON_EFFECT)
  end
  
  