XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet

SpaceNinjaServer

A simple server for a small space ninja game

公开
关注 0 Fork 1 Star 0
返回提交历史

XFEstudio/SpaceNinjaServer

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
Sainan <63328889+Sainan@users.noreply.github.com>
提交于

代码差异

1 个文件 +4 -1
Modified src/controllers/api/claimCompletedRecipeController.ts +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)