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