name: S-Force
card_text: 3 Effect Monsters, including an "S-Force" monster
  You cannot Summon/Set monsters to a zone(s) this card points to. (Quick Effect): You can target 1 face-up Effect Monster your opponent controls; negate its effects until the end of this turn, then you can move that opponent's monster to their Monster Zone this card points to. You can only use this effect of "S-Force Justify" once per turn. At the start of the Damage Step, if this card attacks: You can banish all monsters this card points to.
lua: local s, id, o = GetID()
  function s.initial_effect(c)
  	--link summon
  	aux.AddLinkProcedure(c, aux.FilterBoolFunction(Card.IsLinkType, TYPE_EFFECT), 3, 3, s.lcheck)
  	c:EnableReviveLimit()
  	--zone limit
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_FIELD)
  	e1:SetCode(EFFECT_MUST_USE_MZONE)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET + EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_UNCOPYABLE)
  	e1:SetTargetRange(1, 0)
  	e1:SetValue(s.zonelimit)
  	c:RegisterEffect(e1)
  	--disable
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 0))
  	e2:SetCategory(CATEGORY_DISABLE)
  	e2:SetType(EFFECT_TYPE_QUICK_O)
  	e2:SetCode(EVENT_FREE_CHAIN)
  	e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetHintTiming(0, TIMINGS_CHECK_MONSTER + TIMING_END_PHASE)
  	e2:SetCountLimit(1, id)
  	e2:SetTarget(s.distg)
  	e2:SetOperation(s.disop)
  	c:RegisterEffect(e2)
  	--remove
  	local e3 = Effect.CreateEffect(c)
  	e3:SetDescription(aux.Stringid(id, 1))
  	e3:SetCategory(CATEGORY_REMOVE)
  	e3:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e3:SetCode(EVENT_BATTLE_START)
  	e3:SetCondition(s.rmcon)
  	e3:SetTarget(s.rmtg)
  	e3:SetOperation(s.rmop)
  	c:RegisterEffect(e3)
  end
  function s.lcheck(g)
  	return g:IsExists(Card.IsLinkSetCard, 1, nil, 0x156)
  end
  function s.zonelimit(e)
  	return 0x7f007f & ~e:GetHandler():GetLinkedZone()
  end
  function s.distg(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(1 - tp) and aux.NegateEffectMonsterFilter(chkc)
  	end
  	if chk == 0 then
  		return Duel.IsExistingTarget(aux.NegateEffectMonsterFilter, tp, 0, LOCATION_MZONE, 1, nil)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_DISABLE)
  	local g = Duel.SelectTarget(tp, aux.NegateEffectMonsterFilter, tp, 0, LOCATION_MZONE, 1, 1, nil)
  	Duel.SetOperationInfo(0, CATEGORY_DISABLE, g, 1, 0, 0)
  end
  function s.disop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local tc = Duel.GetFirstTarget()
  	if tc:IsFaceup() and tc:IsRelateToEffect(e) and tc:IsCanBeDisabledByEffect(e) then
  		Duel.NegateRelatedChain(tc, RESET_TURN_SET)
  		local e1 = Effect.CreateEffect(c)
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetCode(EFFECT_DISABLE)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END)
  		tc:RegisterEffect(e1)
  		local e2 = Effect.CreateEffect(c)
  		e2:SetType(EFFECT_TYPE_SINGLE)
  		e2:SetCode(EFFECT_DISABLE_EFFECT)
  		e2:SetValue(RESET_TURN_SET)
  		e2:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END)
  		tc:RegisterEffect(e2)
  		if not c:IsRelateToEffect(e) or c:IsFacedown() or tc:IsImmuneToEffect(e) then
  			return
  		end
  		Duel.AdjustInstantly()
  		local zone = bit.band(c:GetLinkedZone(1 - tp), 0x1f)
  		if tc:IsDisabled() and tc:IsControler(1 - tp) and Duel.GetLocationCount(1 - tp, LOCATION_MZONE, PLAYER_NONE, 0, zone) > 0 and Duel.SelectYesNo(tp, aux.Stringid(id, 2)) then
  			local s = 0
  			local flag = bit.bxor(zone, 0xff) * 0x10000
  			Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TOZONE)
  			s = Duel.SelectDisableField(tp, 1, 0, LOCATION_MZONE, flag) / 0x10000
  			local nseq = 0
  			if s == 1 then
  				nseq = 0
  			elseif s == 2 then
  				nseq = 1
  			elseif s == 4 then
  				nseq = 2
  			elseif s == 8 then
  				nseq = 3
  			else
  				nseq = 4
  			end
  			Duel.MoveSequence(tc, nseq)
  		end
  	end
  end
  function s.rmcon(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.GetAttacker() == e:GetHandler()
  end
  function s.rmtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	local rg = e:GetHandler():GetLinkedGroup():Filter(Card.IsAbleToRemove, nil)
  	if chk == 0 then
  		return #rg > 0
  	end
  	Duel.SetOperationInfo(0, CATEGORY_REMOVE, rg, #rg, 0, 0)
  end
  function s.rmop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if c:IsFaceup() and c:IsRelateToEffect(e) then
  		local rg = c:GetLinkedGroup():Filter(Card.IsAbleToRemove, nil)
  		if #rg > 0 then
  			Duel.Remove(rg, POS_FACEUP, REASON_EFFECT)
  		end
  	end
  end
  
  
source_text: S-Force
  3 Effect Monsters, including an "S-Force" monster
  You cannot Summon/Set monsters to a zone(s) this card points to. (Quick Effect): You can target 1 face-up Effect Monster your opponent controls; negate its effects until the end of this turn, then you can move that opponent's monster to their Monster Zone this card points to. You can only use this effect of "S-Force Justify" once per turn. At the start of the Damage Step, if this card attacks: You can banish all monsters this card points to.
target_text: -- S-Force
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--link summon
  	aux.AddLinkProcedure(c, aux.FilterBoolFunction(Card.IsLinkType, TYPE_EFFECT), 3, 3, s.lcheck)
  	c:EnableReviveLimit()
  	--zone limit
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_FIELD)
  	e1:SetCode(EFFECT_MUST_USE_MZONE)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET + EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_UNCOPYABLE)
  	e1:SetTargetRange(1, 0)
  	e1:SetValue(s.zonelimit)
  	c:RegisterEffect(e1)
  	--disable
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 0))
  	e2:SetCategory(CATEGORY_DISABLE)
  	e2:SetType(EFFECT_TYPE_QUICK_O)
  	e2:SetCode(EVENT_FREE_CHAIN)
  	e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetHintTiming(0, TIMINGS_CHECK_MONSTER + TIMING_END_PHASE)
  	e2:SetCountLimit(1, id)
  	e2:SetTarget(s.distg)
  	e2:SetOperation(s.disop)
  	c:RegisterEffect(e2)
  	--remove
  	local e3 = Effect.CreateEffect(c)
  	e3:SetDescription(aux.Stringid(id, 1))
  	e3:SetCategory(CATEGORY_REMOVE)
  	e3:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e3:SetCode(EVENT_BATTLE_START)
  	e3:SetCondition(s.rmcon)
  	e3:SetTarget(s.rmtg)
  	e3:SetOperation(s.rmop)
  	c:RegisterEffect(e3)
  end
  function s.lcheck(g)
  	return g:IsExists(Card.IsLinkSetCard, 1, nil, 0x156)
  end
  function s.zonelimit(e)
  	return 0x7f007f & ~e:GetHandler():GetLinkedZone()
  end
  function s.distg(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(1 - tp) and aux.NegateEffectMonsterFilter(chkc)
  	end
  	if chk == 0 then
  		return Duel.IsExistingTarget(aux.NegateEffectMonsterFilter, tp, 0, LOCATION_MZONE, 1, nil)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_DISABLE)
  	local g = Duel.SelectTarget(tp, aux.NegateEffectMonsterFilter, tp, 0, LOCATION_MZONE, 1, 1, nil)
  	Duel.SetOperationInfo(0, CATEGORY_DISABLE, g, 1, 0, 0)
  end
  function s.disop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local tc = Duel.GetFirstTarget()
  	if tc:IsFaceup() and tc:IsRelateToEffect(e) and tc:IsCanBeDisabledByEffect(e) then
  		Duel.NegateRelatedChain(tc, RESET_TURN_SET)
  		local e1 = Effect.CreateEffect(c)
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetCode(EFFECT_DISABLE)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END)
  		tc:RegisterEffect(e1)
  		local e2 = Effect.CreateEffect(c)
  		e2:SetType(EFFECT_TYPE_SINGLE)
  		e2:SetCode(EFFECT_DISABLE_EFFECT)
  		e2:SetValue(RESET_TURN_SET)
  		e2:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END)
  		tc:RegisterEffect(e2)
  		if not c:IsRelateToEffect(e) or c:IsFacedown() or tc:IsImmuneToEffect(e) then
  			return
  		end
  		Duel.AdjustInstantly()
  		local zone = bit.band(c:GetLinkedZone(1 - tp), 0x1f)
  		if tc:IsDisabled() and tc:IsControler(1 - tp) and Duel.GetLocationCount(1 - tp, LOCATION_MZONE, PLAYER_NONE, 0, zone) > 0 and Duel.SelectYesNo(tp, aux.Stringid(id, 2)) then
  			local s = 0
  			local flag = bit.bxor(zone, 0xff) * 0x10000
  			Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TOZONE)
  			s = Duel.SelectDisableField(tp, 1, 0, LOCATION_MZONE, flag) / 0x10000
  			local nseq = 0
  			if s == 1 then
  				nseq = 0
  			elseif s == 2 then
  				nseq = 1
  			elseif s == 4 then
  				nseq = 2
  			elseif s == 8 then
  				nseq = 3
  			else
  				nseq = 4
  			end
  			Duel.MoveSequence(tc, nseq)
  		end
  	end
  end
  function s.rmcon(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.GetAttacker() == e:GetHandler()
  end
  function s.rmtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	local rg = e:GetHandler():GetLinkedGroup():Filter(Card.IsAbleToRemove, nil)
  	if chk == 0 then
  		return #rg > 0
  	end
  	Duel.SetOperationInfo(0, CATEGORY_REMOVE, rg, #rg, 0, 0)
  end
  function s.rmop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if c:IsFaceup() and c:IsRelateToEffect(e) then
  		local rg = c:GetLinkedGroup():Filter(Card.IsAbleToRemove, nil)
  		if #rg > 0 then
  			Duel.Remove(rg, POS_FACEUP, REASON_EFFECT)
  		end
  	end
  end
  
  