Fix logic bugs

This commit is contained in:
Isaac Shoebottom 2023-11-03 22:17:05 -03:00
parent 6c6f8b0b70
commit 6e1b576bcf

View File

@ -110,13 +110,13 @@ export function performFunctionIfCapable(ns: NS, server: string, func: CallableF
ns.print(`Not enough hacking level to hack ${server}`)
return false
}
if (ns.getServerNumPortsRequired(server) < ns.getServer(server).openPortCount) {
if (ns.getServer(server).openPortCount < ns.getServerNumPortsRequired(server)) {
ns.print(`Not enough ports, trying to root ${server}`)
}
if (rootServer(ns, server) < ns.getServerNumPortsRequired(server)) {
ns.print(`Need more port opening programs to root ${server}`)
ns.print(`Failed to root ${server}`)
return false
}
}
if (!ns.hasRootAccess(server)) {
ns.print(`Failed to root ${server}`)
return false