forked from phenom/healer-man
66 lines
1.9 KiB
TypeScript
66 lines
1.9 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("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);
|
|
});
|
|
});
|