Fix trainer-related crash when loading data
parent
4fc92f22d9
commit
b201cf0abc
|
@ -576,8 +576,8 @@ export class GameData {
|
||||||
scene.updateScoreText();
|
scene.updateScoreText();
|
||||||
|
|
||||||
const battleType = sessionData.battleType || 0;
|
const battleType = sessionData.battleType || 0;
|
||||||
const trainerConfig = trainerConfigs[sessionData.trainer.trainerType];
|
const trainerConfig = sessionData.trainer ? trainerConfigs[sessionData.trainer.trainerType] : null;
|
||||||
const battle = scene.newBattle(sessionData.waveIndex, battleType, sessionData.trainer, battleType === BattleType.TRAINER ? trainerConfig.doubleOnly || sessionData.trainer.variant === TrainerVariant.DOUBLE : sessionData.enemyParty.length > 1);
|
const battle = scene.newBattle(sessionData.waveIndex, battleType, sessionData.trainer, battleType === BattleType.TRAINER ? trainerConfig?.doubleOnly || sessionData.trainer?.variant === TrainerVariant.DOUBLE : sessionData.enemyParty.length > 1);
|
||||||
battle.enemyLevels = sessionData.enemyParty.map(p => p.level);
|
battle.enemyLevels = sessionData.enemyParty.map(p => p.level);
|
||||||
|
|
||||||
scene.newArena(sessionData.arena.biome, true);
|
scene.newArena(sessionData.arena.biome, true);
|
||||||
|
|
Loading…
Reference in New Issue