name: Scanner
card_text: Once per turn, you can select 1 of your opponent's monsters that is removed from play. Until the End Phase, this card's name is treated as the selected monster's name, and this card has the same Attribute, Level, ATK, and DEF as the selected monster. If this card is removed from the field while this effect is applied, remove it from play.
lua: local s, id, o = GetID()
  function s.initial_effect(c)
  	--copy
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_REMOVE)
  	e1:SetType(EFFECT_TYPE_IGNITION)
  	e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e1:SetCountLimit(1)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.operation)
  	c:RegisterEffect(e1)
  end
  function s.filter(c)
  	return c:IsFaceup() and c:IsType(TYPE_MONSTER) and c:IsLevelAbove(0) and not c:IsForbidden()
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsLocation(LOCATION_REMOVED) and chkc:IsControler(1 - tp) and s.filter(chkc)
  	end
  	if chk == 0 then
  		return Duel.IsExistingTarget(s.filter, tp, 0, LOCATION_REMOVED, 1, nil)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TARGET)
  	Duel.SelectTarget(tp, s.filter, tp, 0, LOCATION_REMOVED, 1, 1, nil)
  end
  function s.operation(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local tc = Duel.GetFirstTarget()
  	if c:IsRelateToEffect(e) and c:IsFaceup() and tc:IsRelateToEffect(e) then
  		local code = tc:GetOriginalCode()
  		local ba = tc:GetBaseAttack()
  		local bd = tc:GetBaseDefense()
  		local at = tc:GetAttribute()
  		local lv = tc:GetLevel()
  		local e1 = Effect.CreateEffect(c)
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
  		e1:SetCode(EFFECT_CHANGE_CODE)
  		e1:SetValue(code)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END)
  		c:RegisterEffect(e1)
  		local e2 = e1:Clone()
  		e2:SetCode(EFFECT_SET_ATTACK_FINAL)
  		e2:SetValue(ba)
  		c:RegisterEffect(e2)
  		local e3 = e1:Clone()
  		e3:SetCode(EFFECT_SET_DEFENSE_FINAL)
  		e3:SetValue(bd)
  		c:RegisterEffect(e3)
  		local e4 = e1:Clone()
  		e4:SetCode(EFFECT_CHANGE_ATTRIBUTE)
  		e4:SetValue(at)
  		c:RegisterEffect(e4)
  		local e5 = e1:Clone()
  		e5:SetCode(EFFECT_CHANGE_LEVEL)
  		e5:SetValue(lv)
  		c:RegisterEffect(e5)
  		--leave redir
  		local e6 = Effect.CreateEffect(c)
  		e6:SetType(EFFECT_TYPE_SINGLE)
  		e6:SetCode(EFFECT_LEAVE_FIELD_REDIRECT)
  		e6:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
  		e6:SetReset(RESET_EVENT + RESETS_REDIRECT + RESET_PHASE + PHASE_END)
  		e6:SetValue(LOCATION_REMOVED)
  		c:RegisterEffect(e6)
  	end
  end
  
  
source_text: Scanner
  Once per turn, you can select 1 of your opponent's monsters that is removed from play. Until the End Phase, this card's name is treated as the selected monster's name, and this card has the same Attribute, Level, ATK, and DEF as the selected monster. If this card is removed from the field while this effect is applied, remove it from play.
target_text: -- Scanner
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--copy
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_REMOVE)
  	e1:SetType(EFFECT_TYPE_IGNITION)
  	e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e1:SetCountLimit(1)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.operation)
  	c:RegisterEffect(e1)
  end
  function s.filter(c)
  	return c:IsFaceup() and c:IsType(TYPE_MONSTER) and c:IsLevelAbove(0) and not c:IsForbidden()
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsLocation(LOCATION_REMOVED) and chkc:IsControler(1 - tp) and s.filter(chkc)
  	end
  	if chk == 0 then
  		return Duel.IsExistingTarget(s.filter, tp, 0, LOCATION_REMOVED, 1, nil)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TARGET)
  	Duel.SelectTarget(tp, s.filter, tp, 0, LOCATION_REMOVED, 1, 1, nil)
  end
  function s.operation(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local tc = Duel.GetFirstTarget()
  	if c:IsRelateToEffect(e) and c:IsFaceup() and tc:IsRelateToEffect(e) then
  		local code = tc:GetOriginalCode()
  		local ba = tc:GetBaseAttack()
  		local bd = tc:GetBaseDefense()
  		local at = tc:GetAttribute()
  		local lv = tc:GetLevel()
  		local e1 = Effect.CreateEffect(c)
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
  		e1:SetCode(EFFECT_CHANGE_CODE)
  		e1:SetValue(code)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END)
  		c:RegisterEffect(e1)
  		local e2 = e1:Clone()
  		e2:SetCode(EFFECT_SET_ATTACK_FINAL)
  		e2:SetValue(ba)
  		c:RegisterEffect(e2)
  		local e3 = e1:Clone()
  		e3:SetCode(EFFECT_SET_DEFENSE_FINAL)
  		e3:SetValue(bd)
  		c:RegisterEffect(e3)
  		local e4 = e1:Clone()
  		e4:SetCode(EFFECT_CHANGE_ATTRIBUTE)
  		e4:SetValue(at)
  		c:RegisterEffect(e4)
  		local e5 = e1:Clone()
  		e5:SetCode(EFFECT_CHANGE_LEVEL)
  		e5:SetValue(lv)
  		c:RegisterEffect(e5)
  		--leave redir
  		local e6 = Effect.CreateEffect(c)
  		e6:SetType(EFFECT_TYPE_SINGLE)
  		e6:SetCode(EFFECT_LEAVE_FIELD_REDIRECT)
  		e6:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
  		e6:SetReset(RESET_EVENT + RESETS_REDIRECT + RESET_PHASE + PHASE_END)
  		e6:SetValue(LOCATION_REMOVED)
  		c:RegisterEffect(e6)
  	end
  end
  
  