name: Number
card_text: 4 Level 9 monsters
  Must be Special Summoned with a "Rank-Up-Magic" Spell targeting "Number 88: Gimmick Puppet of Leo". Neither player can target this card on the field with card effects. Once per turn: You can detach 1 material from this card; inflict 1000 damage to your opponent. During your End Phase, if your opponent's LP are 2000 or less, and this card has no materials, you win the Duel.
external_ids: local SETCARD_ID_0 = 0x95 --Rank-Up-Magic
  
lua: local SETCARD_ID_0 = 0x95 --Rank-Up-Magic
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--xyz summon
  	c:EnableReviveLimit()
  	--cannot special summon
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_SINGLE)
  	e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_UNCOPYABLE)
  	e1:SetCode(EFFECT_SPSUMMON_CONDITION)
  	e1:SetValue(s.splimit)
  	c:RegisterEffect(e1)
  	--
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_SINGLE)
  	e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
  	e2:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetValue(1)
  	c:RegisterEffect(e2)
  	--damage
  	local e3 = Effect.CreateEffect(c)
  	e3:SetDescription(aux.Stringid(id, 0))
  	e3:SetCategory(CATEGORY_DAMAGE)
  	e3:SetType(EFFECT_TYPE_IGNITION)
  	e3:SetRange(LOCATION_MZONE)
  	e3:SetCountLimit(1)
  	e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  	e3:SetCost(s.cost)
  	e3:SetTarget(s.target)
  	e3:SetOperation(s.operation)
  	c:RegisterEffect(e3)
  	--win
  	local e4 = Effect.CreateEffect(c)
  	e4:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_CONTINUOUS)
  	e4:SetProperty(EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_UNCOPYABLE)
  	e4:SetRange(LOCATION_MZONE)
  	e4:SetCode(EVENT_ADJUST)
  	e4:SetOperation(s.winop)
  	c:RegisterEffect(e4)
  end
  aux.xyz_number[id] = 88
  function s.splimit(e, se, sp, st)
  	return se:GetHandler():IsSetCard(SETCARD_ID_0) and se:GetHandler():IsType(TYPE_SPELL) and se:IsHasProperty(EFFECT_FLAG_CARD_TARGET)
  end
  function s.cost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return e:GetHandler():CheckRemoveOverlayCard(tp, 1, REASON_COST)
  	end
  	e:GetHandler():RemoveOverlayCard(tp, 1, 1, REASON_COST)
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return true
  	end
  	Duel.SetTargetPlayer(1 - tp)
  	Duel.SetTargetParam(1000)
  	Duel.SetOperationInfo(0, CATEGORY_DAMAGE, nil, 0, 1 - tp, 1000)
  end
  function s.operation(e, tp, eg, ep, ev, re, r, rp)
  	local p, d = Duel.GetChainInfo(0, CHAININFO_TARGET_PLAYER, CHAININFO_TARGET_PARAM)
  	Duel.Damage(p, d, REASON_EFFECT)
  end
  function s.winop(e, tp, eg, ep, ev, re, r, rp)
  	local WIN_REASON_DISASTER_LEO = 0x18
  	if Duel.GetTurnPlayer() == tp and Duel.GetCurrentPhase() == PHASE_END and Duel.GetLP(1 - tp) <= 2000 and e:GetHandler():GetOverlayCount() == 0 then
  		Duel.Win(tp, WIN_REASON_DISASTER_LEO)
  	end
  end
  
  
source_text: Number
  4 Level 9 monsters
  Must be Special Summoned with a "Rank-Up-Magic" Spell targeting "Number 88: Gimmick Puppet of Leo". Neither player can target this card on the field with card effects. Once per turn: You can detach 1 material from this card; inflict 1000 damage to your opponent. During your End Phase, if your opponent's LP are 2000 or less, and this card has no materials, you win the Duel.
target_text: -- Number
  local SETCARD_ID_0 = 0x95 --Rank-Up-Magic
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--xyz summon
  	c:EnableReviveLimit()
  	--cannot special summon
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_SINGLE)
  	e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_UNCOPYABLE)
  	e1:SetCode(EFFECT_SPSUMMON_CONDITION)
  	e1:SetValue(s.splimit)
  	c:RegisterEffect(e1)
  	--
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_SINGLE)
  	e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
  	e2:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetValue(1)
  	c:RegisterEffect(e2)
  	--damage
  	local e3 = Effect.CreateEffect(c)
  	e3:SetDescription(aux.Stringid(id, 0))
  	e3:SetCategory(CATEGORY_DAMAGE)
  	e3:SetType(EFFECT_TYPE_IGNITION)
  	e3:SetRange(LOCATION_MZONE)
  	e3:SetCountLimit(1)
  	e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  	e3:SetCost(s.cost)
  	e3:SetTarget(s.target)
  	e3:SetOperation(s.operation)
  	c:RegisterEffect(e3)
  	--win
  	local e4 = Effect.CreateEffect(c)
  	e4:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_CONTINUOUS)
  	e4:SetProperty(EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_UNCOPYABLE)
  	e4:SetRange(LOCATION_MZONE)
  	e4:SetCode(EVENT_ADJUST)
  	e4:SetOperation(s.winop)
  	c:RegisterEffect(e4)
  end
  aux.xyz_number[id] = 88
  function s.splimit(e, se, sp, st)
  	return se:GetHandler():IsSetCard(SETCARD_ID_0) and se:GetHandler():IsType(TYPE_SPELL) and se:IsHasProperty(EFFECT_FLAG_CARD_TARGET)
  end
  function s.cost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return e:GetHandler():CheckRemoveOverlayCard(tp, 1, REASON_COST)
  	end
  	e:GetHandler():RemoveOverlayCard(tp, 1, 1, REASON_COST)
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return true
  	end
  	Duel.SetTargetPlayer(1 - tp)
  	Duel.SetTargetParam(1000)
  	Duel.SetOperationInfo(0, CATEGORY_DAMAGE, nil, 0, 1 - tp, 1000)
  end
  function s.operation(e, tp, eg, ep, ev, re, r, rp)
  	local p, d = Duel.GetChainInfo(0, CHAININFO_TARGET_PLAYER, CHAININFO_TARGET_PARAM)
  	Duel.Damage(p, d, REASON_EFFECT)
  end
  function s.winop(e, tp, eg, ep, ev, re, r, rp)
  	local WIN_REASON_DISASTER_LEO = 0x18
  	if Duel.GetTurnPlayer() == tp and Duel.GetCurrentPhase() == PHASE_END and Duel.GetLP(1 - tp) <= 2000 and e:GetHandler():GetOverlayCount() == 0 then
  		Duel.Win(tp, WIN_REASON_DISASTER_LEO)
  	end
  end
  
  