Files
healer-man/src/game/playerRecovery.test.ts
T
2026-08-14 15:56:39 -04:00

53 lines
1.4 KiB
TypeScript

import { describe, expect, it } from "vitest";
import { WAILING_CAVERNS_DEFINITION } from "./dungeons/wailingCaverns";
import {
FALL_RECOVERY_MARGIN,
isBelowDungeonRecoveryPlane,
isBelowManastormRecoveryPlane,
} from "./playerRecovery";
describe("dungeon fall recovery", () => {
it("does not reset the player in Kresh's lower grotto", () => {
const kresh = WAILING_CAVERNS_DEFINITION.areas.find(
(area) => area.id === "kresh",
);
expect(kresh).toBeDefined();
expect(
isBelowDungeonRecoveryPlane(
kresh!.center[1],
WAILING_CAVERNS_DEFINITION.bounds,
),
).toBe(false);
});
it("resets after the player falls below the authored dungeon bounds", () => {
const recoveryY =
WAILING_CAVERNS_DEFINITION.bounds.min[1] - FALL_RECOVERY_MARGIN;
expect(
isBelowDungeonRecoveryPlane(
recoveryY - 0.01,
WAILING_CAVERNS_DEFINITION.bounds,
),
).toBe(true);
});
it("uses imported Manastorm anchor heights instead of fallback dungeon bounds", () => {
const fallbackBounds = {
min: [-600, -90, -600],
max: [600, 80, 600],
} as const;
expect(isBelowManastormRecoveryPlane(
-115,
[-115, -115, -115],
fallbackBounds,
)).toBe(false);
expect(isBelowManastormRecoveryPlane(
-115 - FALL_RECOVERY_MARGIN - 0.01,
[-115, -115],
fallbackBounds,
)).toBe(true);
});
});