Update Healer Man server
This commit is contained in:
1 parent
4c768fbec6
commit
b16821e92e
330 files changed
+35406
-1760
No files matched your search
@@ -0,0 +1,48 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import {
|
||||
wow335DeathKnightSpellDeflectionAbsorbedAmount,
|
||||
wow335DeathKnightSpellDeflectionDamage,
|
||||
wow335DeathKnightSpellDeflectionProfile,
|
||||
wow335DeathKnightSpellDeflectionSchoolMask,
|
||||
wow335DeathKnightSpellDeflectionShouldProc,
|
||||
} from "./wow335DeathKnightSpellDeflectionRuntime";
|
||||
|
||||
describe("WoW Death Knight Spell Deflection", () => {
|
||||
it("reads all generated ranks and DBC school-absorb metadata", () => {
|
||||
expect([1, 2, 3].map(wow335DeathKnightSpellDeflectionProfile)).toEqual([
|
||||
{ rank: 1, absorbFraction: 0.15, procChanceSource: "live-parry", auraType: 69, schoolMask: 126 },
|
||||
{ rank: 2, absorbFraction: 0.3, procChanceSource: "live-parry", auraType: 69, schoolMask: 126 },
|
||||
{ rank: 3, absorbFraction: 0.45, procChanceSource: "live-parry", auraType: 69, schoolMask: 126 },
|
||||
]);
|
||||
expect(wow335DeathKnightSpellDeflectionProfile(0)).toBeNull();
|
||||
expect(wow335DeathKnightSpellDeflectionProfile(4)).toBeNull();
|
||||
const schools = ["physical", "holy", "fire", "nature", "frost", "shadow", "arcane"] as const;
|
||||
expect(schools.map(wow335DeathKnightSpellDeflectionSchoolMask)).toEqual([1, 2, 4, 8, 16, 32, 64]);
|
||||
});
|
||||
|
||||
it("uses Parry chance as the proc chance, including 0%, threshold, and 100% edges", () => {
|
||||
const event = { directDamageSpell: true, schoolMask: 4, damage: 100, parryChancePercent: 5, roll: 0.0499 };
|
||||
expect(wow335DeathKnightSpellDeflectionShouldProc(3, event)).toBe(true);
|
||||
expect(wow335DeathKnightSpellDeflectionShouldProc(3, { ...event, roll: 0.05 })).toBe(false);
|
||||
expect(wow335DeathKnightSpellDeflectionShouldProc(3, { ...event, parryChancePercent: 0, roll: 0 })).toBe(false);
|
||||
expect(wow335DeathKnightSpellDeflectionShouldProc(3, { ...event, parryChancePercent: 100, roll: 0.9999 }))
|
||||
.toBe(true);
|
||||
expect(wow335DeathKnightSpellDeflectionShouldProc(3, { ...event, parryChancePercent: 150, roll: 0.9999 }))
|
||||
.toBe(true);
|
||||
expect(wow335DeathKnightSpellDeflectionShouldProc(3, { ...event, schoolMask: 1 })).toBe(false);
|
||||
});
|
||||
|
||||
it("excludes periodic, non-spell, and zero-damage events", () => {
|
||||
const event = { directDamageSpell: false, schoolMask: 4, damage: 100, parryChancePercent: 100, roll: 0 };
|
||||
expect(wow335DeathKnightSpellDeflectionShouldProc(3, event)).toBe(false);
|
||||
expect(wow335DeathKnightSpellDeflectionShouldProc(3, { ...event, directDamageSpell: true, damage: 0 }))
|
||||
.toBe(false);
|
||||
});
|
||||
|
||||
it("reduces damage by the generated rank value after a successful proc", () => {
|
||||
expect([1, 2, 3].map((rank) => wow335DeathKnightSpellDeflectionDamage(101, rank))).toEqual([86, 71, 56]);
|
||||
expect([1, 2, 3].map((rank) => wow335DeathKnightSpellDeflectionAbsorbedAmount(99, rank))).toEqual([14, 29, 44]);
|
||||
expect([1, 2, 3].map((rank) => wow335DeathKnightSpellDeflectionDamage(99, rank))).toEqual([85, 70, 55]);
|
||||
expect(wow335DeathKnightSpellDeflectionDamage(101, 0)).toBe(101);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user