Skip to content

Commit

Permalink
math.max -> math.min
Browse files Browse the repository at this point in the history
  • Loading branch information
pieterbrandsen authored Mar 18, 2024
1 parent 66518d3 commit 57795d6
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/data/converter/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,15 +101,15 @@ export function getIntentEffect(action, originalObject) {
try {
switch (action) {
case "harvest": {
const usableParts = Math.max(Math.floor(originalObject.store.energy / 2), originalObject.groupedBody.work);
const usableParts = Math.min(Math.floor(originalObject.store.energy / 2), originalObject.groupedBody.work);
return {
action,
energy: usableParts * 2,
effect: (originalObject.groupedBodyEffect.harvest / originalObject.groupedBody.work) * usableParts
};
}
case "build": {
const usableParts = Math.max(Math.floor(originalObject.store.energy / 5), originalObject.groupedBody.work);
const usableParts = Math.min(Math.floor(originalObject.store.energy / 5), originalObject.groupedBody.work);
return {
action,
energy: usableParts * 5,
Expand All @@ -118,15 +118,15 @@ export function getIntentEffect(action, originalObject) {
}
case "repair": {
if (originalObject.type === "tower") return { action, energy: 10 };
const usableParts = Math.max(originalObject.store.energy, originalObject.groupedBody.work);
const usableParts = Math.min(originalObject.store.energy, originalObject.groupedBody.work);
return {
action,
energy: usableParts * 1,
effect: (originalObject.groupedBodyEffect.repair / originalObject.groupedBody.work) * usableParts
};
}
case "upgradeController": {
const usableParts = Math.max(originalObject.store.energy, originalObject.groupedBody.work);
const usableParts = Math.min(originalObject.store.energy, originalObject.groupedBody.work);
return {
action,
energy: usableParts * 1,
Expand Down

0 comments on commit 57795d6

Please sign in to comment.