mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-04-24 14:27:37 -04:00
fix getting the highest ivs for the iv scanner (#4022)
This commit is contained in:
parent
e822c91a16
commit
11ac929a4d
1 changed files with 4 additions and 5 deletions
|
@ -215,12 +215,11 @@ export default class BattleMessageUiHandler extends MessageUiHandler {
|
||||||
getTopIvs(ivs: integer[], shownIvsCount: integer): Stat[] {
|
getTopIvs(ivs: integer[], shownIvsCount: integer): Stat[] {
|
||||||
let shownStats: Stat[] = [];
|
let shownStats: Stat[] = [];
|
||||||
if (shownIvsCount < 6) {
|
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++) {
|
for (let i = 0; i < shownIvsCount; i++) {
|
||||||
if (ivs[i] > highestIv) {
|
shownStats.push(statsPool[i]);
|
||||||
shownStats.push(PERMANENT_STATS[i]);
|
|
||||||
highestIv = ivs[i];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
shownStats = PERMANENT_STATS.slice();
|
shownStats = PERMANENT_STATS.slice();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue