name: Negate
card_text: When an opponent's monster declares an attack: Target the attacking monster; negate the attack, then end the Battle Phase.
lua: local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_ATTACK_ANNOUNCE)
  	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.GetAttacker():IsControler(1 - tp)
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	local tg = Duel.GetAttacker()
  	if chkc then
  		return chkc == tg
  	end
  	if chk == 0 then
  		return tg:IsOnField() and tg:IsCanBeEffectTarget(e)
  	end
  	Duel.SetTargetCard(tg)
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	local tc = Duel.GetAttacker()
  	if tc:IsRelateToEffect(e) and Duel.NegateAttack() then
  		Duel.BreakEffect()
  		Duel.SkipPhase(1 - tp, PHASE_BATTLE, RESET_PHASE + PHASE_BATTLE_STEP, 1)
  	end
  end
  
  
source_text: Negate
  When an opponent's monster declares an attack: Target the attacking monster; negate the attack, then end the Battle Phase.
target_text: -- Negate
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_ATTACK_ANNOUNCE)
  	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.GetAttacker():IsControler(1 - tp)
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	local tg = Duel.GetAttacker()
  	if chkc then
  		return chkc == tg
  	end
  	if chk == 0 then
  		return tg:IsOnField() and tg:IsCanBeEffectTarget(e)
  	end
  	Duel.SetTargetCard(tg)
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	local tc = Duel.GetAttacker()
  	if tc:IsRelateToEffect(e) and Duel.NegateAttack() then
  		Duel.BreakEffect()
  		Duel.SkipPhase(1 - tp, PHASE_BATTLE, RESET_PHASE + PHASE_BATTLE_STEP, 1)
  	end
  end
  
  