From 4633ac2426867cfc33285de5a4b70d93336f784a Mon Sep 17 00:00:00 2001 From: Flashfyre Date: Mon, 25 Mar 2024 14:47:41 -0400 Subject: [PATCH] Add failsafe if moves fail to load --- src/system/pokemon-data.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/system/pokemon-data.ts b/src/system/pokemon-data.ts index ac7bc6ce2..c2cfff0d5 100644 --- a/src/system/pokemon-data.ts +++ b/src/system/pokemon-data.ts @@ -9,6 +9,7 @@ import { Species } from "../data/enums/species"; import { Status } from "../data/status-effect"; import Pokemon, { EnemyPokemon, PokemonMove, PokemonSummonData } from "../field/pokemon"; import { TrainerSlot } from "../data/trainer-config"; +import { Moves } from "../data/enums/moves"; export default class PokemonData { public id: integer; @@ -87,7 +88,7 @@ export default class PokemonData { this.summonData = sourcePokemon.summonData; } } else { - this.moveset = source.moveset.filter(m => m).map((m: any) => new PokemonMove(m.moveId, m.ppUsed, m.ppUp)); + this.moveset = (source.moveset || [ new PokemonMove(Moves.TACKLE), new PokemonMove(Moves.GROWL) ]).filter(m => m).map((m: any) => new PokemonMove(m.moveId, m.ppUsed, m.ppUp)); if (!forHistory) { this.status = source.status ? new Status(source.status.effect, source.status.turnCount, source.status.cureTurn)