TYPESAFETY: Strict internal typing for AugmentationName (#608)

This commit is contained in:
Snarling
2023-06-16 17:52:42 -04:00
committed by GitHub
parent 12b5c00d14
commit a4b826683e
70 changed files with 2649 additions and 3221 deletions
+6 -6
View File
@@ -1,4 +1,4 @@
import { BitNodeMultipliers } from "../BitNode/BitNodeMultipliers";
import { currentNodeMults } from "../BitNode/BitNodeMultipliers";
import { Crime } from "../Crime/Crime";
import { newWorkStats, scaleWorkStats, WorkStats, multWorkStats } from "./WorkStats";
import { Person as IPerson } from "@nsdefs";
@@ -55,9 +55,9 @@ export function calculateCrimeWorkStats(person: IPerson, crime: Crime): WorkStat
intExp: crime.intelligence_exp,
}),
person.mults,
person.mults.crime_money * BitNodeMultipliers.CrimeMoney,
person.mults.crime_money * currentNodeMults.CrimeMoney,
),
BitNodeMultipliers.CrimeExpGain,
currentNodeMults.CrimeExpGain,
false,
);
return gains;
@@ -77,7 +77,7 @@ export const calculateFactionRep = (person: IPerson, type: FactionWorkType, favo
export function calculateFactionExp(person: IPerson, type: FactionWorkType): WorkStats {
return scaleWorkStats(
multWorkStats(FactionWorkStats[type], person.mults),
BitNodeMultipliers.FactionWorkExpGain / gameCPS,
currentNodeMults.FactionWorkExpGain / gameCPS,
);
}
@@ -119,7 +119,7 @@ export const calculateCompanyWorkStats = (
const gains = scaleWorkStats(
multWorkStats(
{
money: companyPosition.baseSalary * company.salaryMultiplier * bn11Mult * BitNodeMultipliers.CompanyWorkMoney,
money: companyPosition.baseSalary * company.salaryMultiplier * bn11Mult * currentNodeMults.CompanyWorkMoney,
hackExp: companyPosition.hackingExpGain,
strExp: companyPosition.strengthExpGain,
defExp: companyPosition.defenseExpGain,
@@ -130,7 +130,7 @@ export const calculateCompanyWorkStats = (
worker.mults,
worker.mults.work_money,
),
company.expMultiplier * BitNodeMultipliers.CompanyWorkExpGain,
company.expMultiplier * currentNodeMults.CompanyWorkExpGain,
false,
);
+4 -4
View File
@@ -9,17 +9,17 @@ import { applyAugmentation } from "../Augmentation/AugmentationHelpers";
import { dialogBoxCreate } from "../ui/React/DialogBox";
import { constructorsForReviver, Generic_toJSON, Generic_fromJSON, IReviverValue } from "../utils/JSONReviver";
import { GraftableAugmentation } from "../PersonObjects/Grafting/GraftableAugmentation";
import { StaticAugmentations } from "../Augmentation/StaticAugmentations";
import { Augmentations } from "../Augmentation/Augmentations";
export const isGraftingWork = (w: Work | null): w is GraftingWork => w !== null && w.type === WorkType.GRAFTING;
interface GraftingWorkParams {
augmentation: string;
augmentation: AugmentationName;
singularity: boolean;
}
export class GraftingWork extends Work {
augmentation: string;
augmentation: AugmentationName;
unitCompleted: number;
constructor(params?: GraftingWorkParams) {
@@ -31,7 +31,7 @@ export class GraftingWork extends Work {
}
unitNeeded(): number {
return new GraftableAugmentation(StaticAugmentations[this.augmentation]).time;
return new GraftableAugmentation(Augmentations[this.augmentation]).time;
}
process(cycles: number): boolean {