mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-22 06:02:26 +01:00
commit
99c82ce340
27
dist/bitburner.d.ts
vendored
27
dist/bitburner.d.ts
vendored
@ -1207,6 +1207,8 @@ export declare interface Formulas {
|
||||
hacknetServers: HacknetServersFormulas;
|
||||
/** Gang formulas */
|
||||
gang: GangFormulas;
|
||||
/** Work formulas */
|
||||
work: WorkFormulas;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -7326,4 +7328,29 @@ export declare interface WarehouseAPI {
|
||||
hasWarehouse(adivisionName: string, acityName: string): boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Work formulas
|
||||
* @public
|
||||
*/
|
||||
export declare interface WorkFormulas {
|
||||
crimeGains(crimeType: string): WorkStats;
|
||||
classGains(player: Player, classType: string, locationName: string): WorkStats;
|
||||
factionGains(player: Player, workType: string, favor: number): WorkStats;
|
||||
}
|
||||
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export declare interface WorkStats {
|
||||
money: number;
|
||||
reputation: number;
|
||||
hackExp: number;
|
||||
strExp: number;
|
||||
defExp: number;
|
||||
dexExp: number;
|
||||
agiExp: number;
|
||||
chaExp: number;
|
||||
intExp: number;
|
||||
}
|
||||
|
||||
export { }
|
||||
|
4
dist/main.bundle.js
vendored
4
dist/main.bundle.js
vendored
File diff suppressed because one or more lines are too long
2
dist/main.bundle.js.map
vendored
2
dist/main.bundle.js.map
vendored
File diff suppressed because one or more lines are too long
42
dist/vendor.bundle.js
vendored
42
dist/vendor.bundle.js
vendored
File diff suppressed because one or more lines are too long
2
dist/vendor.bundle.js.map
vendored
2
dist/vendor.bundle.js.map
vendored
File diff suppressed because one or more lines are too long
@ -26,4 +26,5 @@ You need Formulas.exe on your home computer to use this API.
|
||||
| [hacknetServers](./bitburner.formulas.hacknetservers.md) | [HacknetServersFormulas](./bitburner.hacknetserversformulas.md) | Hacknet Servers formulas |
|
||||
| [reputation](./bitburner.formulas.reputation.md) | [ReputationFormulas](./bitburner.reputationformulas.md) | Reputation formulas |
|
||||
| [skills](./bitburner.formulas.skills.md) | [SkillsFormulas](./bitburner.skillsformulas.md) | Skills formulas |
|
||||
| [work](./bitburner.formulas.work.md) | [WorkFormulas](./bitburner.workformulas.md) | Work formulas |
|
||||
|
||||
|
13
markdown/bitburner.formulas.work.md
Normal file
13
markdown/bitburner.formulas.work.md
Normal file
@ -0,0 +1,13 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [bitburner](./bitburner.md) > [Formulas](./bitburner.formulas.md) > [work](./bitburner.formulas.work.md)
|
||||
|
||||
## Formulas.work property
|
||||
|
||||
Work formulas
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
work: WorkFormulas;
|
||||
```
|
@ -91,6 +91,8 @@
|
||||
| [UserInterface](./bitburner.userinterface.md) | User Interface API. |
|
||||
| [Warehouse](./bitburner.warehouse.md) | Warehouse for a division in a city |
|
||||
| [WarehouseAPI](./bitburner.warehouseapi.md) | Corporation Warehouse API |
|
||||
| [WorkFormulas](./bitburner.workformulas.md) | Work formulas |
|
||||
| [WorkStats](./bitburner.workstats.md) | |
|
||||
|
||||
## Type Aliases
|
||||
|
||||
|
24
markdown/bitburner.workformulas.classgains.md
Normal file
24
markdown/bitburner.workformulas.classgains.md
Normal file
@ -0,0 +1,24 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [bitburner](./bitburner.md) > [WorkFormulas](./bitburner.workformulas.md) > [classGains](./bitburner.workformulas.classgains.md)
|
||||
|
||||
## WorkFormulas.classGains() method
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
classGains(player: Player, classType: string, locationName: string): WorkStats;
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| player | [Player](./bitburner.player.md) | |
|
||||
| classType | string | |
|
||||
| locationName | string | |
|
||||
|
||||
<b>Returns:</b>
|
||||
|
||||
[WorkStats](./bitburner.workstats.md)
|
||||
|
22
markdown/bitburner.workformulas.crimegains.md
Normal file
22
markdown/bitburner.workformulas.crimegains.md
Normal file
@ -0,0 +1,22 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [bitburner](./bitburner.md) > [WorkFormulas](./bitburner.workformulas.md) > [crimeGains](./bitburner.workformulas.crimegains.md)
|
||||
|
||||
## WorkFormulas.crimeGains() method
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
crimeGains(crimeType: string): WorkStats;
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| crimeType | string | |
|
||||
|
||||
<b>Returns:</b>
|
||||
|
||||
[WorkStats](./bitburner.workstats.md)
|
||||
|
24
markdown/bitburner.workformulas.factiongains.md
Normal file
24
markdown/bitburner.workformulas.factiongains.md
Normal file
@ -0,0 +1,24 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [bitburner](./bitburner.md) > [WorkFormulas](./bitburner.workformulas.md) > [factionGains](./bitburner.workformulas.factiongains.md)
|
||||
|
||||
## WorkFormulas.factionGains() method
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
factionGains(player: Player, workType: string, favor: number): WorkStats;
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| player | [Player](./bitburner.player.md) | |
|
||||
| workType | string | |
|
||||
| favor | number | |
|
||||
|
||||
<b>Returns:</b>
|
||||
|
||||
[WorkStats](./bitburner.workstats.md)
|
||||
|
22
markdown/bitburner.workformulas.md
Normal file
22
markdown/bitburner.workformulas.md
Normal file
@ -0,0 +1,22 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [bitburner](./bitburner.md) > [WorkFormulas](./bitburner.workformulas.md)
|
||||
|
||||
## WorkFormulas interface
|
||||
|
||||
Work formulas
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
interface WorkFormulas
|
||||
```
|
||||
|
||||
## Methods
|
||||
|
||||
| Method | Description |
|
||||
| --- | --- |
|
||||
| [classGains(player, classType, locationName)](./bitburner.workformulas.classgains.md) | |
|
||||
| [crimeGains(crimeType)](./bitburner.workformulas.crimegains.md) | |
|
||||
| [factionGains(player, workType, favor)](./bitburner.workformulas.factiongains.md) | |
|
||||
|
11
markdown/bitburner.workstats.agiexp.md
Normal file
11
markdown/bitburner.workstats.agiexp.md
Normal file
@ -0,0 +1,11 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [bitburner](./bitburner.md) > [WorkStats](./bitburner.workstats.md) > [agiExp](./bitburner.workstats.agiexp.md)
|
||||
|
||||
## WorkStats.agiExp property
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
agiExp: number;
|
||||
```
|
11
markdown/bitburner.workstats.chaexp.md
Normal file
11
markdown/bitburner.workstats.chaexp.md
Normal file
@ -0,0 +1,11 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [bitburner](./bitburner.md) > [WorkStats](./bitburner.workstats.md) > [chaExp](./bitburner.workstats.chaexp.md)
|
||||
|
||||
## WorkStats.chaExp property
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
chaExp: number;
|
||||
```
|
11
markdown/bitburner.workstats.defexp.md
Normal file
11
markdown/bitburner.workstats.defexp.md
Normal file
@ -0,0 +1,11 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [bitburner](./bitburner.md) > [WorkStats](./bitburner.workstats.md) > [defExp](./bitburner.workstats.defexp.md)
|
||||
|
||||
## WorkStats.defExp property
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
defExp: number;
|
||||
```
|
11
markdown/bitburner.workstats.dexexp.md
Normal file
11
markdown/bitburner.workstats.dexexp.md
Normal file
@ -0,0 +1,11 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [bitburner](./bitburner.md) > [WorkStats](./bitburner.workstats.md) > [dexExp](./bitburner.workstats.dexexp.md)
|
||||
|
||||
## WorkStats.dexExp property
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
dexExp: number;
|
||||
```
|
11
markdown/bitburner.workstats.hackexp.md
Normal file
11
markdown/bitburner.workstats.hackexp.md
Normal file
@ -0,0 +1,11 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [bitburner](./bitburner.md) > [WorkStats](./bitburner.workstats.md) > [hackExp](./bitburner.workstats.hackexp.md)
|
||||
|
||||
## WorkStats.hackExp property
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
hackExp: number;
|
||||
```
|
11
markdown/bitburner.workstats.intexp.md
Normal file
11
markdown/bitburner.workstats.intexp.md
Normal file
@ -0,0 +1,11 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [bitburner](./bitburner.md) > [WorkStats](./bitburner.workstats.md) > [intExp](./bitburner.workstats.intexp.md)
|
||||
|
||||
## WorkStats.intExp property
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
intExp: number;
|
||||
```
|
27
markdown/bitburner.workstats.md
Normal file
27
markdown/bitburner.workstats.md
Normal file
@ -0,0 +1,27 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [bitburner](./bitburner.md) > [WorkStats](./bitburner.workstats.md)
|
||||
|
||||
## WorkStats interface
|
||||
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
export interface WorkStats
|
||||
```
|
||||
|
||||
## Properties
|
||||
|
||||
| Property | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| [agiExp](./bitburner.workstats.agiexp.md) | number | |
|
||||
| [chaExp](./bitburner.workstats.chaexp.md) | number | |
|
||||
| [defExp](./bitburner.workstats.defexp.md) | number | |
|
||||
| [dexExp](./bitburner.workstats.dexexp.md) | number | |
|
||||
| [hackExp](./bitburner.workstats.hackexp.md) | number | |
|
||||
| [intExp](./bitburner.workstats.intexp.md) | number | |
|
||||
| [money](./bitburner.workstats.money.md) | number | |
|
||||
| [reputation](./bitburner.workstats.reputation.md) | number | |
|
||||
| [strExp](./bitburner.workstats.strexp.md) | number | |
|
||||
|
11
markdown/bitburner.workstats.money.md
Normal file
11
markdown/bitburner.workstats.money.md
Normal file
@ -0,0 +1,11 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [bitburner](./bitburner.md) > [WorkStats](./bitburner.workstats.md) > [money](./bitburner.workstats.money.md)
|
||||
|
||||
## WorkStats.money property
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
money: number;
|
||||
```
|
11
markdown/bitburner.workstats.reputation.md
Normal file
11
markdown/bitburner.workstats.reputation.md
Normal file
@ -0,0 +1,11 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [bitburner](./bitburner.md) > [WorkStats](./bitburner.workstats.md) > [reputation](./bitburner.workstats.reputation.md)
|
||||
|
||||
## WorkStats.reputation property
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
reputation: number;
|
||||
```
|
11
markdown/bitburner.workstats.strexp.md
Normal file
11
markdown/bitburner.workstats.strexp.md
Normal file
@ -0,0 +1,11 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [bitburner](./bitburner.md) > [WorkStats](./bitburner.workstats.md) > [strExp](./bitburner.workstats.strexp.md)
|
||||
|
||||
## WorkStats.strExp property
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
strExp: number;
|
||||
```
|
@ -128,9 +128,9 @@ export function processPassiveFactionRepGain(numCycles: number): void {
|
||||
// 100 favor = 11%/s
|
||||
const favorMult = Math.min(0.1, faction.favor / 1000 + 0.01);
|
||||
// Find the best of all possible favor gain, minimum 1 rep / 2 minute.
|
||||
const hRep = getHackingWorkRepGain(Player, faction);
|
||||
const sRep = getFactionSecurityWorkRepGain(Player, faction);
|
||||
const fRep = getFactionFieldWorkRepGain(Player, faction);
|
||||
const hRep = getHackingWorkRepGain(Player, faction.favor);
|
||||
const sRep = getFactionSecurityWorkRepGain(Player, faction.favor);
|
||||
const fRep = getFactionFieldWorkRepGain(Player, faction.favor);
|
||||
const rate = Math.max(hRep * favorMult, sRep * favorMult, fRep * favorMult, 1 / 120);
|
||||
|
||||
faction.playerReputation += rate * numCycles * Player.mults.faction_rep * BitNodeMultipliers.FactionPassiveRepGain;
|
||||
|
@ -590,6 +590,11 @@ const SourceRamCosts = {
|
||||
ascensionPointsGain: 0,
|
||||
ascensionMultiplier: 0,
|
||||
},
|
||||
work: {
|
||||
crimeGains: 0,
|
||||
classGains: 0,
|
||||
factionGains: 0,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
|
@ -43,6 +43,14 @@ import { favorToRep as calculateFavorToRep, repToFavor as calculateRepToFavor }
|
||||
import { repFromDonation } from "../Faction/formulas/donation";
|
||||
import { InternalAPI, NetscriptContext } from "../Netscript/APIWrapper";
|
||||
import { helpers } from "../Netscript/NetscriptHelpers";
|
||||
import { WorkStats } from "../Work/WorkStats";
|
||||
import { calculateCrimeWorkStats } from "../Work/formulas/Crime";
|
||||
import { Crimes } from "../Crime/Crimes";
|
||||
import { calculateClassEarnings } from "../Work/formulas/Class";
|
||||
import { ClassType } from "../Work/ClassWork";
|
||||
import { LocationName } from "../Locations/data/LocationNames";
|
||||
import { calculateFactionExp, calculateFactionRep } from "../Work/formulas/Faction";
|
||||
import { FactionWorkType } from "../Work/data/FactionWorkType";
|
||||
|
||||
export function NetscriptFormulas(): InternalAPI<IFormulas> {
|
||||
const checkFormulasAccess = function (ctx: NetscriptContext): void {
|
||||
@ -326,5 +334,38 @@ export function NetscriptFormulas(): InternalAPI<IFormulas> {
|
||||
return calculateAscensionMult(points);
|
||||
},
|
||||
},
|
||||
work: {
|
||||
crimeGains:
|
||||
(ctx: NetscriptContext) =>
|
||||
(_crimeType: unknown): WorkStats => {
|
||||
const crimeType = helpers.string(ctx, "crimeType", _crimeType);
|
||||
const crime = Object.values(Crimes).find((c) => String(c.type) === crimeType);
|
||||
if (!crime) throw new Error(`Invalid crime type: ${crimeType}`);
|
||||
return calculateCrimeWorkStats(crime);
|
||||
},
|
||||
classGains:
|
||||
(ctx: NetscriptContext) =>
|
||||
(_player: unknown, _classType: unknown, _locationName: unknown): WorkStats => {
|
||||
const target = helpers.player(ctx, _player);
|
||||
const classType = helpers.string(ctx, "classType", _classType);
|
||||
const locationName = helpers.string(ctx, "locationName", _locationName);
|
||||
return calculateClassEarnings(player, target, classType as ClassType, locationName as LocationName);
|
||||
},
|
||||
factionGains:
|
||||
(ctx: NetscriptContext) =>
|
||||
(_player: unknown, _workType: unknown, _favor: unknown): WorkStats => {
|
||||
const player = helpers.player(ctx, _player);
|
||||
const workType = helpers.string(ctx, "_workType", _workType) as FactionWorkType;
|
||||
const favor = helpers.number(ctx, "favor", _favor);
|
||||
const exp = calculateFactionExp(player, workType);
|
||||
const rep = calculateFactionRep(player, workType, favor);
|
||||
exp.reputation = rep;
|
||||
return exp;
|
||||
},
|
||||
// companyGains: (ctx: NetscriptContext) =>_player: unknown (): WorkStats {
|
||||
// const player = helpers.player(ctx, _player);
|
||||
|
||||
// },
|
||||
},
|
||||
};
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ export class SleeveFactionWork extends Work {
|
||||
[FactionWorkType.FIELD]: getFactionFieldWorkRepGain,
|
||||
[FactionWorkType.SECURITY]: getFactionSecurityWorkRepGain,
|
||||
};
|
||||
return repFormulas[this.factionWorkType](sleeve, faction) * sleeve.shockBonus();
|
||||
return repFormulas[this.factionWorkType](sleeve, faction.favor) * sleeve.shockBonus();
|
||||
}
|
||||
|
||||
getFaction(): Faction {
|
||||
|
@ -1,28 +1,28 @@
|
||||
import { Faction } from "../../Faction/Faction";
|
||||
import { CONSTANTS } from "../../Constants";
|
||||
import { BitNodeMultipliers } from "../../BitNode/BitNodeMultipliers";
|
||||
import { CalculateShareMult } from "../../NetworkShare/Share";
|
||||
import { IPerson } from "../IPerson";
|
||||
import { calculateIntelligenceBonus } from "./intelligence";
|
||||
|
||||
function mult(f: Faction): number {
|
||||
let favorMult = 1 + f.favor / 100;
|
||||
function mult(favor: number): number {
|
||||
let favorMult = 1 + favor / 100;
|
||||
if (isNaN(favorMult)) {
|
||||
favorMult = 1;
|
||||
}
|
||||
return favorMult * BitNodeMultipliers.FactionWorkRepGain;
|
||||
}
|
||||
|
||||
export function getHackingWorkRepGain(p: IPerson, f: Faction): number {
|
||||
export function getHackingWorkRepGain(p: IPerson, favor: number): number {
|
||||
return (
|
||||
((p.skills.hacking + p.skills.intelligence / 3) / CONSTANTS.MaxSkillLevel) *
|
||||
p.mults.faction_rep *
|
||||
p.getIntelligenceBonus(1) *
|
||||
mult(f) *
|
||||
calculateIntelligenceBonus(p.skills.intelligence, 1) *
|
||||
mult(favor) *
|
||||
CalculateShareMult()
|
||||
);
|
||||
}
|
||||
|
||||
export function getFactionSecurityWorkRepGain(p: IPerson, f: Faction): number {
|
||||
export function getFactionSecurityWorkRepGain(p: IPerson, favor: number): number {
|
||||
const t =
|
||||
(0.9 *
|
||||
(p.skills.strength +
|
||||
@ -32,10 +32,10 @@ export function getFactionSecurityWorkRepGain(p: IPerson, f: Faction): number {
|
||||
(p.skills.hacking + p.skills.intelligence) * CalculateShareMult())) /
|
||||
CONSTANTS.MaxSkillLevel /
|
||||
4.5;
|
||||
return t * p.mults.faction_rep * mult(f) * p.getIntelligenceBonus(1);
|
||||
return t * p.mults.faction_rep * mult(favor) * calculateIntelligenceBonus(p.skills.intelligence, 1);
|
||||
}
|
||||
|
||||
export function getFactionFieldWorkRepGain(p: IPerson, f: Faction): number {
|
||||
export function getFactionFieldWorkRepGain(p: IPerson, favor: number): number {
|
||||
const t =
|
||||
(0.9 *
|
||||
(p.skills.strength +
|
||||
@ -46,5 +46,5 @@ export function getFactionFieldWorkRepGain(p: IPerson, f: Faction): number {
|
||||
(p.skills.hacking + p.skills.intelligence) * CalculateShareMult())) /
|
||||
CONSTANTS.MaxSkillLevel /
|
||||
5.5;
|
||||
return t * p.mults.faction_rep * mult(f) * p.getIntelligenceBonus(1);
|
||||
return t * p.mults.faction_rep * mult(favor) * calculateIntelligenceBonus(p.skills.intelligence, 1);
|
||||
}
|
||||
|
27
src/ScriptEditor/NetscriptDefinitions.d.ts
vendored
27
src/ScriptEditor/NetscriptDefinitions.d.ts
vendored
@ -3850,6 +3850,31 @@ interface SkillsFormulas {
|
||||
calculateExp(skill: number, skillMult?: number): number;
|
||||
}
|
||||
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export interface WorkStats {
|
||||
money: number;
|
||||
reputation: number;
|
||||
hackExp: number;
|
||||
strExp: number;
|
||||
defExp: number;
|
||||
dexExp: number;
|
||||
agiExp: number;
|
||||
chaExp: number;
|
||||
intExp: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Work formulas
|
||||
* @public
|
||||
*/
|
||||
interface WorkFormulas {
|
||||
crimeGains(crimeType: string): WorkStats;
|
||||
classGains(player: Player, classType: string, locationName: string): WorkStats;
|
||||
factionGains(player: Player, workType: string, favor: number): WorkStats;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reputation formulas
|
||||
* @public
|
||||
@ -4131,6 +4156,8 @@ export interface Formulas {
|
||||
hacknetServers: HacknetServersFormulas;
|
||||
/** Gang formulas */
|
||||
gang: GangFormulas;
|
||||
/** Work formulas */
|
||||
work: WorkFormulas;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -9,6 +9,7 @@ import { CrimeType } from "../utils/WorkType";
|
||||
import { Work, WorkType } from "./Work";
|
||||
import { newWorkStats, scaleWorkStats, WorkStats } from "./WorkStats";
|
||||
import { BitNodeMultipliers } from "../BitNode/BitNodeMultipliers";
|
||||
import { calculateCrimeWorkStats } from "./formulas/Crime";
|
||||
|
||||
enum newCrimeType {
|
||||
SHOPLIFT = "SHOPLIFT",
|
||||
@ -90,23 +91,7 @@ export class CrimeWork extends Work {
|
||||
}
|
||||
|
||||
earnings(): WorkStats {
|
||||
const crime = this.getCrime();
|
||||
const gains = scaleWorkStats(
|
||||
newWorkStats({
|
||||
money: crime.money,
|
||||
hackExp: crime.hacking_exp * 2,
|
||||
strExp: crime.strength_exp * 2,
|
||||
defExp: crime.defense_exp * 2,
|
||||
dexExp: crime.dexterity_exp * 2,
|
||||
agiExp: crime.agility_exp * 2,
|
||||
chaExp: crime.charisma_exp * 2,
|
||||
intExp: crime.intelligence_exp * 2,
|
||||
}),
|
||||
BitNodeMultipliers.CrimeExpGain,
|
||||
false,
|
||||
);
|
||||
gains.money *= BitNodeMultipliers.CrimeMoney;
|
||||
return gains;
|
||||
return calculateCrimeWorkStats(this.getCrime());
|
||||
}
|
||||
|
||||
commit(player: IPlayer): void {
|
||||
|
@ -8,14 +8,9 @@ import { Faction } from "../Faction/Faction";
|
||||
import { applyWorkStats, scaleWorkStats, WorkStats } from "./WorkStats";
|
||||
import { dialogBoxCreate } from "../ui/React/DialogBox";
|
||||
import { Reputation } from "../ui/React/Reputation";
|
||||
import {
|
||||
getFactionFieldWorkRepGain,
|
||||
getFactionSecurityWorkRepGain,
|
||||
getHackingWorkRepGain,
|
||||
} from "../PersonObjects/formulas/reputation";
|
||||
import { CONSTANTS } from "../Constants";
|
||||
import { AugmentationNames } from "../Augmentation/data/AugmentationNames";
|
||||
import { calculateFactionExp } from "./formulas/Faction";
|
||||
import { calculateFactionExp, calculateFactionRep } from "./formulas/Faction";
|
||||
import { FactionWorkType } from "./data/FactionWorkType";
|
||||
|
||||
interface FactionWorkParams {
|
||||
@ -43,18 +38,11 @@ export class FactionWork extends Work {
|
||||
}
|
||||
|
||||
getReputationRate(player: IPlayer): number {
|
||||
const faction = this.getFaction();
|
||||
const repFormulas = {
|
||||
[FactionWorkType.HACKING]: getHackingWorkRepGain,
|
||||
[FactionWorkType.FIELD]: getFactionFieldWorkRepGain,
|
||||
[FactionWorkType.SECURITY]: getFactionSecurityWorkRepGain,
|
||||
};
|
||||
const rep = repFormulas[this.factionWorkType](player, faction);
|
||||
let focusBonus = 1;
|
||||
if (!player.hasAugmentation(AugmentationNames.NeuroreceptorManager)) {
|
||||
focusBonus = player.focus ? 1 : CONSTANTS.BaseFocusBonus;
|
||||
}
|
||||
return rep * focusBonus;
|
||||
return calculateFactionRep(player, this.factionWorkType, this.getFaction().favor) * focusBonus;
|
||||
}
|
||||
|
||||
getExpRates(player: IPlayer): WorkStats {
|
||||
|
22
src/Work/formulas/Crime.ts
Normal file
22
src/Work/formulas/Crime.ts
Normal file
@ -0,0 +1,22 @@
|
||||
import { BitNodeMultipliers } from "../../BitNode/BitNodeMultipliers";
|
||||
import { Crime } from "src/Crime/Crime";
|
||||
import { newWorkStats, scaleWorkStats, WorkStats } from "../WorkStats";
|
||||
|
||||
export const calculateCrimeWorkStats = (crime: Crime): WorkStats => {
|
||||
const gains = scaleWorkStats(
|
||||
newWorkStats({
|
||||
money: crime.money,
|
||||
hackExp: crime.hacking_exp * 2,
|
||||
strExp: crime.strength_exp * 2,
|
||||
defExp: crime.defense_exp * 2,
|
||||
dexExp: crime.dexterity_exp * 2,
|
||||
agiExp: crime.agility_exp * 2,
|
||||
chaExp: crime.charisma_exp * 2,
|
||||
intExp: crime.intelligence_exp * 2,
|
||||
}),
|
||||
BitNodeMultipliers.CrimeExpGain,
|
||||
false,
|
||||
);
|
||||
gains.money *= BitNodeMultipliers.CrimeMoney;
|
||||
return gains;
|
||||
};
|
@ -3,6 +3,11 @@ import { BitNodeMultipliers } from "../../BitNode/BitNodeMultipliers";
|
||||
import { CONSTANTS } from "../../Constants";
|
||||
import { FactionWorkType } from "../data/FactionWorkType";
|
||||
import { newWorkStats, WorkStats } from "../WorkStats";
|
||||
import {
|
||||
getFactionFieldWorkRepGain,
|
||||
getFactionSecurityWorkRepGain,
|
||||
getHackingWorkRepGain,
|
||||
} from "../../PersonObjects/formulas/reputation";
|
||||
|
||||
const gameCPS = 1000 / CONSTANTS._idleSpeed; // 5 cycles per second
|
||||
|
||||
@ -25,6 +30,15 @@ export const FactionWorkStats: Record<FactionWorkType, WorkStats> = {
|
||||
}),
|
||||
};
|
||||
|
||||
export const calculateFactionRep = (person: IPerson, tpe: FactionWorkType, favor: number): number => {
|
||||
const repFormulas = {
|
||||
[FactionWorkType.HACKING]: getHackingWorkRepGain,
|
||||
[FactionWorkType.FIELD]: getFactionFieldWorkRepGain,
|
||||
[FactionWorkType.SECURITY]: getFactionSecurityWorkRepGain,
|
||||
};
|
||||
return repFormulas[tpe](person, favor);
|
||||
};
|
||||
|
||||
export function calculateFactionExp(person: IPerson, tpe: FactionWorkType): WorkStats {
|
||||
const baseStats = FactionWorkStats[tpe];
|
||||
return {
|
||||
|
@ -295,9 +295,9 @@ const Engine: {
|
||||
// No rep for gangs.
|
||||
if (Player.getGangName() === facName) continue;
|
||||
|
||||
const hRep = getHackingWorkRepGain(Player, faction);
|
||||
const sRep = getFactionSecurityWorkRepGain(Player, faction);
|
||||
const fRep = getFactionFieldWorkRepGain(Player, faction);
|
||||
const hRep = getHackingWorkRepGain(Player, faction.favor);
|
||||
const sRep = getFactionSecurityWorkRepGain(Player, faction.favor);
|
||||
const fRep = getFactionFieldWorkRepGain(Player, faction.favor);
|
||||
// can be infinite, doesn't matter.
|
||||
const reputationRate = Math.max(hRep, sRep, fRep) / Player.factions.length;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user