返回提交历史
Modified
src/controllers/api/claimCompletedRecipeController.ts
+4
-1
XFEstudio/XFESpaceNinjaServer
fix: use flat rush cost at <50% progress (#2634)
otherwise the cost would be increased instead of decreased Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/2634 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>
264e9cfc
代码差异
1 个文件
+4
-1
@@ -102,7 +102,10 @@ export const claimCompletedRecipeController: RequestHandler = async (req, res) =
102
102
const secondsElapsed = Math.trunc(Date.now() / 1000) - start;
103
103
const progress = secondsElapsed / recipe.buildTime;
104
104
logger.debug(`rushing recipe at ${Math.trunc(progress * 100)}% completion`);
105
const cost = Math.round(recipe.skipBuildTimePrice * (1 - (progress - 0.5)));
105
const cost =
106
progress > 0.5
107
? Math.round(recipe.skipBuildTimePrice * (1 - (progress - 0.5)))
108
: recipe.skipBuildTimePrice;
106
109
InventoryChanges = {
107
110
...InventoryChanges,
108
111
...updateCurrency(inventory, cost, true)