El
If you control an "Eldlich" monster: Activate 1 of these effects;
● Shuffle 3 of your banished "Eldlixir" Spells/Traps with different names into your Deck, and if you do, destroy all cards on the field.
● Shuffle 3 of your banished "Golden Land" Spells/Traps with different names into your Deck, and if you do, halve your opponent's LP, then you gain LP equal to their LP.
You can only activate 1 "El Dorado Adelantado" per turn.
local SETCARD_ID_0 = 0x1142 --Eldlich
local SETCARD_ID_1 = 0x2142 --Eldlixir
local SETCARD_ID_2 = 0x143 --Golden

local SETCARD_ID_0 = 0x1142 --Eldlich
local SETCARD_ID_1 = 0x2142 --Eldlixir
local SETCARD_ID_2 = 0x143 --Golden
local s, id, o = GetID()
function s.initial_effect(c)
	--Activate
	local e1 = Effect.CreateEffect(c)
	e1:SetCategory(CATEGORY_RECOVER + CATEGORY_DESTROY + CATEGORY_TODECK)
	e1:SetType(EFFECT_TYPE_ACTIVATE)
	e1:SetCode(EVENT_FREE_CHAIN)
	e1:SetCountLimit(1, id + EFFECT_COUNT_CODE_OATH)
	e1:SetCondition(s.condition)
	e1:SetTarget(s.target)
	e1:SetOperation(s.activate)
	c:RegisterEffect(e1)
end
function s.filter(c)
	return c:IsSetCard(SETCARD_ID_2) and c:IsFaceup()
end
function s.tdfilter1(c)
	return c:IsSetCard(SETCARD_ID_2) and c:IsFaceup()
end
function s.tdfilter2(c)
	return c:IsSetCard(SETCARD_ID_2) and c:IsFaceup()
end
function s.condition(e, tp, eg, ep, ev, re, r, rp)
	return Duel.IsExistingMatchingCard(s.filter, tp, LOCATION_MZONE, 0, 1, nil)
end
function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
	local g1 = Duel.GetMatchingGroup(s.tdfilter1, tp, LOCATION_REMOVED, 0, nil)
	local g2 = Duel.GetMatchingGroup(s.tdfilter2, tp, LOCATION_REMOVED, 0, nil)
	local b1 = g1:GetClassCount(Card.GetCode) > 2 and Duel.IsExistingMatchingCard(aux.TRUE, tp, LOCATION_ONFIELD, LOCATION_ONFIELD, 1, e:GetHandler())
	local b2 = g2:GetClassCount(Card.GetCode) > 2
	if chk == 0 then
		return b1 or b2
	end
	local off = 1
	local ops = {}
	local opval = {}
	if b1 then
		ops[off] = aux.Stringid(id, 0)
		opval[off - 1] = 1
		off = off + 1
	end
	if b2 then
		ops[off] = aux.Stringid(id, 1)
		opval[off - 1] = 2
		off = off + 1
	end
	local op = Duel.SelectOption(tp, table.unpack(ops))
	local sel = opval[op]
	e:SetLabel(sel)
	if sel == 1 then
		local g = Duel.GetMatchingGroup(aux.TRUE, tp, LOCATION_ONFIELD, LOCATION_ONFIELD, e:GetHandler())
		Duel.SetOperationInfo(0, CATEGORY_DESTROY, g, g:GetCount(), 0, 0)
	end
end
function s.activate(e, tp, eg, ep, ev, re, r, rp)
	local c = e:GetHandler()
	local sel = e:GetLabel()
	if sel == 1 then
		local g = Duel.GetMatchingGroup(s.tdfilter1, tp, LOCATION_REMOVED, 0, nil)
		if g:GetClassCount(Card.GetCode) >= 3 then
			Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TODECK)
			local tg = g:SelectSubGroup(tp, aux.dncheck, false, 3, 3)
			if #tg > 0 then
				Duel.HintSelection(tg)
			end
			Duel.SendtoDeck(tg, nil, SEQ_DECKSHUFFLE, REASON_EFFECT)
			local og = Duel.GetOperatedGroup()
			if og:IsExists(Card.IsLocation, 1, nil, LOCATION_DECK) then
				Duel.ShuffleDeck(tp)
			end
			local ct = og:FilterCount(Card.IsLocation, nil, LOCATION_DECK + LOCATION_EXTRA)
			if ct == 3 then
				Duel.BreakEffect()
				local g = Duel.GetMatchingGroup(aux.TRUE, tp, LOCATION_ONFIELD, LOCATION_ONFIELD, e:GetHandler())
				if #g > 0 then
					Duel.Destroy(g, REASON_EFFECT)
				end
			end
		end
	else
		local g = Duel.GetMatchingGroup(s.tdfilter2, tp, LOCATION_REMOVED, 0, nil)
		if g:GetClassCount(Card.GetCode) >= 3 then
			Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TODECK)
			local tg = g:SelectSubGroup(tp, aux.dncheck, false, 3, 3)
			if #tg > 0 then
				Duel.HintSelection(tg)
			end
			Duel.SendtoDeck(tg, nil, SEQ_DECKSHUFFLE, REASON_EFFECT)
			local og = Duel.GetOperatedGroup()
			if og:IsExists(Card.IsLocation, 1, nil, LOCATION_DECK) then
				Duel.ShuffleDeck(tp)
			end
			local ct = og:FilterCount(Card.IsLocation, nil, LOCATION_DECK + LOCATION_EXTRA)
			if ct == 3 then
				Duel.BreakEffect()
				Duel.SetLP(1 - tp, math.ceil(Duel.GetLP(1 - tp) / 2))
				Duel.Recover(tp, Duel.GetLP(1 - tp), REASON_EFFECT)
			end
		end
	end
end


El
If you control an "Eldlich" monster: Activate 1 of these effects;
● Shuffle 3 of your banished "Eldlixir" Spells/Traps with different names into your Deck, and if you do, destroy all cards on the field.
● Shuffle 3 of your banished "Golden Land" Spells/Traps with different names into your Deck, and if you do, halve your opponent's LP, then you gain LP equal to their LP.
You can only activate 1 "El Dorado Adelantado" per turn.
-- El
local SETCARD_ID_0 = 0x1142 --Eldlich
local SETCARD_ID_1 = 0x2142 --Eldlixir
local SETCARD_ID_2 = 0x143 --Golden
local s, id, o = GetID()
function s.initial_effect(c)
	--Activate
	local e1 = Effect.CreateEffect(c)
	e1:SetCategory(CATEGORY_RECOVER + CATEGORY_DESTROY + CATEGORY_TODECK)
	e1:SetType(EFFECT_TYPE_ACTIVATE)
	e1:SetCode(EVENT_FREE_CHAIN)
	e1:SetCountLimit(1, id + EFFECT_COUNT_CODE_OATH)
	e1:SetCondition(s.condition)
	e1:SetTarget(s.target)
	e1:SetOperation(s.activate)
	c:RegisterEffect(e1)
end
function s.filter(c)
	return c:IsSetCard(SETCARD_ID_2) and c:IsFaceup()
end
function s.tdfilter1(c)
	return c:IsSetCard(SETCARD_ID_2) and c:IsFaceup()
end
function s.tdfilter2(c)
	return c:IsSetCard(SETCARD_ID_2) and c:IsFaceup()
end
function s.condition(e, tp, eg, ep, ev, re, r, rp)
	return Duel.IsExistingMatchingCard(s.filter, tp, LOCATION_MZONE, 0, 1, nil)
end
function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
	local g1 = Duel.GetMatchingGroup(s.tdfilter1, tp, LOCATION_REMOVED, 0, nil)
	local g2 = Duel.GetMatchingGroup(s.tdfilter2, tp, LOCATION_REMOVED, 0, nil)
	local b1 = g1:GetClassCount(Card.GetCode) > 2 and Duel.IsExistingMatchingCard(aux.TRUE, tp, LOCATION_ONFIELD, LOCATION_ONFIELD, 1, e:GetHandler())
	local b2 = g2:GetClassCount(Card.GetCode) > 2
	if chk == 0 then
		return b1 or b2
	end
	local off = 1
	local ops = {}
	local opval = {}
	if b1 then
		ops[off] = aux.Stringid(id, 0)
		opval[off - 1] = 1
		off = off + 1
	end
	if b2 then
		ops[off] = aux.Stringid(id, 1)
		opval[off - 1] = 2
		off = off + 1
	end
	local op = Duel.SelectOption(tp, table.unpack(ops))
	local sel = opval[op]
	e:SetLabel(sel)
	if sel == 1 then
		local g = Duel.GetMatchingGroup(aux.TRUE, tp, LOCATION_ONFIELD, LOCATION_ONFIELD, e:GetHandler())
		Duel.SetOperationInfo(0, CATEGORY_DESTROY, g, g:GetCount(), 0, 0)
	end
end
function s.activate(e, tp, eg, ep, ev, re, r, rp)
	local c = e:GetHandler()
	local sel = e:GetLabel()
	if sel == 1 then
		local g = Duel.GetMatchingGroup(s.tdfilter1, tp, LOCATION_REMOVED, 0, nil)
		if g:GetClassCount(Card.GetCode) >= 3 then
			Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TODECK)
			local tg = g:SelectSubGroup(tp, aux.dncheck, false, 3, 3)
			if #tg > 0 then
				Duel.HintSelection(tg)
			end
			Duel.SendtoDeck(tg, nil, SEQ_DECKSHUFFLE, REASON_EFFECT)
			local og = Duel.GetOperatedGroup()
			if og:IsExists(Card.IsLocation, 1, nil, LOCATION_DECK) then
				Duel.ShuffleDeck(tp)
			end
			local ct = og:FilterCount(Card.IsLocation, nil, LOCATION_DECK + LOCATION_EXTRA)
			if ct == 3 then
				Duel.BreakEffect()
				local g = Duel.GetMatchingGroup(aux.TRUE, tp, LOCATION_ONFIELD, LOCATION_ONFIELD, e:GetHandler())
				if #g > 0 then
					Duel.Destroy(g, REASON_EFFECT)
				end
			end
		end
	else
		local g = Duel.GetMatchingGroup(s.tdfilter2, tp, LOCATION_REMOVED, 0, nil)
		if g:GetClassCount(Card.GetCode) >= 3 then
			Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TODECK)
			local tg = g:SelectSubGroup(tp, aux.dncheck, false, 3, 3)
			if #tg > 0 then
				Duel.HintSelection(tg)
			end
			Duel.SendtoDeck(tg, nil, SEQ_DECKSHUFFLE, REASON_EFFECT)
			local og = Duel.GetOperatedGroup()
			if og:IsExists(Card.IsLocation, 1, nil, LOCATION_DECK) then
				Duel.ShuffleDeck(tp)
			end
			local ct = og:FilterCount(Card.IsLocation, nil, LOCATION_DECK + LOCATION_EXTRA)
			if ct == 3 then
				Duel.BreakEffect()
				Duel.SetLP(1 - tp, math.ceil(Duel.GetLP(1 - tp) / 2))
				Duel.Recover(tp, Duel.GetLP(1 - tp), REASON_EFFECT)
			end
		end
	end
end

