fix getting the highest ivs for the iv scanner (#4022)

This commit is contained in:
MokaStitcher 2024-09-04 19:00:31 +02:00 committed by GitHub
parent e822c91a16
commit 11ac929a4d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 5 deletions

View File

@ -215,12 +215,11 @@ export default class BattleMessageUiHandler extends MessageUiHandler {
getTopIvs(ivs: integer[], shownIvsCount: integer): Stat[] {
let shownStats: Stat[] = [];
if (shownIvsCount < 6) {
let highestIv = -1;
const statsPool = PERMANENT_STATS.slice();
// Sort the stats from highest to lowest iv
statsPool.sort((s1, s2) => ivs[s2] - ivs[s1]);
for (let i = 0; i < shownIvsCount; i++) {
if (ivs[i] > highestIv) {
shownStats.push(PERMANENT_STATS[i]);
highestIv = ivs[i];
}
shownStats.push(statsPool[i]);
}
} else {
shownStats = PERMANENT_STATS.slice();