Fix ink consumption grid rounding bug

This commit is contained in:
Kalle
2026-09-25 20:07:06 +03:00
parent b5e8c9c55b
commit d777beade0
3 changed files with 36 additions and 2 deletions

View File

@@ -253,6 +253,36 @@ describe("Analyze build", () => {
).toBe(roundToNDecimalPlaces((jrParams.InkConsume! * 100) / 1.1));
});
test.each([
{ why: "Sploosh 64.995", weaponSplId: 0, iss: 9, ism: 16, expected: 64.99 },
{
why: "Sploosh 101.998",
weaponSplId: 0,
iss: 15,
ism: 57,
expected: 101.99,
},
{ why: "Jr. just under 100", weaponSplId: 10, iss: 3, ism: 1, expected: 99.99 },
] as const)(
"Full ink tank actions are truncated, not rounded up ($why)",
({ weaponSplId, iss, ism, expected }) => {
const analyzed = buildStats({
weaponSplId,
abilityPoints: new Map([
["ISS", iss],
["ISM", ism],
]),
hasTacticooler: false,
});
const oneSubOption = analyzed.stats.fullInkTankOptions.find(
(option) => option.subsUsed === 1,
);
expect(oneSubOption?.value).toBe(expected);
},
);
test("Sub Power Up Beakon AP boost matches Lean", () => {
for (const [subPowerAp, quickSuperJumpAp] of subPowerApToQuickSuperJumpAp) {
const analyzed = buildStats({

View File

@@ -316,11 +316,10 @@ export function fullInkTankOptions(
id: nanoid(),
subsUsed: subsFromFullInkTank,
type,
value: effectToRounded(
value: cutToNDecimalPlaces(
(inkTankSize(args.weaponSplId) -
subWeaponInkConsume * subsFromFullInkTank) /
mainWeaponInkConsume,
2,
),
});
}

View File

@@ -0,0 +1,5 @@
---
navItem: analyzer
type: bug
---
Build analyzer no longer shows one extra action from a full ink tank when the true count falls just short of the next whole number