Fix off-by-one error (#3177)

This commit is contained in:
NightKev 2024-07-27 20:56:27 -07:00 committed by GitHub
parent 806f0f4e83
commit 4d87254001
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -854,9 +854,8 @@ export class GameData {
const sessionData = this.parseSessionData(sessionDataStr);
for (let i = 0; i <= 5; i++) {
if (sessionData.party[i]?.abilityIndex === 1) {
if (allSpecies[sessionData.party[i].species].ability1 === allSpecies[sessionData.party[i].species].ability2 &&
allSpecies[sessionData.party[i].species].abilityHidden !== Abilities.NONE &&
allSpecies[sessionData.party[i].species].abilityHidden !== allSpecies[sessionData.party[i].species].ability1) {
const speciesToCheck = allSpecies[sessionData.party[i].species - 1];
if (speciesToCheck.ability1 === speciesToCheck.ability2 && speciesToCheck.abilityHidden !== Abilities.NONE && speciesToCheck.abilityHidden !== speciesToCheck.ability1) {
sessionData.party[i].abilityIndex = 2;
}
}