name: Light
card_text: At the start of your opponent's Battle Phase: You can target any number of Attack Position monsters your opponent controls; while this card is in your Monster Zone, those monsters must attack this card this turn, if able. Once per turn, when an attack is declared involving this card and an opponent's Attack Position monster: You can negate the attack, and if you do, inflict damage to your opponent equal to half the original ATK of that opponent's monster.
lua: local s, id, o = GetID()
  function s.initial_effect(c)
  	--must attack
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_O)
  	e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e1:SetCode(EVENT_PHASE + PHASE_BATTLE_START)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetCountLimit(1)
  	e1:SetCondition(s.atkcon1)
  	e1:SetTarget(s.atktg)
  	e1:SetOperation(s.atkop)
  	c:RegisterEffect(e1)
  	--negate attack
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 1))
  	e2:SetCategory(CATEGORY_DAMAGE)
  	e2:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_O)
  	e2:SetCode(EVENT_ATTACK_ANNOUNCE)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetCountLimit(1)
  	e2:SetCondition(s.damcon)
  	e2:SetTarget(s.damtg)
  	e2:SetOperation(s.damop)
  	c:RegisterEffect(e2)
  end
  function s.atkcon1(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.GetTurnPlayer() ~= tp
  end
  function s.atktg(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsControler(1 - tp) and chkc:IsLocation(LOCATION_MZONE) and chkc:IsAttackPos()
  	end
  	if chk == 0 then
  		return Duel.IsExistingTarget(Card.IsAttackPos, tp, 0, LOCATION_MZONE, 1, nil)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_ATTACK)
  	Duel.SelectTarget(tp, Card.IsAttackPos, tp, 0, LOCATION_MZONE, 1, 7, nil)
  end
  function s.atkop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if not (c:IsRelateToEffect(e) and c:IsFaceup() and c:IsControler(tp)) then
  		return
  	end
  	local tg = Duel.GetChainInfo(0, CHAININFO_TARGET_CARDS):Filter(Card.IsRelateToEffect, nil, e)
  	local tc = tg:GetFirst()
  	while tc do
  		c:CreateRelation(tc, RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END)
  		local e1 = Effect.CreateEffect(c)
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
  		e1:SetCode(EFFECT_MUST_ATTACK)
  		e1:SetCondition(s.atkcon2)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END)
  		tc:RegisterEffect(e1)
  		local e2 = e1:Clone()
  		e2:SetCode(EFFECT_MUST_ATTACK_MONSTER)
  		e2:SetValue(s.atklimit)
  		tc:RegisterEffect(e2)
  		tc = tg:GetNext()
  	end
  end
  function s.atkcon2(e, tp, eg, ep, ev, re, r, rp)
  	return e:GetOwner():IsRelateToCard(e:GetHandler())
  end
  function s.atklimit(e, c)
  	return c == e:GetOwner()
  end
  function s.damcon(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local bc = c:GetBattleTarget()
  	return bc and bc:IsPosition(POS_FACEUP_ATTACK) and (Duel.GetAttacker() == c or Duel.GetAttackTarget() == c)
  end
  function s.damtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return true
  	end
  	local dam = math.ceil(e:GetHandler():GetBattleTarget():GetBaseAttack() / 2)
  	Duel.SetOperationInfo(0, CATEGORY_DAMAGE, nil, 0, 1 - tp, dam)
  end
  function s.damop(e, tp, eg, ep, ev, re, r, rp)
  	local bc = e:GetHandler():GetBattleTarget()
  	if Duel.NegateAttack() and bc and bc:IsRelateToBattle() and bc:IsControler(1 - tp) then
  		Duel.Damage(1 - tp, math.ceil(bc:GetBaseAttack() / 2), REASON_EFFECT)
  	end
  end
  
  
source_text: Light
  At the start of your opponent's Battle Phase: You can target any number of Attack Position monsters your opponent controls; while this card is in your Monster Zone, those monsters must attack this card this turn, if able. Once per turn, when an attack is declared involving this card and an opponent's Attack Position monster: You can negate the attack, and if you do, inflict damage to your opponent equal to half the original ATK of that opponent's monster.
target_text: -- Light
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--must attack
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_O)
  	e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e1:SetCode(EVENT_PHASE + PHASE_BATTLE_START)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetCountLimit(1)
  	e1:SetCondition(s.atkcon1)
  	e1:SetTarget(s.atktg)
  	e1:SetOperation(s.atkop)
  	c:RegisterEffect(e1)
  	--negate attack
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 1))
  	e2:SetCategory(CATEGORY_DAMAGE)
  	e2:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_O)
  	e2:SetCode(EVENT_ATTACK_ANNOUNCE)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetCountLimit(1)
  	e2:SetCondition(s.damcon)
  	e2:SetTarget(s.damtg)
  	e2:SetOperation(s.damop)
  	c:RegisterEffect(e2)
  end
  function s.atkcon1(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.GetTurnPlayer() ~= tp
  end
  function s.atktg(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsControler(1 - tp) and chkc:IsLocation(LOCATION_MZONE) and chkc:IsAttackPos()
  	end
  	if chk == 0 then
  		return Duel.IsExistingTarget(Card.IsAttackPos, tp, 0, LOCATION_MZONE, 1, nil)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_ATTACK)
  	Duel.SelectTarget(tp, Card.IsAttackPos, tp, 0, LOCATION_MZONE, 1, 7, nil)
  end
  function s.atkop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if not (c:IsRelateToEffect(e) and c:IsFaceup() and c:IsControler(tp)) then
  		return
  	end
  	local tg = Duel.GetChainInfo(0, CHAININFO_TARGET_CARDS):Filter(Card.IsRelateToEffect, nil, e)
  	local tc = tg:GetFirst()
  	while tc do
  		c:CreateRelation(tc, RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END)
  		local e1 = Effect.CreateEffect(c)
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
  		e1:SetCode(EFFECT_MUST_ATTACK)
  		e1:SetCondition(s.atkcon2)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END)
  		tc:RegisterEffect(e1)
  		local e2 = e1:Clone()
  		e2:SetCode(EFFECT_MUST_ATTACK_MONSTER)
  		e2:SetValue(s.atklimit)
  		tc:RegisterEffect(e2)
  		tc = tg:GetNext()
  	end
  end
  function s.atkcon2(e, tp, eg, ep, ev, re, r, rp)
  	return e:GetOwner():IsRelateToCard(e:GetHandler())
  end
  function s.atklimit(e, c)
  	return c == e:GetOwner()
  end
  function s.damcon(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local bc = c:GetBattleTarget()
  	return bc and bc:IsPosition(POS_FACEUP_ATTACK) and (Duel.GetAttacker() == c or Duel.GetAttackTarget() == c)
  end
  function s.damtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return true
  	end
  	local dam = math.ceil(e:GetHandler():GetBattleTarget():GetBaseAttack() / 2)
  	Duel.SetOperationInfo(0, CATEGORY_DAMAGE, nil, 0, 1 - tp, dam)
  end
  function s.damop(e, tp, eg, ep, ev, re, r, rp)
  	local bc = e:GetHandler():GetBattleTarget()
  	if Duel.NegateAttack() and bc and bc:IsRelateToBattle() and bc:IsControler(1 - tp) then
  		Duel.Damage(1 - tp, math.ceil(bc:GetBaseAttack() / 2), REASON_EFFECT)
  	end
  end
  
  