Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/overlords/Overlord.ts
Original file line number Diff line number Diff line change
Expand Up @@ -602,7 +602,7 @@ export abstract class Overlord {
const [moveBoosts, nonMoveBoosts] = _.partition(neededBoostResources,
resource => Abathur.isMoveBoost(<ResourceConstant>resource));

for (const boost of [...moveBoosts, nonMoveBoosts]) { // try to get move boosts first if they're available
for (const boost of [...moveBoosts, ...nonMoveBoosts]) { // try to get move boosts first if they're available
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd change this to have typescript help a little:

      const neededBoosts = zerg.getNeededBoosts();
      const neededBoostResources = _.keys(neededBoosts) as MineralBoostConstant[];

      const [moveBoosts, nonMoveBoosts] = _.partition(neededBoostResources,
                              resource => Abathur.isMoveBoost(<ResourceConstant>resource));

      for (const boost of [...moveBoosts, ...nonMoveBoosts]) { // try to get move boosts first if they're available
        const b: MineralBoostConstant = boost; // Have the types help ensure correctness.
        const boostLab = _.find(evolutionChamber.boostingLabs, lab => lab.mineralType === b);
        if (boostLab) {
          zerg.task = Tasks.getBoosted(boostLab, <ResourceConstant>boost);
          return;
        }
      }

Other than that, LGTM.

const boostLab = _.find(evolutionChamber.boostingLabs, lab => lab.mineralType == boost);
if (boostLab) {
zerg.task = Tasks.getBoosted(boostLab, <ResourceConstant>boost);
Expand Down