name: EN
card_text: Send 1 "Neo-Spacian" monster and 1 "Elemental HERO" monster (1 from your hand and 1 from your Deck) to the GY; Special Summon 1 "Neo-Spacian" monster or 1 Level 5 or higher "Elemental HERO" monster from your Deck, and if you do, add 1 "Polymerization" from your Deck or GY to your hand. If you Special Summoned "Elemental HERO Neos" by this effect, it gains 1000 ATK. You cannot Special Summon monsters from the Extra Deck, except Fusion Monsters, the turn you activate this card. You can only activate 1 "EN - Engage Neo Space" per turn.
external_ids: local CARD_ID_0 = 89943723 --Elemental HERO Neos
  local CARD_ID_1 = 24094653 --Polymerization
  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 = 24094653 --Polymerization
  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 + CATEGORY_TOHAND + CATEGORY_SEARCH)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetCountLimit(1, id + EFFECT_COUNT_CODE_OATH)
  	e1:SetCost(s.spcost)
  	e1:SetTarget(s.sptg)
  	e1:SetOperation(s.spop)
  	c:RegisterEffect(e1)
  	Duel.AddCustomActivityCounter(id, ACTIVITY_SPSUMMON, s.counterfilter)
  end
  function s.counterfilter(c)
  	return not c:IsSummonLocation(LOCATION_EXTRA) or c:IsType(TYPE_FUSION)
  end
  function s.costfilter(c)
  	return c:IsSetCard(SETCARD_ID_1, 0x3008) and c:IsType(TYPE_MONSTER) and c:IsAbleToGraveAsCost()
  end
  function s.fselect(g, e, tp)
  	return g:GetClassCount(Card.GetLocation) == g:GetCount() and aux.gfcheck(g, Card.IsSetCard, SETCARD_ID_1, 0x3008) and Duel.IsExistingMatchingCard(s.spfilter, tp, LOCATION_DECK, 0, 1, g, e, tp)
  end
  function s.spfilter(c, e, tp)
  	return (c:IsSetCard(SETCARD_ID_1) or (c:IsLevelAbove(5) and c:IsSetCard(0x3008))) and c:IsCanBeSpecialSummoned(e, 0, tp, false, false)
  end
  function s.spcost(e, tp, eg, ep, ev, re, r, rp, chk)
  	local g = Duel.GetMatchingGroup(s.costfilter, tp, LOCATION_HAND + LOCATION_DECK, 0, nil)
  	if chk == 0 then
  		return Duel.GetCustomActivityCount(id, tp, ACTIVITY_SPSUMMON) == 0 and g:CheckSubGroup(s.fselect, 2, 2, e, tp)
  	end
  	local e1 = Effect.CreateEffect(e:GetHandler())
  	e1:SetType(EFFECT_TYPE_FIELD)
  	e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET + EFFECT_FLAG_OATH)
  	e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
  	e1:SetReset(RESET_PHASE + PHASE_END)
  	e1:SetTargetRange(1, 0)
  	e1:SetTarget(s.splimit)
  	Duel.RegisterEffect(e1, tp)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TOGRAVE)
  	local sg = g:SelectSubGroup(tp, s.fselect, false, 2, 2, e, tp)
  	Duel.SendtoGrave(sg, REASON_COST)
  end
  function s.splimit(e, c)
  	return c:IsLocation(LOCATION_EXTRA) and not c:IsType(TYPE_FUSION)
  end
  function s.thfilter(c)
  	return c:IsCode(CARD_ID_1) and c:IsAbleToHand()
  end
  function s.sptg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.GetLocationCount(tp, LOCATION_MZONE) > 0
  			and Duel.IsExistingMatchingCard(s.spfilter, tp, LOCATION_DECK, 0, 1, nil, e, tp)
  			and Duel.IsExistingMatchingCard(s.thfilter, tp, LOCATION_DECK + LOCATION_GRAVE, 0, 1, nil)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, nil, 1, tp, LOCATION_DECK)
  	Duel.SetOperationInfo(0, CATEGORY_TOHAND, nil, 1, tp, LOCATION_DECK + LOCATION_GRAVE)
  end
  function s.spop(e, tp, eg, ep, ev, re, r, rp)
  	if Duel.GetLocationCount(tp, LOCATION_MZONE) <= 0 then
  		return
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
  	local sc = Duel.SelectMatchingCard(tp, s.spfilter, tp, LOCATION_DECK, 0, 1, 1, nil, e, tp):GetFirst()
  	if sc and Duel.SpecialSummon(sc, 0, tp, tp, false, false, POS_FACEUP) > 0 then
  		if sc:IsCode(CARD_ID_0) then
  			local e1 = Effect.CreateEffect(e:GetHandler())
  			e1:SetType(EFFECT_TYPE_SINGLE)
  			e1:SetCode(EFFECT_UPDATE_ATTACK)
  			e1:SetValue(1000)
  			e1:SetReset(RESET_EVENT + RESETS_STANDARD)
  			sc:RegisterEffect(e1)
  		end
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_ATOHAND)
  		local hg = Duel.SelectMatchingCard(tp, aux.NecroValleyFilter(s.thfilter), tp, LOCATION_DECK + LOCATION_GRAVE, 0, 1, 1, nil)
  		local tc = hg:GetFirst()
  		if tc then
  			Duel.SendtoHand(tc, nil, REASON_EFFECT)
  			Duel.ConfirmCards(1 - tp, tc)
  		end
  	end
  end
  
  
source_text: EN
  Send 1 "Neo-Spacian" monster and 1 "Elemental HERO" monster (1 from your hand and 1 from your Deck) to the GY; Special Summon 1 "Neo-Spacian" monster or 1 Level 5 or higher "Elemental HERO" monster from your Deck, and if you do, add 1 "Polymerization" from your Deck or GY to your hand. If you Special Summoned "Elemental HERO Neos" by this effect, it gains 1000 ATK. You cannot Special Summon monsters from the Extra Deck, except Fusion Monsters, the turn you activate this card. You can only activate 1 "EN - Engage Neo Space" per turn.
target_text: -- EN
  local CARD_ID_0 = 89943723 --Elemental HERO Neos
  local CARD_ID_1 = 24094653 --Polymerization
  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 + CATEGORY_TOHAND + CATEGORY_SEARCH)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetCountLimit(1, id + EFFECT_COUNT_CODE_OATH)
  	e1:SetCost(s.spcost)
  	e1:SetTarget(s.sptg)
  	e1:SetOperation(s.spop)
  	c:RegisterEffect(e1)
  	Duel.AddCustomActivityCounter(id, ACTIVITY_SPSUMMON, s.counterfilter)
  end
  function s.counterfilter(c)
  	return not c:IsSummonLocation(LOCATION_EXTRA) or c:IsType(TYPE_FUSION)
  end
  function s.costfilter(c)
  	return c:IsSetCard(SETCARD_ID_1, 0x3008) and c:IsType(TYPE_MONSTER) and c:IsAbleToGraveAsCost()
  end
  function s.fselect(g, e, tp)
  	return g:GetClassCount(Card.GetLocation) == g:GetCount() and aux.gfcheck(g, Card.IsSetCard, SETCARD_ID_1, 0x3008) and Duel.IsExistingMatchingCard(s.spfilter, tp, LOCATION_DECK, 0, 1, g, e, tp)
  end
  function s.spfilter(c, e, tp)
  	return (c:IsSetCard(SETCARD_ID_1) or (c:IsLevelAbove(5) and c:IsSetCard(0x3008))) and c:IsCanBeSpecialSummoned(e, 0, tp, false, false)
  end
  function s.spcost(e, tp, eg, ep, ev, re, r, rp, chk)
  	local g = Duel.GetMatchingGroup(s.costfilter, tp, LOCATION_HAND + LOCATION_DECK, 0, nil)
  	if chk == 0 then
  		return Duel.GetCustomActivityCount(id, tp, ACTIVITY_SPSUMMON) == 0 and g:CheckSubGroup(s.fselect, 2, 2, e, tp)
  	end
  	local e1 = Effect.CreateEffect(e:GetHandler())
  	e1:SetType(EFFECT_TYPE_FIELD)
  	e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET + EFFECT_FLAG_OATH)
  	e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
  	e1:SetReset(RESET_PHASE + PHASE_END)
  	e1:SetTargetRange(1, 0)
  	e1:SetTarget(s.splimit)
  	Duel.RegisterEffect(e1, tp)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TOGRAVE)
  	local sg = g:SelectSubGroup(tp, s.fselect, false, 2, 2, e, tp)
  	Duel.SendtoGrave(sg, REASON_COST)
  end
  function s.splimit(e, c)
  	return c:IsLocation(LOCATION_EXTRA) and not c:IsType(TYPE_FUSION)
  end
  function s.thfilter(c)
  	return c:IsCode(CARD_ID_1) and c:IsAbleToHand()
  end
  function s.sptg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.GetLocationCount(tp, LOCATION_MZONE) > 0
  			and Duel.IsExistingMatchingCard(s.spfilter, tp, LOCATION_DECK, 0, 1, nil, e, tp)
  			and Duel.IsExistingMatchingCard(s.thfilter, tp, LOCATION_DECK + LOCATION_GRAVE, 0, 1, nil)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, nil, 1, tp, LOCATION_DECK)
  	Duel.SetOperationInfo(0, CATEGORY_TOHAND, nil, 1, tp, LOCATION_DECK + LOCATION_GRAVE)
  end
  function s.spop(e, tp, eg, ep, ev, re, r, rp)
  	if Duel.GetLocationCount(tp, LOCATION_MZONE) <= 0 then
  		return
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
  	local sc = Duel.SelectMatchingCard(tp, s.spfilter, tp, LOCATION_DECK, 0, 1, 1, nil, e, tp):GetFirst()
  	if sc and Duel.SpecialSummon(sc, 0, tp, tp, false, false, POS_FACEUP) > 0 then
  		if sc:IsCode(CARD_ID_0) then
  			local e1 = Effect.CreateEffect(e:GetHandler())
  			e1:SetType(EFFECT_TYPE_SINGLE)
  			e1:SetCode(EFFECT_UPDATE_ATTACK)
  			e1:SetValue(1000)
  			e1:SetReset(RESET_EVENT + RESETS_STANDARD)
  			sc:RegisterEffect(e1)
  		end
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_ATOHAND)
  		local hg = Duel.SelectMatchingCard(tp, aux.NecroValleyFilter(s.thfilter), tp, LOCATION_DECK + LOCATION_GRAVE, 0, 1, 1, nil)
  		local tc = hg:GetFirst()
  		if tc then
  			Duel.SendtoHand(tc, nil, REASON_EFFECT)
  			Duel.ConfirmCards(1 - tp, tc)
  		end
  	end
  end
  
  