name: Cyberse
card_text: Once per turn: You can target 1 Level 4 or lower monster you control; increase its Level by its original Level until the end of this turn. If your monster(s) in the Extra Monster Zone would be destroyed by battle or card effect, you can banish this card from your GY instead. You can only use this effect of "Cyberse Synchron" once per turn.
lua: local s, id, o = GetID()
  function s.initial_effect(c)
  	--Increase level
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_IGNITION)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e1:SetCountLimit(1)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.operation)
  	c:RegisterEffect(e1)
  	--Destroy replace
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_CONTINUOUS)
  	e2:SetCode(EFFECT_DESTROY_REPLACE)
  	e2:SetRange(LOCATION_GRAVE)
  	e2:SetCountLimit(1, id)
  	e2:SetTarget(s.reptg)
  	e2:SetValue(s.repval)
  	c:RegisterEffect(e2)
  end
  function s.filter(c)
  	return c:IsFaceup() and c:IsLevelBelow(4)
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and s.filter(chkc)
  	end
  	if chk == 0 then
  		return Duel.IsExistingTarget(s.filter, tp, LOCATION_MZONE, 0, 1, nil)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_FACEUP)
  	local g = Duel.SelectTarget(tp, s.filter, tp, LOCATION_MZONE, 0, 1, 1, nil, tp)
  end
  function s.operation(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_LEVEL)
  		e1:SetValue(tc:GetOriginalLevel())
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END)
  		tc:RegisterEffect(e1)
  	end
  end
  function s.repfilter(c, tp)
  	return c:IsLocation(LOCATION_MZONE) and c:GetSequence() >= 5 and c:IsControler(tp) and c:IsReason(REASON_EFFECT + REASON_BATTLE) and not c:IsReason(REASON_REPLACE)
  end
  function s.reptg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return e:GetHandler():IsAbleToRemove() and eg:IsExists(s.repfilter, 1, nil, tp)
  	end
  	if Duel.SelectEffectYesNo(tp, e:GetHandler(), 96) then
  		Duel.Remove(e:GetHandler(), POS_FACEUP, REASON_EFFECT)
  		return true
  	else
  		return false
  	end
  end
  function s.repval(e, c)
  	return s.repfilter(c, e:GetHandlerPlayer())
  end
  
  
source_text: Cyberse
  Once per turn: You can target 1 Level 4 or lower monster you control; increase its Level by its original Level until the end of this turn. If your monster(s) in the Extra Monster Zone would be destroyed by battle or card effect, you can banish this card from your GY instead. You can only use this effect of "Cyberse Synchron" once per turn.
target_text: -- Cyberse
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--Increase level
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_IGNITION)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e1:SetCountLimit(1)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.operation)
  	c:RegisterEffect(e1)
  	--Destroy replace
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_CONTINUOUS)
  	e2:SetCode(EFFECT_DESTROY_REPLACE)
  	e2:SetRange(LOCATION_GRAVE)
  	e2:SetCountLimit(1, id)
  	e2:SetTarget(s.reptg)
  	e2:SetValue(s.repval)
  	c:RegisterEffect(e2)
  end
  function s.filter(c)
  	return c:IsFaceup() and c:IsLevelBelow(4)
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and s.filter(chkc)
  	end
  	if chk == 0 then
  		return Duel.IsExistingTarget(s.filter, tp, LOCATION_MZONE, 0, 1, nil)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_FACEUP)
  	local g = Duel.SelectTarget(tp, s.filter, tp, LOCATION_MZONE, 0, 1, 1, nil, tp)
  end
  function s.operation(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_LEVEL)
  		e1:SetValue(tc:GetOriginalLevel())
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END)
  		tc:RegisterEffect(e1)
  	end
  end
  function s.repfilter(c, tp)
  	return c:IsLocation(LOCATION_MZONE) and c:GetSequence() >= 5 and c:IsControler(tp) and c:IsReason(REASON_EFFECT + REASON_BATTLE) and not c:IsReason(REASON_REPLACE)
  end
  function s.reptg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return e:GetHandler():IsAbleToRemove() and eg:IsExists(s.repfilter, 1, nil, tp)
  	end
  	if Duel.SelectEffectYesNo(tp, e:GetHandler(), 96) then
  		Duel.Remove(e:GetHandler(), POS_FACEUP, REASON_EFFECT)
  		return true
  	else
  		return false
  	end
  end
  function s.repval(e, c)
  	return s.repfilter(c, e:GetHandlerPlayer())
  end
  
  