Compare commits

...

1 commit

Author SHA1 Message Date
ducdat0507
46306ee0e7
Fix repeatables buying more than intended when cumulativeCost is false 2023-05-19 17:12:53 +07:00

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);