name: Invader
card_text: FLIP: Target 1 monster your opponent controls; switch control of it with this card. This effect cannot be activated during the Battle Phase.
lua: local s, id, o = GetID()
  function s.initial_effect(c)
  	--flip
  	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_SINGLE + EFFECT_TYPE_FLIP)
  	e1:SetCondition(s.condition)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.operation)
  	c:RegisterEffect(e1)
  end
  function s.swapfilter(c)
  	local tp = c:GetControler()
  	return c:IsAbleToChangeControler() and Duel.GetMZoneCount(tp, c, tp, LOCATION_REASON_CONTROL) > 0
  end
  function s.condition(e)
  	local ph = Duel.GetCurrentPhase()
  	return not (ph >= PHASE_BATTLE_START and ph <= PHASE_BATTLE)
  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 true
  	end
  	if Duel.GetMZoneCount(tp, e:GetHandler(), tp, LOCATION_REASON_CONTROL) > 0 and Duel.IsExistingTarget(s.swapfilter, tp, 0, LOCATION_MZONE, 1, nil) then
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_CONTROL)
  		local mon = Duel.SelectTarget(tp, s.swapfilter, tp, 0, LOCATION_MZONE, 1, 1, nil)
  		mon:AddCard(e:GetHandler())
  		Duel.SetOperationInfo(0, CATEGORY_CONTROL, mon, 2, 0, 0)
  	end
  end
  function s.operation(e, tp, eg, ep, ev, re, r, rp)
  	local tc = Duel.GetFirstTarget()
  	local c = e:GetHandler()
  	if c:IsRelateToEffect(e) and tc and tc:IsRelateToEffect(e) then
  		Duel.SwapControl(c, tc)
  	end
  end
  
  
source_text: Invader
  FLIP: Target 1 monster your opponent controls; switch control of it with this card. This effect cannot be activated during the Battle Phase.
target_text: -- Invader
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--flip
  	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_SINGLE + EFFECT_TYPE_FLIP)
  	e1:SetCondition(s.condition)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.operation)
  	c:RegisterEffect(e1)
  end
  function s.swapfilter(c)
  	local tp = c:GetControler()
  	return c:IsAbleToChangeControler() and Duel.GetMZoneCount(tp, c, tp, LOCATION_REASON_CONTROL) > 0
  end
  function s.condition(e)
  	local ph = Duel.GetCurrentPhase()
  	return not (ph >= PHASE_BATTLE_START and ph <= PHASE_BATTLE)
  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 true
  	end
  	if Duel.GetMZoneCount(tp, e:GetHandler(), tp, LOCATION_REASON_CONTROL) > 0 and Duel.IsExistingTarget(s.swapfilter, tp, 0, LOCATION_MZONE, 1, nil) then
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_CONTROL)
  		local mon = Duel.SelectTarget(tp, s.swapfilter, tp, 0, LOCATION_MZONE, 1, 1, nil)
  		mon:AddCard(e:GetHandler())
  		Duel.SetOperationInfo(0, CATEGORY_CONTROL, mon, 2, 0, 0)
  	end
  end
  function s.operation(e, tp, eg, ep, ev, re, r, rp)
  	local tc = Duel.GetFirstTarget()
  	local c = e:GetHandler()
  	if c:IsRelateToEffect(e) and tc and tc:IsRelateToEffect(e) then
  		Duel.SwapControl(c, tc)
  	end
  end
  
  