mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2025-02-18 10:53:43 +01:00
Rebase fix, move hasAugmentation to Person
This commit is contained in:
@ -4,6 +4,7 @@ import { Player } from "../Player";
|
|||||||
|
|
||||||
import { dialogBoxCreate } from "../ui/React/DialogBox";
|
import { dialogBoxCreate } from "../ui/React/DialogBox";
|
||||||
|
|
||||||
|
//This is only used for the player
|
||||||
export function determineCrimeSuccess(type: string): boolean {
|
export function determineCrimeSuccess(type: string): boolean {
|
||||||
let chance = 0;
|
let chance = 0;
|
||||||
let found = false;
|
let found = false;
|
||||||
|
@ -197,3 +197,7 @@ export function updateSkillLevels(this: Person): void {
|
|||||||
this.hp.max = Math.floor(10 + this.skills.defense / 10);
|
this.hp.max = Math.floor(10 + this.skills.defense / 10);
|
||||||
this.hp.current = Math.round(this.hp.max * ratio);
|
this.hp.current = Math.round(this.hp.max * ratio);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function hasAugmentation(this: Person, augName: string, ignoreQueued: boolean = false) {
|
||||||
|
return this.augmentations.some((a) => a.name === augName && (ignoreQueued || !this.queuedAugmentations.includes(a)));
|
||||||
|
}
|
||||||
|
@ -53,9 +53,7 @@ export class PlayerObject extends Person {
|
|||||||
moneySourceB = new MoneySourceTracker();
|
moneySourceB = new MoneySourceTracker();
|
||||||
playtimeSinceLastAug = 0;
|
playtimeSinceLastAug = 0;
|
||||||
playtimeSinceLastBitnode = 0;
|
playtimeSinceLastBitnode = 0;
|
||||||
purchasedServers: string[] = [];
|
purchasedServers: string[] = []; scriptProdSinceLastAug = 0;
|
||||||
queuedAugmentations: IPlayerOwnedAugmentation[] = [];
|
|
||||||
scriptProdSinceLastAug = 0;
|
|
||||||
sleeves: Sleeve[] = [];
|
sleeves: Sleeve[] = [];
|
||||||
sleevesFromCovenant = 0;
|
sleevesFromCovenant = 0;
|
||||||
sourceFiles: PlayerOwnedSourceFile[] = [];
|
sourceFiles: PlayerOwnedSourceFile[] = [];
|
||||||
@ -105,7 +103,6 @@ export class PlayerObject extends Person {
|
|||||||
getUpgradeHomeRamCost = serverMethods.getUpgradeHomeRamCost;
|
getUpgradeHomeRamCost = serverMethods.getUpgradeHomeRamCost;
|
||||||
getUpgradeHomeCoresCost = serverMethods.getUpgradeHomeCoresCost;
|
getUpgradeHomeCoresCost = serverMethods.getUpgradeHomeCoresCost;
|
||||||
gotoLocation = generalMethods.gotoLocation;
|
gotoLocation = generalMethods.gotoLocation;
|
||||||
hasAugmentation = augmentationMethods.hasAugmentation;
|
|
||||||
hasCorporation = corporationMethods.hasCorporation;
|
hasCorporation = corporationMethods.hasCorporation;
|
||||||
hasGangWith = gangMethods.hasGangWith;
|
hasGangWith = gangMethods.hasGangWith;
|
||||||
hasTorRouter = serverMethods.hasTorRouter;
|
hasTorRouter = serverMethods.hasTorRouter;
|
||||||
|
@ -2,31 +2,8 @@
|
|||||||
* Augmentation-related methods for the Player class (PlayerObject)
|
* Augmentation-related methods for the Player class (PlayerObject)
|
||||||
*/
|
*/
|
||||||
import { PlayerObject } from "./PlayerObject";
|
import { PlayerObject } from "./PlayerObject";
|
||||||
|
|
||||||
import { Augmentation } from "../../Augmentation/Augmentation";
|
|
||||||
|
|
||||||
import { calculateEntropy } from "../Grafting/EntropyAccumulation";
|
import { calculateEntropy } from "../Grafting/EntropyAccumulation";
|
||||||
|
|
||||||
export function hasAugmentation(this: PlayerObject, aug: string | Augmentation, ignoreQueued = false): boolean {
|
|
||||||
const augName: string = aug instanceof Augmentation ? aug.name : aug;
|
|
||||||
|
|
||||||
for (const owned of this.augmentations) {
|
|
||||||
if (owned.name === augName) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!ignoreQueued) {
|
|
||||||
for (const owned of this.queuedAugmentations) {
|
|
||||||
if (owned.name === augName) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function applyEntropy(this: PlayerObject, stacks = 1): void {
|
export function applyEntropy(this: PlayerObject, stacks = 1): void {
|
||||||
// Re-apply all multipliers
|
// Re-apply all multipliers
|
||||||
this.reapplyAllAugmentations();
|
this.reapplyAllAugmentations();
|
||||||
|
Reference in New Issue
Block a user