Fix starter moveset logic for starters with forms
parent
2623313970
commit
88de47d8d8
|
@ -638,7 +638,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
|
||||||
return {
|
return {
|
||||||
label: allMoves[sm].name,
|
label: allMoves[sm].name,
|
||||||
handler: () => {
|
handler: () => {
|
||||||
this.swichMoveHandler(i, sm, m)
|
this.switchMoveHandler(i, sm, m)
|
||||||
showSwapOptions(this.starterMoveset);
|
showSwapOptions(this.starterMoveset);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -787,7 +787,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
|
||||||
return success || error;
|
return success || error;
|
||||||
}
|
}
|
||||||
|
|
||||||
swichMoveHandler(i: number, newMove: Moves, move: Moves) {
|
switchMoveHandler(i: number, newMove: Moves, move: Moves) {
|
||||||
const speciesId = this.lastSpecies.speciesId;
|
const speciesId = this.lastSpecies.speciesId;
|
||||||
const existingMoveIndex = this.starterMoveset.indexOf(newMove);
|
const existingMoveIndex = this.starterMoveset.indexOf(newMove);
|
||||||
this.starterMoveset[i] = newMove;
|
this.starterMoveset[i] = newMove;
|
||||||
|
@ -796,17 +796,17 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
|
||||||
const props: DexAttrProps = this.scene.gameData.getSpeciesDexAttrProps(this.lastSpecies, this.dexAttrCursor);
|
const props: DexAttrProps = this.scene.gameData.getSpeciesDexAttrProps(this.lastSpecies, this.dexAttrCursor);
|
||||||
// species has different forms
|
// species has different forms
|
||||||
if (pokemonFormLevelMoves.hasOwnProperty(speciesId)) {
|
if (pokemonFormLevelMoves.hasOwnProperty(speciesId)) {
|
||||||
// starterMoveData doesn't have base form moves
|
// starterMoveData doesn't have base form moves or is using the single form format
|
||||||
if (!this.scene.gameData.starterMoveData.hasOwnProperty(speciesId)){
|
if (!this.scene.gameData.starterMoveData.hasOwnProperty(speciesId) || Array.isArray(this.scene.gameData.starterMoveData[speciesId]))
|
||||||
this.scene.gameData.starterMoveData[speciesId] = this.starterMoveset.slice(0) as StarterMoveset;
|
this.scene.gameData.starterMoveData[speciesId] = { [props.formIndex]: this.starterMoveset.slice(0) as StarterMoveset };
|
||||||
}
|
const starterMoveData = this.scene.gameData.starterMoveData[speciesId][props.formIndex];
|
||||||
const starterMoveData = this.scene.gameData.starterMoveData[speciesId]
|
|
||||||
// starterMoveData doesn't have active form moves
|
// starterMoveData doesn't have active form moves
|
||||||
if (!starterMoveData.hasOwnProperty(props.formIndex)) {
|
if (!starterMoveData.hasOwnProperty(props.formIndex))
|
||||||
this.scene.gameData.starterMoveData[speciesId][props.formIndex] = this.starterMoveset.slice(0) as StarterMoveset;
|
this.scene.gameData.starterMoveData[speciesId][props.formIndex] = this.starterMoveset.slice(0) as StarterMoveset;
|
||||||
}
|
|
||||||
// does the species' starter move data have its form's starter moves and has it been updated
|
// does the species' starter move data have its form's starter moves and has it been updated
|
||||||
if (starterMoveData.hasOwnProperty(props.formIndex) && Array.isArray(starterMoveData[props.formIndex])) {
|
if (starterMoveData.hasOwnProperty(props.formIndex)) {
|
||||||
// active form move hasn't been updated
|
// active form move hasn't been updated
|
||||||
if (starterMoveData[props.formIndex][existingMoveIndex] !== newMove)
|
if (starterMoveData[props.formIndex][existingMoveIndex] !== newMove)
|
||||||
this.scene.gameData.starterMoveData[speciesId][props.formIndex] = this.starterMoveset.slice(0) as StarterMoveset;
|
this.scene.gameData.starterMoveData[speciesId][props.formIndex] = this.starterMoveset.slice(0) as StarterMoveset;
|
||||||
|
|
Loading…
Reference in New Issue