name: Mystical
card_text: Activate only when a Spell Card that targets 1 player is activated. The effect of that Spell Card is applied to the other player instead.
lua: local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_CHAINING)
  	e1:SetCondition(s.condition)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.activate)
  	c:RegisterEffect(e1)
  end
  function s.condition(e, tp, eg, ep, ev, re, r, rp)
  	return re:IsHasType(EFFECT_TYPE_ACTIVATE) and re:IsActiveType(TYPE_SPELL) and re:IsHasProperty(EFFECT_FLAG_PLAYER_TARGET)
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		local te = Duel.GetChainInfo(ev, CHAININFO_TRIGGERING_EFFECT)
  		local ftg = te:GetTarget()
  		return ftg == nil or ftg(e, tp, eg, ep, ev, re, r, rp, chk)
  	end
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	local p = Duel.GetChainInfo(ev, CHAININFO_TARGET_PLAYER)
  	Duel.ChangeTargetPlayer(ev, 1 - p)
  end
  
  
source_text: Mystical
  Activate only when a Spell Card that targets 1 player is activated. The effect of that Spell Card is applied to the other player instead.
target_text: -- Mystical
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_CHAINING)
  	e1:SetCondition(s.condition)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.activate)
  	c:RegisterEffect(e1)
  end
  function s.condition(e, tp, eg, ep, ev, re, r, rp)
  	return re:IsHasType(EFFECT_TYPE_ACTIVATE) and re:IsActiveType(TYPE_SPELL) and re:IsHasProperty(EFFECT_FLAG_PLAYER_TARGET)
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		local te = Duel.GetChainInfo(ev, CHAININFO_TRIGGERING_EFFECT)
  		local ftg = te:GetTarget()
  		return ftg == nil or ftg(e, tp, eg, ep, ev, re, r, rp, chk)
  	end
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	local p = Duel.GetChainInfo(ev, CHAININFO_TARGET_PLAYER)
  	Duel.ChangeTargetPlayer(ev, 1 - p)
  end
  
  