name: X-Saber
card_text: When this card destroys an opponent's monster by battle and sends it to the Graveyard, you can Tribute this card to return the destroyed card to the top of its owner's Deck.
lua: local s, id, o = GetID()
  function s.initial_effect(c)
  	--to deck
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_TODECK)
  	e1:SetCode(EVENT_BATTLE_DESTROYING)
  	e1:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e1:SetCondition(s.tdcon)
  	e1:SetCost(s.tdcost)
  	e1:SetTarget(s.tdtg)
  	e1:SetOperation(s.tdop)
  	c:RegisterEffect(e1)
  end
  function s.tdcon(e, tp, eg, ep, ev, re, r, rp)
  	local t = e:GetHandler():GetBattleTarget()
  	e:SetLabelObject(t)
  	return aux.bdogcon(e, tp, eg, ep, ev, re, r, rp)
  end
  function s.tdcost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return e:GetHandler():IsReleasable()
  	end
  	Duel.Release(e:GetHandler(), REASON_COST)
  end
  function s.tdtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	local t = e:GetLabelObject()
  	if chk == 0 then
  		return t:IsAbleToDeck()
  	end
  	t:CreateEffectRelation(e)
  	Duel.SetOperationInfo(0, CATEGORY_TODECK, t, 1, 0, 0)
  end
  function s.tdop(e, tp, eg, ep, ev, re, r, rp)
  	local tc = e:GetLabelObject()
  	if tc:IsRelateToEffect(e) then
  		Duel.SendtoDeck(tc, nil, SEQ_DECKTOP, REASON_EFFECT)
  	end
  end
  
  
source_text: X-Saber
  When this card destroys an opponent's monster by battle and sends it to the Graveyard, you can Tribute this card to return the destroyed card to the top of its owner's Deck.
target_text: -- X-Saber
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--to deck
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_TODECK)
  	e1:SetCode(EVENT_BATTLE_DESTROYING)
  	e1:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e1:SetCondition(s.tdcon)
  	e1:SetCost(s.tdcost)
  	e1:SetTarget(s.tdtg)
  	e1:SetOperation(s.tdop)
  	c:RegisterEffect(e1)
  end
  function s.tdcon(e, tp, eg, ep, ev, re, r, rp)
  	local t = e:GetHandler():GetBattleTarget()
  	e:SetLabelObject(t)
  	return aux.bdogcon(e, tp, eg, ep, ev, re, r, rp)
  end
  function s.tdcost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return e:GetHandler():IsReleasable()
  	end
  	Duel.Release(e:GetHandler(), REASON_COST)
  end
  function s.tdtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	local t = e:GetLabelObject()
  	if chk == 0 then
  		return t:IsAbleToDeck()
  	end
  	t:CreateEffectRelation(e)
  	Duel.SetOperationInfo(0, CATEGORY_TODECK, t, 1, 0, 0)
  end
  function s.tdop(e, tp, eg, ep, ev, re, r, rp)
  	local tc = e:GetLabelObject()
  	if tc:IsRelateToEffect(e) then
  		Duel.SendtoDeck(tc, nil, SEQ_DECKTOP, REASON_EFFECT)
  	end
  end
  
  