From 8b382dd42e7ea882bf3a8f3ab2c60f24225a4086 Mon Sep 17 00:00:00 2001 From: Matthew Olker Date: Sun, 7 Apr 2024 21:58:11 -0400 Subject: [PATCH] Fix Calyrex Rider uanble to change starter moves --- src/ui/starter-select-ui-handler.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/ui/starter-select-ui-handler.ts b/src/ui/starter-select-ui-handler.ts index 9e9ed36ff..e930cd150 100644 --- a/src/ui/starter-select-ui-handler.ts +++ b/src/ui/starter-select-ui-handler.ts @@ -9,7 +9,7 @@ import { allAbilities } from "../data/ability"; import { GameMode, GameModes, gameModes } from "../game-mode"; import { Unlockables } from "../system/unlockables"; import { GrowthRate, getGrowthRateColor } from "../data/exp"; -import { DexAttr, DexEntry, StarterFormMoveData, StarterMoveset } from "../system/game-data"; +import { DexAttr, DexAttrProps, DexEntry, StarterFormMoveData, StarterMoveset } from "../system/game-data"; import * as Utils from "../utils"; import PokemonIconAnimHandler, { PokemonIconAnimMode } from "./pokemon-icon-anim-handler"; import { StatsContainer } from "./stats-container"; @@ -634,6 +634,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler { ui.showText(`Select a move to swap with ${allMoves[m].name}.`, null, () => { ui.setModeWithoutClear(Mode.OPTION_SELECT, { options: this.speciesStarterMoves.filter(sm => sm !== m).map(sm => { + // make an option for each available starter move return { label: allMoves[sm].name, handler: () => { @@ -642,14 +643,16 @@ export default class StarterSelectUiHandler extends MessageUiHandler { this.starterMoveset[i] = sm; if (existingMoveIndex > -1) this.starterMoveset[existingMoveIndex] = m; - const props = this.scene.gameData.getSpeciesDexAttrProps(this.lastSpecies, this.dexAttrCursor); + const props: DexAttrProps = this.scene.gameData.getSpeciesDexAttrProps(this.lastSpecies, this.dexAttrCursor); + // form moves has the species but starterMoveData doesn't if (!this.scene.gameData.starterMoveData.hasOwnProperty(speciesId) && pokemonFormLevelMoves.hasOwnProperty(speciesId)) { this.scene.gameData.starterMoveData[speciesId] = pokemonFormLevelMoves.hasOwnProperty(speciesId) ? {} : this.starterMoveset.slice(0) as StarterMoveset; } if (pokemonFormLevelMoves.hasOwnProperty(speciesId)) { - if (!this.scene.gameData.starterMoveData[speciesId].hasOwnProperty(props.formIndex)) + // does the species' starter move data have its form's starter moves and has it been updated + if (this.scene.gameData.starterMoveData[speciesId].hasOwnProperty(props.formIndex) && this.scene.gameData.starterMoveData[speciesId][props.formIndex][existingMoveIndex] !== sm) this.scene.gameData.starterMoveData[speciesId][props.formIndex] = this.starterMoveset.slice(0) as StarterMoveset; } else this.scene.gameData.starterMoveData[speciesId] = this.starterMoveset.slice(0) as StarterMoveset;