pokerogue/src/data/mystery-encounters/mystery-encounter-save-data.ts
Sirz Benjie 5854b21da0
[Refactor] Remove circular imports part 1 (#5663)
* Extract Mode enum out of UI and into its own file

Reduces circular imports from 909 to 773

* Move around utility files

Reduces cyclical dependencies from 773 to 765

* Remove starterColors and bypassLogin from battle-scene

Reduces cyclical dependencies from 765 to 623

* Fix test runner error

* Update import for bypassLogin in test

* Update mocks for utils in tests

* Fix broken tests

* Update selectWithTera override

* Update path for utils in ab-attr.ts

* Update path for utils in ability-class.ts

* Fix utils import path in healer.test.ts
2025-04-19 11:57:03 +00:00

39 lines
1.2 KiB
TypeScript

import type { MysteryEncounterType } from "#enums/mystery-encounter-type";
import { BASE_MYSTERY_ENCOUNTER_SPAWN_WEIGHT } from "#app/data/mystery-encounters/mystery-encounters";
import { isNullOrUndefined } from "#app/utils/common";
import type { MysteryEncounterTier } from "#enums/mystery-encounter-tier";
export class SeenEncounterData {
type: MysteryEncounterType;
tier: MysteryEncounterTier;
waveIndex: number;
selectedOption: number;
constructor(type: MysteryEncounterType, tier: MysteryEncounterTier, waveIndex: number, selectedOption?: number) {
this.type = type;
this.tier = tier;
this.waveIndex = waveIndex;
this.selectedOption = selectedOption ?? -1;
}
}
export interface QueuedEncounter {
type: MysteryEncounterType;
spawnPercent: number; // Out of 100
}
export class MysteryEncounterSaveData {
encounteredEvents: SeenEncounterData[] = [];
encounterSpawnChance: number = BASE_MYSTERY_ENCOUNTER_SPAWN_WEIGHT;
queuedEncounters: QueuedEncounter[] = [];
constructor(data?: MysteryEncounterSaveData) {
if (!isNullOrUndefined(data)) {
Object.assign(this, data);
}
this.encounteredEvents = this.encounteredEvents ?? [];
this.queuedEncounters = this.queuedEncounters ?? [];
}
}