name: Mother
card_text: If you control no monsters, you can Special Summon this card (from your hand). You can Tribute this card; you cannot Special Summon from the Extra Deck for the rest of this turn, except Xyz Monsters, also Special Summon up to 3 "Baby Spider" from your hand and/or Deck, and if you do, they become Level 5, but cannot be used as material for an Xyz Summon, except the Xyz Summon of a DARK monster. You can only use this effect of "Mother Spider Splitter" once per turn.
external_ids: local CARD_ID_0 = 59822133 --Blue-Eyes Spirit Dragon
  local CARD_ID_1 = 60023855 --Baby Spider
  
lua: local CARD_ID_0 = 59822133 --Blue-Eyes Spirit Dragon
  local CARD_ID_1 = 60023855 --Baby Spider
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--special summon rule
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_FIELD)
  	e1:SetCode(EFFECT_SPSUMMON_PROC)
  	e1:SetProperty(EFFECT_FLAG_UNCOPYABLE)
  	e1:SetRange(LOCATION_HAND)
  	e1:SetCondition(s.sprcon)
  	c:RegisterEffect(e1)
  	--special summon
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 0))
  	e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
  	e2:SetType(EFFECT_TYPE_IGNITION)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetCountLimit(1, id)
  	e2:SetCost(s.spcost)
  	e2:SetTarget(s.sptg)
  	e2:SetOperation(s.spop)
  	c:RegisterEffect(e2)
  end
  function s.sprcon(e, c)
  	if c == nil then
  		return true
  	end
  	return Duel.GetFieldGroupCount(c:GetControler(), LOCATION_MZONE, 0) == 0 and Duel.GetLocationCount(c:GetControler(), LOCATION_MZONE) > 0
  end
  function s.spcost(e, tp, eg, ep, ev, re, r, rp, chk)
  	local c = e:GetHandler()
  	if chk == 0 then
  		return c:IsReleasable() and Duel.GetMZoneCount(tp, c) > 0
  	end
  	Duel.Release(c, REASON_COST)
  end
  function s.spfilter(c, e, tp)
  	return c:IsCode(CARD_ID_1) and c:IsCanBeSpecialSummoned(e, 0, tp, false, false)
  end
  function s.sptg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.spfilter, tp, LOCATION_HAND + LOCATION_DECK, 0, 1, nil, e, tp)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, nil, 1, tp, LOCATION_HAND + LOCATION_DECK)
  end
  function s.spop(e, tp, eg, ep, ev, re, r, rp)
  	local e1 = Effect.CreateEffect(e:GetHandler())
  	e1:SetType(EFFECT_TYPE_FIELD)
  	e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  	e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
  	e1:SetTargetRange(1, 0)
  	e1:SetTarget(s.splimit)
  	e1:SetReset(RESET_PHASE + PHASE_END)
  	Duel.RegisterEffect(e1, tp)
  	local ft = Duel.GetMZoneCount(tp)
  	local g = Duel.GetMatchingGroup(s.spfilter, tp, LOCATION_HAND + LOCATION_DECK, 0, nil, e, tp)
  	if ft <= 0 or #g == 0 then
  		return
  	end
  	if ft > 3 then
  		ft = 3
  	end
  	if Duel.IsPlayerAffectedByEffect(tp, CARD_ID_0) then
  		ft = 1
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
  	local sg = g:Select(tp, 1, ft, nil)
  	for tc in aux.Next(sg) do
  		Duel.SpecialSummonStep(tc, 0, tp, tp, false, false, POS_FACEUP)
  		local e1 = Effect.CreateEffect(e:GetHandler())
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetCode(EFFECT_CHANGE_LEVEL)
  		e1:SetValue(5)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD)
  		tc:RegisterEffect(e1)
  		local e2 = Effect.CreateEffect(e:GetHandler())
  		e2:SetType(EFFECT_TYPE_SINGLE)
  		e2:SetCode(EFFECT_CANNOT_BE_XYZ_MATERIAL)
  		e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_UNCOPYABLE)
  		e2:SetValue(s.xyzlimit)
  		e2:SetReset(RESET_EVENT + RESETS_STANDARD)
  		tc:RegisterEffect(e2)
  	end
  	Duel.SpecialSummonComplete()
  end
  function s.splimit(e, c)
  	return not c:IsType(TYPE_XYZ) and c:IsLocation(LOCATION_EXTRA)
  end
  function s.xyzlimit(e, c)
  	if not c then
  		return false
  	end
  	return not c:IsAttribute(ATTRIBUTE_DARK)
  end
  
  
source_text: Mother
  If you control no monsters, you can Special Summon this card (from your hand). You can Tribute this card; you cannot Special Summon from the Extra Deck for the rest of this turn, except Xyz Monsters, also Special Summon up to 3 "Baby Spider" from your hand and/or Deck, and if you do, they become Level 5, but cannot be used as material for an Xyz Summon, except the Xyz Summon of a DARK monster. You can only use this effect of "Mother Spider Splitter" once per turn.
target_text: -- Mother
  local CARD_ID_0 = 59822133 --Blue-Eyes Spirit Dragon
  local CARD_ID_1 = 60023855 --Baby Spider
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--special summon rule
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_FIELD)
  	e1:SetCode(EFFECT_SPSUMMON_PROC)
  	e1:SetProperty(EFFECT_FLAG_UNCOPYABLE)
  	e1:SetRange(LOCATION_HAND)
  	e1:SetCondition(s.sprcon)
  	c:RegisterEffect(e1)
  	--special summon
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 0))
  	e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
  	e2:SetType(EFFECT_TYPE_IGNITION)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetCountLimit(1, id)
  	e2:SetCost(s.spcost)
  	e2:SetTarget(s.sptg)
  	e2:SetOperation(s.spop)
  	c:RegisterEffect(e2)
  end
  function s.sprcon(e, c)
  	if c == nil then
  		return true
  	end
  	return Duel.GetFieldGroupCount(c:GetControler(), LOCATION_MZONE, 0) == 0 and Duel.GetLocationCount(c:GetControler(), LOCATION_MZONE) > 0
  end
  function s.spcost(e, tp, eg, ep, ev, re, r, rp, chk)
  	local c = e:GetHandler()
  	if chk == 0 then
  		return c:IsReleasable() and Duel.GetMZoneCount(tp, c) > 0
  	end
  	Duel.Release(c, REASON_COST)
  end
  function s.spfilter(c, e, tp)
  	return c:IsCode(CARD_ID_1) and c:IsCanBeSpecialSummoned(e, 0, tp, false, false)
  end
  function s.sptg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.spfilter, tp, LOCATION_HAND + LOCATION_DECK, 0, 1, nil, e, tp)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, nil, 1, tp, LOCATION_HAND + LOCATION_DECK)
  end
  function s.spop(e, tp, eg, ep, ev, re, r, rp)
  	local e1 = Effect.CreateEffect(e:GetHandler())
  	e1:SetType(EFFECT_TYPE_FIELD)
  	e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  	e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
  	e1:SetTargetRange(1, 0)
  	e1:SetTarget(s.splimit)
  	e1:SetReset(RESET_PHASE + PHASE_END)
  	Duel.RegisterEffect(e1, tp)
  	local ft = Duel.GetMZoneCount(tp)
  	local g = Duel.GetMatchingGroup(s.spfilter, tp, LOCATION_HAND + LOCATION_DECK, 0, nil, e, tp)
  	if ft <= 0 or #g == 0 then
  		return
  	end
  	if ft > 3 then
  		ft = 3
  	end
  	if Duel.IsPlayerAffectedByEffect(tp, CARD_ID_0) then
  		ft = 1
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
  	local sg = g:Select(tp, 1, ft, nil)
  	for tc in aux.Next(sg) do
  		Duel.SpecialSummonStep(tc, 0, tp, tp, false, false, POS_FACEUP)
  		local e1 = Effect.CreateEffect(e:GetHandler())
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetCode(EFFECT_CHANGE_LEVEL)
  		e1:SetValue(5)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD)
  		tc:RegisterEffect(e1)
  		local e2 = Effect.CreateEffect(e:GetHandler())
  		e2:SetType(EFFECT_TYPE_SINGLE)
  		e2:SetCode(EFFECT_CANNOT_BE_XYZ_MATERIAL)
  		e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_UNCOPYABLE)
  		e2:SetValue(s.xyzlimit)
  		e2:SetReset(RESET_EVENT + RESETS_STANDARD)
  		tc:RegisterEffect(e2)
  	end
  	Duel.SpecialSummonComplete()
  end
  function s.splimit(e, c)
  	return not c:IsType(TYPE_XYZ) and c:IsLocation(LOCATION_EXTRA)
  end
  function s.xyzlimit(e, c)
  	if not c then
  		return false
  	end
  	return not c:IsAttribute(ATTRIBUTE_DARK)
  end
  
  