Fix ability edge case when saving starter ability data

pull/193/head
Flashfyre 2024-04-19 11:01:22 -04:00
parent 46b5ff089d
commit 5c367db8a3
2 changed files with 6 additions and 4 deletions

View File

@ -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);

View File

@ -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;