Release Healer Man 0.1.23
This commit is contained in:
1 parent
7f6001723a
commit
c4346751a9
9 files changed
+205
-23
No files matched your search
@@ -0,0 +1,36 @@
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
import {
|
||||
isMobAggroRangeVisible,
|
||||
MOB_AGGRO_RANGE_VISIBILITY_DISTANCE,
|
||||
} from "./mobAggroRangeVisibility";
|
||||
|
||||
describe("mob aggro range visibility", () => {
|
||||
it("shows an in-range mob only when the player has line of sight", () => {
|
||||
const visible = vi.fn(() => true);
|
||||
const blocked = vi.fn(() => false);
|
||||
|
||||
expect(isMobAggroRangeVisible([0, 0, 0], [20, 0, 0], visible)).toBe(true);
|
||||
expect(isMobAggroRangeVisible([0, 0, 0], [20, 0, 0], blocked)).toBe(false);
|
||||
expect(visible).toHaveBeenCalledWith([0, 0, 0], [20, 0, 0]);
|
||||
expect(blocked).toHaveBeenCalledWith([0, 0, 0], [20, 0, 0]);
|
||||
});
|
||||
|
||||
it("hides distant mobs without performing a line-of-sight query", () => {
|
||||
const hasLineOfSight = vi.fn(() => true);
|
||||
|
||||
expect(isMobAggroRangeVisible(
|
||||
[0, 0, 0],
|
||||
[MOB_AGGRO_RANGE_VISIBILITY_DISTANCE + 0.01, 0, 0],
|
||||
hasLineOfSight,
|
||||
)).toBe(false);
|
||||
expect(hasLineOfSight).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("includes mobs exactly on the visibility boundary", () => {
|
||||
expect(isMobAggroRangeVisible(
|
||||
[0, 0, 0],
|
||||
[0, 0, MOB_AGGRO_RANGE_VISIBILITY_DISTANCE],
|
||||
() => true,
|
||||
)).toBe(true);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user