mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-18 20:25:45 +01:00
MISC: Rework reputation bonus after installing a backdoor (#1236)
This commit is contained in:
parent
4d3dbf169d
commit
d4bdb8de2b
@ -1,4 +1,6 @@
|
|||||||
import type { CompanyName, LocationName } from "@enums";
|
import type { CompanyName, LocationName } from "@enums";
|
||||||
|
import { CONSTANTS } from "../Constants";
|
||||||
|
import { isBackdoorInstalledInCompanyServer } from "../Server/ServerHelpers";
|
||||||
|
|
||||||
type LocationNameString = `${LocationName}`;
|
type LocationNameString = `${LocationName}`;
|
||||||
type CompanyNameString = `${CompanyName}`;
|
type CompanyNameString = `${CompanyName}`;
|
||||||
@ -9,3 +11,9 @@ export function companyNameAsLocationName(companyName: CompanyName): LocationNam
|
|||||||
// Due to the check above, we know that all company names are valid location names.
|
// Due to the check above, we know that all company names are valid location names.
|
||||||
return companyName as unknown as LocationName;
|
return companyName as unknown as LocationName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function calculateEffectiveRequiredReputation(companyName: CompanyName, reputation: number): number {
|
||||||
|
return (
|
||||||
|
reputation * (isBackdoorInstalledInCompanyServer(companyName) ? CONSTANTS.CompanyRequiredReputationMultiplier : 1)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
@ -53,6 +53,7 @@ export const CONSTANTS: {
|
|||||||
SoARepMult: number;
|
SoARepMult: number;
|
||||||
EntropyEffect: number;
|
EntropyEffect: number;
|
||||||
Donations: number; // number of blood/plasma/palette donation the dev have verified., boosts NFG
|
Donations: number; // number of blood/plasma/palette donation the dev have verified., boosts NFG
|
||||||
|
CompanyRequiredReputationMultiplier: number; // Only use this if a backdoor is installed in the company's server
|
||||||
LatestUpdate: string;
|
LatestUpdate: string;
|
||||||
} = {
|
} = {
|
||||||
VersionString: "2.6.1dev",
|
VersionString: "2.6.1dev",
|
||||||
@ -153,6 +154,8 @@ export const CONSTANTS: {
|
|||||||
|
|
||||||
Donations: 151,
|
Donations: 151,
|
||||||
|
|
||||||
|
CompanyRequiredReputationMultiplier: 0.75,
|
||||||
|
|
||||||
// Also update doc/source/changelog.rst
|
// Also update doc/source/changelog.rst
|
||||||
LatestUpdate: `
|
LatestUpdate: `
|
||||||
## v2.6.1 dev - last updated 23 Apr 2024
|
## v2.6.1 dev - last updated 23 Apr 2024
|
||||||
|
@ -31,6 +31,8 @@
|
|||||||
|
|
||||||
### Megacorporations
|
### Megacorporations
|
||||||
|
|
||||||
|
If you install a backdoor on a company's server, the required reputation of that company faction is reduced by 25%.
|
||||||
|
|
||||||
| Faction Name | Requirements |
|
| Faction Name | Requirements |
|
||||||
| --------------------------- | ----------------------------------------------------------------------------------------------------- |
|
| --------------------------- | ----------------------------------------------------------------------------------------------------- |
|
||||||
| ECorp | \* Have 400k reputation with the Corporation |
|
| ECorp | \* Have 400k reputation with the Corporation |
|
||||||
|
@ -3,7 +3,6 @@ import { ServerName } from "../Types/strings";
|
|||||||
import { Server } from "../Server/Server";
|
import { Server } from "../Server/Server";
|
||||||
import { GetServer } from "../Server/AllServers";
|
import { GetServer } from "../Server/AllServers";
|
||||||
import { HacknetServer } from "../Hacknet/HacknetServer";
|
import { HacknetServer } from "../Hacknet/HacknetServer";
|
||||||
import { serverMetadata } from "../Server/data/servers";
|
|
||||||
import { Companies } from "../Company/Companies";
|
import { Companies } from "../Company/Companies";
|
||||||
import { formatReputation, formatMoney, formatRam } from "../ui/formatNumber";
|
import { formatReputation, formatMoney, formatRam } from "../ui/formatNumber";
|
||||||
import type { PlayerObject } from "../PersonObjects/Player/PlayerObject";
|
import type { PlayerObject } from "../PersonObjects/Player/PlayerObject";
|
||||||
@ -29,6 +28,7 @@ import type {
|
|||||||
SomeRequirement,
|
SomeRequirement,
|
||||||
EveryRequirement,
|
EveryRequirement,
|
||||||
} from "@nsdefs";
|
} from "@nsdefs";
|
||||||
|
import { calculateEffectiveRequiredReputation } from "../Company/utils";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Declarative format for checking that the player satisfies some condition, such as the requirements for being invited to a faction.
|
* Declarative format for checking that the player satisfies some condition, such as the requirements for being invited to a faction.
|
||||||
@ -69,18 +69,19 @@ export const employedBy = (companyName: CompanyName): PlayerCondition => ({
|
|||||||
|
|
||||||
export const haveCompanyRep = (companyName: CompanyName, rep: number): PlayerCondition => ({
|
export const haveCompanyRep = (companyName: CompanyName, rep: number): PlayerCondition => ({
|
||||||
toString(): string {
|
toString(): string {
|
||||||
return `${formatReputation(rep)} reputation with ${companyName}`;
|
return `${formatReputation(calculateEffectiveRequiredReputation(companyName, rep))} reputation with ${companyName}`;
|
||||||
},
|
},
|
||||||
toJSON(): CompanyReputationRequirement {
|
toJSON(): CompanyReputationRequirement {
|
||||||
return { type: "companyReputation", company: companyName, reputation: rep };
|
return {
|
||||||
|
type: "companyReputation",
|
||||||
|
company: companyName,
|
||||||
|
reputation: calculateEffectiveRequiredReputation(companyName, rep),
|
||||||
|
};
|
||||||
},
|
},
|
||||||
isSatisfied(): boolean {
|
isSatisfied(): boolean {
|
||||||
const company = Companies[companyName];
|
const company = Companies[companyName];
|
||||||
if (!company) return false;
|
if (!company) return false;
|
||||||
const serverMeta = serverMetadata.find((s) => s.specialName === companyName);
|
return company.playerReputation >= calculateEffectiveRequiredReputation(companyName, rep);
|
||||||
const server = GetServer(serverMeta ? serverMeta.hostname : "");
|
|
||||||
const bonus = server?.backdoorInstalled ? 100e3 : 0;
|
|
||||||
return company.playerReputation + bonus >= rep;
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -57,6 +57,7 @@ import { getRecordEntries } from "../Types/Record";
|
|||||||
import { JobTracks } from "../Company/data/JobTracks";
|
import { JobTracks } from "../Company/data/JobTracks";
|
||||||
import { ServerConstants } from "../Server/data/Constants";
|
import { ServerConstants } from "../Server/data/Constants";
|
||||||
import { blackOpsArray } from "../Bladeburner/data/BlackOperations";
|
import { blackOpsArray } from "../Bladeburner/data/BlackOperations";
|
||||||
|
import { calculateEffectiveRequiredReputation } from "../Company/utils";
|
||||||
|
|
||||||
export function NetscriptSingularity(): InternalAPI<ISingularity> {
|
export function NetscriptSingularity(): InternalAPI<ISingularity> {
|
||||||
const runAfterReset = function (cbScript: ScriptFilePath) {
|
const runAfterReset = function (cbScript: ScriptFilePath) {
|
||||||
@ -691,7 +692,7 @@ export function NetscriptSingularity(): InternalAPI<ISingularity> {
|
|||||||
field: job.field,
|
field: job.field,
|
||||||
nextPosition: job.nextPosition,
|
nextPosition: job.nextPosition,
|
||||||
salary: job.baseSalary * company.salaryMultiplier,
|
salary: job.baseSalary * company.salaryMultiplier,
|
||||||
requiredReputation: job.requiredReputation,
|
requiredReputation: calculateEffectiveRequiredReputation(companyName, job.requiredReputation),
|
||||||
requiredSkills: job.requiredSkills(company.jobStatReqOffset),
|
requiredSkills: job.requiredSkills(company.jobStatReqOffset),
|
||||||
};
|
};
|
||||||
return res;
|
return res;
|
||||||
|
@ -10,6 +10,7 @@ import { Person as IPerson } from "@nsdefs";
|
|||||||
import { Server as IServer } from "@nsdefs";
|
import { Server as IServer } from "@nsdefs";
|
||||||
import { workerScripts } from "../Netscript/WorkerScripts";
|
import { workerScripts } from "../Netscript/WorkerScripts";
|
||||||
import { killWorkerScriptByPid } from "../Netscript/killWorkerScript";
|
import { killWorkerScriptByPid } from "../Netscript/killWorkerScript";
|
||||||
|
import { serverMetadata } from "./data/servers";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a new server, while also ensuring that the new server
|
* Constructs a new server, while also ensuring that the new server
|
||||||
@ -236,6 +237,15 @@ export function isBackdoorInstalled(server: BaseServer): boolean {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function isBackdoorInstalledInCompanyServer(companyName: string): boolean {
|
||||||
|
const serverMeta = serverMetadata.find((s) => s.specialName === companyName);
|
||||||
|
const server = GetServer(serverMeta ? serverMeta.hostname : "");
|
||||||
|
if (!server) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return isBackdoorInstalled(server);
|
||||||
|
}
|
||||||
|
|
||||||
export function getCoreBonus(cores = 1): number {
|
export function getCoreBonus(cores = 1): number {
|
||||||
const coreBonus = 1 + (cores - 1) / 16;
|
const coreBonus = 1 + (cores - 1) / 16;
|
||||||
return coreBonus;
|
return coreBonus;
|
||||||
|
Loading…
Reference in New Issue
Block a user