API: Add weakenEffect to formulas.hacking namespace (#2626)

This commit is contained in:
Lee Stutzman
2026-04-11 00:36:45 +01:00
committed by GitHub
parent 8cbd6ff9e1
commit fb3fa00b3d
7 changed files with 135 additions and 1 deletions
+9 -1
View File
@@ -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: