Fix repeatables buying more than intended when cumulativeCost is false #18

Open
ducdat0507 wants to merge 1 commit from ducdat0507/patch-1 into main
Showing only changes of commit 46306ee0e7 - Show all commits

View file

@ -1453,7 +1453,9 @@ export function calculateMaxAffordable(
formula.invertIntegral(Decimal.add(resource.value, formula.evaluateIntegral())) formula.invertIntegral(Decimal.add(resource.value, formula.evaluateIntegral()))
).sub(unref(formula.innermostVariable) ?? 0); ).sub(unref(formula.innermostVariable) ?? 0);
} else { } else {
affordable = Decimal.floor(formula.invert(resource.value)); affordable = Decimal.floor(
formula.invert(resource.value)
).add(1).sub(unref(formula.innermostVariable) ?? 0);
} }
} }
affordable = Decimal.clampMax(affordable, maxBulkAmount); affordable = Decimal.clampMax(affordable, maxBulkAmount);