EN
Shuffle 1 "Elemental HERO" or "Neo-Spacian" monster you control into the Deck, and if you do, Special Summon 1 "Elemental HERO" or "Neo-Spacian" monster with a different name from your Deck. You can banish this card from your GY; shuffle from your GY into the Deck, either 1 "Elemental HERO" monster and 1 "Neo-Spacian" monster, OR 1 "Elemental HERO Neos", then draw 1 card. You can only use each effect of "EN Shuffle" once per turn.
local CARD_ID_0 = 89943723 --Elemental HERO Neos
local SETCARD_ID_0 = 0x3008 --Elemental

local CARD_ID_0 = 89943723 --Elemental HERO Neos
local SETCARD_ID_0 = 0x3008 --Elemental
local s, id, o = GetID()
function s.initial_effect(c)
	aux.AddCodeList(c, CARD_ID_0)
	aux.AddSetNameMonsterList(c, SETCARD_ID_0)
	--spsummon
	local e1 = Effect.CreateEffect(c)
	e1:SetCategory(CATEGORY_TODECK + CATEGORY_SPECIAL_SUMMON)
	e1:SetType(EFFECT_TYPE_ACTIVATE)
	e1:SetCode(EVENT_FREE_CHAIN)
	e1:SetCountLimit(1, id)
	e1:SetTarget(s.sptg)
	e1:SetOperation(s.spop)
	c:RegisterEffect(e1)
	--draw
	local e2 = Effect.CreateEffect(c)
	e2:SetCategory(CATEGORY_TODECK + CATEGORY_DRAW)
	e2:SetType(EFFECT_TYPE_IGNITION)
	e2:SetRange(LOCATION_GRAVE)
	e2:SetCountLimit(1, id + 1)
	e2:SetCost(aux.bfgcost)
	e2:SetTarget(s.drtg)
	e2:SetOperation(s.drop)
	c:RegisterEffect(e2)
end
function s.tdfilter(c, e, tp)
	return c:IsFaceup()
		and c:IsSetCard(SETCARD_ID_0, 0x1f)
		and c:IsType(TYPE_MONSTER)
		and c:IsAbleToDeck()
		and Duel.GetMZoneCount(tp, c) > 0
		and Duel.IsExistingMatchingCard(s.spfilter, tp, LOCATION_DECK, 0, 1, nil, e, tp, c:GetCode())
end
function s.spfilter(c, e, tp, code)
	return c:IsSetCard(SETCARD_ID_0, 0x1f) and not c:IsCode(code) 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.tdfilter, tp, LOCATION_MZONE, 0, 1, nil, e, tp)
	end
	Duel.SetOperationInfo(0, CATEGORY_TODECK, nil, 1, tp, LOCATION_MZONE)
	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, nil, 1, tp, LOCATION_DECK)
end
function s.spop(e, tp, eg, ep, ev, re, r, rp)
	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TODECK)
	local tc = Duel.SelectMatchingCard(tp, s.tdfilter, tp, LOCATION_MZONE, 0, 1, 1, nil, e, tp):GetFirst()
	if not tc then
		return
	end
	local code = tc:GetCode()
	if Duel.SendtoDeck(tc, nil, SEQ_DECKSHUFFLE, REASON_EFFECT) > 0 and tc:IsLocation(LOCATION_DECK + LOCATION_EXTRA) and Duel.GetLocationCount(tp, LOCATION_MZONE) > 0 then
		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
		local g = Duel.SelectMatchingCard(tp, s.spfilter, tp, LOCATION_DECK, 0, 1, 1, nil, e, tp, code)
		if g:GetCount() > 0 then
			Duel.SpecialSummon(g, 0, tp, tp, false, false, POS_FACEUP)
		end
	end
end
function s.filter(c)
	return c:IsType(TYPE_MONSTER) and c:IsAbleToDeck() and (c:IsSetCard(SETCARD_ID_0, 0x1f) or c:IsCode(CARD_ID_0))
end
function s.gcheck(g)
	return #g == 1 and g:GetFirst():IsCode(CARD_ID_0) or aux.gfcheck(g, Card.IsSetCard, SETCARD_ID_0, 0x1f)
end
function s.drtg(e, tp, eg, ep, ev, re, r, rp, chk)
	if chk == 0 then
		if not Duel.IsPlayerCanDraw(tp, 1) then
			return false
		end
		local g = Duel.GetMatchingGroup(s.filter, tp, LOCATION_GRAVE, 0, nil)
		return g:CheckSubGroup(s.gcheck, 1, 2)
	end
	Duel.SetOperationInfo(0, CATEGORY_TODECK, nil, 1, tp, LOCATION_GRAVE)
	Duel.SetOperationInfo(0, CATEGORY_DRAW, nil, 0, tp, 1)
end
function s.drop(e, tp, eg, ep, ev, re, r, rp)
	local g = Duel.GetMatchingGroup(aux.NecroValleyFilter(s.filter), tp, LOCATION_GRAVE, 0, nil)
	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TODECK)
	local sg = g:SelectSubGroup(tp, s.gcheck, false, 1, 2)
	if sg then
		Duel.HintSelection(sg)
		if Duel.SendtoDeck(sg, nil, SEQ_DECKSHUFFLE, REASON_EFFECT) > 0 then
			local og = Duel.GetOperatedGroup()
			if not og:IsExists(Card.IsLocation, 1, nil, LOCATION_DECK + LOCATION_EXTRA) then
				return
			end
			Duel.ShuffleDeck(tp)
			Duel.BreakEffect()
			Duel.Draw(tp, 1, REASON_EFFECT)
		end
	end
end


EN
Shuffle 1 "Elemental HERO" or "Neo-Spacian" monster you control into the Deck, and if you do, Special Summon 1 "Elemental HERO" or "Neo-Spacian" monster with a different name from your Deck. You can banish this card from your GY; shuffle from your GY into the Deck, either 1 "Elemental HERO" monster and 1 "Neo-Spacian" monster, OR 1 "Elemental HERO Neos", then draw 1 card. You can only use each effect of "EN Shuffle" once per turn.
-- EN
local CARD_ID_0 = 89943723 --Elemental HERO Neos
local SETCARD_ID_0 = 0x3008 --Elemental
local s, id, o = GetID()
function s.initial_effect(c)
	aux.AddCodeList(c, CARD_ID_0)
	aux.AddSetNameMonsterList(c, SETCARD_ID_0)
	--spsummon
	local e1 = Effect.CreateEffect(c)
	e1:SetCategory(CATEGORY_TODECK + CATEGORY_SPECIAL_SUMMON)
	e1:SetType(EFFECT_TYPE_ACTIVATE)
	e1:SetCode(EVENT_FREE_CHAIN)
	e1:SetCountLimit(1, id)
	e1:SetTarget(s.sptg)
	e1:SetOperation(s.spop)
	c:RegisterEffect(e1)
	--draw
	local e2 = Effect.CreateEffect(c)
	e2:SetCategory(CATEGORY_TODECK + CATEGORY_DRAW)
	e2:SetType(EFFECT_TYPE_IGNITION)
	e2:SetRange(LOCATION_GRAVE)
	e2:SetCountLimit(1, id + 1)
	e2:SetCost(aux.bfgcost)
	e2:SetTarget(s.drtg)
	e2:SetOperation(s.drop)
	c:RegisterEffect(e2)
end
function s.tdfilter(c, e, tp)
	return c:IsFaceup()
		and c:IsSetCard(SETCARD_ID_0, 0x1f)
		and c:IsType(TYPE_MONSTER)
		and c:IsAbleToDeck()
		and Duel.GetMZoneCount(tp, c) > 0
		and Duel.IsExistingMatchingCard(s.spfilter, tp, LOCATION_DECK, 0, 1, nil, e, tp, c:GetCode())
end
function s.spfilter(c, e, tp, code)
	return c:IsSetCard(SETCARD_ID_0, 0x1f) and not c:IsCode(code) 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.tdfilter, tp, LOCATION_MZONE, 0, 1, nil, e, tp)
	end
	Duel.SetOperationInfo(0, CATEGORY_TODECK, nil, 1, tp, LOCATION_MZONE)
	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, nil, 1, tp, LOCATION_DECK)
end
function s.spop(e, tp, eg, ep, ev, re, r, rp)
	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TODECK)
	local tc = Duel.SelectMatchingCard(tp, s.tdfilter, tp, LOCATION_MZONE, 0, 1, 1, nil, e, tp):GetFirst()
	if not tc then
		return
	end
	local code = tc:GetCode()
	if Duel.SendtoDeck(tc, nil, SEQ_DECKSHUFFLE, REASON_EFFECT) > 0 and tc:IsLocation(LOCATION_DECK + LOCATION_EXTRA) and Duel.GetLocationCount(tp, LOCATION_MZONE) > 0 then
		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
		local g = Duel.SelectMatchingCard(tp, s.spfilter, tp, LOCATION_DECK, 0, 1, 1, nil, e, tp, code)
		if g:GetCount() > 0 then
			Duel.SpecialSummon(g, 0, tp, tp, false, false, POS_FACEUP)
		end
	end
end
function s.filter(c)
	return c:IsType(TYPE_MONSTER) and c:IsAbleToDeck() and (c:IsSetCard(SETCARD_ID_0, 0x1f) or c:IsCode(CARD_ID_0))
end
function s.gcheck(g)
	return #g == 1 and g:GetFirst():IsCode(CARD_ID_0) or aux.gfcheck(g, Card.IsSetCard, SETCARD_ID_0, 0x1f)
end
function s.drtg(e, tp, eg, ep, ev, re, r, rp, chk)
	if chk == 0 then
		if not Duel.IsPlayerCanDraw(tp, 1) then
			return false
		end
		local g = Duel.GetMatchingGroup(s.filter, tp, LOCATION_GRAVE, 0, nil)
		return g:CheckSubGroup(s.gcheck, 1, 2)
	end
	Duel.SetOperationInfo(0, CATEGORY_TODECK, nil, 1, tp, LOCATION_GRAVE)
	Duel.SetOperationInfo(0, CATEGORY_DRAW, nil, 0, tp, 1)
end
function s.drop(e, tp, eg, ep, ev, re, r, rp)
	local g = Duel.GetMatchingGroup(aux.NecroValleyFilter(s.filter), tp, LOCATION_GRAVE, 0, nil)
	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TODECK)
	local sg = g:SelectSubGroup(tp, s.gcheck, false, 1, 2)
	if sg then
		Duel.HintSelection(sg)
		if Duel.SendtoDeck(sg, nil, SEQ_DECKSHUFFLE, REASON_EFFECT) > 0 then
			local og = Duel.GetOperatedGroup()
			if not og:IsExists(Card.IsLocation, 1, nil, LOCATION_DECK + LOCATION_EXTRA) then
				return
			end
			Duel.ShuffleDeck(tp)
			Duel.BreakEffect()
			Duel.Draw(tp, 1, REASON_EFFECT)
		end
	end
end

