Star
Pay any number of Life Points in multiples of 500; reduce the Level of 1 monster you control or that is in your hand by 1 for each 500 Life Points you paid, until the End Phase.
local s, id, o = GetID()
function s.initial_effect(c)
	--activate
	local e1 = Effect.CreateEffect(c)
	e1:SetType(EFFECT_TYPE_ACTIVATE)
	e1:SetCode(EVENT_FREE_CHAIN)
	e1:SetCost(s.cost)
	e1:SetTarget(s.tg)
	e1:SetOperation(s.op)
	c:RegisterEffect(e1)
end
function s.cost(e, tp, eg, ep, ev, re, r, rp, chk)
	if chk == 0 then
		return Duel.CheckLPCost(tp, 500, true)
	end
	local lp = Duel.GetLP(tp)
	local g = Duel.GetMatchingGroup(Card.IsLevelAbove, tp, LOCATION_HAND + LOCATION_MZONE, 0, nil, 2)
	local tg = g:GetMaxGroup(Card.GetLevel)
	local maxlv = math.min(tg:GetFirst():GetLevel(), 255)
	local t = {}
	local l = 1
	while l < maxlv and l * 500 <= lp do
		t[l] = l * 500
		l = l + 1
	end
	Duel.Hint(HINT_SELECTMSG, tp, aux.Stringid(id, 0))
	local announce = Duel.AnnounceNumber(tp, table.unpack(t))
	Duel.PayLPCost(tp, announce, true)
	e:SetLabel(announce / 500)
end
function s.tg(e, tp, eg, ep, ev, re, r, rp, chk)
	if chk == 0 then
		return Duel.IsExistingMatchingCard(Card.IsLevelAbove, tp, LOCATION_HAND + LOCATION_MZONE, 0, 1, nil, 2)
	end
end
function s.op(e, tp, eg, ep, ev, re, r, rp)
	local ct = e:GetLabel()
	local g = Duel.GetMatchingGroup(Card.IsLevelAbove, tp, LOCATION_HAND + LOCATION_MZONE, 0, nil, ct + 1)
	if g:GetCount() > 0 then
		Duel.Hint(HINT_SELECTMSG, tp, aux.Stringid(id, 1))
		local sg = g:Select(tp, 1, 1, nil)
		local tc = sg:GetFirst()
		if tc:IsLocation(LOCATION_MZONE) then
			Duel.HintSelection(sg)
		end
		Duel.ConfirmCards(1 - tp, sg)
		if tc:IsLocation(LOCATION_HAND) then
			Duel.ShuffleHand(tp)
		end
		local e1 = Effect.CreateEffect(e:GetHandler())
		e1:SetType(EFFECT_TYPE_SINGLE)
		e1:SetCode(EFFECT_UPDATE_LEVEL)
		e1:SetReset(RESET_EVENT + RESETS_STANDARD - RESET_TOFIELD + RESET_PHASE + PHASE_END)
		e1:SetValue(-ct)
		tc:RegisterEffect(e1)
	end
end


Star
Pay any number of Life Points in multiples of 500; reduce the Level of 1 monster you control or that is in your hand by 1 for each 500 Life Points you paid, until the End Phase.
-- Star
local s, id, o = GetID()
function s.initial_effect(c)
	--activate
	local e1 = Effect.CreateEffect(c)
	e1:SetType(EFFECT_TYPE_ACTIVATE)
	e1:SetCode(EVENT_FREE_CHAIN)
	e1:SetCost(s.cost)
	e1:SetTarget(s.tg)
	e1:SetOperation(s.op)
	c:RegisterEffect(e1)
end
function s.cost(e, tp, eg, ep, ev, re, r, rp, chk)
	if chk == 0 then
		return Duel.CheckLPCost(tp, 500, true)
	end
	local lp = Duel.GetLP(tp)
	local g = Duel.GetMatchingGroup(Card.IsLevelAbove, tp, LOCATION_HAND + LOCATION_MZONE, 0, nil, 2)
	local tg = g:GetMaxGroup(Card.GetLevel)
	local maxlv = math.min(tg:GetFirst():GetLevel(), 255)
	local t = {}
	local l = 1
	while l < maxlv and l * 500 <= lp do
		t[l] = l * 500
		l = l + 1
	end
	Duel.Hint(HINT_SELECTMSG, tp, aux.Stringid(id, 0))
	local announce = Duel.AnnounceNumber(tp, table.unpack(t))
	Duel.PayLPCost(tp, announce, true)
	e:SetLabel(announce / 500)
end
function s.tg(e, tp, eg, ep, ev, re, r, rp, chk)
	if chk == 0 then
		return Duel.IsExistingMatchingCard(Card.IsLevelAbove, tp, LOCATION_HAND + LOCATION_MZONE, 0, 1, nil, 2)
	end
end
function s.op(e, tp, eg, ep, ev, re, r, rp)
	local ct = e:GetLabel()
	local g = Duel.GetMatchingGroup(Card.IsLevelAbove, tp, LOCATION_HAND + LOCATION_MZONE, 0, nil, ct + 1)
	if g:GetCount() > 0 then
		Duel.Hint(HINT_SELECTMSG, tp, aux.Stringid(id, 1))
		local sg = g:Select(tp, 1, 1, nil)
		local tc = sg:GetFirst()
		if tc:IsLocation(LOCATION_MZONE) then
			Duel.HintSelection(sg)
		end
		Duel.ConfirmCards(1 - tp, sg)
		if tc:IsLocation(LOCATION_HAND) then
			Duel.ShuffleHand(tp)
		end
		local e1 = Effect.CreateEffect(e:GetHandler())
		e1:SetType(EFFECT_TYPE_SINGLE)
		e1:SetCode(EFFECT_UPDATE_LEVEL)
		e1:SetReset(RESET_EVENT + RESETS_STANDARD - RESET_TOFIELD + RESET_PHASE + PHASE_END)
		e1:SetValue(-ct)
		tc:RegisterEffect(e1)
	end
end

