Skip to content

Commit 010223e

Browse files
committed
actually, keep the stat check but only use it if the leftover evs are the same
this makes both trapinch and amoonguss work as expected
1 parent a3a4a38 commit 010223e

File tree

1 file changed

+23
-3
lines changed

1 file changed

+23
-3
lines changed

play.pokemonshowdown.com/src/battle-tooltips.ts

+23-3
Original file line numberDiff line numberDiff line change
@@ -2992,9 +2992,29 @@ function BattleStatOptimizer(set: PokemonSet, formatid: ID) {
29922992
}
29932993

29942994
const leftoverEVs = 508 - totalEVs;
2995-
if (totalEVs <= 508 && allValidEVs && leftoverEVs > curLeftoverEVs) {
2996-
curSpread = spread;
2997-
curLeftoverEVs = leftoverEVs;
2995+
if (totalEVs <= 508 && allValidEVs) {
2996+
if (leftoverEVs > curLeftoverEVs) {
2997+
curSpread = spread;
2998+
curLeftoverEVs = leftoverEVs;
2999+
} else if (leftoverEVs === curLeftoverEVs) {
3000+
// Check if we hit a jump point
3001+
let allGreaterThanOrEqual = true;
3002+
let atLeastOneGreaterThan = false;
3003+
for (const stat of Dex.statNames) {
3004+
const statVal = getStat(stat, spread.evs[stat], nature);
3005+
const curStatVal = getStat(stat, curSpread.evs?.[stat] || 0, curSpread);
3006+
if (statVal < curStatVal) {
3007+
allGreaterThanOrEqual = false;
3008+
break;
3009+
} else if (statVal > curStatVal) {
3010+
atLeastOneGreaterThan = true;
3011+
}
3012+
}
3013+
if (allGreaterThanOrEqual && atLeastOneGreaterThan) {
3014+
curSpread = spread;
3015+
curLeftoverEVs = leftoverEVs;
3016+
}
3017+
}
29983018
}
29993019
}
30003020

0 commit comments

Comments
 (0)