forked from phenom/healer-man
97 lines
3.3 KiB
TypeScript
97 lines
3.3 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import type { MobCombatState } from "./combatStore";
|
|
import type { ManastormEncounterDefinition } from "./manastorm";
|
|
import {
|
|
MANASTORM_CHAOTIC_LINK_DAMAGE_PER_STACK,
|
|
MANASTORM_CHAOTIC_LINK_HEALTH_PER_STACK,
|
|
manastormChaoticLinkRuntimeIds,
|
|
manastormChaoticLinkState,
|
|
} from "./manastormChaoticLink";
|
|
|
|
const encounter = {
|
|
id: "chaotic-link-fixture",
|
|
dungeonId: "wailing-caverns",
|
|
bossRuntimeId: "manastorm:spawn:fixture:boss",
|
|
bossEntityId: "fixture-boss",
|
|
bossName: "Linked Boss",
|
|
bossPosition: [10, 0, 10],
|
|
playerSpawn: { footPosition: [0, 0, 0], yaw: 0 },
|
|
portalPosition: [20, 0, 20],
|
|
trashRuntimeIds: [
|
|
"manastorm:guardian-spawn:fixture:1",
|
|
"manastorm:guardian-spawn:fixture:2",
|
|
"manastorm:guardian-spawn:fixture:3",
|
|
"manastorm:guardian-spawn:fixture:4",
|
|
"manastorm:guardian-spawn:fixture:5",
|
|
],
|
|
} as const satisfies ManastormEncounterDefinition;
|
|
|
|
function mob(dead: boolean): MobCombatState {
|
|
return { dead } as MobCombatState;
|
|
}
|
|
|
|
describe("Manastorm Chaotic Link", () => {
|
|
it("creates about half as many stacks as guardians and removes one per kill", () => {
|
|
const fresh = manastormChaoticLinkState(encounter, {});
|
|
expect(fresh).toMatchObject({
|
|
guardianCount: 5,
|
|
defeatedGuardians: 0,
|
|
requiredGuardianKills: 3,
|
|
activeStacks: 3,
|
|
broken: false,
|
|
bossHealthMultiplier: 1.75,
|
|
bossDamageMultiplier: 1.3,
|
|
});
|
|
|
|
const weakened = manastormChaoticLinkState(encounter, {
|
|
[encounter.trashRuntimeIds[0]]: mob(true),
|
|
[encounter.trashRuntimeIds[1]]: mob(true),
|
|
});
|
|
expect(weakened).toMatchObject({
|
|
defeatedGuardians: 2,
|
|
activeStacks: 1,
|
|
bossHealthMultiplier: 1 + MANASTORM_CHAOTIC_LINK_HEALTH_PER_STACK,
|
|
bossDamageMultiplier: 1 + MANASTORM_CHAOTIC_LINK_DAMAGE_PER_STACK,
|
|
});
|
|
|
|
const broken = manastormChaoticLinkState(encounter, {
|
|
[encounter.trashRuntimeIds[0]]: mob(true),
|
|
[encounter.trashRuntimeIds[1]]: mob(true),
|
|
[encounter.trashRuntimeIds[2]]: mob(true),
|
|
});
|
|
expect(broken).toMatchObject({
|
|
activeStacks: 0,
|
|
broken: true,
|
|
bossHealthMultiplier: 1,
|
|
bossDamageMultiplier: 1,
|
|
});
|
|
});
|
|
|
|
it("keeps the boss and linked guardians present from stage entry onward", () => {
|
|
const expected = [
|
|
...encounter.trashRuntimeIds,
|
|
encounter.bossRuntimeId,
|
|
];
|
|
expect(manastormChaoticLinkRuntimeIds(encounter, "enter")).toEqual(expected);
|
|
expect(manastormChaoticLinkRuntimeIds(encounter, "trash")).toEqual(expected);
|
|
expect(manastormChaoticLinkRuntimeIds(encounter, "boss")).toEqual(expected);
|
|
expect(manastormChaoticLinkRuntimeIds(encounter, "next")).toEqual([]);
|
|
});
|
|
|
|
it("uses an authored exact requirement and disables empowerment with the global switch", () => {
|
|
expect(manastormChaoticLinkState({ ...encounter, requiredGuardianKills: 1 }, {})).toMatchObject({
|
|
requiredGuardianKills: 1,
|
|
activeStacks: 1,
|
|
broken: false,
|
|
});
|
|
expect(manastormChaoticLinkState({ ...encounter, requiredGuardianKills: 5, chaoticLinkEnabled: false }, {})).toMatchObject({
|
|
guardianCount: 5,
|
|
requiredGuardianKills: 0,
|
|
activeStacks: 0,
|
|
broken: true,
|
|
bossHealthMultiplier: 1,
|
|
bossDamageMultiplier: 1,
|
|
});
|
|
});
|
|
});
|