From 93c91bf73a6802cd2a725a1cd05bcd959fbd9b6e Mon Sep 17 00:00:00 2001 From: Nicholas Galauxy Date: Sat, 25 May 2024 12:53:46 -0500 Subject: [PATCH] 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 --- src/data/pokemon-species.ts | 7 +++++++ src/ui/starter-select-ui-handler.ts | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/data/pokemon-species.ts b/src/data/pokemon-species.ts index 0d0d77d9512..eb23ea3d60a 100644 --- a/src/data/pokemon-species.ts +++ b/src/data/pokemon-species.ts @@ -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 { diff --git a/src/ui/starter-select-ui-handler.ts b/src/ui/starter-select-ui-handler.ts index a8bc760287f..d4fdf97912d 100644 --- a/src/ui/starter-select-ui-handler.ts +++ b/src/ui/starter-select-ui-handler.ts @@ -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;