Skip to content

Commit

Permalink
Correct income calcuators
Browse files Browse the repository at this point in the history
  • Loading branch information
pieterbrandsen authored Mar 18, 2024
1 parent 394cc44 commit 48a635d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/data/converter/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,14 +100,12 @@ export function summarizeObjects(objects) {
export function getIntentEffect(action, originalObject) {
try {
switch (action) {
case "harvest": {
const usableParts = Math.min(Math.floor(originalObject.store.energy / 2), originalObject.groupedBody.work);
case "harvest":
return {
action,
energy: usableParts * 2,
effect: (originalObject.groupedBodyEffect.harvest / originalObject.groupedBody.work) * usableParts
};
}
energy: originalObject.groupedBody.work * 2,
effect: originalObject.groupedBodyEffect.harvest
}
case "build": {
const usableParts = Math.min(Math.floor(originalObject.store.energy / 5), originalObject.groupedBody.work);
return {
Expand Down
3 changes: 3 additions & 0 deletions tests/dataTypes/owned.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -765,6 +765,9 @@ describe("Owned data type process check", () => {
settings.push({
type: TestHelper.dataTypes.creep, data: {
0: {
store: {
energy: 1000,
},
actionLog: {
harvest: {
},
Expand Down
3 changes: 3 additions & 0 deletions tests/dataTypes/reserved.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,9 @@ describe("Reserved data type process check", () => {
settings.push({
type: TestHelper.dataTypes.creep, data: {
0: {
store: {
energy: 1000,
},
actionLog: {
harvest: {
},
Expand Down

0 comments on commit 48a635d

Please sign in to comment.