mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-26 17:43:48 +01:00
weaken message
This commit is contained in:
parent
4ec021c8f0
commit
ddd0eaaf5c
@ -212,13 +212,18 @@ export class Terminal implements ITerminal {
|
||||
player.gainHackingExp(expGainedOnSuccess);
|
||||
player.gainIntelligenceExp(expGainedOnSuccess / CONSTANTS.IntelligenceTerminalHackBaseExpGain);
|
||||
|
||||
const oldSec = server.hackDifficulty;
|
||||
server.fortify(CONSTANTS.ServerFortifyAmount);
|
||||
const newSec = server.hackDifficulty;
|
||||
|
||||
this.print(
|
||||
`Hack successful! Gained ${numeralWrapper.formatMoney(moneyGained)} and ${numeralWrapper.formatExp(
|
||||
expGainedOnSuccess,
|
||||
)} hacking exp`,
|
||||
);
|
||||
this.print(
|
||||
`Security increased from ${numeralWrapper.formatSecurity(oldSec)} to ${numeralWrapper.formatSecurity(newSec)}`,
|
||||
);
|
||||
} else {
|
||||
// Failure
|
||||
player.gainHackingExp(expGainedOnFailure);
|
||||
@ -237,13 +242,18 @@ export class Terminal implements ITerminal {
|
||||
}
|
||||
if (!(server instanceof Server)) throw new Error("server should be normal server");
|
||||
const expGain = calculateHackingExpGain(server, player);
|
||||
const oldSec = server.hackDifficulty;
|
||||
const growth = processSingleServerGrowth(server, 25, player, server.cpuCores) - 1;
|
||||
const newSec = server.hackDifficulty;
|
||||
this.print(
|
||||
`Available money on '${server.hostname}' grown by ${numeralWrapper.formatPercentage(
|
||||
growth,
|
||||
6,
|
||||
)}. Gained ${numeralWrapper.formatExp(expGain)} hacking exp.`,
|
||||
);
|
||||
this.print(
|
||||
`Security increased from ${numeralWrapper.formatSecurity(oldSec)} to ${numeralWrapper.formatSecurity(newSec)}`,
|
||||
);
|
||||
}
|
||||
|
||||
finishWeaken(player: IPlayer, cancelled = false): void {
|
||||
@ -255,10 +265,14 @@ export class Terminal implements ITerminal {
|
||||
}
|
||||
if (!(server instanceof Server)) throw new Error("server should be normal server");
|
||||
const expGain = calculateHackingExpGain(server, player);
|
||||
const oldSec = server.hackDifficulty;
|
||||
server.weaken(CONSTANTS.ServerWeakenAmount);
|
||||
const newSec = server.hackDifficulty;
|
||||
this.print(
|
||||
`'${server.hostname}' security level weakened to ${server.hackDifficulty.toFixed(3)} ` +
|
||||
`and Gained ${numeralWrapper.formatExp(expGain)} hacking exp.`,
|
||||
`Security decreased from ${numeralWrapper.formatSecurity(oldSec)} to ${numeralWrapper.formatSecurity(
|
||||
newSec,
|
||||
)} (min: ${numeralWrapper.formatSecurity(server.minDifficulty)})` +
|
||||
` and Gained ${numeralWrapper.formatExp(expGain)} hacking exp.`,
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -105,6 +105,10 @@ class NumeralFormatter {
|
||||
return this.format(n, "0,0");
|
||||
}
|
||||
|
||||
formatSecurity(n: number): string {
|
||||
return n.toFixed(3);
|
||||
}
|
||||
|
||||
formatRAM(n: number): string {
|
||||
if (n < 1e3) return this.format(n, "0.00") + "GB";
|
||||
if (n < 1e6) return this.format(n / 1e3, "0.00") + "TB";
|
||||
|
Loading…
Reference in New Issue
Block a user