Fix case where you jump too many levels at once

This commit is contained in:
Isaac Shoebottom 2023-11-13 13:31:52 -04:00
parent f0d4017711
commit c320b31ac3

View File

@ -7,7 +7,7 @@ export async function main(ns: NS) {
levels = levels.filter(level => level > hackingLevel) levels = levels.filter(level => level > hackingLevel)
do { do {
if (levels.includes(hackingLevel)) { if (Math.min(...levels) <= hackingLevel) {
// remove the level from the list, so we don't try to hack it again // remove the level from the list, so we don't try to hack it again
levels.splice(levels.indexOf(hackingLevel), 1) levels.splice(levels.indexOf(hackingLevel), 1)
ns.tprint(`Hacking level increased to ${hackingLevel}`) ns.tprint(`Hacking level increased to ${hackingLevel}`)