name: Gravity
card_text: 1 non-Link Monster in an Extra Monster Zone
  Cannot be used as Link Material the turn it is Link Summoned. This card in the Extra Monster Zone cannot be destroyed by battle with a monster in the Main Monster Zone. At the start of the Damage Step, if this card battles an opponent's monster in the Extra Monster Zone: You can return both that opponent's monster and this card to the Deck.
lua: local s, id, o = GetID()
  function s.initial_effect(c)
  	--link summon
  	c:EnableReviveLimit()
  	aux.AddLinkProcedure(c, s.mfilter, 1, 1)
  	--cannot link material
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_SINGLE)
  	e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_UNCOPYABLE)
  	e1:SetCode(EFFECT_CANNOT_BE_LINK_MATERIAL)
  	e1:SetValue(s.lmlimit)
  	c:RegisterEffect(e1)
  	--battle indes
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_SINGLE)
  	e2:SetCode(EFFECT_INDESTRUCTABLE_BATTLE)
  	e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetValue(s.indes)
  	c:RegisterEffect(e2)
  	--to deck
  	local e3 = Effect.CreateEffect(c)
  	e3:SetDescription(aux.Stringid(id, 0))
  	e3:SetCategory(CATEGORY_TODECK)
  	e3:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e3:SetCode(EVENT_BATTLE_START)
  	e3:SetCondition(s.tdcon)
  	e3:SetTarget(s.tdtg)
  	e3:SetOperation(s.tdop)
  	c:RegisterEffect(e3)
  end
  function s.mfilter(c)
  	return not c:IsLinkType(TYPE_LINK) and c:GetSequence() > 4
  end
  function s.lmlimit(e)
  	local c = e:GetHandler()
  	return c:IsSummonType(SUMMON_TYPE_LINK) and c:GetTurnID() == Duel.GetTurnCount()
  end
  function s.indes(e, c)
  	return e:GetHandler():GetSequence() > 4 and c:GetSequence() <= 4
  end
  function s.tdcon(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local tc = c:GetBattleTarget()
  	e:SetLabelObject(tc)
  	return tc and tc:IsControler(1 - tp) and tc:GetSequence() > 4
  end
  function s.tdtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	local c = e:GetHandler()
  	local tc = e:GetLabelObject()
  	if chk == 0 then
  		return tc and c:IsAbleToDeck() and tc:IsAbleToDeck()
  	end
  	local g = Group.FromCards(c, tc)
  	Duel.SetOperationInfo(0, CATEGORY_TODECK, g, 2, 0, 0)
  end
  function s.tdop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local tc = e:GetLabelObject()
  	if not c:IsRelateToBattle() then
  		return
  	end
  	if tc and tc:IsRelateToBattle() and tc:IsControler(1 - tp) then
  		local g = Group.FromCards(c, tc)
  		Duel.SendtoDeck(g, nil, SEQ_DECKSHUFFLE, REASON_EFFECT)
  	end
  end
  
  
source_text: Gravity
  1 non-Link Monster in an Extra Monster Zone
  Cannot be used as Link Material the turn it is Link Summoned. This card in the Extra Monster Zone cannot be destroyed by battle with a monster in the Main Monster Zone. At the start of the Damage Step, if this card battles an opponent's monster in the Extra Monster Zone: You can return both that opponent's monster and this card to the Deck.
target_text: -- Gravity
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--link summon
  	c:EnableReviveLimit()
  	aux.AddLinkProcedure(c, s.mfilter, 1, 1)
  	--cannot link material
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_SINGLE)
  	e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_UNCOPYABLE)
  	e1:SetCode(EFFECT_CANNOT_BE_LINK_MATERIAL)
  	e1:SetValue(s.lmlimit)
  	c:RegisterEffect(e1)
  	--battle indes
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_SINGLE)
  	e2:SetCode(EFFECT_INDESTRUCTABLE_BATTLE)
  	e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetValue(s.indes)
  	c:RegisterEffect(e2)
  	--to deck
  	local e3 = Effect.CreateEffect(c)
  	e3:SetDescription(aux.Stringid(id, 0))
  	e3:SetCategory(CATEGORY_TODECK)
  	e3:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e3:SetCode(EVENT_BATTLE_START)
  	e3:SetCondition(s.tdcon)
  	e3:SetTarget(s.tdtg)
  	e3:SetOperation(s.tdop)
  	c:RegisterEffect(e3)
  end
  function s.mfilter(c)
  	return not c:IsLinkType(TYPE_LINK) and c:GetSequence() > 4
  end
  function s.lmlimit(e)
  	local c = e:GetHandler()
  	return c:IsSummonType(SUMMON_TYPE_LINK) and c:GetTurnID() == Duel.GetTurnCount()
  end
  function s.indes(e, c)
  	return e:GetHandler():GetSequence() > 4 and c:GetSequence() <= 4
  end
  function s.tdcon(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local tc = c:GetBattleTarget()
  	e:SetLabelObject(tc)
  	return tc and tc:IsControler(1 - tp) and tc:GetSequence() > 4
  end
  function s.tdtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	local c = e:GetHandler()
  	local tc = e:GetLabelObject()
  	if chk == 0 then
  		return tc and c:IsAbleToDeck() and tc:IsAbleToDeck()
  	end
  	local g = Group.FromCards(c, tc)
  	Duel.SetOperationInfo(0, CATEGORY_TODECK, g, 2, 0, 0)
  end
  function s.tdop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local tc = e:GetLabelObject()
  	if not c:IsRelateToBattle() then
  		return
  	end
  	if tc and tc:IsRelateToBattle() and tc:IsControler(1 - tp) then
  		local g = Group.FromCards(c, tc)
  		Duel.SendtoDeck(g, nil, SEQ_DECKSHUFFLE, REASON_EFFECT)
  	end
  end
  
  