mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-24 07:02:26 +01:00
MISC: small fixes (#270)
* infiltration gain bug fix * fix corp division description * avoid some issues with Infinity at super high NFG levels Co-authored-by: Daniel Perez Alvarez <danielpza@protonmail.com>
This commit is contained in:
parent
dfa691784c
commit
1baa615def
@ -466,11 +466,12 @@ Path 1 (new):
|
|||||||
is extremely powerful, as it raises all multipliers by a significant amount. This also a let's you
|
is extremely powerful, as it raises all multipliers by a significant amount. This also a let's you
|
||||||
get used to augments and other features resetting.
|
get used to augments and other features resetting.
|
||||||
|
|
||||||
2. Do **BitNode-3: Corporatocracy** once to unlock the Corporation mechanic. This mechanic
|
2. Do **BitNode-3: Corporatocracy** at least once to unlock the Corporation mechanic, finishing all
|
||||||
has highest profit potential in the game.
|
3 levels unlocks the full API for free allowing fully scripted corp. This mechanic has highest
|
||||||
|
profit potential in the game.
|
||||||
|
|
||||||
3. Do **BitNode-10: Digital Carbon** once to unlock sleeves and grafting. Sleeves are useful in all nodes
|
3. Do **BitNode-10: Digital Carbon** once to unlock sleeves and grafting. Sleeves are useful in all nodes
|
||||||
and grafting can be useful in future BitNodes (especially 8). It's recommended to buy all sleeves and
|
and grafting can be useful in future BitNodes (especially 8). It's recommended to buy all purchasable sleeves and
|
||||||
their memory during the first run.
|
their memory during the first run.
|
||||||
|
|
||||||
The ordering of the next three is dependant on playing style and wants/needs.
|
The ordering of the next three is dependant on playing style and wants/needs.
|
||||||
|
@ -107,6 +107,7 @@ export function purchaseAugmentation(aug: Augmentation, fac: Faction, sing = fal
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function processPassiveFactionRepGain(numCycles: number): void {
|
export function processPassiveFactionRepGain(numCycles: number): void {
|
||||||
|
if (Player.bitNodeN === 2) return;
|
||||||
for (const name of Object.keys(Factions)) {
|
for (const name of Object.keys(Factions)) {
|
||||||
if (isFactionWork(Player.currentWork) && name === Player.currentWork.factionName) continue;
|
if (isFactionWork(Player.currentWork) && name === Player.currentWork.factionName) continue;
|
||||||
if (!Factions.hasOwnProperty(name)) continue;
|
if (!Factions.hasOwnProperty(name)) continue;
|
||||||
|
@ -9,7 +9,7 @@ export interface FormulaGang {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function calculateWantedPenalty(gang: FormulaGang): number {
|
export function calculateWantedPenalty(gang: FormulaGang): number {
|
||||||
return gang.respect / (gang.respect + gang.wantedLevel);
|
return Math.max(gang.respect + 0.0001) / (gang.respect + gang.wantedLevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function calculateRespectGain(gang: FormulaGang, member: GangMember, task: GangMemberTask): number {
|
export function calculateRespectGain(gang: FormulaGang, member: GangMember, task: GangMemberTask): number {
|
||||||
|
@ -38,14 +38,12 @@ export function Victory(props: IProps): React.ReactElement {
|
|||||||
const isMemberOfInfiltrators = Player.factions.includes(FactionNames.ShadowsOfAnarchy);
|
const isMemberOfInfiltrators = Player.factions.includes(FactionNames.ShadowsOfAnarchy);
|
||||||
|
|
||||||
function sell(): void {
|
function sell(): void {
|
||||||
handleInfiltrators();
|
|
||||||
Player.gainMoney(moneyGain, "infiltration");
|
Player.gainMoney(moneyGain, "infiltration");
|
||||||
quitInfiltration();
|
quitInfiltration();
|
||||||
}
|
}
|
||||||
|
|
||||||
function trade(): void {
|
function trade(): void {
|
||||||
if (faction === "none") return;
|
if (faction === "none") return;
|
||||||
handleInfiltrators();
|
|
||||||
Factions[faction].playerReputation += repGain;
|
Factions[faction].playerReputation += repGain;
|
||||||
quitInfiltration();
|
quitInfiltration();
|
||||||
}
|
}
|
||||||
|
13
src/ScriptEditor/NetscriptDefinitions.d.ts
vendored
13
src/ScriptEditor/NetscriptDefinitions.d.ts
vendored
@ -3938,6 +3938,7 @@ interface HackingFormulas {
|
|||||||
hackPercent(server: Server, player: Person): number;
|
hackPercent(server: Server, player: Person): number;
|
||||||
/**
|
/**
|
||||||
* Calculate the percent a server would grow to.
|
* Calculate the percent a server would grow to.
|
||||||
|
* Not exact due to limitations of mathematics.
|
||||||
* (Ex: 3.0 would would grow the server to 300% of its current value.)
|
* (Ex: 3.0 would would grow the server to 300% of its current value.)
|
||||||
* @param server - Server info from {@link NS.getServer | getServer}
|
* @param server - Server info from {@link NS.getServer | getServer}
|
||||||
* @param threads - Amount of thread.
|
* @param threads - Amount of thread.
|
||||||
@ -4615,11 +4616,11 @@ export interface NS {
|
|||||||
*
|
*
|
||||||
* Use your hacking skills to increase the amount of money available on a server.
|
* Use your hacking skills to increase the amount of money available on a server.
|
||||||
* The runtime for this command depends on your hacking level and the target server’s
|
* The runtime for this command depends on your hacking level and the target server’s
|
||||||
* security level. When `grow` completes, the money available on a target server will
|
* security level. When `grow` completes, the money available on a target server will be increased
|
||||||
* be increased by a certain, fixed percentage. This percentage is determined by the
|
* by amount equal to the number of threads used and a certain, fixed percentage of current money on
|
||||||
* target server’s growth rate (which varies between servers) and security level. Generally,
|
* the server. This percentage is determined by the target server’s growth rate (which varies between servers)
|
||||||
* higher-level servers have higher growth rates. The {@link NS.getServerGrowth | getServerGrowth} function can be used
|
* and security level. Generally, higher-level servers have higher growth rates.
|
||||||
* to obtain a server’s growth rate.
|
* The {@link NS.getServerGrowth | getServerGrowth} function can be used to obtain a server’s growth rate.
|
||||||
*
|
*
|
||||||
* Like {@link NS.hack | hack}, `grow` can be called on any server, regardless of where the script is running.
|
* Like {@link NS.hack | hack}, `grow` can be called on any server, regardless of where the script is running.
|
||||||
* The grow() command requires root access to the target server, but there is no required hacking
|
* The grow() command requires root access to the target server, but there is no required hacking
|
||||||
@ -4773,6 +4774,8 @@ export interface NS {
|
|||||||
* the amount of money available on the specified server by the specified amount.
|
* the amount of money available on the specified server by the specified amount.
|
||||||
* The specified amount is multiplicative and is in decimal form, not percentage.
|
* The specified amount is multiplicative and is in decimal form, not percentage.
|
||||||
*
|
*
|
||||||
|
* Due to limitations of mathematics, this function won't be the true value, but an approximation.
|
||||||
|
*
|
||||||
* Warning: The value returned by this function isn’t necessarily a whole number.
|
* Warning: The value returned by this function isn’t necessarily a whole number.
|
||||||
*
|
*
|
||||||
* @example
|
* @example
|
||||||
|
@ -183,14 +183,15 @@ export function numCycleForGrowthCorrected(server: Server, targetMoney: number,
|
|||||||
*/
|
*/
|
||||||
let bt = exponentialBase ** threadMultiplier;
|
let bt = exponentialBase ** threadMultiplier;
|
||||||
if (bt == Infinity) bt = 1e300;
|
if (bt == Infinity) bt = 1e300;
|
||||||
|
|
||||||
let corr = Infinity;
|
let corr = Infinity;
|
||||||
// Two sided error because we do not want to get stuck if the error stays on the wrong side
|
// Two sided error because we do not want to get stuck if the error stays on the wrong side
|
||||||
do {
|
do {
|
||||||
// c should be above 0 so Halley's method can't be used, we have to stick to Newton-Raphson
|
// c should be above 0 so Halley's method can't be used, we have to stick to Newton-Raphson
|
||||||
const bct = bt ** cycles;
|
let bct = bt ** cycles;
|
||||||
|
if (bct == Infinity) bct = 1e300;
|
||||||
const opc = startMoney + cycles;
|
const opc = startMoney + cycles;
|
||||||
const diff = opc * bct - targetMoney;
|
let diff = opc * bct - targetMoney;
|
||||||
|
if (diff == Infinity) diff = 1e300;
|
||||||
corr = diff / (opc * x + 1.0) / bct;
|
corr = diff / (opc * x + 1.0) / bct;
|
||||||
cycles -= corr;
|
cycles -= corr;
|
||||||
} while (Math.abs(corr) >= 1);
|
} while (Math.abs(corr) >= 1);
|
||||||
|
@ -275,7 +275,7 @@ const Engine: {
|
|||||||
if (Player.currentWork !== null) {
|
if (Player.currentWork !== null) {
|
||||||
Player.focus = true;
|
Player.focus = true;
|
||||||
Player.processWork(numCyclesOffline);
|
Player.processWork(numCyclesOffline);
|
||||||
} else {
|
} else if (Player.bitNodeN !== 2) {
|
||||||
for (let i = 0; i < Player.factions.length; i++) {
|
for (let i = 0; i < Player.factions.length; i++) {
|
||||||
const facName = Player.factions[i];
|
const facName = Player.factions[i];
|
||||||
if (!Factions.hasOwnProperty(facName)) continue;
|
if (!Factions.hasOwnProperty(facName)) continue;
|
||||||
|
Loading…
Reference in New Issue
Block a user