mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-27 16:37:33 +01:00
Refactored Augmentation implementation to Typescript, and to have the multiplier information in the actrual Augmentation object
This commit is contained in:
parent
bcb231a966
commit
6d8d25e0bb
156
src/Augmentation/Augmentation.ts
Normal file
156
src/Augmentation/Augmentation.ts
Normal file
@ -0,0 +1,156 @@
|
||||
// Class definition for a single Augmentation object
|
||||
import { CONSTANTS } from "../Constants";
|
||||
import { IMap } from "../types";
|
||||
|
||||
import { BitNodeMultipliers } from "../BitNode/BitNodeMultipliers";
|
||||
import { Faction } from "../Faction/Faction";
|
||||
import { Factions } from "../Faction/Factions";
|
||||
|
||||
import { Generic_fromJSON, Generic_toJSON, Reviver } from "../../utils/JSONReviver";
|
||||
|
||||
interface IConstructorParams {
|
||||
info: string;
|
||||
moneyCost: number;
|
||||
name: string;
|
||||
prereqs?: string[];
|
||||
repCost: number;
|
||||
|
||||
hacking_mult?: number;
|
||||
strength_mult?: number;
|
||||
defense_mult?: number;
|
||||
dexterity_mult?: number;
|
||||
agility_mult?: number;
|
||||
charisma_mult?: number;
|
||||
hacking_exp_mult?: number;
|
||||
strength_exp_mult?: number;
|
||||
defense_exp_mult?: number;
|
||||
dexterity_exp_mult?: number;
|
||||
agility_exp_mult?: number;
|
||||
charisma_exp_mult?: number;
|
||||
hacking_chance_mult?: number;
|
||||
hacking_speed_mult?: number;
|
||||
hacking_money_mult?: number;
|
||||
hacking_grow_mult?: number;
|
||||
company_rep_mult?: number;
|
||||
faction_rep_mult?: number;
|
||||
crime_money_mult?: number;
|
||||
crime_success_mult?: number;
|
||||
work_money_mult?: number;
|
||||
hacknet_node_money_mult?: number;
|
||||
hacknet_node_purchase_cost_mult?: number;
|
||||
hacknet_node_ram_cost_mult?: number;
|
||||
hacknet_node_core_cost_mult?: number;
|
||||
hacknet_node_level_cost_mult?: number;
|
||||
bladeburner_max_stamina_mult?: number;
|
||||
bladeburner_stamina_gain_mult?: number;
|
||||
bladeburner_analysis_mult?: number;
|
||||
bladeburner_success_chance_mult?: number;
|
||||
}
|
||||
|
||||
export class Augmentation {
|
||||
// Initiatizes a Augmentation object from a JSON save state.
|
||||
static fromJSON(value: any): Augmentation {
|
||||
return Generic_fromJSON(Augmentation, value.data);
|
||||
}
|
||||
|
||||
// How much money this costs to buy
|
||||
baseCost: number = 0;
|
||||
|
||||
// How much faction reputation is required to unlock this
|
||||
baseRepRequirement: number = 0;
|
||||
|
||||
// Description of what this Aug is and what it does
|
||||
info: string = "";
|
||||
|
||||
// Augmentation level - for repeatable Augs like NeuroFlux Governor
|
||||
level: number = 0;
|
||||
|
||||
// Name of Augmentation
|
||||
name: string = "";
|
||||
|
||||
// Whether the player owns this Augmentation
|
||||
owned: boolean = false;
|
||||
|
||||
// Array of names of all prerequisites
|
||||
prereqs: string[] = [];
|
||||
|
||||
// Multipliers given by this Augmentation. Must match the property name in
|
||||
// The Player/Person classes
|
||||
mults: IMap<number> = {}
|
||||
|
||||
constructor(params: IConstructorParams={ info: "", moneyCost: 0, name: "", repCost: 0 }) {
|
||||
this.name = params.name;
|
||||
this.info = params.info;
|
||||
this.prereqs = params.prereqs ? params.prereqs : [];
|
||||
|
||||
this.baseRepRequirement = params.repCost * CONSTANTS.AugmentationRepMultiplier * BitNodeMultipliers.AugmentationRepCost;
|
||||
this.baseCost = params.moneyCost * CONSTANTS.AugmentationCostMultiplier * BitNodeMultipliers.AugmentationMoneyCost;
|
||||
|
||||
this.level = 0;
|
||||
|
||||
// Set multipliers
|
||||
if (params.hacking_mult) { this.mults.hacking_mult = params.hacking_mult; }
|
||||
if (params.strength_mult) { this.mults.strength_mult = params.strength_mult; }
|
||||
if (params.defense_mult) { this.mults.defense_mult = params.defense_mult; }
|
||||
if (params.dexterity_mult) { this.mults.dexterity_mult = params.dexterity_mult; }
|
||||
if (params.agility_mult) { this.mults.agility_mult = params.agility_mult; }
|
||||
if (params.charisma_mult) { this.mults.charisma_mult = params.charisma_mult; }
|
||||
if (params.hacking_exp_mult) { this.mults.hacking_exp_mult = params.hacking_exp_mult; }
|
||||
if (params.strength_exp_mult) { this.mults.strength_exp_mult = params.strength_exp_mult; }
|
||||
if (params.defense_exp_mult) { this.mults.defense_exp_mult = params.defense_exp_mult; }
|
||||
if (params.dexterity_exp_mult) { this.mults.dexterity_exp_mult = params.dexterity_exp_mult; }
|
||||
if (params.agility_exp_mult) { this.mults.agility_exp_mult = params.agility_exp_mult; }
|
||||
if (params.charisma_exp_mult) { this.mults.charisma_exp_mult = params.charisma_exp_mult; }
|
||||
if (params.hacking_chance_mult) { this.mults.hacking_chance_mult = params.hacking_chance_mult; }
|
||||
if (params.hacking_speed_mult) { this.mults.hacking_speed_mult = params.hacking_speed_mult; }
|
||||
if (params.hacking_money_mult) { this.mults.hacking_money_mult = params.hacking_money_mult; }
|
||||
if (params.hacking_grow_mult) { this.mults.hacking_grow_mult = params.hacking_grow_mult; }
|
||||
if (params.company_rep_mult) { this.mults.company_rep_mult = params.company_rep_mult; }
|
||||
if (params.faction_rep_mult) { this.mults.faction_rep_mult = params.faction_rep_mult; }
|
||||
if (params.crime_money_mult) { this.mults.crime_money_mult = params.crime_money_mult; }
|
||||
if (params.crime_success_mult) { this.mults.crime_success_mult = params.crime_success_mult; }
|
||||
if (params.work_money_mult) { this.mults.work_money_mult = params.work_money_mult; }
|
||||
if (params.hacknet_node_money_mult) { this.mults.hacknet_node_money_mult = params.hacknet_node_money_mult; }
|
||||
if (params.hacknet_node_purchase_cost_mult) { this.mults.hacknet_node_purchase_cost_mult = params.hacknet_node_purchase_cost_mult; }
|
||||
if (params.hacknet_node_ram_cost_mult) { this.mults.hacknet_node_ram_cost_mult = params.hacknet_node_ram_cost_mult; }
|
||||
if (params.hacknet_node_core_cost_mult) { this.mults.hacknet_node_core_cost_mult = params.hacknet_node_core_cost_mult; }
|
||||
if (params.hacknet_node_level_cost_mult) { this.mults.hacknet_node_level_cost_mult = params.hacknet_node_level_cost_mult; }
|
||||
if (params.bladeburner_max_stamina_mult) { this.mults.bladeburner_max_stamina_mult = params.bladeburner_max_stamina_mult; }
|
||||
if (params.bladeburner_stamina_gain_mult) { this.mults.bladeburner_stamina_gain_mult = params.bladeburner_stamina_gain_mult; }
|
||||
if (params.bladeburner_analysis_mult) { this.mults.bladeburner_analysis_mult = params.bladeburner_analysis_mult; }
|
||||
if (params.bladeburner_success_chance_mult) { this.mults.bladeburner_success_chance_mult = params.bladeburner_success_chance_mult; }
|
||||
}
|
||||
|
||||
// Adds this Augmentation to the specified Factions
|
||||
addToFactions(factionList: string[]): void {
|
||||
for (let i = 0; i < factionList.length; ++i) {
|
||||
const faction: Faction | null = Factions[factionList[i]];
|
||||
if (faction == null) {
|
||||
console.warn(`In Augmentation.addToFactions(), could not find faction with this name: ${factionList[i]}`);
|
||||
continue;
|
||||
}
|
||||
faction!.augmentations.push(this.name);
|
||||
}
|
||||
}
|
||||
|
||||
// Adds this Augmentation to all Factions
|
||||
addToAllFactions(): void {
|
||||
for (const fac in Factions) {
|
||||
if (Factions.hasOwnProperty(fac)) {
|
||||
const facObj: Faction | null = Factions[fac];
|
||||
if (facObj == null) {
|
||||
console.warn(`Invalid Faction object in addToAllFactions(). Key value: ${fac}`);
|
||||
continue;
|
||||
}
|
||||
facObj!.augmentations.push(this.name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Serialize the current object to a JSON save state.
|
||||
toJSON(): any {
|
||||
return Generic_toJSON("Augmentation", this);
|
||||
}
|
||||
}
|
||||
|
||||
Reviver.constructors.Augmentation = Augmentation;
|
File diff suppressed because it is too large
Load Diff
4
src/Augmentation/Augmentations.ts
Normal file
4
src/Augmentation/Augmentations.ts
Normal file
@ -0,0 +1,4 @@
|
||||
import { Augmentation } from "./Augmentation";
|
||||
import { IMap } from "../types";
|
||||
|
||||
export let Augmentations: IMap<Augmentation> = {};
|
13
src/Augmentation/PlayerOwnedAugmentation.ts
Normal file
13
src/Augmentation/PlayerOwnedAugmentation.ts
Normal file
@ -0,0 +1,13 @@
|
||||
export class PlayerOwnedAugmentation {
|
||||
level: number = 1;
|
||||
name: string = "";
|
||||
|
||||
constructor(name: string = "") {
|
||||
this.name = name;
|
||||
}
|
||||
}
|
||||
|
||||
export interface IPlayerOwnedAugmentation {
|
||||
level: number;
|
||||
name: string;
|
||||
}
|
114
src/Augmentation/data/AugmentationNames.ts
Normal file
114
src/Augmentation/data/AugmentationNames.ts
Normal file
@ -0,0 +1,114 @@
|
||||
import { IMap } from "../../types";
|
||||
|
||||
export let AugmentationNames: IMap<string> = {
|
||||
Targeting1: "Augmented Targeting I",
|
||||
Targeting2: "Augmented Targeting II",
|
||||
Targeting3: "Augmented Targeting III",
|
||||
SyntheticHeart: "Synthetic Heart",
|
||||
SynfibrilMuscle: "Synfibril Muscle",
|
||||
CombatRib1: "Combat Rib I",
|
||||
CombatRib2: "Combat Rib II",
|
||||
CombatRib3: "Combat Rib III",
|
||||
NanofiberWeave: "Nanofiber Weave",
|
||||
SubdermalArmor: "NEMEAN Subdermal Weave",
|
||||
WiredReflexes: "Wired Reflexes",
|
||||
GrapheneBoneLacings: "Graphene Bone Lacings",
|
||||
BionicSpine: "Bionic Spine",
|
||||
GrapheneBionicSpine: "Graphene Bionic Spine Upgrade",
|
||||
BionicLegs: "Bionic Legs",
|
||||
GrapheneBionicLegs: "Graphene Bionic Legs Upgrade",
|
||||
SpeechProcessor: "Speech Processor Implant",
|
||||
TITN41Injection: "TITN-41 Gene-Modification Injection",
|
||||
EnhancedSocialInteractionImplant: "Enhanced Social Interaction Implant",
|
||||
BitWire: "BitWire",
|
||||
ArtificialBioNeuralNetwork: "Artificial Bio-neural Network Implant",
|
||||
ArtificialSynapticPotentiation: "Artificial Synaptic Potentiation",
|
||||
EnhancedMyelinSheathing: "Enhanced Myelin Sheathing",
|
||||
SynapticEnhancement: "Synaptic Enhancement Implant",
|
||||
NeuralRetentionEnhancement: "Neural-Retention Enhancement",
|
||||
DataJack: "DataJack",
|
||||
ENM: "Embedded Netburner Module",
|
||||
ENMCore: "Embedded Netburner Module Core Implant",
|
||||
ENMCoreV2: "Embedded Netburner Module Core V2 Upgrade",
|
||||
ENMCoreV3: "Embedded Netburner Module Core V3 Upgrade",
|
||||
ENMAnalyzeEngine: "Embedded Netburner Module Analyze Engine",
|
||||
ENMDMA: "Embedded Netburner Module Direct Memory Access Upgrade",
|
||||
Neuralstimulator: "Neuralstimulator",
|
||||
NeuralAccelerator: "Neural Accelerator",
|
||||
CranialSignalProcessorsG1: "Cranial Signal Processors - Gen I",
|
||||
CranialSignalProcessorsG2: "Cranial Signal Processors - Gen II",
|
||||
CranialSignalProcessorsG3: "Cranial Signal Processors - Gen III",
|
||||
CranialSignalProcessorsG4: "Cranial Signal Processors - Gen IV",
|
||||
CranialSignalProcessorsG5: "Cranial Signal Processors - Gen V",
|
||||
NeuronalDensification: "Neuronal Densification",
|
||||
NuoptimalInjectorImplant: "Nuoptimal Nootropic Injector Implant",
|
||||
SpeechEnhancement: "Speech Enhancement",
|
||||
FocusWire: "FocusWire",
|
||||
PCDNI: "PC Direct-Neural Interface",
|
||||
PCDNIOptimizer: "PC Direct-Neural Interface Optimization Submodule",
|
||||
PCDNINeuralNetwork: "PC Direct-Neural Interface NeuroNet Injector",
|
||||
ADRPheromone1: "ADR-V1 Pheromone Gene",
|
||||
ADRPheromone2: "ADR-V2 Pheromone Gene",
|
||||
HacknetNodeCPUUpload: "Hacknet Node CPU Architecture Neural-Upload",
|
||||
HacknetNodeCacheUpload: "Hacknet Node Cache Architecture Neural-Upload",
|
||||
HacknetNodeNICUpload: "Hacknet Node NIC Architecture Neural-Upload",
|
||||
HacknetNodeKernelDNI: "Hacknet Node Kernel Direct-Neural Interface",
|
||||
HacknetNodeCoreDNI: "Hacknet Node Core Direct-Neural Interface",
|
||||
NeuroFluxGovernor: "NeuroFlux Governor",
|
||||
Neurotrainer1: "Neurotrainer I",
|
||||
Neurotrainer2: "Neurotrainer II",
|
||||
Neurotrainer3: "Neurotrainer III",
|
||||
Hypersight: "HyperSight Corneal Implant",
|
||||
LuminCloaking1: "LuminCloaking-V1 Skin Implant",
|
||||
LuminCloaking2: "LuminCloaking-V2 Skin Implant",
|
||||
HemoRecirculator: "HemoRecirculator",
|
||||
SmartSonar: "SmartSonar Implant",
|
||||
PowerRecirculator: "Power Recirculation Core",
|
||||
QLink: "QLink",
|
||||
TheRedPill: "The Red Pill",
|
||||
SPTN97: "SPTN-97 Gene Modification",
|
||||
HiveMind: "ECorp HVMind Implant",
|
||||
CordiARCReactor: "CordiARC Fusion Reactor",
|
||||
SmartJaw: "SmartJaw",
|
||||
Neotra: "Neotra",
|
||||
Xanipher: "Xanipher",
|
||||
nextSENS: "nextSENS Gene Modification",
|
||||
OmniTekInfoLoad: "OmniTek InfoLoad",
|
||||
PhotosyntheticCells: "Photosynthetic Cells",
|
||||
Neurolink: "BitRunners Neurolink",
|
||||
TheBlackHand: "The Black Hand",
|
||||
CRTX42AA: "CRTX42-AA Gene Modification",
|
||||
Neuregen: "Neuregen Gene Modification",
|
||||
CashRoot: "CashRoot Starter Kit",
|
||||
NutriGen: "NutriGen Implant",
|
||||
INFRARet: "INFRARET Enhancement",
|
||||
DermaForce: "DermaForce Particle Barrier",
|
||||
GrapheneBrachiBlades: "Graphene BranchiBlades Upgrade",
|
||||
GrapheneBionicArms: "Graphene Bionic Arms Upgrade",
|
||||
BrachiBlades: "BrachiBlades",
|
||||
BionicArms: "Bionic Arms",
|
||||
SNA: "Social Negotiation Assistant (S.N.A)",
|
||||
EsperEyewear: "EsperTech Bladeburner Eyewear",
|
||||
EMS4Recombination: "EMS-4 Recombination",
|
||||
OrionShoulder: "ORION-MKIV Shoulder",
|
||||
HyperionV1: "Hyperion Plasma Cannon V1",
|
||||
HyperionV2: "Hyperion Plasma Cannon V2",
|
||||
GolemSerum: "GOLEM Serum",
|
||||
VangelisVirus: "Vangelis Virus",
|
||||
VangelisVirus3: "Vangelis Virus 3.0",
|
||||
INTERLINKED: "I.N.T.E.R.L.I.N.K.E.D",
|
||||
BladeRunner: "Blade's Runners",
|
||||
BladeArmor: "BLADE-51b Tesla Armor",
|
||||
BladeArmorPowerCells: "BLADE-51b Tesla Armor: Power Cells Upgrade",
|
||||
BladeArmorEnergyShielding: "BLADE-51b Tesla Armor: Energy Shielding Upgrade",
|
||||
BladeArmorUnibeam: "BLADE-51b Tesla Armor: Unibeam Upgrade",
|
||||
BladeArmorOmnibeam: "BLADE-51b Tesla Armor: Omnibeam Upgrade",
|
||||
BladeArmorIPU: "BLADE-51b Tesla Armor: IPU Upgrade",
|
||||
BladesSimulacrum: "The Blade's Simulacrum",
|
||||
|
||||
//Wasteland Augs
|
||||
//PepBoy: "P.E.P-Boy", Plasma Energy Projection System
|
||||
//PepBoyForceField Generates plasma force fields
|
||||
//PepBoyBlasts Generate high density plasma concussive blasts
|
||||
//PepBoyDataStorage STore more data on pep boy,
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
import {BitNodeMultipliers} from "./BitNodeMultipliers";
|
||||
import {Player} from "./Player";
|
||||
import { BitNodeMultipliers } from "./BitNodeMultipliers";
|
||||
import { Player } from "../Player";
|
||||
|
||||
function BitNode(n, name, desc="", info="") {
|
||||
this.number = n;
|
1
src/BitNode/README.md
Normal file
1
src/BitNode/README.md
Normal file
@ -0,0 +1 @@
|
||||
Contains implementation of BitNodes and BitNode-specific mechanics
|
@ -1,5 +1,6 @@
|
||||
import { Augmentations , AugmentationNames } from "./Augmentations";
|
||||
import { BitNodeMultipliers } from "./BitNodeMultipliers";
|
||||
import { Augmentations } from "./Augmentation/Augmentations";
|
||||
import { AugmentationNames } from "./Augmentation/data/AugmentationNames";
|
||||
import { BitNodeMultipliers } from "./BitNode/BitNodeMultipliers";
|
||||
import { CONSTANTS } from "./Constants";
|
||||
import { Engine } from "./engine";
|
||||
import { Faction } from "./Faction/Faction";
|
||||
|
@ -13,7 +13,7 @@ import { MaterialSizes } from "./MaterialSizes";
|
||||
import { Product } from "./Product";
|
||||
import { ResearchMap } from "./ResearchMap";
|
||||
|
||||
import { BitNodeMultipliers } from "../BitNodeMultipliers";
|
||||
import { BitNodeMultipliers } from "../BitNode/BitNodeMultipliers";
|
||||
import { CONSTANTS } from "../Constants";
|
||||
import { Factions } from "../Faction/Factions";
|
||||
import { showLiterature } from "../Literature";
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { AugmentationNames } from "./Augmentations";
|
||||
import { AugmentationNames } from "./Augmentation/data/AugmentationNames";
|
||||
import { generateRandomContract } from "./CodingContractGenerator";
|
||||
import { Programs } from "./Programs/Programs";
|
||||
import { Factions } from "./Faction/Factions";
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { Augmentations, AugmentationNames,
|
||||
PlayerOwnedAugmentation } from "../Augmentations";
|
||||
import { BitNodeMultipliers } from "../BitNodeMultipliers";
|
||||
import { Augmentations } from "../Augmentation/Augmentations";
|
||||
import { PlayerOwnedAugmentation } from "../Augmentation/PlayerOwnedAugmentation";
|
||||
import { AugmentationNames } from "../Augmentation/data/AugmentationNames";
|
||||
import { BitNodeMultipliers } from "../BitNode/BitNodeMultipliers";
|
||||
import { CONSTANTS } from "../Constants";
|
||||
import { Engine } from "../engine";
|
||||
import { Faction } from "./Faction";
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { BitNodeMultipliers } from "./BitNodeMultipliers";
|
||||
import { BitNodeMultipliers } from "./BitNode/BitNodeMultipliers";
|
||||
import { Player } from "./Player";
|
||||
import { Server } from "./Server";
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
import {BitNodeMultipliers} from "./BitNodeMultipliers";
|
||||
import {CONSTANTS} from "./Constants";
|
||||
import {Engine} from "./engine";
|
||||
import { BitNodeMultipliers } from "./BitNode/BitNodeMultipliers";
|
||||
import { CONSTANTS } from "./Constants";
|
||||
import { Engine } from "./engine";
|
||||
import {iTutorialSteps, iTutorialNextStep,
|
||||
ITutorial} from "./InteractiveTutorial";
|
||||
import {Player} from "./Player";
|
||||
|
@ -1,12 +1,12 @@
|
||||
import {BitNodeMultipliers} from "./BitNodeMultipliers";
|
||||
import {CONSTANTS} from "./Constants";
|
||||
import {Engine} from "./engine";
|
||||
import {Player} from "./Player";
|
||||
import {dialogBoxCreate} from "../utils/DialogBox";
|
||||
import {clearEventListeners} from "../utils/uiHelpers/clearEventListeners";
|
||||
import {getRandomInt} from "../utils/helpers/getRandomInt";
|
||||
import {infiltrationBoxCreate} from "../utils/InfiltrationBox";
|
||||
import {formatNumber} from "../utils/StringHelperFunctions";
|
||||
import { BitNodeMultipliers } from "./BitNode/BitNodeMultipliers";
|
||||
import { CONSTANTS } from "./Constants";
|
||||
import { Engine } from "./engine";
|
||||
import { Player } from "./Player";
|
||||
import { dialogBoxCreate } from "../utils/DialogBox";
|
||||
import { clearEventListeners } from "../utils/uiHelpers/clearEventListeners";
|
||||
import { getRandomInt } from "../utils/helpers/getRandomInt";
|
||||
import { infiltrationBoxCreate } from "../utils/InfiltrationBox";
|
||||
import { formatNumber } from "../utils/StringHelperFunctions";
|
||||
|
||||
/* Infiltration.js
|
||||
*
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { Augmentations,
|
||||
Augmentation,
|
||||
AugmentationNames } from "./Augmentations";
|
||||
import { Augmentatation } from "./Augmentation/Augmentation";
|
||||
import { Augmentations } from "./Augmentation/Augmentations";
|
||||
import { AugmentationNames } from "./Augmentation/data/AugmentationNames";
|
||||
import { Programs } from "./Programs/Programs";
|
||||
import { inMission } from "./Missions";
|
||||
import { Player } from "./Player";
|
||||
|
@ -1,12 +1,12 @@
|
||||
import {BitNodeMultipliers} from "./BitNodeMultipliers";
|
||||
import {CONSTANTS} from "./Constants";
|
||||
import {Player} from "./Player";
|
||||
import {Environment} from "./NetscriptEnvironment";
|
||||
import {WorkerScript, addWorkerScript} from "./NetscriptWorker";
|
||||
import {Server, getServer} from "./Server";
|
||||
import {Settings} from "./Settings";
|
||||
import {Script, findRunningScript,
|
||||
RunningScript} from "./Script";
|
||||
import { BitNodeMultipliers } from "./BitNode/BitNodeMultipliers";
|
||||
import { CONSTANTS } from "./Constants";
|
||||
import { Player } from "./Player";
|
||||
import { Environment } from "./NetscriptEnvironment";
|
||||
import { WorkerScript, addWorkerScript} from "./NetscriptWorker";
|
||||
import { Server, getServer} from "./Server";
|
||||
import { Settings } from "./Settings";
|
||||
import { Script, findRunningScript,
|
||||
RunningScript } from "./Script";
|
||||
|
||||
import {parse, Node} from "../utils/acorn";
|
||||
import {arrayToString} from "../utils/helpers/arrayToString";
|
||||
|
@ -2,10 +2,12 @@ var sprintf = require('sprintf-js').sprintf,
|
||||
vsprintf = require('sprintf-js').vsprintf
|
||||
|
||||
import {updateActiveScriptsItems} from "./ActiveScriptsUI";
|
||||
import {Augmentations, Augmentation,
|
||||
augmentationExists, installAugmentations,
|
||||
AugmentationNames} from "./Augmentations";
|
||||
import {BitNodeMultipliers} from "./BitNodeMultipliers";
|
||||
import { Augmentation } from "./Augmentation/Augmentation";
|
||||
import { Augmentations } from "./Augmentation/Augmentations";
|
||||
import { augmentationExists,
|
||||
installAugmentations } from "./Augmentation/AugmentationHelpers";
|
||||
import { AugmentationNames } from "./Augmentation/data/AugmentationNames";
|
||||
import { BitNodeMultipliers } from "./BitNode/BitNodeMultipliers";
|
||||
import { determineCrimeSuccess, findCrime } from "./Crime/CrimeHelpers";
|
||||
import {Bladeburner} from "./Bladeburner";
|
||||
import {Company} from "./Company/Company";
|
||||
|
@ -1,5 +1,6 @@
|
||||
// Base class representing a person-like object
|
||||
import { BitNodeMultipliers } from "../BitNodeMultipliers";
|
||||
import { IPlayerOwnedAugmentation } from "../Augmentation/PlayerOwnedAugmentation";
|
||||
import { BitNodeMultipliers } from "../BitNode/BitNodeMultipliers";
|
||||
import { Cities } from "../Locations/Cities";
|
||||
import { CONSTANTS } from "../Constants";
|
||||
import { IMap } from "../types";
|
||||
@ -10,10 +11,12 @@ import { IMap } from "../types";
|
||||
//
|
||||
// Only contains the needed properties for Sleeve implementation
|
||||
export interface IPlayer {
|
||||
augmentations: IPlayerOwnedAugmentation[];
|
||||
companyName: string;
|
||||
factions: string[];
|
||||
jobs: IMap<string>;
|
||||
money: any;
|
||||
queuedAugmentations: IPlayerOwnedAugmentation[];
|
||||
|
||||
hacking_skill: number;
|
||||
strength: number;
|
||||
@ -23,6 +26,13 @@ export interface IPlayer {
|
||||
charisma: number;
|
||||
intelligence: number;
|
||||
|
||||
hacking_exp: number;
|
||||
strength_exp: number;
|
||||
defense_exp: number;
|
||||
dexterity_exp: number;
|
||||
agility_exp: number;
|
||||
charisma_exp: number;
|
||||
|
||||
crime_success_mult: number;
|
||||
|
||||
gainHackingExp(exp: number): void;
|
||||
@ -33,6 +43,7 @@ export interface IPlayer {
|
||||
gainCharismaExp(exp: number): void;
|
||||
gainMoney(money: number): void;
|
||||
loseMoney(money: number): void;
|
||||
reapplyAllAugmentations(resetMultipliers: boolean): void;
|
||||
startCrime(crimeType: string,
|
||||
hackExp: number,
|
||||
strExp: number,
|
||||
@ -83,7 +94,7 @@ export abstract class Person {
|
||||
max_hp: number = 10;
|
||||
|
||||
/**
|
||||
* Multipliers
|
||||
* Experience
|
||||
*/
|
||||
hacking_exp: number = 0;
|
||||
strength_exp: number = 0;
|
||||
@ -93,6 +104,9 @@ export abstract class Person {
|
||||
charisma_exp: number = 0;
|
||||
intelligence_exp: number = 0;
|
||||
|
||||
/**
|
||||
* Multipliers
|
||||
*/
|
||||
hacking_mult: number = 1;
|
||||
strength_mult: number = 1;
|
||||
defense_mult: number = 1;
|
||||
@ -107,6 +121,11 @@ export abstract class Person {
|
||||
agility_exp_mult: number = 1;
|
||||
charisma_exp_mult: number = 1;
|
||||
|
||||
hacking_chance_mult: number = 1;
|
||||
hacking_speed_mult: number = 1;
|
||||
hacking_money_mult: number = 1;
|
||||
hacking_grow_mult: number = 1;
|
||||
|
||||
company_rep_mult: number = 1;
|
||||
faction_rep_mult: number = 1;
|
||||
|
||||
|
10
src/PersonObjects/Resleeving/README.md
Normal file
10
src/PersonObjects/Resleeving/README.md
Normal file
@ -0,0 +1,10 @@
|
||||
Implements the Re-sleeving feature, which allows players to purchase a new body
|
||||
that comes with pre-existing Augmentations and experience. Note that purchasing
|
||||
a new body causes you to lose all of your old Augmentations and experience
|
||||
|
||||
This feature is introduced in BitNode-10, and destroying BitNode-10 allows
|
||||
the user to use it in other BitNodes (provided that they purchase the required
|
||||
cortical stack Augmentation)
|
||||
|
||||
While they are based on the same concept, this feature is different than the
|
||||
"Sleeve" mechanic.
|
45
src/PersonObjects/Resleeving/Resleeve.ts
Normal file
45
src/PersonObjects/Resleeving/Resleeve.ts
Normal file
@ -0,0 +1,45 @@
|
||||
/**
|
||||
* Implements the Resleeve class, which defines a new body
|
||||
* that the player can "re-sleeve" into.
|
||||
*/
|
||||
import { Person } from "../Person";
|
||||
|
||||
import { Augmentation } from "../../Augmentation/Augmentation";
|
||||
import { Augmentations } from "../../Augmentation/Augmentations";
|
||||
import { CONSTANTS } from "../../Constants";
|
||||
|
||||
export class Resleeve extends Person {
|
||||
constructor() {
|
||||
super();
|
||||
}
|
||||
|
||||
getCost(): number {
|
||||
// Each experience point adds this to the cost
|
||||
const CostPerExp: number = 5;
|
||||
|
||||
// Final cost is multiplied by # Augs ^ this constant
|
||||
const NumAugsExponent: number = 1.05;
|
||||
|
||||
// Get total exp in this re-sleeve
|
||||
let totalExp: number = this.hacking_exp +
|
||||
this.strength_exp +
|
||||
this.defense_exp +
|
||||
this.dexterity_exp +
|
||||
this.agility_exp +
|
||||
this.charisma_exp;
|
||||
|
||||
// Get total base Augmentation cost for this re-sleeve
|
||||
let totalAugmentationCost: number = 0;
|
||||
for (let i = 0; i < this.augmentations.length; ++i) {
|
||||
const aug: Augmentation | null = Augmentations[this.augmentations[i]];
|
||||
if (aug == null) {
|
||||
console.error(`Could not find Augmentation ${this.augmentations[i]}`);
|
||||
continue;
|
||||
}
|
||||
totalAugmentationCost += aug!.baseCost;
|
||||
}
|
||||
|
||||
return (totalExp * CostPerExp) + (totalAugmentationCost * Math.pow(this.augmentations.length, NumAugsExponent));
|
||||
}
|
||||
|
||||
}
|
74
src/PersonObjects/Resleeving/Resleeving.ts
Normal file
74
src/PersonObjects/Resleeving/Resleeving.ts
Normal file
@ -0,0 +1,74 @@
|
||||
/**
|
||||
* Implements the Re-sleeving mechanic for BitNode-10.
|
||||
* This allows the player to purchase and "use" new sleeves at VitaLife.
|
||||
* These new sleeves come with different starting experience and Augmentations
|
||||
* The cost of these new sleeves scales based on the exp and Augs.
|
||||
*
|
||||
* Note that this is different from the "Sleeve mechanic". The "Sleeve" mechanic
|
||||
* provides new sleeves, essentially clones. This Re-sleeving mechanic lets
|
||||
* the player purchase a new body with pre-existing Augmentations and experience
|
||||
*
|
||||
* As of right now, this feature is only available in BitNode 10
|
||||
*/
|
||||
import { Resleeve } from "./Resleeve";
|
||||
import { IPlayer } from "../Person";
|
||||
|
||||
import { Augmentation } from "../../Augmentation/Augmentation";
|
||||
import { Augmentations } from "../../Augmentation/Augmentations";
|
||||
import { PlayerOwnedAugmentation } from "../../Augmentation/PlayerOwnedAugmentation";
|
||||
|
||||
import { getRandomInt } from "../../../utils/helpers/getRandomInt";
|
||||
|
||||
|
||||
// Executes the actual re-sleeve when one is purchased
|
||||
export function resleeve(r: Resleeve, p: IPlayer) {
|
||||
// Set the player's exp
|
||||
p.hacking_exp = r.hacking_exp;
|
||||
p.strength_exp = r.strength_exp;
|
||||
p.defense_exp = r.defense_exp;
|
||||
p.dexterity_exp = r.dexterity_exp;
|
||||
p.agility_exp = r.agility_exp;
|
||||
p.charisma_exp = r.charisma_exp;
|
||||
|
||||
// Clear all of the player's augmentations, including those that are
|
||||
// purchased but not installed
|
||||
p.queuedAugmentations.length = 0;
|
||||
p.augmentations.length = 0;
|
||||
|
||||
for (let i = 0; i < r.augmentations.length; ++i) {
|
||||
p.augmentations.push(new PlayerOwnedAugmentation(r.augmentations[i]));
|
||||
}
|
||||
|
||||
p.reapplyAllAugmentations(true);
|
||||
}
|
||||
|
||||
// Creates all of the Re-sleeves that will be available for purchase at VitaLife
|
||||
export function generateResleeves(): Resleeve[] {
|
||||
const NumResleeves: number = 40; // Total number of Resleeves to generate
|
||||
|
||||
let ret: Resleeve[] = [];
|
||||
for (let i = 0; i < NumResleeves; ++i) {
|
||||
// i will be a number indicating how "powerful" the Re-sleeve should be
|
||||
let r: Resleeve = new Resleeve();
|
||||
|
||||
// Generate experience
|
||||
const expMult: number = i + 1;
|
||||
r.hacking_exp = expMult * getRandomInt(500, 1500);
|
||||
r.strength_exp = expMult * getRandomInt(500, 1500);
|
||||
r.defense_exp = expMult * getRandomInt(500, 1500);
|
||||
r.dexterity_exp = expMult * getRandomInt(500, 1500);
|
||||
r.agility_exp = expMult * getRandomInt(500, 1500);
|
||||
r.charisma_exp = expMult * getRandomInt(500, 1500);
|
||||
|
||||
// Generate Augs
|
||||
const baseNumAugs: number = Math.ceil((i + 1) / 2);
|
||||
const numAugs: number = getRandomInt(baseNumAugs, baseNumAugs + 2);
|
||||
for (let a = 0; a < numAugs; ++a) {
|
||||
const augKeys: string[] = Object.keys(Augmentations);
|
||||
|
||||
r.augmentations.push(TODO);
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
@ -13,7 +13,7 @@ import { Person,
|
||||
ITaskTracker,
|
||||
createTaskTracker } from "../Person";
|
||||
|
||||
import { BitNodeMultipliers } from "../../BitNodeMultipliers";
|
||||
import { BitNodeMultipliers } from "../../BitNode/BitNodeMultipliers";
|
||||
|
||||
import { Crime } from "../../Crime/Crime";
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
import { Augmentations,
|
||||
applyAugmentation,
|
||||
AugmentationNames,
|
||||
PlayerOwnedAugmentation } from "./Augmentations";
|
||||
import { BitNodeMultipliers } from "./BitNodeMultipliers";
|
||||
import { Augmentations } from "./Augmentation/Augmentations";
|
||||
import { applyAugmentation } from "./Augmentation/AugmentationHelpers";
|
||||
import { PlayerOwnedAugmentation } from "./Augmentation/PlayerOwnedAugmentation";
|
||||
import { AugmentationNames } from "./Augmentation/data/AugmentationNames";
|
||||
import { BitNodeMultipliers } from "./BitNode/BitNodeMultipliers";
|
||||
import { CodingContractRewardType } from "./CodingContracts";
|
||||
import { Company } from "./Company/Company";
|
||||
import { Companies } from "./Company/Companies";
|
||||
|
@ -1,7 +1,9 @@
|
||||
import {deleteActiveScriptsItem} from "./ActiveScriptsUI";
|
||||
import {Augmentations, augmentationExists,
|
||||
initAugmentations, AugmentationNames} from "./Augmentations";
|
||||
import {initBitNodeMultipliers} from "./BitNode";
|
||||
import { Augmentations } from "./Augmentation/Augmentations";
|
||||
import { augmentationExists,
|
||||
initAugmentations } from "./Augmentation/AugmentationHelpers";
|
||||
import { AugmentationNames } from "./Augmentation/data/AugmentationNames";
|
||||
import { initBitNodeMultipliers } from "./BitNode/BitNode";
|
||||
import {Bladeburner} from "./Bladeburner";
|
||||
import {writeCinematicText} from "./CinematicText";
|
||||
import {Companies, initCompanies} from "./Company/Companies";
|
||||
|
@ -1,10 +1,11 @@
|
||||
import {BitNodes} from "./BitNode";
|
||||
import {Engine} from "./engine";
|
||||
import {Player} from "./Player";
|
||||
import {prestigeSourceFile} from "./Prestige";
|
||||
import {SourceFiles, SourceFile,
|
||||
PlayerOwnedSourceFile} from "./SourceFile";
|
||||
import {Terminal} from "./Terminal";
|
||||
import { BitNodes } from "./BitNode/BitNode";
|
||||
import { Engine } from "./engine";
|
||||
import { Player } from "./Player";
|
||||
import { prestigeSourceFile } from "./Prestige";
|
||||
import { SourceFiles,
|
||||
SourceFile,
|
||||
PlayerOwnedSourceFile } from "./SourceFile";
|
||||
import { Terminal } from "./Terminal";
|
||||
|
||||
import {clearEventListeners} from "../utils/uiHelpers/clearEventListeners";
|
||||
import {dialogBoxCreate} from "../utils/DialogBox";
|
||||
@ -56,7 +57,7 @@ function hackWorldDaemon(currentNodeNumber, flume=false) {
|
||||
// Clear Red Pill screen first
|
||||
var container = document.getElementById("red-pill-content");
|
||||
removeChildrenFromElement(container);
|
||||
|
||||
|
||||
redPillFlag = true;
|
||||
Engine.loadRedPillContent();
|
||||
return writeRedPillLine("[ERROR] SEMPOOL INVALID").then(function() {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { BitNodeMultipliers } from "./BitNodeMultipliers";
|
||||
import { BitNodeMultipliers } from "./BitNode/BitNodeMultipliers";
|
||||
import { CodingContract,
|
||||
ContractTypes } from "./CodingContracts";
|
||||
import { CONSTANTS } from "./Constants";
|
||||
|
@ -1,5 +1,5 @@
|
||||
import {Player} from "./Player";
|
||||
import {BitNodes} from "./BitNode";
|
||||
import { Player } from "./Player";
|
||||
import { BitNodes } from "./BitNode/BitNode";
|
||||
|
||||
/* SourceFile.js */
|
||||
//Each SourceFile corresponds to a BitNode with the same number
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { dialogBoxCreate} from "../utils/DialogBox";
|
||||
import { dialogBoxCreate} from "../utils/DialogBox";
|
||||
import { gameOptionsBoxClose,
|
||||
gameOptionsBoxOpen} from "../utils/GameOptions";
|
||||
gameOptionsBoxOpen } from "../utils/GameOptions";
|
||||
import { getRandomInt } from "../utils/helpers/getRandomInt";
|
||||
import { removeChildrenFromElement } from "../utils/uiHelpers/removeChildrenFromElement";
|
||||
import { clearEventListeners } from "../utils/uiHelpers/clearEventListeners";
|
||||
@ -17,12 +17,15 @@ import {formatNumber,
|
||||
import {loxBoxCreate, logBoxUpdateText,
|
||||
logBoxOpened} from "../utils/LogBox";
|
||||
import {updateActiveScriptsItems} from "./ActiveScriptsUI";
|
||||
import {Augmentations, installAugmentations,
|
||||
initAugmentations, AugmentationNames,
|
||||
displayAugmentationsContent,
|
||||
PlayerOwnedAugmentation} from "./Augmentations";
|
||||
import { Augmentations } from "./Augmentation/Augmentations";
|
||||
import { installAugmentations,
|
||||
initAugmentations,
|
||||
displayAugmentationsContent,
|
||||
PlayerOwnedAugmentation } from "./Augmentation/AugmentationHelpers";
|
||||
import { AugmentationNames } from "./Augmentation/data/AugmentationNames";
|
||||
|
||||
import {BitNodes, initBitNodes,
|
||||
initBitNodeMultipliers} from "./BitNode";
|
||||
initBitNodeMultipliers} from "./BitNode/BitNode";
|
||||
import {Bladeburner} from "./Bladeburner";
|
||||
import {CharacterOverview} from "./CharacterOverview";
|
||||
import {cinematicTextFlag} from "./CinematicText";
|
||||
|
@ -1,11 +1,12 @@
|
||||
import { BitNodeMultipliers } from "../src/BitNodeMultipliers";
|
||||
import { dialogBoxCreate } from "./DialogBox";
|
||||
import { clearEventListeners } from "./uiHelpers/clearEventListeners";
|
||||
import { formatNumber } from "./StringHelperFunctions";
|
||||
|
||||
import { BitNodeMultipliers } from "../src/BitNode/BitNodeMultipliers";
|
||||
import { CONSTANTS } from "../src/Constants";
|
||||
import { Faction } from "../src/Faction/Faction";
|
||||
import { Factions } from "../src/Faction/Factions";
|
||||
import { Player } from "../src/Player";
|
||||
import { dialogBoxCreate } from "./DialogBox";
|
||||
import { clearEventListeners } from "./uiHelpers/clearEventListeners";
|
||||
import { formatNumber } from "./StringHelperFunctions";
|
||||
|
||||
//Keep track of last faction
|
||||
var lastFac = "";
|
||||
|
Loading…
Reference in New Issue
Block a user