Skip to content

Commit

Permalink
actually, keep the stat check but only use it if the leftover evs are…
Browse files Browse the repository at this point in the history
… the same

this makes both trapinch and amoonguss work as expected
  • Loading branch information
Karthik99999 committed Apr 4, 2024
1 parent a3a4a38 commit 010223e
Showing 1 changed file with 23 additions and 3 deletions.
26 changes: 23 additions & 3 deletions play.pokemonshowdown.com/src/battle-tooltips.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2992,9 +2992,29 @@ function BattleStatOptimizer(set: PokemonSet, formatid: ID) {
}

const leftoverEVs = 508 - totalEVs;
if (totalEVs <= 508 && allValidEVs && leftoverEVs > curLeftoverEVs) {
curSpread = spread;
curLeftoverEVs = leftoverEVs;
if (totalEVs <= 508 && allValidEVs) {
if (leftoverEVs > curLeftoverEVs) {
curSpread = spread;
curLeftoverEVs = leftoverEVs;
} else if (leftoverEVs === curLeftoverEVs) {
// Check if we hit a jump point
let allGreaterThanOrEqual = true;
let atLeastOneGreaterThan = false;
for (const stat of Dex.statNames) {
const statVal = getStat(stat, spread.evs[stat], nature);
const curStatVal = getStat(stat, curSpread.evs?.[stat] || 0, curSpread);
if (statVal < curStatVal) {
allGreaterThanOrEqual = false;
break;
} else if (statVal > curStatVal) {
atLeastOneGreaterThan = true;
}
}
if (allGreaterThanOrEqual && atLeastOneGreaterThan) {
curSpread = spread;
curLeftoverEVs = leftoverEVs;
}
}
}
}

Expand Down

0 comments on commit 010223e

Please sign in to comment.