name: Number
card_text: 4 Level 3 DARK monsters
  All Tokens you control can make a second attack during each Battle Phase. If this card has "Number 43: Manipulator of Souls" as an Xyz Material, it gains this effect.
  ● Once per turn: You can detach 1 Xyz Material from this card; Special Summon 1 "Manipulator Token" (Fiend-Type/DARK/Level 1/ATK ?/DEF ?). (When Summoned, its ATK and DEF each become equal to half the opponent's current LP.)
external_ids: local CARD_ID_0 = 56051086 --Number 43: Manipulator of Souls
  local CARD_ID_1 = 32446631 --Manipulator Token
  
lua: local CARD_ID_0 = 56051086 --Number 43: Manipulator of Souls
  local CARD_ID_1 = 32446631 --Manipulator Token
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--xyz summon
  	aux.AddXyzProcedure(c, aux.FilterBoolFunction(Card.IsAttribute, ATTRIBUTE_DARK), 3, 4)
  	c:EnableReviveLimit()
  	--atk
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_FIELD)
  	e1:SetCode(EFFECT_EXTRA_ATTACK)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetTargetRange(LOCATION_MZONE, 0)
  	e1:SetTarget(s.atktg)
  	e1:SetValue(1)
  	c:RegisterEffect(e1)
  	--token
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 0))
  	e2:SetCategory(CATEGORY_SPECIAL_SUMMON + CATEGORY_TOKEN)
  	e2:SetType(EFFECT_TYPE_IGNITION)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetCountLimit(1)
  	e2:SetCondition(s.condition)
  	e2:SetCost(s.cost)
  	e2:SetTarget(s.target)
  	e2:SetOperation(s.operation)
  	c:RegisterEffect(e2)
  end
  aux.xyz_number[id] = 43
  function s.atktg(e, c)
  	return c:IsType(TYPE_TOKEN)
  end
  function s.condition(e, tp, eg, ep, ev, re, r, rp)
  	return e:GetHandler():GetOverlayGroup():IsExists(Card.IsCode, 1, nil, CARD_ID_0)
  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 Duel.GetLocationCount(tp, LOCATION_MZONE) > 0 and Duel.IsPlayerCanSpecialSummonMonster(tp, id + 1, 0, TYPES_TOKEN_MONSTER, -2, -2, 1, RACE_FIEND, ATTRIBUTE_DARK)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, nil, 1, tp, LOCATION_MZONE)
  	Duel.SetOperationInfo(0, CATEGORY_TOKEN, nil, 1, tp, LOCATION_MZONE)
  end
  function s.operation(e, tp, eg, ep, ev, re, r, rp)
  	if Duel.GetLocationCount(tp, LOCATION_MZONE) <= 0 then
  		return
  	end
  	if not Duel.IsPlayerCanSpecialSummonMonster(tp, id + 1, 0, TYPES_TOKEN_MONSTER, -2, -2, 1, RACE_FIEND, ATTRIBUTE_DARK) then
  		return
  	end
  	local token = Duel.CreateToken(tp, id + 1)
  	if Duel.SpecialSummonStep(token, 0, tp, tp, false, false, POS_FACEUP) then
  		local e1 = Effect.CreateEffect(e:GetHandler())
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetCode(EFFECT_SET_ATTACK)
  		e1:SetValue(math.ceil(Duel.GetLP(1 - tp) / 2))
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD)
  		token:RegisterEffect(e1)
  		local e2 = e1:Clone()
  		e2:SetCode(EFFECT_SET_DEFENSE)
  		token:RegisterEffect(e2)
  	end
  	Duel.SpecialSummonComplete()
  end
  
  
source_text: Number
  4 Level 3 DARK monsters
  All Tokens you control can make a second attack during each Battle Phase. If this card has "Number 43: Manipulator of Souls" as an Xyz Material, it gains this effect.
  ● Once per turn: You can detach 1 Xyz Material from this card; Special Summon 1 "Manipulator Token" (Fiend-Type/DARK/Level 1/ATK ?/DEF ?). (When Summoned, its ATK and DEF each become equal to half the opponent's current LP.)
target_text: -- Number
  local CARD_ID_0 = 56051086 --Number 43: Manipulator of Souls
  local CARD_ID_1 = 32446631 --Manipulator Token
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--xyz summon
  	aux.AddXyzProcedure(c, aux.FilterBoolFunction(Card.IsAttribute, ATTRIBUTE_DARK), 3, 4)
  	c:EnableReviveLimit()
  	--atk
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_FIELD)
  	e1:SetCode(EFFECT_EXTRA_ATTACK)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetTargetRange(LOCATION_MZONE, 0)
  	e1:SetTarget(s.atktg)
  	e1:SetValue(1)
  	c:RegisterEffect(e1)
  	--token
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 0))
  	e2:SetCategory(CATEGORY_SPECIAL_SUMMON + CATEGORY_TOKEN)
  	e2:SetType(EFFECT_TYPE_IGNITION)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetCountLimit(1)
  	e2:SetCondition(s.condition)
  	e2:SetCost(s.cost)
  	e2:SetTarget(s.target)
  	e2:SetOperation(s.operation)
  	c:RegisterEffect(e2)
  end
  aux.xyz_number[id] = 43
  function s.atktg(e, c)
  	return c:IsType(TYPE_TOKEN)
  end
  function s.condition(e, tp, eg, ep, ev, re, r, rp)
  	return e:GetHandler():GetOverlayGroup():IsExists(Card.IsCode, 1, nil, CARD_ID_0)
  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 Duel.GetLocationCount(tp, LOCATION_MZONE) > 0 and Duel.IsPlayerCanSpecialSummonMonster(tp, id + 1, 0, TYPES_TOKEN_MONSTER, -2, -2, 1, RACE_FIEND, ATTRIBUTE_DARK)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, nil, 1, tp, LOCATION_MZONE)
  	Duel.SetOperationInfo(0, CATEGORY_TOKEN, nil, 1, tp, LOCATION_MZONE)
  end
  function s.operation(e, tp, eg, ep, ev, re, r, rp)
  	if Duel.GetLocationCount(tp, LOCATION_MZONE) <= 0 then
  		return
  	end
  	if not Duel.IsPlayerCanSpecialSummonMonster(tp, id + 1, 0, TYPES_TOKEN_MONSTER, -2, -2, 1, RACE_FIEND, ATTRIBUTE_DARK) then
  		return
  	end
  	local token = Duel.CreateToken(tp, id + 1)
  	if Duel.SpecialSummonStep(token, 0, tp, tp, false, false, POS_FACEUP) then
  		local e1 = Effect.CreateEffect(e:GetHandler())
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetCode(EFFECT_SET_ATTACK)
  		e1:SetValue(math.ceil(Duel.GetLP(1 - tp) / 2))
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD)
  		token:RegisterEffect(e1)
  		local e2 = e1:Clone()
  		e2:SetCode(EFFECT_SET_DEFENSE)
  		token:RegisterEffect(e2)
  	end
  	Duel.SpecialSummonComplete()
  end
  
  