name: Terra
card_text: During your opponent's Battle Phase, if you control "Elemental HERO Terra Firma": This turn, all Level 4 or lower monsters your opponent controls that can attack a face-up "Elemental HERO Terra Firma" you control must attack it, and cannot otherwise attack.
external_ids: local CARD_ID_0 = 74711057 --Elemental HERO Terra Firma
  local SETCARD_ID_0 = 0x3008 --Elemental
  
lua: local CARD_ID_0 = 74711057 --Elemental HERO Terra Firma
  local SETCARD_ID_0 = 0x3008 --Elemental
  local s, id, o = GetID()
  function s.initial_effect(c)
  	aux.AddSetNameMonsterList(c, SETCARD_ID_0)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetHintTiming(0, TIMING_BATTLE_START)
  	e1:SetCondition(s.condition)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.activate)
  	c:RegisterEffect(e1)
  end
  function s.condition(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.GetTurnPlayer() ~= tp and (Duel.GetCurrentPhase() >= PHASE_BATTLE_START and Duel.GetCurrentPhase() <= PHASE_BATTLE)
  end
  function s.filter1(c)
  	return c:IsFaceup() and c:IsCode(CARD_ID_0)
  end
  function s.filter2(c)
  	return c:IsFaceup() and c:IsLevelBelow(4)
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.filter1, tp, LOCATION_MZONE, 0, 1, nil) and Duel.IsExistingMatchingCard(s.filter2, tp, 0, LOCATION_MZONE, 1, nil)
  	end
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	local e1 = Effect.CreateEffect(e:GetHandler())
  	e1:SetType(EFFECT_TYPE_FIELD)
  	e1:SetCode(EFFECT_MUST_ATTACK)
  	e1:SetTargetRange(0, LOCATION_MZONE)
  	e1:SetTarget(s.attg)
  	e1:SetReset(RESET_PHASE + PHASE_BATTLE)
  	Duel.RegisterEffect(e1, tp)
  	local e2 = e1:Clone()
  	e2:SetCode(EFFECT_MUST_ATTACK_MONSTER)
  	e2:SetValue(s.atklimit)
  	Duel.RegisterEffect(e2, tp)
  end
  function s.attg(e, c)
  	return c:IsLevelBelow(4)
  end
  function s.atklimit(e, c)
  	return c:IsCode(CARD_ID_0)
  end
  
  
source_text: Terra
  During your opponent's Battle Phase, if you control "Elemental HERO Terra Firma": This turn, all Level 4 or lower monsters your opponent controls that can attack a face-up "Elemental HERO Terra Firma" you control must attack it, and cannot otherwise attack.
target_text: -- Terra
  local CARD_ID_0 = 74711057 --Elemental HERO Terra Firma
  local SETCARD_ID_0 = 0x3008 --Elemental
  local s, id, o = GetID()
  function s.initial_effect(c)
  	aux.AddSetNameMonsterList(c, SETCARD_ID_0)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetHintTiming(0, TIMING_BATTLE_START)
  	e1:SetCondition(s.condition)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.activate)
  	c:RegisterEffect(e1)
  end
  function s.condition(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.GetTurnPlayer() ~= tp and (Duel.GetCurrentPhase() >= PHASE_BATTLE_START and Duel.GetCurrentPhase() <= PHASE_BATTLE)
  end
  function s.filter1(c)
  	return c:IsFaceup() and c:IsCode(CARD_ID_0)
  end
  function s.filter2(c)
  	return c:IsFaceup() and c:IsLevelBelow(4)
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.filter1, tp, LOCATION_MZONE, 0, 1, nil) and Duel.IsExistingMatchingCard(s.filter2, tp, 0, LOCATION_MZONE, 1, nil)
  	end
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	local e1 = Effect.CreateEffect(e:GetHandler())
  	e1:SetType(EFFECT_TYPE_FIELD)
  	e1:SetCode(EFFECT_MUST_ATTACK)
  	e1:SetTargetRange(0, LOCATION_MZONE)
  	e1:SetTarget(s.attg)
  	e1:SetReset(RESET_PHASE + PHASE_BATTLE)
  	Duel.RegisterEffect(e1, tp)
  	local e2 = e1:Clone()
  	e2:SetCode(EFFECT_MUST_ATTACK_MONSTER)
  	e2:SetValue(s.atklimit)
  	Duel.RegisterEffect(e2, tp)
  end
  function s.attg(e, c)
  	return c:IsLevelBelow(4)
  end
  function s.atklimit(e, c)
  	return c:IsCode(CARD_ID_0)
  end
  
  