Skip to content
This repository was archived by the owner on Aug 12, 2025. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions Libs/teamlib.lua
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ end
--- @return : team index, of lowest leveled pkm under level_cap | nil, if none exists
--- @type : integer | nil
function team.getLowestPkmToLvl(level_cap)
return team._compare(team.getPkmToLvl(level_cap), gen.minLvl)
if getTeamSize() > 1 then
return team._compare(team.getPkmToLvl(level_cap), gen.minLvl)
end
end

function team.getAlivePkmToLvl(level_cap)
Expand Down Expand Up @@ -113,7 +115,9 @@ function team.getLowestPkmAlive()
end

function team.getLowestLvl()
return getPokemonLevel(team.getLowestLvlPkm())
if getTeamSize() > 1 then
return getPokemonLevel(team.getLowestLvlPkm())
end
end

function team.getPkm()
Expand Down Expand Up @@ -205,6 +209,7 @@ end

--actual calculations
function team._compare(t, fn)
if getTeamSize() > 1 then
if not t then return nil end
if #t == 0 then return nil end --, nil end
local key, value = 1, t[1]
Expand All @@ -214,6 +219,7 @@ function team._compare(t, fn)
end
end
return value
end
end

function team._filter(t, fn, ...)
Expand Down Expand Up @@ -264,4 +270,4 @@ function team._transform(t, fn)
end


return team
return team