Add failsafe if moves fail to load

pull/16/head
Flashfyre 2024-03-25 14:47:41 -04:00
parent bd67ccde8b
commit 4633ac2426
1 changed files with 2 additions and 1 deletions

View File

@ -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)