Fix ability edge case when saving starter ability data
parent
46b5ff089d
commit
5c367db8a3
|
@ -994,11 +994,13 @@ export class GameData {
|
||||||
if (noStarterFormKeys.includes(pokemon.getFormKey()))
|
if (noStarterFormKeys.includes(pokemon.getFormKey()))
|
||||||
pokemon.formIndex = 0;
|
pokemon.formIndex = 0;
|
||||||
const dexAttr = pokemon.getDexAttr();
|
const dexAttr = pokemon.getDexAttr();
|
||||||
console.log(dexAttr);
|
|
||||||
pokemon.formIndex = formIndex;
|
pokemon.formIndex = formIndex;
|
||||||
dexEntry.caughtAttr |= dexAttr;
|
dexEntry.caughtAttr |= dexAttr;
|
||||||
if (speciesStarters.hasOwnProperty(species.speciesId))
|
if (speciesStarters.hasOwnProperty(species.speciesId)) {
|
||||||
this.starterData[species.speciesId].abilityAttr |= Math.pow(2, pokemon.abilityIndex);
|
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);
|
dexEntry.natureAttr |= Math.pow(2, pokemon.nature + 1);
|
||||||
|
|
||||||
const hasPrevolution = pokemonPrevolutions.hasOwnProperty(species.speciesId);
|
const hasPrevolution = pokemonPrevolutions.hasOwnProperty(species.speciesId);
|
||||||
|
|
|
@ -1445,7 +1445,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
|
||||||
|
|
||||||
this.canCycleShiny = !!(dexEntry.caughtAttr & DexAttr.NON_SHINY && dexEntry.caughtAttr & DexAttr.SHINY);
|
this.canCycleShiny = !!(dexEntry.caughtAttr & DexAttr.NON_SHINY && dexEntry.caughtAttr & DexAttr.SHINY);
|
||||||
this.canCycleGender = !!(dexEntry.caughtAttr & DexAttr.MALE && dexEntry.caughtAttr & DexAttr.FEMALE);
|
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))
|
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;
|
.map((_, f) => dexEntry.caughtAttr & this.scene.gameData.getFormAttr(f)).filter(f => f).length > 1;
|
||||||
this.canCycleNature = this.scene.gameData.getNaturesForAttr(dexEntry.natureAttr).length > 1;
|
this.canCycleNature = this.scene.gameData.getNaturesForAttr(dexEntry.natureAttr).length > 1;
|
||||||
|
|
Loading…
Reference in New Issue