Skip to content

Commit

Permalink
fixed fuel consumption display
Browse files Browse the repository at this point in the history
  • Loading branch information
ametel01 committed Feb 4, 2024
1 parent d4d3ee1 commit 706833c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
10 changes: 5 additions & 5 deletions packages/frontend/src/constants/Stats.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export const ShipsStats = {
hull: 1000,
speed: 5000,
cargo: 10000,
consumption: 10,
consumption: 23,
},
scraper: {
id: 1,
Expand All @@ -15,7 +15,7 @@ export const ShipsStats = {
hull: 1600,
speed: 2000,
cargo: 20000,
consumption: 300,
consumption: 343,
},
sparrow: {
id: 2,
Expand All @@ -24,7 +24,7 @@ export const ShipsStats = {
hull: 1000,
speed: 12500,
cargo: 50,
consumption: 20,
consumption: 23,
},
frigate: {
id: 3,
Expand All @@ -33,7 +33,7 @@ export const ShipsStats = {
hull: 8000,
speed: 15000,
cargo: 300,
consumption: 800,
consumption: 353,
},
armade: {
id: 4,
Expand All @@ -42,7 +42,7 @@ export const ShipsStats = {
hull: 15000,
speed: 10000,
cargo: 1500,
consumption: 500,
consumption: 590,
},
};

Expand Down
6 changes: 2 additions & 4 deletions packages/frontend/src/shared/utils/FleetUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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)
);
}

Expand Down

0 comments on commit 706833c

Please sign in to comment.