name: Zubaba
card_text: 2 Level 4 monsters
  Once per turn: You can detach 1 Xyz Material from this card; equip 1 Warrior-Type monster from your hand to this card. This card gains ATK equal to the combined ATK of the monsters equipped to it by this effect.
lua: local s, id, o = GetID()
  function s.initial_effect(c)
  	--xyz summon
  	aux.AddXyzProcedure(c, nil, 4, 2)
  	c:EnableReviveLimit()
  	--equip
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetType(EFFECT_TYPE_IGNITION)
  	e1:SetCategory(CATEGORY_EQUIP)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetCountLimit(1)
  	e1:SetCost(s.eqcost)
  	e1:SetTarget(s.eqtg)
  	e1:SetOperation(s.eqop)
  	c:RegisterEffect(e1)
  end
  function s.eqcost(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.filter(c, tp)
  	return c:IsRace(RACE_WARRIOR) and c:CheckUniqueOnField(tp) and not c:IsForbidden()
  end
  function s.eqtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.GetLocationCount(tp, LOCATION_SZONE) > 0 and Duel.IsExistingMatchingCard(s.filter, tp, LOCATION_HAND, 0, 1, nil, tp)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_EQUIP, nil, 1, tp, LOCATION_HAND)
  end
  function s.eqop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if Duel.GetLocationCount(tp, LOCATION_SZONE) <= 0 then
  		return
  	end
  	if c:IsFacedown() or not c:IsRelateToEffect(e) then
  		return
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_EQUIP)
  	local g = Duel.SelectMatchingCard(tp, s.filter, tp, LOCATION_HAND, 0, 1, 1, nil, tp)
  	local tc = g:GetFirst()
  	if tc then
  		if not Duel.Equip(tp, tc, c) then
  			return
  		end
  		local e1 = Effect.CreateEffect(c)
  		e1:SetProperty(EFFECT_FLAG_OWNER_RELATE)
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetCode(EFFECT_EQUIP_LIMIT)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD)
  		e1:SetValue(s.eqlimit)
  		tc:RegisterEffect(e1)
  		local atk = tc:GetTextAttack()
  		if atk > 0 then
  			local e2 = Effect.CreateEffect(c)
  			e2:SetType(EFFECT_TYPE_EQUIP)
  			e2:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE + EFFECT_FLAG_OWNER_RELATE)
  			e2:SetCode(EFFECT_UPDATE_ATTACK)
  			e2:SetReset(RESET_EVENT + RESETS_STANDARD)
  			e2:SetValue(atk)
  			tc:RegisterEffect(e2)
  		end
  	end
  end
  function s.eqlimit(e, c)
  	return e:GetOwner() == c
  end
  
  
source_text: Zubaba
  2 Level 4 monsters
  Once per turn: You can detach 1 Xyz Material from this card; equip 1 Warrior-Type monster from your hand to this card. This card gains ATK equal to the combined ATK of the monsters equipped to it by this effect.
target_text: -- Zubaba
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--xyz summon
  	aux.AddXyzProcedure(c, nil, 4, 2)
  	c:EnableReviveLimit()
  	--equip
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetType(EFFECT_TYPE_IGNITION)
  	e1:SetCategory(CATEGORY_EQUIP)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetCountLimit(1)
  	e1:SetCost(s.eqcost)
  	e1:SetTarget(s.eqtg)
  	e1:SetOperation(s.eqop)
  	c:RegisterEffect(e1)
  end
  function s.eqcost(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.filter(c, tp)
  	return c:IsRace(RACE_WARRIOR) and c:CheckUniqueOnField(tp) and not c:IsForbidden()
  end
  function s.eqtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.GetLocationCount(tp, LOCATION_SZONE) > 0 and Duel.IsExistingMatchingCard(s.filter, tp, LOCATION_HAND, 0, 1, nil, tp)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_EQUIP, nil, 1, tp, LOCATION_HAND)
  end
  function s.eqop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if Duel.GetLocationCount(tp, LOCATION_SZONE) <= 0 then
  		return
  	end
  	if c:IsFacedown() or not c:IsRelateToEffect(e) then
  		return
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_EQUIP)
  	local g = Duel.SelectMatchingCard(tp, s.filter, tp, LOCATION_HAND, 0, 1, 1, nil, tp)
  	local tc = g:GetFirst()
  	if tc then
  		if not Duel.Equip(tp, tc, c) then
  			return
  		end
  		local e1 = Effect.CreateEffect(c)
  		e1:SetProperty(EFFECT_FLAG_OWNER_RELATE)
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetCode(EFFECT_EQUIP_LIMIT)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD)
  		e1:SetValue(s.eqlimit)
  		tc:RegisterEffect(e1)
  		local atk = tc:GetTextAttack()
  		if atk > 0 then
  			local e2 = Effect.CreateEffect(c)
  			e2:SetType(EFFECT_TYPE_EQUIP)
  			e2:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE + EFFECT_FLAG_OWNER_RELATE)
  			e2:SetCode(EFFECT_UPDATE_ATTACK)
  			e2:SetReset(RESET_EVENT + RESETS_STANDARD)
  			e2:SetValue(atk)
  			tc:RegisterEffect(e2)
  		end
  	end
  end
  function s.eqlimit(e, c)
  	return e:GetOwner() == c
  end
  
  