forked from OpenWF/SpaceNinjaServer
		
	fix: use flat rush cost at <50% progress (#2634)
otherwise the cost would be increased instead of decreased Reviewed-on: OpenWF/SpaceNinjaServer#2634 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>
This commit is contained in:
		
							parent
							
								
									5d5554a80e
								
							
						
					
					
						commit
						264e9cfc98
					
				@ -102,7 +102,10 @@ export const claimCompletedRecipeController: RequestHandler = async (req, res) =
 | 
				
			|||||||
            const secondsElapsed = Math.trunc(Date.now() / 1000) - start;
 | 
					            const secondsElapsed = Math.trunc(Date.now() / 1000) - start;
 | 
				
			||||||
            const progress = secondsElapsed / recipe.buildTime;
 | 
					            const progress = secondsElapsed / recipe.buildTime;
 | 
				
			||||||
            logger.debug(`rushing recipe at ${Math.trunc(progress * 100)}% completion`);
 | 
					            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 = {
 | 
				
			||||||
                ...InventoryChanges,
 | 
					                ...InventoryChanges,
 | 
				
			||||||
                ...updateCurrency(inventory, cost, true)
 | 
					                ...updateCurrency(inventory, cost, true)
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user