mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-05-05 23:27:55 +02:00
Added a few formulas to calculate work gains
This commit is contained in:
+2
-17
@@ -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 {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user