Release v0.1.4 2026-07-12
This commit is contained in:
@@ -7,28 +7,38 @@ import {
|
||||
gearUpgradeCosts,
|
||||
upgradeGearSlot,
|
||||
} from "./gear";
|
||||
import { bossCoinDrop, type MaterialStack } from "./loot";
|
||||
import { groupDrop, type MaterialStack } from "./loot";
|
||||
|
||||
describe("IWT2-style gear progression", () => {
|
||||
it("uses exact rank-one and rank-two boss coin costs", () => {
|
||||
it("uses exact rank-one and rank-two group drop costs", () => {
|
||||
const rankOne = gearUpgradeCosts("priest", "weapon", 0);
|
||||
const rankTwo = gearUpgradeCosts("priest", "weapon", 1);
|
||||
expect(rankOne.map((cost) => cost.quantity)).toEqual([2]);
|
||||
expect(rankTwo.map((cost) => cost.quantity)).toEqual([3, 1]);
|
||||
});
|
||||
|
||||
it("preserves IWT2 Veteran coin parity for ranks six through ten", () => {
|
||||
it("preserves IWT2 Veteran drop parity for ranks six through ten", () => {
|
||||
const recipe = GEAR_RECIPES.nia.weapon;
|
||||
const costs = gearUpgradeCosts("nia", "weapon", 5);
|
||||
expect(costs[0].itemId).toBe(bossCoinDrop(recipe.primaryBossId, "veteran").id);
|
||||
expect(costs[0].itemId).toBe(groupDrop(recipe.primaryGroupId, "veteran").id);
|
||||
expect(costs.map((cost) => cost.quantity)).toEqual([6, 5]);
|
||||
});
|
||||
|
||||
it("requires two distinct mechanic groups for every gear recipe", () => {
|
||||
for (const owner of Object.values(GEAR_RECIPES)) {
|
||||
for (const recipe of Object.values(owner)) expect(recipe.primaryGroupId).not.toBe(recipe.secondaryGroupId);
|
||||
}
|
||||
expect(GEAR_RECIPES.priest.chest).toMatchObject({ primaryGroupId: "charge", secondaryGroupId: "shockwave-fall" });
|
||||
expect(GEAR_RECIPES.brann.weapon).toMatchObject({ primaryGroupId: "charge", secondaryGroupId: "scuttle-burst" });
|
||||
expect(GEAR_RECIPES.nia.chest).toMatchObject({ primaryGroupId: "charge", secondaryGroupId: "rift-lanes" });
|
||||
expect(GEAR_RECIPES.vale.chest).toMatchObject({ primaryGroupId: "charge", secondaryGroupId: "rift-lanes" });
|
||||
});
|
||||
|
||||
it("spends all costs atomically and advances one rank", () => {
|
||||
const progress = createDefaultGearProgress();
|
||||
const costs = gearUpgradeCosts("brann", "weapon", 0);
|
||||
const coin = bossCoinDrop(GEAR_RECIPES.brann.weapon.primaryBossId, "initiate");
|
||||
const inventory: MaterialStack[] = [{ id: coin.id, name: coin.name, quantity: 3, rarity: coin.rarity, itemLevel: coin.itemLevel, glyph: coin.glyph }];
|
||||
const drop = groupDrop(GEAR_RECIPES.brann.weapon.primaryGroupId, "initiate");
|
||||
const inventory: MaterialStack[] = [{ id: drop.id, name: drop.name, quantity: 3, rarity: drop.rarity, itemLevel: drop.itemLevel, glyph: drop.glyph }];
|
||||
expect(canAffordGearUpgrade(inventory, costs)).toBe(true);
|
||||
const result = upgradeGearSlot(progress, inventory, "brann", "weapon");
|
||||
expect(result.gearProgress.brann.slots.weapon.level).toBe(1);
|
||||
|
||||
Reference in New Issue
Block a user