From 706833cbd31e133be8171c8731a85b70dc5faa76 Mon Sep 17 00:00:00 2001 From: ametel01 Date: Sun, 4 Feb 2024 12:35:52 +0800 Subject: [PATCH] fixed fuel consumption display --- packages/frontend/src/constants/Stats.ts | 10 +++++----- packages/frontend/src/shared/utils/FleetUtils.ts | 6 ++---- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/packages/frontend/src/constants/Stats.ts b/packages/frontend/src/constants/Stats.ts index 0fa0f06..7b31dab 100644 --- a/packages/frontend/src/constants/Stats.ts +++ b/packages/frontend/src/constants/Stats.ts @@ -6,7 +6,7 @@ export const ShipsStats = { hull: 1000, speed: 5000, cargo: 10000, - consumption: 10, + consumption: 23, }, scraper: { id: 1, @@ -15,7 +15,7 @@ export const ShipsStats = { hull: 1600, speed: 2000, cargo: 20000, - consumption: 300, + consumption: 343, }, sparrow: { id: 2, @@ -24,7 +24,7 @@ export const ShipsStats = { hull: 1000, speed: 12500, cargo: 50, - consumption: 20, + consumption: 23, }, frigate: { id: 3, @@ -33,7 +33,7 @@ export const ShipsStats = { hull: 8000, speed: 15000, cargo: 300, - consumption: 800, + consumption: 353, }, armade: { id: 4, @@ -42,7 +42,7 @@ export const ShipsStats = { hull: 15000, speed: 10000, cargo: 1500, - consumption: 500, + consumption: 590, }, }; diff --git a/packages/frontend/src/shared/utils/FleetUtils.ts b/packages/frontend/src/shared/utils/FleetUtils.ts index fe3b10c..943d94f 100644 --- a/packages/frontend/src/shared/utils/FleetUtils.ts +++ b/packages/frontend/src/shared/utils/FleetUtils.ts @@ -29,7 +29,7 @@ function getUnitConsumption( ): number { const consumption = 1 + - Math.round( + Math.ceil( ((ship.consumption * distance) / 35000) * Math.pow(speed / 100 + 1, 2) ); return consumption; @@ -45,9 +45,7 @@ export function getFuelConsumption( fleet.scraper * getUnitConsumption(SCRAPER, distance, speedFactor) + fleet.sparrow * getUnitConsumption(SPARROW, distance, speedFactor) + fleet.frigate * getUnitConsumption(FRIGATE, distance, speedFactor) + - fleet.armade * - getUnitConsumption(ARMADE, distance, speedFactor) * - (speedFactor / 100) + fleet.armade * getUnitConsumption(ARMADE, distance, speedFactor) ); }