Release v0.1.3 2026-07-11
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { createEncounterGearModifiers } from "./gearEffects";
|
||||
import {
|
||||
GEAR_RECIPES,
|
||||
canAffordGearUpgrade,
|
||||
createDefaultGearProgress,
|
||||
gearUpgradeCosts,
|
||||
upgradeGearSlot,
|
||||
} from "./gear";
|
||||
import { bossCoinDrop, type MaterialStack } from "./loot";
|
||||
|
||||
describe("IWT2-style gear progression", () => {
|
||||
it("uses exact rank-one and rank-two boss coin 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", () => {
|
||||
const recipe = GEAR_RECIPES.nia.weapon;
|
||||
const costs = gearUpgradeCosts("nia", "weapon", 5);
|
||||
expect(costs[0].itemId).toBe(bossCoinDrop(recipe.primaryBossId, "veteran").id);
|
||||
expect(costs.map((cost) => cost.quantity)).toEqual([6, 5]);
|
||||
});
|
||||
|
||||
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 }];
|
||||
expect(canAffordGearUpgrade(inventory, costs)).toBe(true);
|
||||
const result = upgradeGearSlot(progress, inventory, "brann", "weapon");
|
||||
expect(result.gearProgress.brann.slots.weapon.level).toBe(1);
|
||||
expect(result.inventory[0].quantity).toBe(1);
|
||||
expect(progress.brann.slots.weapon.level).toBe(0);
|
||||
});
|
||||
|
||||
it("projects rank bonuses without mutating saved progress", () => {
|
||||
const progress = createDefaultGearProgress();
|
||||
progress.priest.slots.weapon.level = 10;
|
||||
progress.priest.slots.chest.level = 10;
|
||||
progress.brann.slots.weapon.level = 10;
|
||||
progress.brann.slots.helmet.level = 10;
|
||||
const modifiers = createEncounterGearModifiers(progress, "priest");
|
||||
expect(modifiers.aelia.healingPower).toBeCloseTo(1.4);
|
||||
expect(modifiers.aelia.maxHealth).toBeCloseTo(1.4);
|
||||
expect(modifiers.brann.damage).toBeCloseTo(1.4);
|
||||
expect(modifiers.brann.stunDuration).toBeCloseTo(0.2);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user