mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-16 06:18:42 +02:00
API: Add weakenEffect to formulas.hacking namespace (#2626)
This commit is contained in:
@@ -746,6 +746,7 @@ import nsDoc_bitburner_hackingformulas_hackexp_md from "../../markdown/bitburner
|
||||
import nsDoc_bitburner_hackingformulas_hackpercent_md from "../../markdown/bitburner.hackingformulas.hackpercent.md?raw";
|
||||
import nsDoc_bitburner_hackingformulas_hacktime_md from "../../markdown/bitburner.hackingformulas.hacktime.md?raw";
|
||||
import nsDoc_bitburner_hackingformulas_md from "../../markdown/bitburner.hackingformulas.md?raw";
|
||||
import nsDoc_bitburner_hackingformulas_weakeneffect_md from "../../markdown/bitburner.hackingformulas.weakeneffect.md?raw";
|
||||
import nsDoc_bitburner_hackingformulas_weakentime_md from "../../markdown/bitburner.hackingformulas.weakentime.md?raw";
|
||||
import nsDoc_bitburner_hackingmultipliers_chance_md from "../../markdown/bitburner.hackingmultipliers.chance.md?raw";
|
||||
import nsDoc_bitburner_hackingmultipliers_growth_md from "../../markdown/bitburner.hackingmultipliers.growth.md?raw";
|
||||
@@ -2342,6 +2343,7 @@ AllPages["nsDoc/bitburner.hackingformulas.hackexp.md"] = nsDoc_bitburner_hacking
|
||||
AllPages["nsDoc/bitburner.hackingformulas.hackpercent.md"] = nsDoc_bitburner_hackingformulas_hackpercent_md;
|
||||
AllPages["nsDoc/bitburner.hackingformulas.hacktime.md"] = nsDoc_bitburner_hackingformulas_hacktime_md;
|
||||
AllPages["nsDoc/bitburner.hackingformulas.md"] = nsDoc_bitburner_hackingformulas_md;
|
||||
AllPages["nsDoc/bitburner.hackingformulas.weakeneffect.md"] = nsDoc_bitburner_hackingformulas_weakeneffect_md;
|
||||
AllPages["nsDoc/bitburner.hackingformulas.weakentime.md"] = nsDoc_bitburner_hackingformulas_weakentime_md;
|
||||
AllPages["nsDoc/bitburner.hackingmultipliers.chance.md"] = nsDoc_bitburner_hackingmultipliers_chance_md;
|
||||
AllPages["nsDoc/bitburner.hackingmultipliers.growth.md"] = nsDoc_bitburner_hackingmultipliers_growth_md;
|
||||
|
||||
@@ -692,6 +692,7 @@ export const RamCosts: RamCostTree<NSFull> = {
|
||||
hackTime: 0,
|
||||
growTime: 0,
|
||||
weakenTime: 0,
|
||||
weakenEffect: 0,
|
||||
},
|
||||
hacknetNodes: {
|
||||
moneyGainRate: 0,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Player } from "@player";
|
||||
import { calculateServerGrowth, calculateGrowMoney } from "../Server/formulas/grow";
|
||||
import { numCycleForGrowthCorrected } from "../Server/ServerHelpers";
|
||||
import { getWeakenEffect, numCycleForGrowthCorrected } from "../Server/ServerHelpers";
|
||||
import {
|
||||
calculateMoneyGainRate,
|
||||
calculateLevelUpgradeCost,
|
||||
@@ -235,6 +235,14 @@ export function NetscriptFormulas(): InternalAPI<IFormulas> {
|
||||
checkFormulasAccess(ctx);
|
||||
return calculateWeakenTime(server, person) * 1000;
|
||||
},
|
||||
weakenEffect:
|
||||
(ctx) =>
|
||||
(_threads, _cores = 1) => {
|
||||
const threads = helpers.number(ctx, "threads", _threads);
|
||||
const cores = helpers.number(ctx, "cores", _cores);
|
||||
checkFormulasAccess(ctx);
|
||||
return getWeakenEffect(threads, cores);
|
||||
},
|
||||
},
|
||||
hacknetNodes: {
|
||||
moneyGainRate:
|
||||
|
||||
10
src/ScriptEditor/NetscriptDefinitions.d.ts
vendored
10
src/ScriptEditor/NetscriptDefinitions.d.ts
vendored
@@ -6299,6 +6299,16 @@ interface HackingFormulas {
|
||||
* @returns The calculated weaken time, in milliseconds.
|
||||
*/
|
||||
weakenTime(server: Server, player: Person): number;
|
||||
/**
|
||||
* Calculate the security decrease from a weaken operation.
|
||||
* Unlike other hacking formulas, weaken effect depends only on thread count and
|
||||
* core count, not on server or player properties. The core bonus formula is
|
||||
* {@code 1 + (cores - 1) / 16}.
|
||||
* @param threads - Number of threads running weaken.
|
||||
* @param cores - Number of cores on the host server. Default 1.
|
||||
* @returns The security decrease amount.
|
||||
*/
|
||||
weakenEffect(threads: number, cores?: number): number;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user