Fix repeatables buying more than intended when cumulativeCost is false

This commit is contained in:
ducdat0507 2023-05-19 17:12:53 +07:00 committed by GitHub
parent a5efed6e4a
commit 46306ee0e7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

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