Fix incorrectly unselectable starter formes (#1332)

* Fix incorrectly unselectable starter formes

* Fix linter issue that got merged upstream

* Remove battle-bond key from form key overrides based on feedback
This commit is contained in:
Nicholas Galauxy 2024-05-25 12:53:46 -05:00 committed by GitHub
parent 1b8b0789c0
commit 93c91bf73a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 1 deletions

View File

@ -807,6 +807,9 @@ export class PokemonForm extends PokemonSpeciesForm {
public formKey: string;
public formSpriteKey: string;
// This is a collection of form keys that have in-run form changes, but should still be separately selectable from the start screen
private starterSelectableKeys: string[] = ["10", "50", "10-pc", "50-pc", "red", "orange", "yellow", "green", "blue", "indigo", "violet"];
constructor(formName: string, formKey: string, type1: Type, type2: Type, height: number, weight: number, ability1: Abilities, ability2: Abilities, abilityHidden: Abilities,
baseTotal: integer, baseHp: integer, baseAtk: integer, baseDef: integer, baseSpatk: integer, baseSpdef: integer, baseSpd: integer,
catchRate: integer, baseFriendship: integer, baseExp: integer, genderDiffs?: boolean, formSpriteKey?: string) {
@ -820,6 +823,10 @@ export class PokemonForm extends PokemonSpeciesForm {
getFormSpriteKey(_formIndex?: integer) {
return this.formSpriteKey !== null ? this.formSpriteKey : this.formKey;
}
isStarterSelectable() {
return !this.formKey || this.starterSelectableKeys.indexOf[this.formKey] !== -1;
}
}
export enum SpeciesFormKey {

View File

@ -1627,7 +1627,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) && 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.isStarterSelectable || !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;
this.canCycleVariant = shiny && [ dexEntry.caughtAttr & DexAttr.DEFAULT_VARIANT, dexEntry.caughtAttr & DexAttr.VARIANT_2, dexEntry.caughtAttr & DexAttr.VARIANT_3].filter(v => v).length > 1;