Formulas.exe

This commit is contained in:
Olivier Gagnon 2021-10-27 23:41:47 -04:00
parent 4fbcb1c4e9
commit e892e16585
10 changed files with 63 additions and 56 deletions

26
dist/vendor.bundle.js vendored

File diff suppressed because one or more lines are too long

@ -31,7 +31,7 @@ List of all Source-Files
| | * Each level of this Source-File opens up more of the Singularity Functions to use. | | | * Each level of this Source-File opens up more of the Singularity Functions to use. |
+------------------------------------+-------------------------------------------------------------------------------------+ +------------------------------------+-------------------------------------------------------------------------------------+
| BitNode-5: Artificial Intelligence | * Unlocks :ref:`gameplay_intelligence`. | | BitNode-5: Artificial Intelligence | * Unlocks :ref:`gameplay_intelligence`. |
| | * Unlocks :js:func:`getBitNodeMultipliers` and :js:func:`getServer` | | | * Unlocks :js:func:`getBitNodeMultipliers` and start with Formulas.exe |
| | Netscript functions, as well as :ref:`netscriptformulas`. | | | Netscript functions, as well as :ref:`netscriptformulas`. |
| | * Increases all of the player's hacking-related multipliers by 8%/12%/14%. | | | * Increases all of the player's hacking-related multipliers by 8%/12%/14%. |
+------------------------------------+-------------------------------------------------------------------------------------+ +------------------------------------+-------------------------------------------------------------------------------------+

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -63,6 +63,11 @@ export const GeneralActions: {
), ),
}, },
"Incite Violence": { "Incite Violence": {
desc: <>Purposefully stir trouble in the synthoid community in order to gain a political edge.</>, desc: (
<>
Purposefully stir trouble in the synthoid community in order to gain a political edge. This will generate
additional contracts and operations, at the cost of increased Chaos.
</>
),
}, },
}; };

@ -23,7 +23,7 @@ export function listAllDarkwebItems(): void {
const item = DarkWebItems[key]; const item = DarkWebItems[key];
Terminal.printRaw( Terminal.printRaw(
<> <>
{item.program} - <Money money={item.price} /> - {item.description}` {item.program} - <Money money={item.price} /> - {item.description}
</>, </>,
); );
} }

@ -10,11 +10,11 @@ export const DarkWebItems: IMap<DarkWebItem> = {
SQLInjectProgram: new DarkWebItem(Programs.SQLInjectProgram.name, 250e6, "Opens up SQL Ports."), SQLInjectProgram: new DarkWebItem(Programs.SQLInjectProgram.name, 250e6, "Opens up SQL Ports."),
DeepscanV1: new DarkWebItem(Programs.DeepscanV1.name, 500000, "Enables 'scan-analyze' with a depth up to 5."), DeepscanV1: new DarkWebItem(Programs.DeepscanV1.name, 500000, "Enables 'scan-analyze' with a depth up to 5."),
DeepscanV2: new DarkWebItem(Programs.DeepscanV2.name, 25e6, "Enables 'scan-analyze' with a depth up to 10."), DeepscanV2: new DarkWebItem(Programs.DeepscanV2.name, 25e6, "Enables 'scan-analyze' with a depth up to 10."),
AutolinkProgram: new DarkWebItem(Programs.AutoLink.name, 1e6, "Enables direct connect via 'scan-analyze.'"), AutolinkProgram: new DarkWebItem(Programs.AutoLink.name, 1e6, "Enables direct connect via 'scan-analyze."),
ServerProfilerProgram: new DarkWebItem( ServerProfilerProgram: new DarkWebItem(
Programs.ServerProfiler.name, Programs.ServerProfiler.name,
1e6, 1e6,
"Displays hacking and Netscript-related information about a server.", "Displays hacking and Netscript-related information about a server.",
), ),
FormulasProgram: new DarkWebItem(Programs.Formulas.name, 1e9, "Unlock access to the formulas API."), FormulasProgram: new DarkWebItem(Programs.Formulas.name, 5e9, "Unlock access to the formulas API."),
}; };

@ -27,6 +27,7 @@ import {
calculateGrowTime, calculateGrowTime,
calculateWeakenTime, calculateWeakenTime,
} from "../Hacking"; } from "../Hacking";
import { Programs } from "../Programs/Programs";
export interface INetscriptFormulas { export interface INetscriptFormulas {
basic: { basic: {
@ -65,106 +66,99 @@ export function NetscriptFormulas(
workerScript: WorkerScript, workerScript: WorkerScript,
helper: INetscriptHelper, helper: INetscriptHelper,
): INetscriptFormulas { ): INetscriptFormulas {
const checkFormulasAccess = function (func: any, n: any): void { const checkFormulasAccess = function (func: string): void {
if ( if (!player.hasProgram(Programs.Formulas.name)) {
(player.sourceFileLvl(5) < 1 && player.bitNodeN !== 5) || throw helper.makeRuntimeErrorMsg(`formulas.${func}`, `Requires Formulas.exe to run.`);
(player.sourceFileLvl(n) < 1 && player.bitNodeN !== n)
) {
let extra = "";
if (n !== 5) {
extra = ` and Source-File ${n}-1`;
}
throw helper.makeRuntimeErrorMsg(`formulas.${func}`, `Requires Source-File 5-1${extra} to run.`);
} }
}; };
return { return {
basic: { basic: {
calculateSkill: function (exp: any, mult: any = 1): any { calculateSkill: function (exp: any, mult: any = 1): any {
checkFormulasAccess("basic.calculateSkill", 5); checkFormulasAccess("basic.calculateSkill");
return calculateSkill(exp, mult); return calculateSkill(exp, mult);
}, },
calculateExp: function (skill: any, mult: any = 1): any { calculateExp: function (skill: any, mult: any = 1): any {
checkFormulasAccess("basic.calculateExp", 5); checkFormulasAccess("basic.calculateExp");
return calculateExp(skill, mult); return calculateExp(skill, mult);
}, },
hackChance: function (server: any, player: any): any { hackChance: function (server: any, player: any): any {
checkFormulasAccess("basic.hackChance", 5); checkFormulasAccess("basic.hackChance");
return calculateHackingChance(server, player); return calculateHackingChance(server, player);
}, },
hackExp: function (server: any, player: any): any { hackExp: function (server: any, player: any): any {
checkFormulasAccess("basic.hackExp", 5); checkFormulasAccess("basic.hackExp");
return calculateHackingExpGain(server, player); return calculateHackingExpGain(server, player);
}, },
hackPercent: function (server: any, player: any): any { hackPercent: function (server: any, player: any): any {
checkFormulasAccess("basic.hackPercent", 5); checkFormulasAccess("basic.hackPercent");
return calculatePercentMoneyHacked(server, player); return calculatePercentMoneyHacked(server, player);
}, },
growPercent: function (server: any, threads: any, player: any, cores: any = 1): any { growPercent: function (server: any, threads: any, player: any, cores: any = 1): any {
checkFormulasAccess("basic.growPercent", 5); checkFormulasAccess("basic.growPercent");
return calculateServerGrowth(server, threads, player, cores); return calculateServerGrowth(server, threads, player, cores);
}, },
hackTime: function (server: any, player: any): any { hackTime: function (server: any, player: any): any {
checkFormulasAccess("basic.hackTime", 5); checkFormulasAccess("basic.hackTime");
return calculateHackingTime(server, player); return calculateHackingTime(server, player);
}, },
growTime: function (server: any, player: any): any { growTime: function (server: any, player: any): any {
checkFormulasAccess("basic.growTime", 5); checkFormulasAccess("basic.growTime");
return calculateGrowTime(server, player); return calculateGrowTime(server, player);
}, },
weakenTime: function (server: any, player: any): any { weakenTime: function (server: any, player: any): any {
checkFormulasAccess("basic.weakenTime", 5); checkFormulasAccess("basic.weakenTime");
return calculateWeakenTime(server, player); return calculateWeakenTime(server, player);
}, },
}, },
hacknetNodes: { hacknetNodes: {
moneyGainRate: function (level: any, ram: any, cores: any, mult: any = 1): any { moneyGainRate: function (level: any, ram: any, cores: any, mult: any = 1): any {
checkFormulasAccess("hacknetNodes.moneyGainRate", 5); checkFormulasAccess("hacknetNodes.moneyGainRate");
return calculateMoneyGainRate(level, ram, cores, mult); return calculateMoneyGainRate(level, ram, cores, mult);
}, },
levelUpgradeCost: function (startingLevel: any, extraLevels: any = 1, costMult: any = 1): any { levelUpgradeCost: function (startingLevel: any, extraLevels: any = 1, costMult: any = 1): any {
checkFormulasAccess("hacknetNodes.levelUpgradeCost", 5); checkFormulasAccess("hacknetNodes.levelUpgradeCost");
return calculateLevelUpgradeCost(startingLevel, extraLevels, costMult); return calculateLevelUpgradeCost(startingLevel, extraLevels, costMult);
}, },
ramUpgradeCost: function (startingRam: any, extraLevels: any = 1, costMult: any = 1): any { ramUpgradeCost: function (startingRam: any, extraLevels: any = 1, costMult: any = 1): any {
checkFormulasAccess("hacknetNodes.ramUpgradeCost", 5); checkFormulasAccess("hacknetNodes.ramUpgradeCost");
return calculateRamUpgradeCost(startingRam, extraLevels, costMult); return calculateRamUpgradeCost(startingRam, extraLevels, costMult);
}, },
coreUpgradeCost: function (startingCore: any, extraCores: any = 1, costMult: any = 1): any { coreUpgradeCost: function (startingCore: any, extraCores: any = 1, costMult: any = 1): any {
checkFormulasAccess("hacknetNodes.coreUpgradeCost", 5); checkFormulasAccess("hacknetNodes.coreUpgradeCost");
return calculateCoreUpgradeCost(startingCore, extraCores, costMult); return calculateCoreUpgradeCost(startingCore, extraCores, costMult);
}, },
hacknetNodeCost: function (n: any, mult: any): any { hacknetNodeCost: function (n: any, mult: any): any {
checkFormulasAccess("hacknetNodes.hacknetNodeCost", 5); checkFormulasAccess("hacknetNodes.hacknetNodeCost");
return calculateNodeCost(n, mult); return calculateNodeCost(n, mult);
}, },
constants: function (): any { constants: function (): any {
checkFormulasAccess("hacknetNodes.constants", 5); checkFormulasAccess("hacknetNodes.constants");
return Object.assign({}, HacknetNodeConstants); return Object.assign({}, HacknetNodeConstants);
}, },
}, },
hacknetServers: { hacknetServers: {
hashGainRate: function (level: any, ramUsed: any, maxRam: any, cores: any, mult: any = 1): any { hashGainRate: function (level: any, ramUsed: any, maxRam: any, cores: any, mult: any = 1): any {
checkFormulasAccess("hacknetServers.hashGainRate", 9); checkFormulasAccess("hacknetServers.hashGainRate");
return HScalculateHashGainRate(level, ramUsed, maxRam, cores, mult); return HScalculateHashGainRate(level, ramUsed, maxRam, cores, mult);
}, },
levelUpgradeCost: function (startingLevel: any, extraLevels: any = 1, costMult: any = 1): any { levelUpgradeCost: function (startingLevel: any, extraLevels: any = 1, costMult: any = 1): any {
checkFormulasAccess("hacknetServers.levelUpgradeCost", 9); checkFormulasAccess("hacknetServers.levelUpgradeCost");
return HScalculateLevelUpgradeCost(startingLevel, extraLevels, costMult); return HScalculateLevelUpgradeCost(startingLevel, extraLevels, costMult);
}, },
ramUpgradeCost: function (startingRam: any, extraLevels: any = 1, costMult: any = 1): any { ramUpgradeCost: function (startingRam: any, extraLevels: any = 1, costMult: any = 1): any {
checkFormulasAccess("hacknetServers.ramUpgradeCost", 9); checkFormulasAccess("hacknetServers.ramUpgradeCost");
return HScalculateRamUpgradeCost(startingRam, extraLevels, costMult); return HScalculateRamUpgradeCost(startingRam, extraLevels, costMult);
}, },
coreUpgradeCost: function (startingCore: any, extraCores: any = 1, costMult: any = 1): any { coreUpgradeCost: function (startingCore: any, extraCores: any = 1, costMult: any = 1): any {
checkFormulasAccess("hacknetServers.coreUpgradeCost", 9); checkFormulasAccess("hacknetServers.coreUpgradeCost");
return HScalculateCoreUpgradeCost(startingCore, extraCores, costMult); return HScalculateCoreUpgradeCost(startingCore, extraCores, costMult);
}, },
cacheUpgradeCost: function (startingCache: any, extraCache: any = 1): any { cacheUpgradeCost: function (startingCache: any, extraCache: any = 1): any {
checkFormulasAccess("hacknetServers.cacheUpgradeCost", 9); checkFormulasAccess("hacknetServers.cacheUpgradeCost");
return HScalculateCacheUpgradeCost(startingCache, extraCache); return HScalculateCacheUpgradeCost(startingCache, extraCache);
}, },
hashUpgradeCost: function (upgName: any, level: any): any { hashUpgradeCost: function (upgName: any, level: any): any {
checkFormulasAccess("hacknetServers.hashUpgradeCost", 9); checkFormulasAccess("hacknetServers.hashUpgradeCost");
const upg = player.hashManager.getUpgrade(upgName); const upg = player.hashManager.getUpgrade(upgName);
if (!upg) { if (!upg) {
throw helper.makeRuntimeErrorMsg( throw helper.makeRuntimeErrorMsg(
@ -175,11 +169,11 @@ export function NetscriptFormulas(
return upg.getCost(level); return upg.getCost(level);
}, },
hacknetServerCost: function (n: any, mult: any): any { hacknetServerCost: function (n: any, mult: any): any {
checkFormulasAccess("hacknetServers.hacknetServerCost", 9); checkFormulasAccess("hacknetServers.hacknetServerCost");
return HScalculateServerCost(n, mult); return HScalculateServerCost(n, mult);
}, },
constants: function (): any { constants: function (): any {
checkFormulasAccess("hacknetServers.constants", 9); checkFormulasAccess("hacknetServers.constants");
return Object.assign({}, HacknetServerConstants); return Object.assign({}, HacknetServerConstants);
}, },
}, },

@ -65,6 +65,10 @@ export function prestigeAugmentation(): void {
homeComp.programs.push(Programs.AutoLink.name); homeComp.programs.push(Programs.AutoLink.name);
} }
if (Player.sourceFileLvl(5) > 0) {
homeComp.programs.push(Programs.Formulas.name);
}
// Re-create foreign servers // Re-create foreign servers
initForeignServers(Player.getHomeComputer()); initForeignServers(Player.getHomeComputer());
@ -216,6 +220,10 @@ export function prestigeSourceFile(flume: boolean): void {
// Messages // Messages
initMessages(); initMessages();
if (Player.sourceFileLvl(5) > 0) {
homeComp.programs.push(Programs.Formulas.name);
}
// BitNode 3: Corporatocracy // BitNode 3: Corporatocracy
if (Player.bitNodeN === 3) { if (Player.bitNodeN === 3) {
homeComp.messages.push(LiteratureNames.CorporationManagementHandbook); homeComp.messages.push(LiteratureNames.CorporationManagementHandbook);

@ -68,8 +68,8 @@ SourceFiles["SourceFile5"] = new SourceFile(
persistent (it never gets reset back to 1). However, gaining Intelligence experience is much slower than other persistent (it never gets reset back to 1). However, gaining Intelligence experience is much slower than other
stats, and it is also hidden (you won't know when you gain experience and how much). Higher Intelligence levels stats, and it is also hidden (you won't know when you gain experience and how much). Higher Intelligence levels
will boost your production for many actions in the game. In addition, this Source-File will unlock the will boost your production for many actions in the game. In addition, this Source-File will unlock the
getBitNodeMultipliers() and getServer() Netscript functions, as well as the formulas API, and will raise all of getBitNodeMultipliers() and let you start with Formulas.exe, and will raise all of your hacking-related
your hacking-related multipliers by: multipliers by:
<br /> <br />
<br /> <br />
Level 1: 8% Level 1: 8%