mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-18 12:15:44 +01:00
MISC: Remove unnecessary dependency in Person class (#1534)
This commit is contained in:
parent
1b9676c68e
commit
23f193c8eb
@ -1,16 +1,16 @@
|
||||
import type { Skills } from "./Skills";
|
||||
import type { HP } from "./HP";
|
||||
import type { Person as IPerson, WorkStats } from "@nsdefs";
|
||||
import type { PlayerOwnedAugmentation } from "../Augmentation/PlayerOwnedAugmentation";
|
||||
import type { IReviverValue } from "../utils/JSONReviver";
|
||||
import type { MoneySource } from "../utils/MoneySourceTracker";
|
||||
import type { HP } from "./HP";
|
||||
import type { Skills } from "./Skills";
|
||||
|
||||
import { CityName } from "@enums";
|
||||
import { PlayerOwnedAugmentation } from "../Augmentation/PlayerOwnedAugmentation";
|
||||
import { calculateSkill } from "./formulas/skill";
|
||||
import { defaultMultipliers } from "./Multipliers";
|
||||
import { IReviverValue } from "../utils/JSONReviver";
|
||||
import { currentNodeMults } from "../BitNode/BitNodeMultipliers";
|
||||
import { Player } from "../Player";
|
||||
import { CONSTANTS } from "../Constants";
|
||||
import { PlayerObject } from "./Player/PlayerObject";
|
||||
import { Player } from "../Player";
|
||||
import { defaultMultipliers } from "./Multipliers";
|
||||
import { calculateSkill } from "./formulas/skill";
|
||||
|
||||
// Base class representing a person-like object
|
||||
export abstract class Person implements IPerson {
|
||||
@ -226,7 +226,7 @@ export abstract class Person implements IPerson {
|
||||
return false;
|
||||
}
|
||||
|
||||
Player.loseMoney(CONSTANTS.TravelCost, this instanceof PlayerObject ? "other" : "sleeves");
|
||||
Player.loseMoney(CONSTANTS.TravelCost, this.travelCostMoneySource());
|
||||
this.city = cityName;
|
||||
|
||||
return true;
|
||||
@ -239,6 +239,7 @@ export abstract class Person implements IPerson {
|
||||
this.mults = defaultMultipliers();
|
||||
}
|
||||
|
||||
abstract travelCostMoneySource(): MoneySource;
|
||||
abstract takeDamage(amt: number): boolean;
|
||||
abstract whoAmI(): string;
|
||||
abstract toJSON(): IReviverValue;
|
||||
|
@ -19,7 +19,7 @@ import * as workMethods from "./PlayerObjectWorkMethods";
|
||||
import { setPlayer } from "@player";
|
||||
import { CompanyName, FactionName, JobName, LocationName } from "@enums";
|
||||
import { HashManager } from "../../Hacknet/HashManager";
|
||||
import { MoneySourceTracker } from "../../utils/MoneySourceTracker";
|
||||
import { type MoneySource, MoneySourceTracker } from "../../utils/MoneySourceTracker";
|
||||
import { constructorsForReviver, Generic_toJSON, Generic_fromJSON, IReviverValue } from "../../utils/JSONReviver";
|
||||
import { JSONMap, JSONSet } from "../../Types/Jsonable";
|
||||
import { cyrb53 } from "../../utils/StringHelperFunctions";
|
||||
@ -163,6 +163,10 @@ export class PlayerObject extends Person implements IPlayer {
|
||||
this.lastAugReset = this.lastNodeReset = Date.now();
|
||||
}
|
||||
|
||||
travelCostMoneySource(): MoneySource {
|
||||
return "other";
|
||||
}
|
||||
|
||||
whoAmI(): string {
|
||||
return "Player";
|
||||
}
|
||||
|
@ -48,6 +48,7 @@ import { Multipliers, mergeMultipliers } from "../Multipliers";
|
||||
import { getFactionAugmentationsFiltered } from "../../Faction/FactionHelpers";
|
||||
import { Augmentations } from "../../Augmentation/Augmentations";
|
||||
import { getAugCost } from "../../Augmentation/AugmentationHelpers";
|
||||
import type { MoneySource } from "../../utils/MoneySourceTracker";
|
||||
|
||||
export class Sleeve extends Person implements SleevePerson {
|
||||
currentWork: SleeveWork | null = null;
|
||||
@ -529,6 +530,10 @@ export class Sleeve extends Person implements SleevePerson {
|
||||
return false;
|
||||
}
|
||||
|
||||
travelCostMoneySource(): MoneySource {
|
||||
return "sleeves";
|
||||
}
|
||||
|
||||
takeDamage(amt: number): boolean {
|
||||
if (typeof amt !== "number") {
|
||||
console.warn(`Player.takeDamage() called without a numeric argument: ${amt}`);
|
||||
|
Loading…
Reference in New Issue
Block a user