forked from phenom/healer-man
88 lines
2.7 KiB
TypeScript
88 lines
2.7 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import {
|
|
damageAfterArmor,
|
|
healthFromStamina,
|
|
itemStatSummary,
|
|
itemStatsFor,
|
|
normalizeItemStats,
|
|
weaponDps,
|
|
} from "./itemStats";
|
|
|
|
describe("boss item stats", () => {
|
|
it("scales the original 3.3.5a attributes without changing their distribution", () => {
|
|
const base = {
|
|
itemId: 5404,
|
|
inventorySlot: "chest",
|
|
armorType: "leather",
|
|
weaponType: null,
|
|
} as const;
|
|
const low = itemStatsFor({ ...base, quality: "uncommon", itemLevel: 10 });
|
|
const high = itemStatsFor({ ...base, quality: "rare", itemLevel: 30 });
|
|
|
|
expect(high.agility).toBeGreaterThan(low.agility);
|
|
expect(high.armor).toBeGreaterThan(low.armor);
|
|
expect(high.strength).toBe(0);
|
|
expect(itemStatSummary(high)).toContain("Agility");
|
|
expect(itemStatSummary(high)).toContain("Armor");
|
|
});
|
|
|
|
it("retains original weapon damage, school, speed, and DPS", () => {
|
|
const firebelcher = itemStatsFor({
|
|
itemId: 5243,
|
|
quality: "rare",
|
|
inventorySlot: "ranged",
|
|
armorType: null,
|
|
weaponType: "wand",
|
|
itemLevel: 20,
|
|
sourceItemLevel: 20,
|
|
});
|
|
expect(firebelcher.rangedWeapon).toMatchObject({
|
|
damageMin: 24,
|
|
damageMax: 45,
|
|
damageSchool: "fire",
|
|
speedMs: 1700,
|
|
});
|
|
expect(weaponDps(firebelcher.rangedWeapon!)).toBeCloseTo(20.29, 2);
|
|
});
|
|
|
|
it("migrates pre-stat saved loot from its captured item metadata", () => {
|
|
const fallback = {
|
|
itemId: 6631,
|
|
quality: "rare" as const,
|
|
inventorySlot: "two-hand",
|
|
armorType: null,
|
|
weaponType: "staff",
|
|
itemLevel: 25,
|
|
};
|
|
expect(normalizeItemStats(undefined, fallback)).toEqual(itemStatsFor(fallback));
|
|
});
|
|
|
|
it("persists explicit RoM-native gear separately from unchanged WotLK stats", () => {
|
|
const source = {
|
|
itemId: 999001,
|
|
quality: "rare" as const,
|
|
inventorySlot: "head",
|
|
armorType: null,
|
|
weaponType: null,
|
|
itemLevel: 20,
|
|
sourceItemLevel: 20,
|
|
sourceStats: { strength: 8, spellPower: 40 },
|
|
romNative: { strength: 3, magicalDamage: 17, healPowerRateFactor: 1.15 },
|
|
};
|
|
const item = itemStatsFor(source);
|
|
expect(item).toMatchObject({ strength: 8, spellPower: 40 });
|
|
expect(item.romNative).toEqual(source.romNative);
|
|
expect(normalizeItemStats(item, source)).toMatchObject({
|
|
strength: 8,
|
|
spellPower: 40,
|
|
romNative: source.romNative,
|
|
});
|
|
});
|
|
|
|
it("turns stamina into health and armor into reduced incoming damage", () => {
|
|
expect(healthFromStamina(7)).toBe(70);
|
|
expect(damageAfterArmor(100, 0, 20)).toBe(100);
|
|
expect(damageAfterArmor(100, 120, 20)).toBeLessThan(100);
|
|
});
|
|
});
|