diff --git a/src/Terminal/Terminal.ts b/src/Terminal/Terminal.ts index e1f7d093e..25ed5264f 100644 --- a/src/Terminal/Terminal.ts +++ b/src/Terminal/Terminal.ts @@ -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.`, ); } diff --git a/src/ui/numeralFormat.ts b/src/ui/numeralFormat.ts index 40aee1f80..2a8da34cb 100644 --- a/src/ui/numeralFormat.ts +++ b/src/ui/numeralFormat.ts @@ -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";