From 4d872540010f98cb32156778d75183320b0be85b Mon Sep 17 00:00:00 2001 From: NightKev <34855794+DayKev@users.noreply.github.com> Date: Sat, 27 Jul 2024 20:56:27 -0700 Subject: [PATCH] Fix off-by-one error (#3177) --- src/system/game-data.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/system/game-data.ts b/src/system/game-data.ts index 3c0ae20ca1e..9bd0fcd0745 100644 --- a/src/system/game-data.ts +++ b/src/system/game-data.ts @@ -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; } }