fix null exception on isBattleMysteryEncounter

This commit is contained in:
ImperialSympathizer 2024-10-17 14:40:03 -04:00
parent ecf9103350
commit d1c4a2e74c
2 changed files with 3 additions and 4 deletions

View File

@ -19,7 +19,6 @@ import { MysteryEncounterMode } from "#enums/mystery-encounter-mode";
import { CustomModifierSettings } from "#app/modifier/modifier-type"; import { CustomModifierSettings } from "#app/modifier/modifier-type";
import { ModifierTier } from "#app/modifier/modifier-tier"; import { ModifierTier } from "#app/modifier/modifier-tier";
import { MysteryEncounterType } from "#enums/mystery-encounter-type"; import { MysteryEncounterType } from "#enums/mystery-encounter-type";
import { isNullOrUndefined } from "./utils";
export enum ClassicFixedBossWaves { export enum ClassicFixedBossWaves {
// TODO: other fixed wave battles should be added here // TODO: other fixed wave battles should be added here
@ -415,7 +414,7 @@ export default class Battle {
* Returns if the battle is of type {@linkcode BattleType.MYSTERY_ENCOUNTER} * Returns if the battle is of type {@linkcode BattleType.MYSTERY_ENCOUNTER}
*/ */
isBattleMysteryEncounter(): boolean { isBattleMysteryEncounter(): boolean {
return !isNullOrUndefined(this.battleType) && this.battleType === BattleType.MYSTERY_ENCOUNTER; return this.battleType === BattleType.MYSTERY_ENCOUNTER;
} }
} }

View File

@ -253,8 +253,8 @@ export class EncounterPhase extends BattlePhase {
this.scene.updateModifiers(true); this.scene.updateModifiers(true);
}*/ }*/
const { battleType, waveIndex, isBattleMysteryEncounter } = this.scene.currentBattle; const { battleType, waveIndex } = this.scene.currentBattle;
if (this.scene.isMysteryEncounterValidForWave(battleType, waveIndex) && !isBattleMysteryEncounter()) { if (this.scene.isMysteryEncounterValidForWave(battleType, waveIndex) && !this.scene.currentBattle.isBattleMysteryEncounter()) {
// Increment ME spawn chance if an ME could have spawned but did not // Increment ME spawn chance if an ME could have spawned but did not
// Only do this AFTER session has been saved to avoid duplicating increments // Only do this AFTER session has been saved to avoid duplicating increments
this.scene.mysteryEncounterSaveData.encounterSpawnChance += WEIGHT_INCREMENT_ON_SPAWN_MISS; this.scene.mysteryEncounterSaveData.encounterSpawnChance += WEIGHT_INCREMENT_ON_SPAWN_MISS;