forked from phenom/healer-man
Update Healer Man server
This commit is contained in:
1 parent
8b9c95b24f
commit
14e105642c
13 files changed
+355
-12
No files matched your search
@@ -396,6 +396,8 @@ export interface DungeonEncounterProvider {
|
||||
readonly definition: DungeonEncounterDefinition;
|
||||
readonly encounterId: string;
|
||||
readonly dungeonId: string;
|
||||
/** Framework-created providers may be rebuilt when a seeded run changes its definition. */
|
||||
readonly runtimeManaged?: boolean;
|
||||
readonly getSnapshot: () => DungeonEncounterSnapshot;
|
||||
readonly dispatch: (event: DungeonEncounterEvent) => readonly DungeonEncounterEffect[];
|
||||
readonly reset: (scope: DungeonEncounterResetScope, now?: number) => void;
|
||||
@@ -564,8 +566,14 @@ export function activateDungeonEncounterDefinitions(
|
||||
const existing = providers.get(definition.id);
|
||||
if (existing) {
|
||||
if (existing.dungeonId !== dungeonId) throw new Error(`Encounter ${definition.id} has conflicting dungeon owners`);
|
||||
existing.setContext?.({ difficultyId });
|
||||
continue;
|
||||
if (!existing.runtimeManaged || existing.definition === definition) {
|
||||
existing.setContext?.({ difficultyId });
|
||||
continue;
|
||||
}
|
||||
// Seeded variants can keep a stable encounter id while changing the
|
||||
// boss/objective rules. Reusing that provider would leave completion
|
||||
// listening for the previous run's boss.
|
||||
providers.delete(definition.id);
|
||||
}
|
||||
let snapshot = createDungeonEncounterSnapshot(definition);
|
||||
let context: DungeonEncounterRuntimeContext = { difficultyId };
|
||||
@@ -573,6 +581,7 @@ export function activateDungeonEncounterDefinitions(
|
||||
definition,
|
||||
encounterId: definition.id,
|
||||
dungeonId,
|
||||
runtimeManaged: true,
|
||||
getSnapshot: () => snapshot,
|
||||
dispatch: (event) => {
|
||||
const result = reduceDungeonEncounter(definition, snapshot, event, context);
|
||||
|
||||
Reference in new issue
Block a user