fix: use flat rush cost at <50% progress
All checks were successful
Build / build (pull_request) Successful in 1m39s

otherwise the cost would be increased instead of decreased
This commit is contained in:
Sainan 2025-08-15 21:44:21 +02:00
parent c47a29ec96
commit 614075e4bc

View File

@ -102,7 +102,10 @@ export const claimCompletedRecipeController: RequestHandler = async (req, res) =
const secondsElapsed = Math.trunc(Date.now() / 1000) - start;
const progress = secondsElapsed / recipe.buildTime;
logger.debug(`rushing recipe at ${Math.trunc(progress * 100)}% completion`);
const cost = Math.round(recipe.skipBuildTimePrice * (1 - (progress - 0.5)));
const cost =
progress > 0.5
? Math.round(recipe.skipBuildTimePrice * (1 - (progress - 0.5)))
: recipe.skipBuildTimePrice;
InventoryChanges = {
...InventoryChanges,
...updateCurrency(inventory, cost, true)