Release Healer Man 0.1.45

This commit is contained in:
phenom committed 2026-09-15 14:43:15 -04:00
1 parent 756ee4f64a
commit f82daf1c13
242 files changed
+1440 -101

No files matched your search

+67 -1
View File
@@ -256,6 +256,62 @@ async function playBufferedCombatCue(event: CombatPresentationEvent, sound: Comb
return true;
}
const GENERATED_SCHOOL_FREQUENCY: Readonly<Record<CombatPresentationEvent["school"], number>> = {
physical: 150,
holy: 520,
fire: 230,
nature: 330,
frost: 410,
shadow: 110,
arcane: 620,
};
function playGeneratedCombatCue(event: CombatPresentationEvent): boolean {
if (
!configuredSettings
|| !combatAudioGroupOutputEnabled(configuredSettings, configuredMasterVolume, event.actorGroup)
) return false;
const audioContext = ensureContext();
if (!audioContext || !groupGains) return false;
void audioContext.resume().catch(() => undefined);
const oscillator = audioContext.createOscillator();
const envelope = audioContext.createGain();
const panner = positionPanner(audioContext, event);
const duration = event.phase === "cast-start" ? 0.12 : event.phase === "aura-start" ? 0.2 : 0.09;
const phasePitch = event.phase === "release" ? 1.15 : event.phase === "impact" ? 0.82 : 1;
oscillator.type = event.school === "shadow" || event.school === "physical" ? "triangle" : "sine";
oscillator.frequency.setValueAtTime(
GENERATED_SCHOOL_FREQUENCY[event.school] * phasePitch,
audioContext.currentTime,
);
envelope.gain.setValueAtTime(0.0001, audioContext.currentTime);
envelope.gain.exponentialRampToValueAtTime(0.075, audioContext.currentTime + 0.01);
envelope.gain.exponentialRampToValueAtTime(0.0001, audioContext.currentTime + duration);
oscillator.connect(envelope);
envelope.connect(panner);
panner.connect(groupGains[event.actorGroup]);
let stopped = false;
const voice: ActiveVoice = {
group: event.actorGroup,
stop: () => {
if (stopped) return;
stopped = true;
try { oscillator.stop(); } catch { /* already stopped */ }
},
};
const unregister = registerVoice(voice);
oscillator.onended = () => {
stopped = true;
unregister();
oscillator.disconnect();
envelope.disconnect();
panner.disconnect();
};
oscillator.start();
oscillator.stop(audioContext.currentTime + duration);
return true;
}
export function playCombatAudio(event: CombatPresentationEvent): void {
if (event.phase === "cast-cancel") {
stopCombatAudioGroup(event.actorGroup);
@@ -266,7 +322,17 @@ export function playCombatAudio(event: CombatPresentationEvent): void {
|| !combatAudioGroupOutputEnabled(configuredSettings, configuredMasterVolume, event.actorGroup)
) return;
const sound = weightedSound(event);
if (sound) void playBufferedCombatCue(event, sound).catch(() => undefined);
if (sound) {
void playBufferedCombatCue(event, sound)
.then((played) => {
if (!played) playGeneratedCombatCue(event);
})
.catch(() => {
playGeneratedCombatCue(event);
});
} else {
playGeneratedCombatCue(event);
}
}
export function stopCombatAudioGroup(group: CombatActorGroup): void {