Update Healer Man server
This commit is contained in:
1 parent
8b9c95b24f
commit
14e105642c
13 files changed
+355
-12
No files matched your search
@@ -1,18 +1,22 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import {
|
||||
activeDungeonCompletedObjectiveIds,
|
||||
advanceDungeonEncounters,
|
||||
createDungeonEncounterSnapshot,
|
||||
reduceDungeonEncounter,
|
||||
resetDungeonEncounters,
|
||||
validateDungeonEncounterDefinition,
|
||||
} from "./dungeonEncounterRuntime";
|
||||
import { BITE_SIZED_STOCKADES_DUNGEON_ID, STORMWIND_STOCKADE_DUNGEON_ID } from "./dungeonContentSource";
|
||||
import { DUNGEON_REGISTRY, dungeonDefinitionById } from "./dungeonRegistry";
|
||||
import { activateDungeonSession, restartActiveDungeonSession } from "./dungeonSession";
|
||||
import { useDungeonRunStore } from "./dungeonRunStore";
|
||||
import { completedDungeonRun, useDungeonRunStore } from "./dungeonRunStore";
|
||||
import {
|
||||
BITE_SIZED_STOCKADES_BOSS_CANDIDATES,
|
||||
createBiteSizedStockadesDefinition,
|
||||
} from "./dungeons/biteSizedStockades";
|
||||
import { validateDungeonWorldObject } from "./dungeonWorldObjects";
|
||||
import { dungeonEnemyScaling } from "./dungeonBossScaling";
|
||||
|
||||
const source = DUNGEON_REGISTRY[STORMWIND_STOCKADE_DUNGEON_ID];
|
||||
|
||||
@@ -32,6 +36,7 @@ describe("bite-sized Stormwind Stockades", () => {
|
||||
const bossId = biteSized.bosses[0].id;
|
||||
expect(BITE_SIZED_STOCKADES_BOSS_CANDIDATES.map((boss) => boss.sourceSpawnId)).toContain(bossId);
|
||||
expect(biteSized.objectiveOrder).toEqual(biteSized.bosses);
|
||||
expect(biteSized.finalBossDurability).toBe("standard");
|
||||
expect(biteSized.staticSpawns.filter((spawn) => spawn.id === bossId)).toHaveLength(1);
|
||||
expect(biteSized.staticSpawns.every((spawn) => Math.abs(spawn.position[2]) <= 15)).toBe(true);
|
||||
expect(biteSized.navigationLinks).toEqual(source.navigationLinks);
|
||||
@@ -71,6 +76,32 @@ describe("bite-sized Stormwind Stockades", () => {
|
||||
.toBe(first.staticSpawns.find((spawn) => spawn.id === first.bosses[0].id)?.entityId);
|
||||
});
|
||||
|
||||
it("uses ordinary boss durability for every level-17 roll", () => {
|
||||
const variants = new Map<string, ReturnType<typeof createBiteSizedStockadesDefinition>>();
|
||||
for (let index = 0; index < 1_000 && variants.size < BITE_SIZED_STOCKADES_BOSS_CANDIDATES.length; index += 1) {
|
||||
const definition = createBiteSizedStockadesDefinition(source, `level-17-run-${index}`);
|
||||
variants.set(definition.bosses[0].id, definition);
|
||||
}
|
||||
expect(variants.size).toBe(BITE_SIZED_STOCKADES_BOSS_CANDIDATES.length);
|
||||
|
||||
const ordinaryBoss = source.bosses[0];
|
||||
const ordinarySpawn = source.staticSpawns.find((spawn) => spawn.id === ordinaryBoss.id)!;
|
||||
const ordinaryEntity = source.entities[ordinarySpawn.entityId];
|
||||
for (const characterSource of ["wow", "rom", "coa"] as const) {
|
||||
const ordinaryHealth = dungeonEnemyScaling(
|
||||
source, ordinaryEntity, ordinaryBoss.id, 17, "normal", 1, characterSource,
|
||||
).maxHealth;
|
||||
for (const definition of variants.values()) {
|
||||
const boss = definition.bosses[0];
|
||||
const spawn = definition.staticSpawns.find((entry) => entry.id === boss.id)!;
|
||||
const entity = definition.entities[spawn.entityId];
|
||||
expect(dungeonEnemyScaling(
|
||||
definition, entity, boss.id, 17, "normal", 1, characterSource,
|
||||
).maxHealth, `${characterSource}:${boss.name}`).toBeCloseTo(ordinaryHealth);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
it("uses the run identity for fresh, restarted, and shared sessions", () => {
|
||||
expect(activateDungeonSession(BITE_SIZED_STOCKADES_DUNGEON_ID, undefined, { runId: "run-a" })).toBe(true);
|
||||
const firstBoss = dungeonDefinitionById(BITE_SIZED_STOCKADES_DUNGEON_ID)!.bosses[0].name;
|
||||
@@ -103,4 +134,44 @@ describe("bite-sized Stormwind Stockades", () => {
|
||||
expect(reduced.flags["dungeon-complete"]).toBe(true);
|
||||
expect(reduced.phase).toBe("complete");
|
||||
});
|
||||
|
||||
it("rebuilds seeded boss rules and records the original timer after a wipe and retry", () => {
|
||||
expect(activateDungeonSession(BITE_SIZED_STOCKADES_DUNGEON_ID, undefined, { runId: "stale-provider-a" })).toBe(true);
|
||||
const firstBossId = dungeonDefinitionById(BITE_SIZED_STOCKADES_DUNGEON_ID)!.bosses[0].id;
|
||||
let nextRunId = "stale-provider-b";
|
||||
for (let index = 0; index < 1_000; index += 1) {
|
||||
const candidate = `stale-provider-${index}`;
|
||||
if (createBiteSizedStockadesDefinition(source, candidate).bosses[0].id !== firstBossId) {
|
||||
nextRunId = candidate;
|
||||
break;
|
||||
}
|
||||
}
|
||||
expect(activateDungeonSession(BITE_SIZED_STOCKADES_DUNGEON_ID, undefined, { runId: nextRunId })).toBe(true);
|
||||
const rerolledBossId = dungeonDefinitionById(BITE_SIZED_STOCKADES_DUNGEON_ID)!.bosses[0].id;
|
||||
expect(rerolledBossId).not.toBe(firstBossId);
|
||||
|
||||
const party = [{ name: "Tester", classId: "priest", level: 17, role: "healer", npc: false }] as const;
|
||||
const run = useDungeonRunStore.getState();
|
||||
run.start(1_000, party);
|
||||
advanceDungeonEncounters(BITE_SIZED_STOCKADES_DUNGEON_ID, {
|
||||
kind: "tick",
|
||||
now: 2_000,
|
||||
facts: { registeredEntityIds: [rerolledBossId], deadEntityIds: [] },
|
||||
});
|
||||
resetDungeonEncounters("boss-wipe", BITE_SIZED_STOCKADES_DUNGEON_ID, 3_000);
|
||||
expect(useDungeonRunStore.getState().progress?.startedAt).toBe(1_000);
|
||||
|
||||
advanceDungeonEncounters(BITE_SIZED_STOCKADES_DUNGEON_ID, {
|
||||
kind: "tick",
|
||||
now: 9_000,
|
||||
facts: { registeredEntityIds: [rerolledBossId], deadEntityIds: [rerolledBossId] },
|
||||
});
|
||||
run.advance(activeDungeonCompletedObjectiveIds(BITE_SIZED_STOCKADES_DUNGEON_ID), [rerolledBossId], 9_000, party);
|
||||
expect(completedDungeonRun(useDungeonRunStore.getState().progress!)).toMatchObject({
|
||||
id: nextRunId,
|
||||
durationMs: 8_000,
|
||||
killedBossIds: [rerolledBossId],
|
||||
fullClear: true,
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user