name: Cross-Dimensional
card_text: Target 1 "Ancient Gear" monster you control; banish it. During the next Standby Phase, return that banished monster to the field, and if you do, its ATK becomes double its original ATK until the end of that turn. If 1 or more "Ancient Gear Golem" or "Ancient Gear Golem - Ultimate Pound" you control would be destroyed by battle or card effect, you can banish this card from your GY instead.
external_ids: local CARD_ID_0 = 95735217 --Ancient Gear Golem - Ultimate Pound
  local CARD_ID_1 = 83104731 --Ancient Gear Golem
  local SETCARD_ID_0 = 0x7 --Ancient
  
lua: local CARD_ID_0 = 95735217 --Ancient Gear Golem - Ultimate Pound
  local CARD_ID_1 = 83104731 --Ancient Gear Golem
  local SETCARD_ID_0 = 0x7 --Ancient
  local s, id, o = GetID()
  function s.initial_effect(c)
  	aux.AddCodeList(c, CARD_ID_1)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_REMOVE)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetHintTiming(0, TIMING_END_PHASE)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.activate)
  	c:RegisterEffect(e1)
  	--destroy replace
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_CONTINUOUS)
  	e2:SetCode(EFFECT_DESTROY_REPLACE)
  	e2:SetRange(LOCATION_GRAVE)
  	e2:SetTarget(s.reptg)
  	e2:SetValue(s.repval)
  	e2:SetOperation(s.repop)
  	c:RegisterEffect(e2)
  end
  function s.rmfilter(c)
  	return c:IsFaceup() and c:IsSetCard(SETCARD_ID_0) and c:IsAbleToRemove()
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and s.rmfilter(chkc)
  	end
  	if chk == 0 then
  		return Duel.IsExistingTarget(s.rmfilter, tp, LOCATION_MZONE, 0, 1, nil)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_REMOVE)
  	local g = Duel.SelectTarget(tp, s.rmfilter, tp, LOCATION_MZONE, 0, 1, 1, nil)
  	Duel.SetOperationInfo(0, CATEGORY_REMOVE, g, 1, 0, 0)
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	local tc = Duel.GetFirstTarget()
  	if tc:IsRelateToEffect(e) and Duel.Remove(tc, 0, REASON_EFFECT + REASON_TEMPORARY) > 0 then
  		local e1 = Effect.CreateEffect(e:GetHandler())
  		e1:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_CONTINUOUS)
  		e1:SetCode(EVENT_PHASE + PHASE_STANDBY)
  		e1:SetLabelObject(tc)
  		e1:SetCountLimit(1)
  		if Duel.GetCurrentPhase() == PHASE_STANDBY then
  			e1:SetLabel(Duel.GetTurnCount())
  			e1:SetCondition(s.retcon)
  			e1:SetReset(RESET_PHASE + PHASE_STANDBY, 2)
  		else
  			e1:SetReset(RESET_PHASE + PHASE_STANDBY)
  		end
  		e1:SetOperation(s.retop)
  		Duel.RegisterEffect(e1, tp)
  	end
  end
  function s.retcon(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.GetTurnCount() ~= e:GetLabel()
  end
  function s.retop(e, tp, eg, ep, ev, re, r, rp)
  	local tc = e:GetLabelObject()
  	if Duel.ReturnToField(tc) then
  		local atk = tc:GetBaseAttack()
  		local e1 = Effect.CreateEffect(e:GetHandler())
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetCode(EFFECT_SET_ATTACK)
  		e1:SetValue(atk * 2)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END)
  		tc:RegisterEffect(e1)
  	end
  end
  function s.repfilter(c, tp)
  	return c:IsFaceup() and c:IsCode(CARD_ID_1, CARD_ID_0) and c:IsOnField() and c:IsControler(tp) and c:IsReason(REASON_EFFECT + REASON_BATTLE) and not c:IsReason(REASON_REPLACE)
  end
  function s.reptg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return e:GetHandler():IsAbleToRemove() and eg:IsExists(s.repfilter, 1, nil, tp)
  	end
  	return Duel.SelectEffectYesNo(tp, e:GetHandler(), 96)
  end
  function s.repval(e, c)
  	return s.repfilter(c, e:GetHandlerPlayer())
  end
  function s.repop(e, tp, eg, ep, ev, re, r, rp)
  	Duel.Remove(e:GetHandler(), POS_FACEUP, REASON_EFFECT)
  end
  
  
source_text: Cross-Dimensional
  Target 1 "Ancient Gear" monster you control; banish it. During the next Standby Phase, return that banished monster to the field, and if you do, its ATK becomes double its original ATK until the end of that turn. If 1 or more "Ancient Gear Golem" or "Ancient Gear Golem - Ultimate Pound" you control would be destroyed by battle or card effect, you can banish this card from your GY instead.
target_text: -- Cross-Dimensional
  local CARD_ID_0 = 95735217 --Ancient Gear Golem - Ultimate Pound
  local CARD_ID_1 = 83104731 --Ancient Gear Golem
  local SETCARD_ID_0 = 0x7 --Ancient
  local s, id, o = GetID()
  function s.initial_effect(c)
  	aux.AddCodeList(c, CARD_ID_1)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_REMOVE)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetHintTiming(0, TIMING_END_PHASE)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.activate)
  	c:RegisterEffect(e1)
  	--destroy replace
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_CONTINUOUS)
  	e2:SetCode(EFFECT_DESTROY_REPLACE)
  	e2:SetRange(LOCATION_GRAVE)
  	e2:SetTarget(s.reptg)
  	e2:SetValue(s.repval)
  	e2:SetOperation(s.repop)
  	c:RegisterEffect(e2)
  end
  function s.rmfilter(c)
  	return c:IsFaceup() and c:IsSetCard(SETCARD_ID_0) and c:IsAbleToRemove()
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and s.rmfilter(chkc)
  	end
  	if chk == 0 then
  		return Duel.IsExistingTarget(s.rmfilter, tp, LOCATION_MZONE, 0, 1, nil)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_REMOVE)
  	local g = Duel.SelectTarget(tp, s.rmfilter, tp, LOCATION_MZONE, 0, 1, 1, nil)
  	Duel.SetOperationInfo(0, CATEGORY_REMOVE, g, 1, 0, 0)
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	local tc = Duel.GetFirstTarget()
  	if tc:IsRelateToEffect(e) and Duel.Remove(tc, 0, REASON_EFFECT + REASON_TEMPORARY) > 0 then
  		local e1 = Effect.CreateEffect(e:GetHandler())
  		e1:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_CONTINUOUS)
  		e1:SetCode(EVENT_PHASE + PHASE_STANDBY)
  		e1:SetLabelObject(tc)
  		e1:SetCountLimit(1)
  		if Duel.GetCurrentPhase() == PHASE_STANDBY then
  			e1:SetLabel(Duel.GetTurnCount())
  			e1:SetCondition(s.retcon)
  			e1:SetReset(RESET_PHASE + PHASE_STANDBY, 2)
  		else
  			e1:SetReset(RESET_PHASE + PHASE_STANDBY)
  		end
  		e1:SetOperation(s.retop)
  		Duel.RegisterEffect(e1, tp)
  	end
  end
  function s.retcon(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.GetTurnCount() ~= e:GetLabel()
  end
  function s.retop(e, tp, eg, ep, ev, re, r, rp)
  	local tc = e:GetLabelObject()
  	if Duel.ReturnToField(tc) then
  		local atk = tc:GetBaseAttack()
  		local e1 = Effect.CreateEffect(e:GetHandler())
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetCode(EFFECT_SET_ATTACK)
  		e1:SetValue(atk * 2)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END)
  		tc:RegisterEffect(e1)
  	end
  end
  function s.repfilter(c, tp)
  	return c:IsFaceup() and c:IsCode(CARD_ID_1, CARD_ID_0) and c:IsOnField() and c:IsControler(tp) and c:IsReason(REASON_EFFECT + REASON_BATTLE) and not c:IsReason(REASON_REPLACE)
  end
  function s.reptg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return e:GetHandler():IsAbleToRemove() and eg:IsExists(s.repfilter, 1, nil, tp)
  	end
  	return Duel.SelectEffectYesNo(tp, e:GetHandler(), 96)
  end
  function s.repval(e, c)
  	return s.repfilter(c, e:GetHandlerPlayer())
  end
  function s.repop(e, tp, eg, ep, ev, re, r, rp)
  	Duel.Remove(e:GetHandler(), POS_FACEUP, REASON_EFFECT)
  end
  
  