name: Reject
card_text: When an opponent's monster declares a direct attack: End the Battle Phase, then you can Special Summon 1 Tuner and 1 Synchro Monster from your Graveyard, but they have their effects negated.
lua: local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_ATTACK_ANNOUNCE)
  	e1:SetCondition(s.condition)
  	e1:SetCost(s.cost)
  	e1:SetOperation(s.activate)
  	c:RegisterEffect(e1)
  end
  function s.condition(e, tp, eg, ep, ev, re, r, rp)
  	return eg:GetFirst():IsControler(1 - tp) and Duel.GetAttackTarget() == nil
  end
  function s.cost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return true
  	end
  	Duel.RegisterFlagEffect(tp, id, RESET_PHASE + PHASE_BATTLE, 0, 1)
  end
  function s.filter(c, e, tp)
  	return c:IsType(TYPE_TUNER) and c:IsCanBeSpecialSummoned(e, 0, tp, false, false) and Duel.IsExistingMatchingCard(s.filter2, tp, LOCATION_GRAVE, 0, 1, c, e, tp)
  end
  function s.filter2(c, e, tp)
  	return c:IsType(TYPE_SYNCHRO) and c:IsCanBeSpecialSummoned(e, 0, tp, false, false)
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	if Duel.GetFlagEffect(tp, id) == 0 then
  		return
  	end
  	local c = e:GetHandler()
  	Duel.SkipPhase(1 - tp, PHASE_BATTLE, RESET_PHASE + PHASE_BATTLE_STEP, 1)
  	if Duel.GetLocationCount(tp, LOCATION_MZONE) > 1 and Duel.IsExistingMatchingCard(s.filter, tp, LOCATION_GRAVE, 0, 1, nil, e, tp) and Duel.SelectYesNo(tp, aux.Stringid(id, 0)) then
  		Duel.BreakEffect()
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
  		local g1 = Duel.SelectMatchingCard(tp, aux.NecroValleyFilter(s.filter), tp, LOCATION_GRAVE, 0, 1, 1, nil, e, tp)
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
  		local g2 = Duel.SelectMatchingCard(tp, aux.NecroValleyFilter(s.filter2), tp, LOCATION_GRAVE, 0, 1, 1, g1:GetFirst(), e, tp)
  		g1:Merge(g2)
  		Duel.SpecialSummon(g1, 0, tp, tp, false, false, POS_FACEUP)
  		local tc = g1:GetFirst()
  		while tc do
  			local e1 = Effect.CreateEffect(c)
  			e1:SetType(EFFECT_TYPE_SINGLE)
  			e1:SetCode(EFFECT_DISABLE)
  			e1:SetReset(RESET_EVENT + RESETS_STANDARD)
  			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)
  			tc:RegisterEffect(e2)
  			tc = g1:GetNext()
  		end
  	end
  end
  
  
source_text: Reject
  When an opponent's monster declares a direct attack: End the Battle Phase, then you can Special Summon 1 Tuner and 1 Synchro Monster from your Graveyard, but they have their effects negated.
target_text: -- Reject
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_ATTACK_ANNOUNCE)
  	e1:SetCondition(s.condition)
  	e1:SetCost(s.cost)
  	e1:SetOperation(s.activate)
  	c:RegisterEffect(e1)
  end
  function s.condition(e, tp, eg, ep, ev, re, r, rp)
  	return eg:GetFirst():IsControler(1 - tp) and Duel.GetAttackTarget() == nil
  end
  function s.cost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return true
  	end
  	Duel.RegisterFlagEffect(tp, id, RESET_PHASE + PHASE_BATTLE, 0, 1)
  end
  function s.filter(c, e, tp)
  	return c:IsType(TYPE_TUNER) and c:IsCanBeSpecialSummoned(e, 0, tp, false, false) and Duel.IsExistingMatchingCard(s.filter2, tp, LOCATION_GRAVE, 0, 1, c, e, tp)
  end
  function s.filter2(c, e, tp)
  	return c:IsType(TYPE_SYNCHRO) and c:IsCanBeSpecialSummoned(e, 0, tp, false, false)
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	if Duel.GetFlagEffect(tp, id) == 0 then
  		return
  	end
  	local c = e:GetHandler()
  	Duel.SkipPhase(1 - tp, PHASE_BATTLE, RESET_PHASE + PHASE_BATTLE_STEP, 1)
  	if Duel.GetLocationCount(tp, LOCATION_MZONE) > 1 and Duel.IsExistingMatchingCard(s.filter, tp, LOCATION_GRAVE, 0, 1, nil, e, tp) and Duel.SelectYesNo(tp, aux.Stringid(id, 0)) then
  		Duel.BreakEffect()
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
  		local g1 = Duel.SelectMatchingCard(tp, aux.NecroValleyFilter(s.filter), tp, LOCATION_GRAVE, 0, 1, 1, nil, e, tp)
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
  		local g2 = Duel.SelectMatchingCard(tp, aux.NecroValleyFilter(s.filter2), tp, LOCATION_GRAVE, 0, 1, 1, g1:GetFirst(), e, tp)
  		g1:Merge(g2)
  		Duel.SpecialSummon(g1, 0, tp, tp, false, false, POS_FACEUP)
  		local tc = g1:GetFirst()
  		while tc do
  			local e1 = Effect.CreateEffect(c)
  			e1:SetType(EFFECT_TYPE_SINGLE)
  			e1:SetCode(EFFECT_DISABLE)
  			e1:SetReset(RESET_EVENT + RESETS_STANDARD)
  			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)
  			tc:RegisterEffect(e2)
  			tc = g1:GetNext()
  		end
  	end
  end
  
  