Skip to content

Commit

Permalink
In bladeburner, stanek should should prioritize the bladeburner piece
Browse files Browse the repository at this point in the history
Luckily, by default it prioritizes using the hack pieces (0 and 1) - and 0 is the same shape as 30 (bladeburner), so we can just look for 0 and swap it with 30.
  • Loading branch information
alainbryden committed Jan 14, 2025
1 parent 2614727 commit a02efac
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions stanek.js.create.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,17 @@ export async function main(ns) {
log(ns, 'Cleared any existing stanek layout.');
}

// If we're in a bladeburner BN, and there's no bladeburner piece in our selected layout (id=30),
// replace the identically shaped hacking multi piece with this one.
const has0butNot30 = bestLayout.fragments.some(p => p.id == 0) && !bestLayout.fragments.some(p => p.id == 30);
if (has0butNot30) {
const bitnodeN = (await getNsDataThroughFile(ns, 'ns.getResetInfo()')).currentNode;;
if (bitnodeN == 6 || bitnodeN == 7) {
log(ns, `We're in a bladeburner node, replacing a hack piece with the bladeburner piece.`);
bestLayout.fragments.find(p => p.id == 0).id = 30;
}
}

// Place the layout
log(ns, `Placing ${bestLayout.fragments.length} fragments:\n` + JSON.stringify(bestLayout.fragments));
const result = await getNsDataThroughFile(ns,
Expand Down

0 comments on commit a02efac

Please sign in to comment.