mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-18 20:25:45 +01:00
This commit is contained in:
parent
abdf5f52cd
commit
b597746343
@ -51,6 +51,7 @@ export abstract class Person implements IPerson {
|
|||||||
regenerateHp = personMethods.regenerateHp;
|
regenerateHp = personMethods.regenerateHp;
|
||||||
updateSkillLevels = personMethods.updateSkillLevels;
|
updateSkillLevels = personMethods.updateSkillLevels;
|
||||||
hasAugmentation = personMethods.hasAugmentation;
|
hasAugmentation = personMethods.hasAugmentation;
|
||||||
|
travel = personMethods.travel;
|
||||||
calculateSkill = calculateSkill; //Class version is equal to imported version
|
calculateSkill = calculateSkill; //Class version is equal to imported version
|
||||||
|
|
||||||
/** Reset all multipliers to 1 */
|
/** Reset all multipliers to 1 */
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
|
import type { CityName } from "@enums";
|
||||||
import { Person } from "./Person";
|
import { Person } from "./Person";
|
||||||
import { calculateSkill } from "./formulas/skill";
|
import { calculateSkill } from "./formulas/skill";
|
||||||
import { currentNodeMults } from "../BitNode/BitNodeMultipliers";
|
import { currentNodeMults } from "../BitNode/BitNodeMultipliers";
|
||||||
import { Player } from "@player";
|
import { Player } from "@player";
|
||||||
import { WorkStats } from "@nsdefs";
|
import { WorkStats } from "@nsdefs";
|
||||||
|
import { CONSTANTS } from "../Constants";
|
||||||
|
|
||||||
export function gainHackingExp(this: Person, exp: number): void {
|
export function gainHackingExp(this: Person, exp: number): void {
|
||||||
if (isNaN(exp)) {
|
if (isNaN(exp)) {
|
||||||
@ -167,3 +169,15 @@ export function hasAugmentation(this: Person, augName: string, ignoreQueued = fa
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Travel to another City. Costs money from player regardless of which person is traveling */
|
||||||
|
export function travel(this: Person, cityName: CityName): boolean {
|
||||||
|
if (!Player.canAfford(CONSTANTS.TravelCost)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
Player.loseMoney(CONSTANTS.TravelCost, "sleeves");
|
||||||
|
this.city = cityName;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
@ -110,7 +110,6 @@ export class PlayerObject extends Person implements IPlayer {
|
|||||||
startFocusing = generalMethods.startFocusing;
|
startFocusing = generalMethods.startFocusing;
|
||||||
startGang = gangMethods.startGang;
|
startGang = gangMethods.startGang;
|
||||||
takeDamage = generalMethods.takeDamage;
|
takeDamage = generalMethods.takeDamage;
|
||||||
travel = generalMethods.travel;
|
|
||||||
giveExploit = generalMethods.giveExploit;
|
giveExploit = generalMethods.giveExploit;
|
||||||
giveAchievement = generalMethods.giveAchievement;
|
giveAchievement = generalMethods.giveAchievement;
|
||||||
getCasinoWinnings = generalMethods.getCasinoWinnings;
|
getCasinoWinnings = generalMethods.getCasinoWinnings;
|
||||||
|
@ -28,8 +28,6 @@ import { Faction } from "../../Faction/Faction";
|
|||||||
import { Factions } from "../../Faction/Factions";
|
import { Factions } from "../../Faction/Factions";
|
||||||
import { FactionInvitationEvents } from "../../Faction/ui/FactionInvitationManager";
|
import { FactionInvitationEvents } from "../../Faction/ui/FactionInvitationManager";
|
||||||
import { resetGangs } from "../../Gang/AllGangs";
|
import { resetGangs } from "../../Gang/AllGangs";
|
||||||
import { Cities } from "../../Locations/Cities";
|
|
||||||
import { Locations } from "../../Locations/Locations";
|
|
||||||
import { Sleeve } from "../Sleeve/Sleeve";
|
import { Sleeve } from "../Sleeve/Sleeve";
|
||||||
import { SleeveWorkType } from "../Sleeve/Work/Work";
|
import { SleeveWorkType } from "../Sleeve/Work/Work";
|
||||||
import { calculateSkillProgress as calculateSkillProgressF, ISkillProgress } from "../formulas/skill";
|
import { calculateSkillProgress as calculateSkillProgressF, ISkillProgress } from "../formulas/skill";
|
||||||
@ -532,26 +530,8 @@ export function gainCodingContractReward(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function travel(this: PlayerObject, cityName: CityName): boolean {
|
|
||||||
if (Cities[cityName] == null) {
|
|
||||||
throw new Error(`Player.travel() was called with an invalid city: ${cityName}`);
|
|
||||||
}
|
|
||||||
if (!this.canAfford(CONSTANTS.TravelCost)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.loseMoney(CONSTANTS.TravelCost, "other");
|
|
||||||
this.city = cityName;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function gotoLocation(this: PlayerObject, to: LocationName): boolean {
|
export function gotoLocation(this: PlayerObject, to: LocationName): boolean {
|
||||||
if (Locations[to] == null) {
|
|
||||||
throw new Error(`Player.gotoLocation() was called with an invalid location: ${to}`);
|
|
||||||
}
|
|
||||||
this.location = to;
|
this.location = to;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,7 +44,6 @@ import { SleeveCrimeWork } from "./Work/SleeveCrimeWork";
|
|||||||
import * as sleeveMethods from "./SleeveMethods";
|
import * as sleeveMethods from "./SleeveMethods";
|
||||||
import { calculateIntelligenceBonus } from "../formulas/intelligence";
|
import { calculateIntelligenceBonus } from "../formulas/intelligence";
|
||||||
import { getEnumHelper } from "../../utils/EnumHelper";
|
import { getEnumHelper } from "../../utils/EnumHelper";
|
||||||
import { Cities } from "../../Locations/Cities";
|
|
||||||
|
|
||||||
export class Sleeve extends Person implements SleevePerson {
|
export class Sleeve extends Person implements SleevePerson {
|
||||||
currentWork: SleeveWork | null = null;
|
currentWork: SleeveWork | null = null;
|
||||||
@ -255,21 +254,6 @@ export class Sleeve extends Person implements SleevePerson {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Travel to another City. Costs money from player */
|
|
||||||
travel(cityName: CityName): boolean {
|
|
||||||
if (Cities[cityName] == null) {
|
|
||||||
throw new Error(`Sleeve.travel() was called with an invalid city: ${cityName}`);
|
|
||||||
}
|
|
||||||
if (!Player.canAfford(CONSTANTS.TravelCost)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
Player.loseMoney(CONSTANTS.TravelCost, "sleeves");
|
|
||||||
this.city = cityName;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
tryBuyAugmentation(aug: Augmentation): boolean {
|
tryBuyAugmentation(aug: Augmentation): boolean {
|
||||||
if (!Player.canAfford(aug.baseCost)) {
|
if (!Player.canAfford(aug.baseCost)) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -9,16 +9,16 @@ import { Settings } from "../../../Settings/Settings";
|
|||||||
import { dialogBoxCreate } from "../../../ui/React/DialogBox";
|
import { dialogBoxCreate } from "../../../ui/React/DialogBox";
|
||||||
import { Modal } from "../../../ui/React/Modal";
|
import { Modal } from "../../../ui/React/Modal";
|
||||||
|
|
||||||
interface IProps {
|
interface TravelModalProps {
|
||||||
open: boolean;
|
open: boolean;
|
||||||
onClose: () => void;
|
onClose: () => void;
|
||||||
sleeve: Sleeve;
|
sleeve: Sleeve;
|
||||||
rerender: () => void;
|
rerender: () => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function TravelModal(props: IProps): React.ReactElement {
|
export function TravelModal(props: TravelModalProps): React.ReactElement {
|
||||||
function travel(city: string): void {
|
function travel(city: CityName): void {
|
||||||
if (!props.sleeve.travel(city as CityName)) {
|
if (!props.sleeve.travel(city)) {
|
||||||
dialogBoxCreate("You cannot afford to have this sleeve travel to another city");
|
dialogBoxCreate("You cannot afford to have this sleeve travel to another city");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -36,13 +36,13 @@ export function TravelModal(props: IProps): React.ReactElement {
|
|||||||
also set your current sleeve task to idle.
|
also set your current sleeve task to idle.
|
||||||
</Typography>
|
</Typography>
|
||||||
{Settings.DisableASCIIArt ? (
|
{Settings.DisableASCIIArt ? (
|
||||||
Object.values(CityName).map((city: CityName) => (
|
Object.values(CityName).map((city) => (
|
||||||
<Button key={city} onClick={() => travel(city)}>
|
<Button key={city} onClick={() => travel(city)}>
|
||||||
{city}
|
{city}
|
||||||
</Button>
|
</Button>
|
||||||
))
|
))
|
||||||
) : (
|
) : (
|
||||||
<WorldMap currentCity={props.sleeve.city} onTravel={(city: CityName) => travel(city)} />
|
<WorldMap currentCity={props.sleeve.city} onTravel={travel} />
|
||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
</Modal>
|
</Modal>
|
||||||
|
Loading…
Reference in New Issue
Block a user