name: Gravity
card_text: When your opponent would Summon a monster(s): Send 1 face-up Synchro Monster you control to the GY; negate the Summon, and if you do, destroy that monster, and your opponent cannot Summon a monster until the end of this turn.
lua: local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate(summon)
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_DISABLE_SUMMON + CATEGORY_DESTROY)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_SUMMON)
  	e1:SetCondition(s.condition)
  	e1:SetCost(s.cost)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.activate)
  	c:RegisterEffect(e1)
  	local e2 = e1:Clone()
  	e2:SetCode(EVENT_FLIP_SUMMON)
  	c:RegisterEffect(e2)
  	local e3 = e1:Clone()
  	e3:SetCode(EVENT_SPSUMMON)
  	c:RegisterEffect(e3)
  end
  function s.condition(e, tp, eg, ep, ev, re, r, rp)
  	return aux.NegateSummonCondition() and eg:IsExists(Card.IsControler, 1, nil, 1 - tp)
  end
  function s.cfilter(c)
  	return c:IsFaceup() and c:IsType(TYPE_SYNCHRO) and c:IsAbleToGraveAsCost()
  end
  function s.cost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.cfilter, tp, LOCATION_MZONE, 0, 1, nil)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TOGRAVE)
  	local g = Duel.SelectMatchingCard(tp, s.cfilter, tp, LOCATION_MZONE, 0, 1, 1, nil)
  	Duel.SendtoGrave(g, REASON_COST)
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return true
  	end
  	local g = eg:Filter(Card.IsControler, nil, 1 - tp)
  	Duel.SetOperationInfo(0, CATEGORY_DISABLE_SUMMON, g, g:GetCount(), 0, 0)
  	Duel.SetOperationInfo(0, CATEGORY_DESTROY, g, g:GetCount(), 0, 0)
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	local g = eg:Filter(Card.IsControler, nil, 1 - tp)
  	Duel.NegateSummon(g)
  	Duel.Destroy(g, REASON_EFFECT)
  	local e1 = Effect.CreateEffect(e:GetHandler())
  	e1:SetType(EFFECT_TYPE_FIELD)
  	e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  	e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
  	e1:SetReset(RESET_PHASE + PHASE_END)
  	e1:SetTargetRange(0, 1)
  	Duel.RegisterEffect(e1, tp)
  	local e2 = e1:Clone()
  	e2:SetCode(EFFECT_CANNOT_SUMMON)
  	Duel.RegisterEffect(e2, tp)
  	local e3 = e2:Clone()
  	e3:SetCode(EFFECT_CANNOT_FLIP_SUMMON)
  	Duel.RegisterEffect(e3, tp)
  end
  
  
source_text: Gravity
  When your opponent would Summon a monster(s): Send 1 face-up Synchro Monster you control to the GY; negate the Summon, and if you do, destroy that monster, and your opponent cannot Summon a monster until the end of this turn.
target_text: -- Gravity
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate(summon)
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_DISABLE_SUMMON + CATEGORY_DESTROY)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_SUMMON)
  	e1:SetCondition(s.condition)
  	e1:SetCost(s.cost)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.activate)
  	c:RegisterEffect(e1)
  	local e2 = e1:Clone()
  	e2:SetCode(EVENT_FLIP_SUMMON)
  	c:RegisterEffect(e2)
  	local e3 = e1:Clone()
  	e3:SetCode(EVENT_SPSUMMON)
  	c:RegisterEffect(e3)
  end
  function s.condition(e, tp, eg, ep, ev, re, r, rp)
  	return aux.NegateSummonCondition() and eg:IsExists(Card.IsControler, 1, nil, 1 - tp)
  end
  function s.cfilter(c)
  	return c:IsFaceup() and c:IsType(TYPE_SYNCHRO) and c:IsAbleToGraveAsCost()
  end
  function s.cost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.cfilter, tp, LOCATION_MZONE, 0, 1, nil)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TOGRAVE)
  	local g = Duel.SelectMatchingCard(tp, s.cfilter, tp, LOCATION_MZONE, 0, 1, 1, nil)
  	Duel.SendtoGrave(g, REASON_COST)
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return true
  	end
  	local g = eg:Filter(Card.IsControler, nil, 1 - tp)
  	Duel.SetOperationInfo(0, CATEGORY_DISABLE_SUMMON, g, g:GetCount(), 0, 0)
  	Duel.SetOperationInfo(0, CATEGORY_DESTROY, g, g:GetCount(), 0, 0)
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	local g = eg:Filter(Card.IsControler, nil, 1 - tp)
  	Duel.NegateSummon(g)
  	Duel.Destroy(g, REASON_EFFECT)
  	local e1 = Effect.CreateEffect(e:GetHandler())
  	e1:SetType(EFFECT_TYPE_FIELD)
  	e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  	e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
  	e1:SetReset(RESET_PHASE + PHASE_END)
  	e1:SetTargetRange(0, 1)
  	Duel.RegisterEffect(e1, tp)
  	local e2 = e1:Clone()
  	e2:SetCode(EFFECT_CANNOT_SUMMON)
  	Duel.RegisterEffect(e2, tp)
  	local e3 = e2:Clone()
  	e3:SetCode(EFFECT_CANNOT_FLIP_SUMMON)
  	Duel.RegisterEffect(e3, tp)
  end
  
  