forked from phenom/healer-man
59 lines
2.8 KiB
TypeScript
59 lines
2.8 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { talentModifiersForRanks } from "./talentModifiers";
|
|
import {
|
|
WOW335_DRUID_PREDATORY_INSTINCTS_TALENT_ID,
|
|
wow335DruidPredatoryInstinctsAreaDamageMultiplier,
|
|
wow335DruidPredatoryInstinctsCriticalDamageMultiplier,
|
|
wow335DruidPredatoryInstinctsRankProfile,
|
|
} from "./wow335DruidPredatoryInstinctsRuntime";
|
|
|
|
describe("WoW Druid Predatory Instincts generated ranks", () => {
|
|
it.each([
|
|
[1, 5, 4],
|
|
[2, 10, 7],
|
|
[3, 15, 10],
|
|
] as const)("reads rank %i's critical and area-damage values from the generated tooltip", (
|
|
rank,
|
|
criticalDamageBonusPercent,
|
|
areaDamageTakenReductionPercent,
|
|
) => {
|
|
expect(wow335DruidPredatoryInstinctsRankProfile(rank)).toEqual({
|
|
criticalDamageBonusPercent,
|
|
areaDamageTakenReductionPercent,
|
|
});
|
|
});
|
|
|
|
it("adds the generated bonus to critical damage only while in Cat Form", () => {
|
|
expect(wow335DruidPredatoryInstinctsCriticalDamageMultiplier(2, 1, "cat")).toBeCloseTo(2.05);
|
|
expect(wow335DruidPredatoryInstinctsCriticalDamageMultiplier(2, 2, "cat")).toBeCloseTo(2.1);
|
|
expect(wow335DruidPredatoryInstinctsCriticalDamageMultiplier(2, 3, "cat")).toBeCloseTo(2.15);
|
|
expect(wow335DruidPredatoryInstinctsCriticalDamageMultiplier(2, 3, "bear")).toBe(2);
|
|
expect(wow335DruidPredatoryInstinctsCriticalDamageMultiplier(2, 3, null)).toBe(2);
|
|
expect(wow335DruidPredatoryInstinctsCriticalDamageMultiplier(1.5, 1, "cat")).toBeCloseTo(1.525);
|
|
});
|
|
|
|
it("reduces only area-attack damage received in Cat Form", () => {
|
|
expect(wow335DruidPredatoryInstinctsAreaDamageMultiplier(1, "cat", true)).toBeCloseTo(0.96);
|
|
expect(wow335DruidPredatoryInstinctsAreaDamageMultiplier(2, "cat", true)).toBeCloseTo(0.93);
|
|
expect(wow335DruidPredatoryInstinctsAreaDamageMultiplier(3, "cat", true)).toBeCloseTo(0.9);
|
|
expect(wow335DruidPredatoryInstinctsAreaDamageMultiplier(3, "cat", false)).toBe(1);
|
|
expect(wow335DruidPredatoryInstinctsAreaDamageMultiplier(3, "bear", true)).toBe(1);
|
|
expect(wow335DruidPredatoryInstinctsAreaDamageMultiplier(3, null, true)).toBe(1);
|
|
});
|
|
|
|
it("clamps malformed rank values and leaves the multiplier unchanged", () => {
|
|
expect(wow335DruidPredatoryInstinctsRankProfile(0)).toBeNull();
|
|
expect(wow335DruidPredatoryInstinctsRankProfile(Number.NaN)).toBeNull();
|
|
expect(wow335DruidPredatoryInstinctsRankProfile(99)).toEqual({
|
|
criticalDamageBonusPercent: 15,
|
|
areaDamageTakenReductionPercent: 10,
|
|
});
|
|
expect(wow335DruidPredatoryInstinctsAreaDamageMultiplier(-1, "cat", true)).toBe(1);
|
|
});
|
|
|
|
it("keeps Cat Form and area-delivery clauses out of always-on scalar modifiers", () => {
|
|
expect(talentModifiersForRanks({ [WOW335_DRUID_PREDATORY_INSTINCTS_TALENT_ID]: 3 }, "druid"))
|
|
.toEqual([]);
|
|
});
|
|
});
|