From 5c367db8a31a27140e4a157e3f38d521b1482468 Mon Sep 17 00:00:00 2001 From: Flashfyre Date: Fri, 19 Apr 2024 11:01:22 -0400 Subject: [PATCH] Fix ability edge case when saving starter ability data --- src/system/game-data.ts | 8 +++++--- src/ui/starter-select-ui-handler.ts | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/system/game-data.ts b/src/system/game-data.ts index 3e2fd8e0a..cfee29a78 100644 --- a/src/system/game-data.ts +++ b/src/system/game-data.ts @@ -994,11 +994,13 @@ export class GameData { if (noStarterFormKeys.includes(pokemon.getFormKey())) pokemon.formIndex = 0; const dexAttr = pokemon.getDexAttr(); - console.log(dexAttr); pokemon.formIndex = formIndex; dexEntry.caughtAttr |= dexAttr; - if (speciesStarters.hasOwnProperty(species.speciesId)) - this.starterData[species.speciesId].abilityAttr |= Math.pow(2, pokemon.abilityIndex); + if (speciesStarters.hasOwnProperty(species.speciesId)) { + this.starterData[species.speciesId].abilityAttr |= pokemon.abilityIndex !== 1 || pokemon.species.ability2 + ? Math.pow(2, pokemon.abilityIndex) + : AbilityAttr.ABILITY_HIDDEN; + } dexEntry.natureAttr |= Math.pow(2, pokemon.nature + 1); const hasPrevolution = pokemonPrevolutions.hasOwnProperty(species.speciesId); diff --git a/src/ui/starter-select-ui-handler.ts b/src/ui/starter-select-ui-handler.ts index 32fe93078..fc1d76e7e 100644 --- a/src/ui/starter-select-ui-handler.ts +++ b/src/ui/starter-select-ui-handler.ts @@ -1445,7 +1445,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler { this.canCycleShiny = !!(dexEntry.caughtAttr & DexAttr.NON_SHINY && dexEntry.caughtAttr & DexAttr.SHINY); this.canCycleGender = !!(dexEntry.caughtAttr & DexAttr.MALE && dexEntry.caughtAttr & DexAttr.FEMALE); - this.canCycleAbility = [ abilityAttr & AbilityAttr.ABILITY_1, abilityAttr & AbilityAttr.ABILITY_2, abilityAttr & AbilityAttr.ABILITY_HIDDEN ].filter(a => a).length > 1; + this.canCycleAbility = [ abilityAttr & AbilityAttr.ABILITY_1, (abilityAttr & AbilityAttr.ABILITY_2) && species.ability2, abilityAttr & AbilityAttr.ABILITY_HIDDEN ].filter(a => a).length > 1; this.canCycleForm = species.forms.filter(f => !f.formKey || !pokemonFormChanges[species.speciesId]?.find(fc => fc.formKey)) .map((_, f) => dexEntry.caughtAttr & this.scene.gameData.getFormAttr(f)).filter(f => f).length > 1; this.canCycleNature = this.scene.gameData.getNaturesForAttr(dexEntry.natureAttr).length > 1;