Add failsafe if moves fail to load
parent
bd67ccde8b
commit
4633ac2426
|
@ -9,6 +9,7 @@ import { Species } from "../data/enums/species";
|
||||||
import { Status } from "../data/status-effect";
|
import { Status } from "../data/status-effect";
|
||||||
import Pokemon, { EnemyPokemon, PokemonMove, PokemonSummonData } from "../field/pokemon";
|
import Pokemon, { EnemyPokemon, PokemonMove, PokemonSummonData } from "../field/pokemon";
|
||||||
import { TrainerSlot } from "../data/trainer-config";
|
import { TrainerSlot } from "../data/trainer-config";
|
||||||
|
import { Moves } from "../data/enums/moves";
|
||||||
|
|
||||||
export default class PokemonData {
|
export default class PokemonData {
|
||||||
public id: integer;
|
public id: integer;
|
||||||
|
@ -87,7 +88,7 @@ export default class PokemonData {
|
||||||
this.summonData = sourcePokemon.summonData;
|
this.summonData = sourcePokemon.summonData;
|
||||||
}
|
}
|
||||||
} else {
|
} 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) {
|
if (!forHistory) {
|
||||||
this.status = source.status
|
this.status = source.status
|
||||||
? new Status(source.status.effect, source.status.turnCount, source.status.cureTurn)
|
? new Status(source.status.effect, source.status.turnCount, source.status.cureTurn)
|
||||||
|
|
Loading…
Reference in New Issue