name: Psychic
card_text: Once per turn: You can pay 1000 LP, then target 1 face-up monster your opponent controls and 1 Psychic-Type monster you control, except "Psychic Jumper"; switch control of both those targets, and if you do, their battle positions cannot be changed this turn.
lua: local s, id, o = GetID()
  function s.initial_effect(c)
  	--special summon
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_CONTROL)
  	e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e1:SetType(EFFECT_TYPE_IGNITION)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetCountLimit(1)
  	e1:SetCost(s.cost)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.operation)
  	c:RegisterEffect(e1)
  end
  function s.cost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.CheckLPCost(tp, 1000)
  	end
  	Duel.PayLPCost(tp, 1000)
  end
  function s.filter1(c)
  	local tp = c:GetControler()
  	return c:IsFaceup() and c:IsRace(RACE_PSYCHO) and not c:IsCode(id) and c:IsAbleToChangeControler() and Duel.GetMZoneCount(tp, c, tp, LOCATION_REASON_CONTROL) > 0
  end
  function s.filter2(c)
  	local tp = c:GetControler()
  	return c:IsFaceup() and c:IsAbleToChangeControler() and Duel.GetMZoneCount(tp, c, tp, LOCATION_REASON_CONTROL) > 0
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return false
  	end
  	if chk == 0 then
  		return Duel.IsExistingTarget(s.filter2, tp, 0, LOCATION_MZONE, 1, nil) and Duel.IsExistingTarget(s.filter1, tp, LOCATION_MZONE, 0, 1, nil)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_CONTROL)
  	local g1 = Duel.SelectTarget(tp, s.filter1, tp, LOCATION_MZONE, 0, 1, 1, nil)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_CONTROL)
  	local g2 = Duel.SelectTarget(tp, s.filter2, tp, 0, LOCATION_MZONE, 1, 1, nil)
  	g1:Merge(g2)
  	Duel.SetOperationInfo(0, CATEGORY_CONTROL, g1, 2, 0, 0)
  end
  function s.operation(e, tp, eg, ep, ev, re, r, rp)
  	local g = Duel.GetChainInfo(0, CHAININFO_TARGET_CARDS)
  	local tc1 = g:GetFirst()
  	local tc2 = g:GetNext()
  	if tc1:IsFaceup() and tc1:IsRelateToEffect(e) and tc2:IsFaceup() and tc2:IsRelateToEffect(e) then
  		if Duel.SwapControl(tc1, tc2) then
  			local e1 = Effect.CreateEffect(e:GetHandler())
  			e1:SetType(EFFECT_TYPE_SINGLE)
  			e1:SetCode(EFFECT_CANNOT_CHANGE_POSITION)
  			e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END)
  			tc1:RegisterEffect(e1)
  			local e2 = e1:Clone()
  			tc2:RegisterEffect(e2)
  		end
  	end
  end
  
  
source_text: Psychic
  Once per turn: You can pay 1000 LP, then target 1 face-up monster your opponent controls and 1 Psychic-Type monster you control, except "Psychic Jumper"; switch control of both those targets, and if you do, their battle positions cannot be changed this turn.
target_text: -- Psychic
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--special summon
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_CONTROL)
  	e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e1:SetType(EFFECT_TYPE_IGNITION)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetCountLimit(1)
  	e1:SetCost(s.cost)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.operation)
  	c:RegisterEffect(e1)
  end
  function s.cost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.CheckLPCost(tp, 1000)
  	end
  	Duel.PayLPCost(tp, 1000)
  end
  function s.filter1(c)
  	local tp = c:GetControler()
  	return c:IsFaceup() and c:IsRace(RACE_PSYCHO) and not c:IsCode(id) and c:IsAbleToChangeControler() and Duel.GetMZoneCount(tp, c, tp, LOCATION_REASON_CONTROL) > 0
  end
  function s.filter2(c)
  	local tp = c:GetControler()
  	return c:IsFaceup() and c:IsAbleToChangeControler() and Duel.GetMZoneCount(tp, c, tp, LOCATION_REASON_CONTROL) > 0
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return false
  	end
  	if chk == 0 then
  		return Duel.IsExistingTarget(s.filter2, tp, 0, LOCATION_MZONE, 1, nil) and Duel.IsExistingTarget(s.filter1, tp, LOCATION_MZONE, 0, 1, nil)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_CONTROL)
  	local g1 = Duel.SelectTarget(tp, s.filter1, tp, LOCATION_MZONE, 0, 1, 1, nil)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_CONTROL)
  	local g2 = Duel.SelectTarget(tp, s.filter2, tp, 0, LOCATION_MZONE, 1, 1, nil)
  	g1:Merge(g2)
  	Duel.SetOperationInfo(0, CATEGORY_CONTROL, g1, 2, 0, 0)
  end
  function s.operation(e, tp, eg, ep, ev, re, r, rp)
  	local g = Duel.GetChainInfo(0, CHAININFO_TARGET_CARDS)
  	local tc1 = g:GetFirst()
  	local tc2 = g:GetNext()
  	if tc1:IsFaceup() and tc1:IsRelateToEffect(e) and tc2:IsFaceup() and tc2:IsRelateToEffect(e) then
  		if Duel.SwapControl(tc1, tc2) then
  			local e1 = Effect.CreateEffect(e:GetHandler())
  			e1:SetType(EFFECT_TYPE_SINGLE)
  			e1:SetCode(EFFECT_CANNOT_CHANGE_POSITION)
  			e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END)
  			tc1:RegisterEffect(e1)
  			local e2 = e1:Clone()
  			tc2:RegisterEffect(e2)
  		end
  	end
  end
  
  