forked from phenom/healer-man
Release Healer Man 0.1.21
This commit is contained in:
1 parent
699fc858c9
commit
f6f2375145
210 files changed
+976039
-6247
No files matched your search
@@ -0,0 +1,22 @@
|
||||
import { spawnMatchesDifficulty, type StaticMobSpawnDefinition } from "./mobPopulation";
|
||||
import type { DungeonEncounterSpawnGroupDefinition } from "./dungeonTypes";
|
||||
|
||||
export function activeEncounterSpawnGroupSpawns(
|
||||
groups: readonly DungeonEncounterSpawnGroupDefinition[],
|
||||
activeGroupIds: readonly string[],
|
||||
difficultyMask: number,
|
||||
existingSpawns: readonly StaticMobSpawnDefinition[] = [],
|
||||
): readonly StaticMobSpawnDefinition[] {
|
||||
const active = new Set(activeGroupIds);
|
||||
const existing = new Set(existingSpawns.map((spawn) => spawn.id));
|
||||
const included = new Set<string>();
|
||||
return groups
|
||||
.filter((group) => active.has(group.id))
|
||||
.flatMap((group) => group.spawns)
|
||||
.filter((spawn) => {
|
||||
if (existing.has(spawn.id) || included.has(spawn.id)) return false;
|
||||
if (!spawnMatchesDifficulty(spawn.spawnMask, difficultyMask)) return false;
|
||||
included.add(spawn.id);
|
||||
return true;
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user