name: Morpho
card_text: Once per turn, when the battle position of an opponent's monster(s) is changed (except during the Damage Step): You can target one of those monsters; it loses 1000 ATK and DEF.
lua: local s, id, o = GetID()
  function s.initial_effect(c)
  	--atk,def
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_ATKCHANGE + CATEGORY_DEFCHANGE)
  	e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e1:SetType(EFFECT_TYPE_TRIGGER_O + EFFECT_TYPE_FIELD)
  	e1:SetCode(EVENT_CHANGE_POS)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetCountLimit(1)
  	e1:SetTarget(s.adtg)
  	e1:SetOperation(s.adop)
  	c:RegisterEffect(e1)
  end
  function s.cfilter(c, e, tp)
  	local np = c:GetPosition()
  	local pp = c:GetPreviousPosition()
  	return c:IsControler(tp) and ((pp == 0x1 and np == 0x4) or (pp == 0x4 and np == 0x1) or (pp == 0x8 and np == 0x1)) and c:IsCanBeEffectTarget(e)
  end
  function s.adtg(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return eg:IsContains(chkc) and s.cfilter(chkc, e, 1 - tp)
  	end
  	if chk == 0 then
  		return eg:IsExists(s.cfilter, 1, nil, e, 1 - tp)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TARGET)
  	local g = eg:FilterSelect(tp, s.cfilter, 1, 1, nil, e, 1 - tp)
  	Duel.SetTargetCard(g)
  end
  function s.adop(e, tp, eg, ep, ev, re, r, rp)
  	local tc = Duel.GetFirstTarget()
  	if tc:IsFaceup() and tc:IsRelateToEffect(e) then
  		local e1 = Effect.CreateEffect(e:GetHandler())
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetCode(EFFECT_UPDATE_ATTACK)
  		e1:SetValue(-1000)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD)
  		tc:RegisterEffect(e1)
  		local e2 = e1:Clone()
  		e2:SetCode(EFFECT_UPDATE_DEFENSE)
  		tc:RegisterEffect(e2)
  	end
  end
  
  
source_text: Morpho
  Once per turn, when the battle position of an opponent's monster(s) is changed (except during the Damage Step): You can target one of those monsters; it loses 1000 ATK and DEF.
target_text: -- Morpho
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--atk,def
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_ATKCHANGE + CATEGORY_DEFCHANGE)
  	e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e1:SetType(EFFECT_TYPE_TRIGGER_O + EFFECT_TYPE_FIELD)
  	e1:SetCode(EVENT_CHANGE_POS)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetCountLimit(1)
  	e1:SetTarget(s.adtg)
  	e1:SetOperation(s.adop)
  	c:RegisterEffect(e1)
  end
  function s.cfilter(c, e, tp)
  	local np = c:GetPosition()
  	local pp = c:GetPreviousPosition()
  	return c:IsControler(tp) and ((pp == 0x1 and np == 0x4) or (pp == 0x4 and np == 0x1) or (pp == 0x8 and np == 0x1)) and c:IsCanBeEffectTarget(e)
  end
  function s.adtg(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return eg:IsContains(chkc) and s.cfilter(chkc, e, 1 - tp)
  	end
  	if chk == 0 then
  		return eg:IsExists(s.cfilter, 1, nil, e, 1 - tp)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TARGET)
  	local g = eg:FilterSelect(tp, s.cfilter, 1, 1, nil, e, 1 - tp)
  	Duel.SetTargetCard(g)
  end
  function s.adop(e, tp, eg, ep, ev, re, r, rp)
  	local tc = Duel.GetFirstTarget()
  	if tc:IsFaceup() and tc:IsRelateToEffect(e) then
  		local e1 = Effect.CreateEffect(e:GetHandler())
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetCode(EFFECT_UPDATE_ATTACK)
  		e1:SetValue(-1000)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD)
  		tc:RegisterEffect(e1)
  		local e2 = e1:Clone()
  		e2:SetCode(EFFECT_UPDATE_DEFENSE)
  		tc:RegisterEffect(e2)
  	end
  end
  
  