Time
(Quick Effect): You can Tribute this card, then target 1 "Time Thief" Xyz Monster you control; attach 1 card from your opponent's GY to that monster as material. If this card is in the GY: You can detach 1 material from an Xyz Monster you control; Special Summon this card, but banish it when it leaves the field. You can only use each effect of "Time Thief Bezel Ship" once per turn.
local SETCARD_ID_0 = 0x126 --Time

local SETCARD_ID_0 = 0x126 --Time
local s, id, o = GetID()
function s.initial_effect(c)
	--xyz material
	local e1 = Effect.CreateEffect(c)
	e1:SetDescription(aux.Stringid(id, 0))
	e1:SetType(EFFECT_TYPE_QUICK_O)
	e1:SetCode(EVENT_FREE_CHAIN)
	e1:SetRange(LOCATION_MZONE)
	e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
	e1:SetHintTiming(0, TIMINGS_CHECK_MONSTER)
	e1:SetCountLimit(1, id)
	e1:SetCost(s.matcost)
	e1:SetTarget(s.mattg)
	e1:SetOperation(s.matop)
	c:RegisterEffect(e1)
	--special summon
	local e2 = Effect.CreateEffect(c)
	e2:SetDescription(aux.Stringid(id, 1))
	e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
	e2:SetType(EFFECT_TYPE_IGNITION)
	e2:SetRange(LOCATION_GRAVE)
	e2:SetCountLimit(1, id + 1)
	e2:SetCost(s.spcost)
	e2:SetTarget(s.sptg)
	e2:SetOperation(s.spop)
	c:RegisterEffect(e2)
end
function s.matcost(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.matfilter(c)
	return c:IsSetCard(SETCARD_ID_0) and c:IsType(TYPE_XYZ) and c:IsFaceup()
end
function s.mattg(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
	if chkc then
		return s.matfilter(chkc) and chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp)
	end
	if chk == 0 then
		return Duel.IsExistingTarget(s.matfilter, tp, LOCATION_MZONE, 0, 1, nil) and Duel.IsExistingMatchingCard(Card.IsCanOverlay, tp, 0, LOCATION_GRAVE, 1, nil)
	end
	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TARGET)
	Duel.SelectTarget(tp, s.matfilter, tp, LOCATION_MZONE, 0, 1, 1, nil)
end
function s.matop(e, tp, eg, ep, ev, re, r, rp)
	local tc = Duel.GetFirstTarget()
	if tc:IsRelateToEffect(e) and not tc:IsImmuneToEffect(e) then
		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_XMATERIAL)
		local g = Duel.SelectMatchingCard(tp, aux.NecroValleyFilter(Card.IsCanOverlay), tp, 0, LOCATION_GRAVE, 1, 1, nil)
		Duel.Overlay(tc, g)
	end
end
function s.spcost(e, tp, eg, ep, ev, re, r, rp, chk)
	if chk == 0 then
		return Duel.CheckRemoveOverlayCard(tp, 1, 0, 1, REASON_COST)
	end
	Duel.RemoveOverlayCard(tp, 1, 0, 1, 1, REASON_COST)
end
function s.sptg(e, tp, eg, ep, ev, re, r, rp, chk)
	local c = e:GetHandler()
	if chk == 0 then
		return Duel.GetLocationCount(tp, LOCATION_MZONE) > 0 and c:IsCanBeSpecialSummoned(e, 0, tp, false, false)
	end
	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, c, 1, 0, 0)
end
function s.spop(e, tp, eg, ep, ev, re, r, rp)
	local c = e:GetHandler()
	if c:IsRelateToEffect(e) and Duel.SpecialSummon(c, 0, tp, tp, false, false, POS_FACEUP) > 0 then
		local e1 = Effect.CreateEffect(c)
		e1:SetType(EFFECT_TYPE_SINGLE)
		e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
		e1:SetCode(EFFECT_LEAVE_FIELD_REDIRECT)
		e1:SetValue(LOCATION_REMOVED)
		e1:SetReset(RESET_EVENT + RESETS_REDIRECT)
		c:RegisterEffect(e1, true)
	end
end


Time
(Quick Effect): You can Tribute this card, then target 1 "Time Thief" Xyz Monster you control; attach 1 card from your opponent's GY to that monster as material. If this card is in the GY: You can detach 1 material from an Xyz Monster you control; Special Summon this card, but banish it when it leaves the field. You can only use each effect of "Time Thief Bezel Ship" once per turn.
-- Time
local SETCARD_ID_0 = 0x126 --Time
local s, id, o = GetID()
function s.initial_effect(c)
	--xyz material
	local e1 = Effect.CreateEffect(c)
	e1:SetDescription(aux.Stringid(id, 0))
	e1:SetType(EFFECT_TYPE_QUICK_O)
	e1:SetCode(EVENT_FREE_CHAIN)
	e1:SetRange(LOCATION_MZONE)
	e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
	e1:SetHintTiming(0, TIMINGS_CHECK_MONSTER)
	e1:SetCountLimit(1, id)
	e1:SetCost(s.matcost)
	e1:SetTarget(s.mattg)
	e1:SetOperation(s.matop)
	c:RegisterEffect(e1)
	--special summon
	local e2 = Effect.CreateEffect(c)
	e2:SetDescription(aux.Stringid(id, 1))
	e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
	e2:SetType(EFFECT_TYPE_IGNITION)
	e2:SetRange(LOCATION_GRAVE)
	e2:SetCountLimit(1, id + 1)
	e2:SetCost(s.spcost)
	e2:SetTarget(s.sptg)
	e2:SetOperation(s.spop)
	c:RegisterEffect(e2)
end
function s.matcost(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.matfilter(c)
	return c:IsSetCard(SETCARD_ID_0) and c:IsType(TYPE_XYZ) and c:IsFaceup()
end
function s.mattg(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
	if chkc then
		return s.matfilter(chkc) and chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp)
	end
	if chk == 0 then
		return Duel.IsExistingTarget(s.matfilter, tp, LOCATION_MZONE, 0, 1, nil) and Duel.IsExistingMatchingCard(Card.IsCanOverlay, tp, 0, LOCATION_GRAVE, 1, nil)
	end
	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TARGET)
	Duel.SelectTarget(tp, s.matfilter, tp, LOCATION_MZONE, 0, 1, 1, nil)
end
function s.matop(e, tp, eg, ep, ev, re, r, rp)
	local tc = Duel.GetFirstTarget()
	if tc:IsRelateToEffect(e) and not tc:IsImmuneToEffect(e) then
		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_XMATERIAL)
		local g = Duel.SelectMatchingCard(tp, aux.NecroValleyFilter(Card.IsCanOverlay), tp, 0, LOCATION_GRAVE, 1, 1, nil)
		Duel.Overlay(tc, g)
	end
end
function s.spcost(e, tp, eg, ep, ev, re, r, rp, chk)
	if chk == 0 then
		return Duel.CheckRemoveOverlayCard(tp, 1, 0, 1, REASON_COST)
	end
	Duel.RemoveOverlayCard(tp, 1, 0, 1, 1, REASON_COST)
end
function s.sptg(e, tp, eg, ep, ev, re, r, rp, chk)
	local c = e:GetHandler()
	if chk == 0 then
		return Duel.GetLocationCount(tp, LOCATION_MZONE) > 0 and c:IsCanBeSpecialSummoned(e, 0, tp, false, false)
	end
	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, c, 1, 0, 0)
end
function s.spop(e, tp, eg, ep, ev, re, r, rp)
	local c = e:GetHandler()
	if c:IsRelateToEffect(e) and Duel.SpecialSummon(c, 0, tp, tp, false, false, POS_FACEUP) > 0 then
		local e1 = Effect.CreateEffect(c)
		e1:SetType(EFFECT_TYPE_SINGLE)
		e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
		e1:SetCode(EFFECT_LEAVE_FIELD_REDIRECT)
		e1:SetValue(LOCATION_REMOVED)
		e1:SetReset(RESET_EVENT + RESETS_REDIRECT)
		c:RegisterEffect(e1, true)
	end
end

