name: NEXT
card_text: Special Summon any number of monsters with different names from your hand and/or GY, in Defense Position, that are all "Neo-Spacian" monsters or "Elemental HERO Neos", but negate their effects, and as long as you control any of those Special Summoned monsters face-up, you cannot Special Summon from the Extra Deck, except Fusion Monsters. You can only activate 1 "NEXT" per turn. If you control no cards, you can activate this card from your hand.
external_ids: local CARD_ID_0 = 89943723 --Elemental HERO Neos
  local CARD_ID_1 = 59822133 --Blue-Eyes Spirit Dragon
  local SETCARD_ID_0 = 0x1f --Neo-Spacian
  local SETCARD_ID_1 = 0x3008 --Elemental
  
lua: local CARD_ID_0 = 89943723 --Elemental HERO Neos
  local CARD_ID_1 = 59822133 --Blue-Eyes Spirit Dragon
  local SETCARD_ID_0 = 0x1f --Neo-Spacian
  local SETCARD_ID_1 = 0x3008 --Elemental
  local s, id, o = GetID()
  function s.initial_effect(c)
  	aux.AddCodeList(c, CARD_ID_0)
  	aux.AddSetNameMonsterList(c, SETCARD_ID_1)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetCountLimit(1, id + EFFECT_COUNT_CODE_OATH)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.activate)
  	c:RegisterEffect(e1)
  	--act in hand
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 1))
  	e2:SetType(EFFECT_TYPE_SINGLE)
  	e2:SetCode(EFFECT_TRAP_ACT_IN_HAND)
  	e2:SetCondition(s.handcon)
  	c:RegisterEffect(e2)
  end
  function s.filter(c, e, tp)
  	return (c:IsCode(CARD_ID_0) or c:IsSetCard(SETCARD_ID_1)) and c:IsCanBeSpecialSummoned(e, 0, tp, false, false, POS_FACEUP_DEFENSE)
  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.IsExistingMatchingCard(s.filter, tp, LOCATION_HAND + LOCATION_GRAVE, 0, 1, nil, e, tp)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, nil, 1, tp, LOCATION_HAND + LOCATION_GRAVE)
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local ft = Duel.GetLocationCount(tp, LOCATION_MZONE)
  	if ft <= 0 then
  		return
  	end
  	if Duel.IsPlayerAffectedByEffect(tp, CARD_ID_1) then
  		ft = 1
  	end
  	local g = Duel.GetMatchingGroup(aux.NecroValleyFilter(s.filter), tp, LOCATION_HAND + LOCATION_GRAVE, 0, nil, e, tp)
  	if g:GetCount() == 0 then
  		return
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
  	local sg = g:SelectSubGroup(tp, aux.dncheck, false, 1, ft)
  	for tc in aux.Next(sg) do
  		Duel.SpecialSummonStep(tc, 0, tp, tp, false, false, POS_FACEUP_DEFENSE)
  		local e1 = Effect.CreateEffect(c)
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetCode(EFFECT_DISABLE)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD)
  		tc:RegisterEffect(e1, true)
  		local e2 = Effect.CreateEffect(c)
  		e2:SetType(EFFECT_TYPE_SINGLE)
  		e2:SetCode(EFFECT_DISABLE_EFFECT)
  		e2:SetValue(RESET_TURN_SET)
  		e2:SetReset(RESET_EVENT + RESETS_STANDARD)
  		tc:RegisterEffect(e2, true)
  		local e3 = Effect.CreateEffect(c)
  		e3:SetType(EFFECT_TYPE_FIELD)
  		e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  		e3:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
  		e3:SetRange(LOCATION_MZONE)
  		e3:SetAbsoluteRange(tp, 1, 0)
  		e3:SetTarget(s.splimit)
  		e3:SetReset(RESET_EVENT + RESETS_STANDARD)
  		tc:RegisterEffect(e3, true)
  	end
  	Duel.SpecialSummonComplete()
  end
  function s.splimit(e, c)
  	return not c:IsType(TYPE_FUSION) and c:IsLocation(LOCATION_EXTRA)
  end
  function s.handcon(e)
  	return Duel.GetFieldGroupCount(e:GetHandlerPlayer(), LOCATION_ONFIELD, 0) == 0
  end
  
  
source_text: NEXT
  Special Summon any number of monsters with different names from your hand and/or GY, in Defense Position, that are all "Neo-Spacian" monsters or "Elemental HERO Neos", but negate their effects, and as long as you control any of those Special Summoned monsters face-up, you cannot Special Summon from the Extra Deck, except Fusion Monsters. You can only activate 1 "NEXT" per turn. If you control no cards, you can activate this card from your hand.
target_text: -- NEXT
  local CARD_ID_0 = 89943723 --Elemental HERO Neos
  local CARD_ID_1 = 59822133 --Blue-Eyes Spirit Dragon
  local SETCARD_ID_0 = 0x1f --Neo-Spacian
  local SETCARD_ID_1 = 0x3008 --Elemental
  local s, id, o = GetID()
  function s.initial_effect(c)
  	aux.AddCodeList(c, CARD_ID_0)
  	aux.AddSetNameMonsterList(c, SETCARD_ID_1)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetCountLimit(1, id + EFFECT_COUNT_CODE_OATH)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.activate)
  	c:RegisterEffect(e1)
  	--act in hand
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 1))
  	e2:SetType(EFFECT_TYPE_SINGLE)
  	e2:SetCode(EFFECT_TRAP_ACT_IN_HAND)
  	e2:SetCondition(s.handcon)
  	c:RegisterEffect(e2)
  end
  function s.filter(c, e, tp)
  	return (c:IsCode(CARD_ID_0) or c:IsSetCard(SETCARD_ID_1)) and c:IsCanBeSpecialSummoned(e, 0, tp, false, false, POS_FACEUP_DEFENSE)
  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.IsExistingMatchingCard(s.filter, tp, LOCATION_HAND + LOCATION_GRAVE, 0, 1, nil, e, tp)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, nil, 1, tp, LOCATION_HAND + LOCATION_GRAVE)
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local ft = Duel.GetLocationCount(tp, LOCATION_MZONE)
  	if ft <= 0 then
  		return
  	end
  	if Duel.IsPlayerAffectedByEffect(tp, CARD_ID_1) then
  		ft = 1
  	end
  	local g = Duel.GetMatchingGroup(aux.NecroValleyFilter(s.filter), tp, LOCATION_HAND + LOCATION_GRAVE, 0, nil, e, tp)
  	if g:GetCount() == 0 then
  		return
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
  	local sg = g:SelectSubGroup(tp, aux.dncheck, false, 1, ft)
  	for tc in aux.Next(sg) do
  		Duel.SpecialSummonStep(tc, 0, tp, tp, false, false, POS_FACEUP_DEFENSE)
  		local e1 = Effect.CreateEffect(c)
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetCode(EFFECT_DISABLE)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD)
  		tc:RegisterEffect(e1, true)
  		local e2 = Effect.CreateEffect(c)
  		e2:SetType(EFFECT_TYPE_SINGLE)
  		e2:SetCode(EFFECT_DISABLE_EFFECT)
  		e2:SetValue(RESET_TURN_SET)
  		e2:SetReset(RESET_EVENT + RESETS_STANDARD)
  		tc:RegisterEffect(e2, true)
  		local e3 = Effect.CreateEffect(c)
  		e3:SetType(EFFECT_TYPE_FIELD)
  		e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  		e3:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
  		e3:SetRange(LOCATION_MZONE)
  		e3:SetAbsoluteRange(tp, 1, 0)
  		e3:SetTarget(s.splimit)
  		e3:SetReset(RESET_EVENT + RESETS_STANDARD)
  		tc:RegisterEffect(e3, true)
  	end
  	Duel.SpecialSummonComplete()
  end
  function s.splimit(e, c)
  	return not c:IsType(TYPE_FUSION) and c:IsLocation(LOCATION_EXTRA)
  end
  function s.handcon(e)
  	return Duel.GetFieldGroupCount(e:GetHandlerPlayer(), LOCATION_ONFIELD, 0) == 0
  end
  
  