name: Scrum
card_text: While you control 2 or more face-up Defense Position monsters, your opponent cannot target Defense Position monsters you control with card effects, and they cannot be destroyed by your opponent's card effects. If this card would be destroyed by card effect, you can destroy 1 card in your Spell & Trap Zone instead.
lua: local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	c:RegisterEffect(e1)
  	--indes
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_FIELD)
  	e2:SetCode(EFFECT_INDESTRUCTABLE_EFFECT)
  	e2:SetProperty(EFFECT_FLAG_SET_AVAILABLE)
  	e2:SetRange(LOCATION_SZONE)
  	e2:SetTargetRange(LOCATION_MZONE, 0)
  	e2:SetCondition(s.con)
  	e2:SetTarget(s.tg)
  	e2:SetValue(aux.indoval)
  	c:RegisterEffect(e2)
  	--cannot be target
  	local e3 = Effect.CreateEffect(c)
  	e3:SetType(EFFECT_TYPE_FIELD)
  	e3:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET)
  	e3:SetProperty(EFFECT_FLAG_SET_AVAILABLE + EFFECT_FLAG_IGNORE_IMMUNE)
  	e3:SetRange(LOCATION_SZONE)
  	e3:SetTargetRange(LOCATION_MZONE, 0)
  	e3:SetCondition(s.con)
  	e3:SetTarget(s.tg)
  	e3:SetValue(aux.tgoval)
  	c:RegisterEffect(e3)
  	--destroy replace
  	local e4 = Effect.CreateEffect(c)
  	e4:SetType(EFFECT_TYPE_CONTINUOUS + EFFECT_TYPE_SINGLE)
  	e4:SetCode(EFFECT_DESTROY_REPLACE)
  	e4:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
  	e4:SetRange(LOCATION_SZONE)
  	e4:SetTarget(s.desreptg)
  	e4:SetOperation(s.desrepop)
  	c:RegisterEffect(e4)
  end
  function s.cfilter(c)
  	return c:IsFaceup() and c:IsPosition(POS_FACEUP_DEFENSE)
  end
  function s.con(e)
  	return Duel.IsExistingMatchingCard(s.cfilter, e:GetHandlerPlayer(), LOCATION_MZONE, 0, 2, nil)
  end
  function s.tg(e, c)
  	return c:IsDefensePos()
  end
  function s.repfilter(c, e)
  	return c:GetSequence() < 5 and c:IsDestructable(e) and not c:IsStatus(STATUS_DESTROY_CONFIRMED + STATUS_BATTLE_DESTROYED)
  end
  function s.desreptg(e, tp, eg, ep, ev, re, r, rp, chk)
  	local c = e:GetHandler()
  	if chk == 0 then
  		return not c:IsReason(REASON_REPLACE) and c:IsOnField() and c:IsFaceup() and Duel.IsExistingMatchingCard(s.repfilter, tp, LOCATION_SZONE, 0, 1, c, e)
  	end
  	if Duel.SelectEffectYesNo(tp, c, 96) then
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_DESREPLACE)
  		local g = Duel.SelectMatchingCard(tp, s.repfilter, tp, LOCATION_SZONE, 0, 1, 1, c, e)
  		e:SetLabelObject(g:GetFirst())
  		Duel.HintSelection(g)
  		g:GetFirst():SetStatus(STATUS_DESTROY_CONFIRMED, true)
  		return true
  	else
  		return false
  	end
  end
  function s.desrepop(e, tp, eg, ep, ev, re, r, rp)
  	local tc = e:GetLabelObject()
  	tc:SetStatus(STATUS_DESTROY_CONFIRMED, false)
  	Duel.Destroy(tc, REASON_EFFECT + REASON_REPLACE)
  end
  
  
source_text: Scrum
  While you control 2 or more face-up Defense Position monsters, your opponent cannot target Defense Position monsters you control with card effects, and they cannot be destroyed by your opponent's card effects. If this card would be destroyed by card effect, you can destroy 1 card in your Spell & Trap Zone instead.
target_text: -- Scrum
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	c:RegisterEffect(e1)
  	--indes
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_FIELD)
  	e2:SetCode(EFFECT_INDESTRUCTABLE_EFFECT)
  	e2:SetProperty(EFFECT_FLAG_SET_AVAILABLE)
  	e2:SetRange(LOCATION_SZONE)
  	e2:SetTargetRange(LOCATION_MZONE, 0)
  	e2:SetCondition(s.con)
  	e2:SetTarget(s.tg)
  	e2:SetValue(aux.indoval)
  	c:RegisterEffect(e2)
  	--cannot be target
  	local e3 = Effect.CreateEffect(c)
  	e3:SetType(EFFECT_TYPE_FIELD)
  	e3:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET)
  	e3:SetProperty(EFFECT_FLAG_SET_AVAILABLE + EFFECT_FLAG_IGNORE_IMMUNE)
  	e3:SetRange(LOCATION_SZONE)
  	e3:SetTargetRange(LOCATION_MZONE, 0)
  	e3:SetCondition(s.con)
  	e3:SetTarget(s.tg)
  	e3:SetValue(aux.tgoval)
  	c:RegisterEffect(e3)
  	--destroy replace
  	local e4 = Effect.CreateEffect(c)
  	e4:SetType(EFFECT_TYPE_CONTINUOUS + EFFECT_TYPE_SINGLE)
  	e4:SetCode(EFFECT_DESTROY_REPLACE)
  	e4:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
  	e4:SetRange(LOCATION_SZONE)
  	e4:SetTarget(s.desreptg)
  	e4:SetOperation(s.desrepop)
  	c:RegisterEffect(e4)
  end
  function s.cfilter(c)
  	return c:IsFaceup() and c:IsPosition(POS_FACEUP_DEFENSE)
  end
  function s.con(e)
  	return Duel.IsExistingMatchingCard(s.cfilter, e:GetHandlerPlayer(), LOCATION_MZONE, 0, 2, nil)
  end
  function s.tg(e, c)
  	return c:IsDefensePos()
  end
  function s.repfilter(c, e)
  	return c:GetSequence() < 5 and c:IsDestructable(e) and not c:IsStatus(STATUS_DESTROY_CONFIRMED + STATUS_BATTLE_DESTROYED)
  end
  function s.desreptg(e, tp, eg, ep, ev, re, r, rp, chk)
  	local c = e:GetHandler()
  	if chk == 0 then
  		return not c:IsReason(REASON_REPLACE) and c:IsOnField() and c:IsFaceup() and Duel.IsExistingMatchingCard(s.repfilter, tp, LOCATION_SZONE, 0, 1, c, e)
  	end
  	if Duel.SelectEffectYesNo(tp, c, 96) then
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_DESREPLACE)
  		local g = Duel.SelectMatchingCard(tp, s.repfilter, tp, LOCATION_SZONE, 0, 1, 1, c, e)
  		e:SetLabelObject(g:GetFirst())
  		Duel.HintSelection(g)
  		g:GetFirst():SetStatus(STATUS_DESTROY_CONFIRMED, true)
  		return true
  	else
  		return false
  	end
  end
  function s.desrepop(e, tp, eg, ep, ev, re, r, rp)
  	local tc = e:GetLabelObject()
  	tc:SetStatus(STATUS_DESTROY_CONFIRMED, false)
  	Duel.Destroy(tc, REASON_EFFECT + REASON_REPLACE)
  end
  
  