mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-23 01:32:55 +02:00
merge base
This commit is contained in:
@@ -7,7 +7,7 @@ import { Augmentation } from "../../Augmentation/Augmentation";
|
||||
|
||||
import { calculateEntropy } from "../Grafting/EntropyAccumulation";
|
||||
|
||||
export function hasAugmentation(this: IPlayer, aug: string | Augmentation, installed = false): boolean {
|
||||
export function hasAugmentation(this: IPlayer, aug: string | Augmentation, includeQueued = false): boolean {
|
||||
const augName: string = aug instanceof Augmentation ? aug.name : aug;
|
||||
|
||||
for (const owned of this.augmentations) {
|
||||
@@ -16,7 +16,7 @@ export function hasAugmentation(this: IPlayer, aug: string | Augmentation, insta
|
||||
}
|
||||
}
|
||||
|
||||
if (!installed) {
|
||||
if (!includeQueued) {
|
||||
for (const owned of this.queuedAugmentations) {
|
||||
if (owned.name === augName) {
|
||||
return true;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { Bladeburner } from "../../Bladeburner/Bladeburner";
|
||||
import { SourceFileFlags } from "../../SourceFile/SourceFileFlags";
|
||||
import { IPlayer } from "../IPlayer";
|
||||
|
||||
export function canAccessBladeburner(this: IPlayer): boolean {
|
||||
@@ -7,7 +6,7 @@ export function canAccessBladeburner(this: IPlayer): boolean {
|
||||
return false;
|
||||
}
|
||||
|
||||
return this.bitNodeN === 6 || this.bitNodeN === 7 || SourceFileFlags[6] > 0 || SourceFileFlags[7] > 0;
|
||||
return this.bitNodeN === 6 || this.bitNodeN === 7 || this.sourceFileLvl(6) > 0 || this.sourceFileLvl(7) > 0;
|
||||
}
|
||||
|
||||
export function inBladeburner(this: IPlayer): boolean {
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
import { Corporation } from "../../Corporation/Corporation";
|
||||
import { CorporationUnlockUpgrades } from "../../Corporation/data/CorporationUnlockUpgrades";
|
||||
import { SourceFileFlags } from "../../SourceFile/SourceFileFlags";
|
||||
import {
|
||||
CorporationUnlockUpgradeIndex,
|
||||
CorporationUnlockUpgrades,
|
||||
} from "../../Corporation/data/CorporationUnlockUpgrades";
|
||||
import { IPlayer } from "../IPlayer";
|
||||
|
||||
export function canAccessCorporation(this: IPlayer): boolean {
|
||||
return this.bitNodeN === 3 || SourceFileFlags[3] > 0;
|
||||
return this.bitNodeN === 3 || this.sourceFileLvl(3) > 0;
|
||||
}
|
||||
|
||||
export function hasCorporation(this: IPlayer): boolean {
|
||||
@@ -19,9 +21,9 @@ export function startCorporation(this: IPlayer, corpName: string, additionalShar
|
||||
name: corpName,
|
||||
});
|
||||
|
||||
if (SourceFileFlags[3] === 3) {
|
||||
const warehouseApi = CorporationUnlockUpgrades["7"][0];
|
||||
const OfficeApi = CorporationUnlockUpgrades["8"][0];
|
||||
if (this.sourceFileLvl(3) === 3) {
|
||||
const warehouseApi = CorporationUnlockUpgrades[CorporationUnlockUpgradeIndex.WarehouseAPI].index;
|
||||
const OfficeApi = CorporationUnlockUpgrades[CorporationUnlockUpgradeIndex.OfficeAPI].index;
|
||||
|
||||
this.corporation.unlockUpgrades[warehouseApi] = 1;
|
||||
this.corporation.unlockUpgrades[OfficeApi] = 1;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { Factions } from "../../Faction/Factions";
|
||||
import { Faction } from "../../Faction/Faction";
|
||||
import { Gang } from "../../Gang/Gang";
|
||||
import { SourceFileFlags } from "../../SourceFile/SourceFileFlags";
|
||||
import { IPlayer } from "../IPlayer";
|
||||
|
||||
// Amount of negative karma needed to manage a gang in BitNodes other than 2
|
||||
@@ -11,7 +10,7 @@ export function canAccessGang(this: IPlayer): boolean {
|
||||
if (this.bitNodeN === 2) {
|
||||
return true;
|
||||
}
|
||||
if (SourceFileFlags[2] <= 0) {
|
||||
if (this.sourceFileLvl(2) <= 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,6 @@ import { SpecialServers } from "../../Server/data/SpecialServers";
|
||||
import { applySourceFile } from "../../SourceFile/applySourceFile";
|
||||
import { applyExploit } from "../../Exploits/applyExploits";
|
||||
import { SourceFiles } from "../../SourceFile/SourceFiles";
|
||||
import { SourceFileFlags } from "../../SourceFile/SourceFileFlags";
|
||||
import { influenceStockThroughCompanyWork } from "../../StockMarket/PlayerInfluencing";
|
||||
import { getHospitalizationCost } from "../../Hospital/Hospital";
|
||||
import { WorkerScript } from "../../Netscript/WorkerScript";
|
||||
@@ -121,7 +120,7 @@ export function prestigeAugmentation(this: PlayerObject): void {
|
||||
|
||||
this.queuedAugmentations = [];
|
||||
|
||||
const numSleeves = Math.min(3, SourceFileFlags[10] + (this.bitNodeN === 10 ? 1 : 0)) + this.sleevesFromCovenant;
|
||||
const numSleeves = Math.min(3, this.sourceFileLvl(10) + (this.bitNodeN === 10 ? 1 : 0)) + this.sleevesFromCovenant;
|
||||
if (this.sleeves.length > numSleeves) this.sleeves.length = numSleeves;
|
||||
for (let i = this.sleeves.length; i < numSleeves; i++) {
|
||||
this.sleeves.push(new Sleeve(this));
|
||||
@@ -475,7 +474,7 @@ export function gainIntelligenceExp(this: IPlayer, exp: number): void {
|
||||
console.error("ERROR: NaN passed into Player.gainIntelligenceExp()");
|
||||
return;
|
||||
}
|
||||
if (SourceFileFlags[5] > 0 || this.intelligence > 0) {
|
||||
if (this.sourceFileLvl(5) > 0 || this.intelligence > 0) {
|
||||
this.intelligence_exp += exp;
|
||||
this.intelligence = Math.floor(this.calculateSkill(this.intelligence_exp));
|
||||
}
|
||||
@@ -1045,7 +1044,7 @@ export function getWorkMoneyGain(this: IPlayer): number {
|
||||
// If player has SF-11, calculate salary multiplier from favor
|
||||
let bn11Mult = 1;
|
||||
const company = Companies[this.companyName];
|
||||
if (SourceFileFlags[11] > 0) {
|
||||
if (this.sourceFileLvl(11) > 0) {
|
||||
bn11Mult = 1 + company.favor / 100;
|
||||
}
|
||||
|
||||
@@ -1323,20 +1322,21 @@ export function createProgramWork(this: IPlayer, numCycles: number): boolean {
|
||||
|
||||
export function finishCreateProgramWork(this: IPlayer, cancelled: boolean): string {
|
||||
const programName = this.createProgramName;
|
||||
if (cancelled === false) {
|
||||
if (!cancelled) {
|
||||
//Complete case
|
||||
this.gainIntelligenceExp((CONSTANTS.IntelligenceProgramBaseExpGain * this.timeWorked) / 1000);
|
||||
dialogBoxCreate(`You've finished creating ${programName}!<br>The new program can be found on your home computer.`);
|
||||
|
||||
this.getHomeComputer().programs.push(programName);
|
||||
} else {
|
||||
if (!this.getHomeComputer().programs.includes(programName)) {
|
||||
this.getHomeComputer().programs.push(programName);
|
||||
}
|
||||
} else if (!this.getHomeComputer().programs.includes(programName)) {
|
||||
//Incomplete case
|
||||
const perc = (Math.floor((this.timeWorkedCreateProgram / this.timeNeededToCompleteWork) * 10000) / 100).toString();
|
||||
const incompleteName = programName + "-" + perc + "%-INC";
|
||||
this.getHomeComputer().programs.push(incompleteName);
|
||||
}
|
||||
|
||||
if (!cancelled) {
|
||||
this.gainIntelligenceExp((CONSTANTS.IntelligenceProgramBaseExpGain * this.timeWorked) / 1000);
|
||||
}
|
||||
|
||||
this.isWorking = false;
|
||||
|
||||
this.resetWorkStatus();
|
||||
@@ -2092,12 +2092,7 @@ export function reapplyAllAugmentations(this: IPlayer, resetMultipliers = true):
|
||||
|
||||
const playerAug = this.augmentations[i];
|
||||
const augName = playerAug.name;
|
||||
const aug = Augmentations[augName];
|
||||
if (aug == null) {
|
||||
console.warn(`Invalid augmentation name in Player.reapplyAllAugmentations(). Aug ${augName} will be skipped`);
|
||||
continue;
|
||||
}
|
||||
aug.owned = true;
|
||||
|
||||
if (augName == AugmentationNames.NeuroFluxGovernor) {
|
||||
for (let j = 0; j < playerAug.level; ++j) {
|
||||
applyAugmentation(this.augmentations[i], true);
|
||||
@@ -2718,7 +2713,7 @@ export function gotoLocation(this: IPlayer, to: LocationName): boolean {
|
||||
}
|
||||
|
||||
export function canAccessGrafting(this: IPlayer): boolean {
|
||||
return this.bitNodeN === 10 || SourceFileFlags[10] > 0;
|
||||
return this.bitNodeN === 10 || this.sourceFileLvl(10) > 0;
|
||||
}
|
||||
|
||||
export function giveExploit(this: IPlayer, exploit: Exploit): void {
|
||||
@@ -2756,7 +2751,7 @@ export function setMult(this: IPlayer, name: string, mult: number): void {
|
||||
}
|
||||
|
||||
export function canAccessCotMG(this: IPlayer): boolean {
|
||||
return this.bitNodeN === 13 || SourceFileFlags[13] > 0;
|
||||
return this.bitNodeN === 13 || this.sourceFileLvl(13) > 0;
|
||||
}
|
||||
|
||||
export function sourceFileLvl(this: IPlayer, n: number): number {
|
||||
|
||||
Reference in New Issue
Block a user