name: 天使の手鏡
card_text: フィールド上のモンスター1体を対象に発動した相手の魔法を、別の正しい対象に移し替える。
lua: local s, id, o = GetID()
  function s.initial_effect(c)
  	--activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e1:SetCode(EVENT_CHAINING)
  	e1:SetCondition(s.tgcon)
  	e1:SetTarget(s.tgtg)
  	e1:SetOperation(s.tgop)
  	c:RegisterEffect(e1)
  end
  function s.tgcon(e, tp, eg, ep, ev, re, r, rp)
  	if rp == tp or not re:IsHasType(EFFECT_TYPE_ACTIVATE) or not re:IsActiveType(TYPE_SPELL) or not re:IsHasProperty(EFFECT_FLAG_CARD_TARGET) then
  		return false
  	end
  	local g = Duel.GetChainInfo(ev, CHAININFO_TARGET_CARDS)
  	if not g or g:GetCount() ~= 1 then
  		return false
  	end
  	local tc = g:GetFirst()
  	e:SetLabelObject(tc)
  	return tc:IsLocation(LOCATION_MZONE)
  end
  function s.filter(c, ct)
  	return Duel.CheckChainTarget(ct, c)
  end
  function s.tgtg(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc ~= e:GetLabelObject() and chkc:IsLocation(LOCATION_MZONE) and s.filter(chkc, ev)
  	end
  	if chk == 0 then
  		return Duel.IsExistingTarget(s.filter, tp, LOCATION_MZONE, LOCATION_MZONE, 1, e:GetLabelObject(), ev)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TARGET)
  	Duel.SelectTarget(tp, s.filter, tp, LOCATION_MZONE, LOCATION_MZONE, 1, 1, e:GetLabelObject(), ev)
  end
  function s.tgop(e, tp, eg, ep, ev, re, r, rp)
  	local g = Duel.GetChainInfo(0, CHAININFO_TARGET_CARDS)
  	if g:GetFirst():IsRelateToEffect(e) then
  		Duel.ChangeTargetCard(ev, g)
  	end
  end
  
  
source_text: 天使の手鏡
  フィールド上のモンスター1体を対象に発動した相手の魔法を、別の正しい対象に移し替える。
target_text: -- 天使の手鏡
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e1:SetCode(EVENT_CHAINING)
  	e1:SetCondition(s.tgcon)
  	e1:SetTarget(s.tgtg)
  	e1:SetOperation(s.tgop)
  	c:RegisterEffect(e1)
  end
  function s.tgcon(e, tp, eg, ep, ev, re, r, rp)
  	if rp == tp or not re:IsHasType(EFFECT_TYPE_ACTIVATE) or not re:IsActiveType(TYPE_SPELL) or not re:IsHasProperty(EFFECT_FLAG_CARD_TARGET) then
  		return false
  	end
  	local g = Duel.GetChainInfo(ev, CHAININFO_TARGET_CARDS)
  	if not g or g:GetCount() ~= 1 then
  		return false
  	end
  	local tc = g:GetFirst()
  	e:SetLabelObject(tc)
  	return tc:IsLocation(LOCATION_MZONE)
  end
  function s.filter(c, ct)
  	return Duel.CheckChainTarget(ct, c)
  end
  function s.tgtg(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc ~= e:GetLabelObject() and chkc:IsLocation(LOCATION_MZONE) and s.filter(chkc, ev)
  	end
  	if chk == 0 then
  		return Duel.IsExistingTarget(s.filter, tp, LOCATION_MZONE, LOCATION_MZONE, 1, e:GetLabelObject(), ev)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TARGET)
  	Duel.SelectTarget(tp, s.filter, tp, LOCATION_MZONE, LOCATION_MZONE, 1, 1, e:GetLabelObject(), ev)
  end
  function s.tgop(e, tp, eg, ep, ev, re, r, rp)
  	local g = Duel.GetChainInfo(0, CHAININFO_TARGET_CARDS)
  	if g:GetFirst():IsRelateToEffect(e) then
  		Duel.ChangeTargetCard(ev, g)
  	end
  end
  
  