forked from phenom/healer-man
Update Healer Man server
This commit is contained in:
1 parent
71246e5b75
commit
a868401ebc
40 files changed
+1522
-161
No files matched your search
@@ -208,6 +208,62 @@ describe("combat audio output policy", () => {
|
||||
audio.resetCombatAudio();
|
||||
});
|
||||
|
||||
it("positions release audio at the caster and impact audio at the target", async () => {
|
||||
vi.resetModules();
|
||||
const audio = await import("./combatAudio");
|
||||
const panners: Array<{
|
||||
positionX: { value: number };
|
||||
positionY: { value: number };
|
||||
positionZ: { value: number };
|
||||
}> = [];
|
||||
const audioContext = {
|
||||
currentTime: 0, state: "running", destination: {},
|
||||
createGain: () => ({ connect: vi.fn(), disconnect: vi.fn(), gain: {
|
||||
setTargetAtTime: vi.fn(), value: 1,
|
||||
} }),
|
||||
createPanner: () => {
|
||||
const panner = {
|
||||
connect: vi.fn(), disconnect: vi.fn(),
|
||||
positionX: { value: 0 }, positionY: { value: 0 }, positionZ: { value: 0 },
|
||||
panningModel: "HRTF", distanceModel: "inverse",
|
||||
refDistance: 0, maxDistance: 0, rolloffFactor: 0,
|
||||
};
|
||||
panners.push(panner);
|
||||
return panner;
|
||||
},
|
||||
createBufferSource: () => ({
|
||||
connect: vi.fn(), disconnect: vi.fn(), start: vi.fn(), stop: vi.fn(),
|
||||
buffer: null, loop: false, onended: null,
|
||||
}),
|
||||
decodeAudioData: vi.fn(async () => ({ duration: 0.2 })),
|
||||
resume: vi.fn(async () => undefined),
|
||||
};
|
||||
vi.stubGlobal("window", { AudioContext: function () { return audioContext; } });
|
||||
combatMedia.ready = true;
|
||||
combatMedia.entry.mockReturnValue({
|
||||
key: "runewaker:490256", source: "runewaker", spellId: 490256,
|
||||
sounds: [
|
||||
{ url: "/assets/game/combat-effects/audio/rising-release.mp3", phase: "release" },
|
||||
{ url: "/assets/game/combat-effects/audio/rising-impact.mp3", phase: "impact" },
|
||||
],
|
||||
});
|
||||
combatMedia.fetch.mockImplementation(async () => new Response(new Uint8Array([1, 2, 3])));
|
||||
audio.configureCombatAudio(DEFAULT_COMBAT_PRESENTATION_SETTINGS, 0.6);
|
||||
const release = {
|
||||
...fixtureEvent, source: "runewaker" as const, sourceSpellId: 490256,
|
||||
phase: "release" as const, origin: [1, 2, 3] as const,
|
||||
targetPosition: [9, 8, 7] as const,
|
||||
};
|
||||
audio.playCombatAudio(release);
|
||||
audio.playCombatAudio({ ...release, id: 2, phase: "impact" });
|
||||
await new Promise((resolve) => setTimeout(resolve, 0));
|
||||
|
||||
expect(panners.map((panner) => [
|
||||
panner.positionX.value, panner.positionY.value, panner.positionZ.value,
|
||||
])).toEqual([[1, 2, 3], [9, 8, 7]]);
|
||||
audio.resetCombatAudio();
|
||||
});
|
||||
|
||||
it("loops only a flagged cast sound and stops the matching actor and ability", async () => {
|
||||
vi.resetModules();
|
||||
const audio = await import("./combatAudio");
|
||||
|
||||
Reference in new issue
Block a user