2019-01-15 14:11:14 +01:00
|
|
|
// Class definition for a single Augmentation object
|
2021-08-15 06:24:31 +02:00
|
|
|
import * as React from "react";
|
2019-01-15 14:11:14 +01:00
|
|
|
|
|
|
|
import { Faction } from "../Faction/Faction";
|
|
|
|
import { Factions } from "../Faction/Factions";
|
2021-08-15 06:24:31 +02:00
|
|
|
import { numeralWrapper } from "../ui/numeralFormat";
|
|
|
|
import { Money } from "../ui/React/Money";
|
2019-01-15 14:11:14 +01:00
|
|
|
|
2022-07-15 01:00:10 +02:00
|
|
|
import { Generic_fromJSON, Generic_toJSON, IReviverValue, Reviver } from "../utils/JSONReviver";
|
2022-03-27 06:26:43 +02:00
|
|
|
import { FactionNames } from "../Faction/data/FactionNames";
|
2022-04-14 19:39:38 +02:00
|
|
|
import { IPlayer } from "../PersonObjects/IPlayer";
|
|
|
|
import { AugmentationNames } from "./data/AugmentationNames";
|
|
|
|
import { CONSTANTS } from "../Constants";
|
|
|
|
import { StaticAugmentations } from "./StaticAugmentations";
|
|
|
|
import { BitNodeMultipliers } from "../BitNode/BitNodeMultipliers";
|
|
|
|
import { getBaseAugmentationPriceMultiplier, getGenericAugmentationPriceMultiplier } from "./AugmentationHelpers";
|
2022-04-23 04:34:41 +02:00
|
|
|
import { initSoAAugmentations } from "./data/AugmentationCreator";
|
2022-07-15 00:43:33 +02:00
|
|
|
import { Multipliers, defaultMultipliers } from "../PersonObjects/Multipliers";
|
2022-04-14 19:39:38 +02:00
|
|
|
|
|
|
|
export interface AugmentationCosts {
|
|
|
|
moneyCost: number;
|
|
|
|
repCost: number;
|
|
|
|
}
|
2019-01-15 14:11:14 +01:00
|
|
|
|
2021-09-24 22:02:38 +02:00
|
|
|
export interface IConstructorParams {
|
2021-09-05 01:09:30 +02:00
|
|
|
info: string | JSX.Element;
|
2021-09-25 07:06:17 +02:00
|
|
|
stats?: JSX.Element | null;
|
2021-09-05 01:09:30 +02:00
|
|
|
isSpecial?: boolean;
|
|
|
|
moneyCost: number;
|
|
|
|
name: string;
|
|
|
|
prereqs?: string[];
|
|
|
|
repCost: number;
|
2022-03-19 05:15:24 +01:00
|
|
|
factions: string[];
|
2021-09-05 01:09:30 +02:00
|
|
|
|
2022-07-15 00:43:33 +02:00
|
|
|
hacking?: number;
|
|
|
|
strength?: number;
|
|
|
|
defense?: number;
|
|
|
|
dexterity?: number;
|
|
|
|
agility?: number;
|
|
|
|
charisma?: number;
|
|
|
|
hacking_exp?: number;
|
|
|
|
strength_exp?: number;
|
|
|
|
defense_exp?: number;
|
|
|
|
dexterity_exp?: number;
|
|
|
|
agility_exp?: number;
|
|
|
|
charisma_exp?: number;
|
|
|
|
hacking_chance?: number;
|
|
|
|
hacking_speed?: number;
|
|
|
|
hacking_money?: number;
|
|
|
|
hacking_grow?: number;
|
|
|
|
company_rep?: number;
|
|
|
|
faction_rep?: number;
|
|
|
|
crime_money?: number;
|
|
|
|
crime_success?: number;
|
|
|
|
work_money?: number;
|
|
|
|
hacknet_node_money?: number;
|
|
|
|
hacknet_node_purchase_cost?: number;
|
|
|
|
hacknet_node_ram_cost?: number;
|
|
|
|
hacknet_node_core_cost?: number;
|
|
|
|
hacknet_node_level_cost?: number;
|
|
|
|
bladeburner_max_stamina?: number;
|
|
|
|
bladeburner_stamina_gain?: number;
|
|
|
|
bladeburner_analysis?: number;
|
|
|
|
bladeburner_success_chance?: number;
|
2022-03-27 06:26:43 +02:00
|
|
|
infiltration_base_rep_increase?: number;
|
2022-07-15 00:43:33 +02:00
|
|
|
infiltration_rep?: number;
|
|
|
|
infiltration_trade?: number;
|
|
|
|
infiltration_sell?: number;
|
|
|
|
infiltration_timer?: number;
|
|
|
|
infiltration_damage_reduction?: number;
|
2021-09-05 01:09:30 +02:00
|
|
|
|
|
|
|
startingMoney?: number;
|
|
|
|
programs?: string[];
|
2021-08-15 06:24:31 +02:00
|
|
|
}
|
|
|
|
|
2022-07-15 00:43:33 +02:00
|
|
|
function generateStatsDescription(mults: Multipliers, programs?: string[], startingMoney?: number): JSX.Element {
|
2021-09-05 01:09:30 +02:00
|
|
|
const f = (x: number, decimals = 0): string => {
|
|
|
|
// look, I don't know how to make a "smart decimals"
|
|
|
|
// todo, make it smarter
|
|
|
|
if (x === 1.0777 - 1) return "7.77%";
|
|
|
|
if (x === 1.777 - 1) return "77.7%";
|
|
|
|
return numeralWrapper.formatPercentage(x, decimals);
|
|
|
|
};
|
|
|
|
let desc = <>Effects:</>;
|
|
|
|
|
|
|
|
if (
|
2022-07-15 00:43:33 +02:00
|
|
|
mults.hacking !== 1 &&
|
|
|
|
mults.hacking == mults.strength &&
|
|
|
|
mults.hacking == mults.defense &&
|
|
|
|
mults.hacking == mults.dexterity &&
|
|
|
|
mults.hacking == mults.agility &&
|
|
|
|
mults.hacking == mults.charisma
|
2021-09-05 01:09:30 +02:00
|
|
|
) {
|
|
|
|
desc = (
|
|
|
|
<>
|
|
|
|
{desc}
|
2022-07-15 00:43:33 +02:00
|
|
|
<br />+{f(mults.hacking - 1)} all skills
|
2021-09-05 01:09:30 +02:00
|
|
|
</>
|
|
|
|
);
|
|
|
|
} else {
|
2022-07-15 00:43:33 +02:00
|
|
|
if (mults.hacking !== 1)
|
2021-09-05 01:09:30 +02:00
|
|
|
desc = (
|
|
|
|
<>
|
|
|
|
{desc}
|
2022-07-15 00:43:33 +02:00
|
|
|
<br />+{f(mults.hacking - 1)} hacking skill
|
2021-09-05 01:09:30 +02:00
|
|
|
</>
|
|
|
|
);
|
|
|
|
|
|
|
|
if (
|
2022-07-15 00:43:33 +02:00
|
|
|
mults.strength !== 1 &&
|
|
|
|
mults.strength == mults.defense &&
|
|
|
|
mults.strength == mults.dexterity &&
|
|
|
|
mults.strength == mults.agility
|
2021-09-05 01:09:30 +02:00
|
|
|
) {
|
|
|
|
desc = (
|
|
|
|
<>
|
|
|
|
{desc}
|
2022-07-15 00:43:33 +02:00
|
|
|
<br />+{f(mults.strength - 1)} combat skills
|
2021-09-05 01:09:30 +02:00
|
|
|
</>
|
|
|
|
);
|
2021-08-15 06:24:31 +02:00
|
|
|
} else {
|
2022-07-15 00:43:33 +02:00
|
|
|
if (mults.strength !== 1)
|
2021-09-05 01:09:30 +02:00
|
|
|
desc = (
|
|
|
|
<>
|
|
|
|
{desc}
|
2022-07-15 00:43:33 +02:00
|
|
|
<br />+{f(mults.strength - 1)} strength skill
|
2021-09-05 01:09:30 +02:00
|
|
|
</>
|
|
|
|
);
|
2022-07-15 00:43:33 +02:00
|
|
|
if (mults.defense !== 1)
|
2021-09-05 01:09:30 +02:00
|
|
|
desc = (
|
|
|
|
<>
|
|
|
|
{desc}
|
2022-07-15 00:43:33 +02:00
|
|
|
<br />+{f(mults.defense - 1)} defense skill
|
2021-09-05 01:09:30 +02:00
|
|
|
</>
|
|
|
|
);
|
2022-07-15 00:43:33 +02:00
|
|
|
if (mults.dexterity !== 1)
|
2021-09-05 01:09:30 +02:00
|
|
|
desc = (
|
|
|
|
<>
|
|
|
|
{desc}
|
2022-07-15 00:43:33 +02:00
|
|
|
<br />+{f(mults.dexterity - 1)} dexterity skill
|
2021-09-05 01:09:30 +02:00
|
|
|
</>
|
|
|
|
);
|
2022-07-15 00:43:33 +02:00
|
|
|
if (mults.agility !== 1)
|
2021-09-05 01:09:30 +02:00
|
|
|
desc = (
|
|
|
|
<>
|
|
|
|
{desc}
|
2022-07-15 00:43:33 +02:00
|
|
|
<br />+{f(mults.agility - 1)} agility skill
|
2021-09-05 01:09:30 +02:00
|
|
|
</>
|
|
|
|
);
|
2021-08-15 06:24:31 +02:00
|
|
|
}
|
2022-07-15 00:43:33 +02:00
|
|
|
if (mults.charisma !== 1)
|
2021-09-05 01:09:30 +02:00
|
|
|
desc = (
|
|
|
|
<>
|
|
|
|
{desc}
|
2022-07-15 00:43:33 +02:00
|
|
|
<br />+{f(mults.charisma - 1)} charisma skill
|
2021-09-05 01:09:30 +02:00
|
|
|
</>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (
|
2022-07-15 00:43:33 +02:00
|
|
|
mults.hacking_exp !== 1 &&
|
|
|
|
mults.hacking_exp === mults.strength_exp &&
|
|
|
|
mults.hacking_exp === mults.defense_exp &&
|
|
|
|
mults.hacking_exp === mults.dexterity_exp &&
|
|
|
|
mults.hacking_exp === mults.agility_exp &&
|
|
|
|
mults.hacking_exp === mults.charisma_exp
|
2021-09-05 01:09:30 +02:00
|
|
|
) {
|
|
|
|
desc = (
|
|
|
|
<>
|
|
|
|
{desc}
|
2022-07-15 00:43:33 +02:00
|
|
|
<br />+{f(mults.hacking_exp - 1)} exp for all skills
|
2021-09-05 01:09:30 +02:00
|
|
|
</>
|
|
|
|
);
|
|
|
|
} else {
|
2022-07-15 00:43:33 +02:00
|
|
|
if (mults.hacking_exp !== 1)
|
2021-09-05 01:09:30 +02:00
|
|
|
desc = (
|
|
|
|
<>
|
|
|
|
{desc}
|
2022-07-15 00:43:33 +02:00
|
|
|
<br />+{f(mults.hacking_exp - 1)} hacking exp
|
2021-09-05 01:09:30 +02:00
|
|
|
</>
|
|
|
|
);
|
|
|
|
|
|
|
|
if (
|
2022-07-15 00:43:33 +02:00
|
|
|
mults.strength_exp !== 1 &&
|
|
|
|
mults.strength_exp === mults.defense_exp &&
|
|
|
|
mults.strength_exp === mults.dexterity_exp &&
|
|
|
|
mults.strength_exp === mults.agility_exp
|
2021-09-05 01:09:30 +02:00
|
|
|
) {
|
|
|
|
desc = (
|
|
|
|
<>
|
|
|
|
{desc}
|
2022-07-15 00:43:33 +02:00
|
|
|
<br />+{f(mults.strength_exp - 1)} combat exp
|
2021-09-05 01:09:30 +02:00
|
|
|
</>
|
|
|
|
);
|
2021-08-15 06:24:31 +02:00
|
|
|
} else {
|
2022-07-15 00:43:33 +02:00
|
|
|
if (mults.strength_exp !== 1)
|
2021-09-05 01:09:30 +02:00
|
|
|
desc = (
|
|
|
|
<>
|
|
|
|
{desc}
|
2022-07-15 00:43:33 +02:00
|
|
|
<br />+{f(mults.strength_exp - 1)} strength exp
|
2021-09-05 01:09:30 +02:00
|
|
|
</>
|
|
|
|
);
|
2022-07-15 00:43:33 +02:00
|
|
|
if (mults.defense_exp !== 1)
|
2021-09-05 01:09:30 +02:00
|
|
|
desc = (
|
|
|
|
<>
|
|
|
|
{desc}
|
2022-07-15 00:43:33 +02:00
|
|
|
<br />+{f(mults.defense_exp - 1)} defense exp
|
2021-09-05 01:09:30 +02:00
|
|
|
</>
|
|
|
|
);
|
2022-07-15 00:43:33 +02:00
|
|
|
if (mults.dexterity_exp !== 1)
|
2021-09-05 01:09:30 +02:00
|
|
|
desc = (
|
|
|
|
<>
|
|
|
|
{desc}
|
2022-07-15 00:43:33 +02:00
|
|
|
<br />+{f(mults.dexterity_exp - 1)} dexterity exp
|
2021-09-05 01:09:30 +02:00
|
|
|
</>
|
|
|
|
);
|
2022-07-15 00:43:33 +02:00
|
|
|
if (mults.agility_exp !== 1)
|
2021-09-05 01:09:30 +02:00
|
|
|
desc = (
|
|
|
|
<>
|
|
|
|
{desc}
|
2022-07-15 00:43:33 +02:00
|
|
|
<br />+{f(mults.agility_exp - 1)} agility exp
|
2021-09-05 01:09:30 +02:00
|
|
|
</>
|
|
|
|
);
|
|
|
|
}
|
2022-07-15 00:43:33 +02:00
|
|
|
if (mults.charisma_exp !== 1)
|
2021-09-05 01:09:30 +02:00
|
|
|
desc = (
|
|
|
|
<>
|
|
|
|
{desc}
|
2022-07-15 00:43:33 +02:00
|
|
|
<br />+{f(mults.charisma_exp - 1)} charisma exp
|
2021-09-05 01:09:30 +02:00
|
|
|
</>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2022-07-15 00:43:33 +02:00
|
|
|
if (mults.hacking_speed !== 1)
|
2021-09-05 01:09:30 +02:00
|
|
|
desc = (
|
|
|
|
<>
|
|
|
|
{desc}
|
2022-07-15 00:43:33 +02:00
|
|
|
<br />+{f(mults.hacking_speed - 1)} faster hack(), grow(), and weaken()
|
2021-09-05 01:09:30 +02:00
|
|
|
</>
|
|
|
|
);
|
2022-07-15 00:43:33 +02:00
|
|
|
if (mults.hacking_chance !== 1)
|
2021-09-05 01:09:30 +02:00
|
|
|
desc = (
|
|
|
|
<>
|
|
|
|
{desc}
|
2022-07-15 00:43:33 +02:00
|
|
|
<br />+{f(mults.hacking_chance - 1)} hack() success chance
|
2021-09-05 01:09:30 +02:00
|
|
|
</>
|
|
|
|
);
|
2022-07-15 00:43:33 +02:00
|
|
|
if (mults.hacking_money !== 1)
|
2021-09-05 01:09:30 +02:00
|
|
|
desc = (
|
|
|
|
<>
|
|
|
|
{desc}
|
2022-07-15 00:43:33 +02:00
|
|
|
<br />+{f(mults.hacking_money - 1)} hack() power
|
2021-09-05 01:09:30 +02:00
|
|
|
</>
|
|
|
|
);
|
2022-07-15 00:43:33 +02:00
|
|
|
if (mults.hacking_grow !== 1)
|
2021-09-05 01:09:30 +02:00
|
|
|
desc = (
|
|
|
|
<>
|
|
|
|
{desc}
|
2022-07-15 00:43:33 +02:00
|
|
|
<br />+{f(mults.hacking_grow - 1)} grow() power
|
2021-09-05 01:09:30 +02:00
|
|
|
</>
|
|
|
|
);
|
|
|
|
|
2022-07-15 00:43:33 +02:00
|
|
|
if (mults.faction_rep !== 1 && mults.faction_rep === mults.company_rep) {
|
2021-09-05 01:09:30 +02:00
|
|
|
desc = (
|
|
|
|
<>
|
|
|
|
{desc}
|
2022-07-15 00:43:33 +02:00
|
|
|
<br />+{f(mults.faction_rep - 1)} reputation from factions and companies
|
2021-09-05 01:09:30 +02:00
|
|
|
</>
|
|
|
|
);
|
|
|
|
} else {
|
2022-07-15 00:43:33 +02:00
|
|
|
if (mults.faction_rep !== 1)
|
2021-09-05 01:09:30 +02:00
|
|
|
desc = (
|
|
|
|
<>
|
|
|
|
{desc}
|
2022-07-15 00:43:33 +02:00
|
|
|
<br />+{f(mults.faction_rep - 1)} reputation from factions
|
2021-09-05 01:09:30 +02:00
|
|
|
</>
|
|
|
|
);
|
2022-07-15 00:43:33 +02:00
|
|
|
if (mults.company_rep !== 1)
|
2021-09-05 01:09:30 +02:00
|
|
|
desc = (
|
|
|
|
<>
|
|
|
|
{desc}
|
2022-07-15 00:43:33 +02:00
|
|
|
<br />+{f(mults.company_rep - 1)} reputation from companies
|
2021-09-05 01:09:30 +02:00
|
|
|
</>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2022-07-15 00:43:33 +02:00
|
|
|
if (mults.crime_money !== 1)
|
2021-09-05 01:09:30 +02:00
|
|
|
desc = (
|
|
|
|
<>
|
|
|
|
{desc}
|
2022-07-15 00:43:33 +02:00
|
|
|
<br />+{f(mults.crime_money - 1)} crime money
|
2021-09-05 01:09:30 +02:00
|
|
|
</>
|
|
|
|
);
|
2022-07-15 00:43:33 +02:00
|
|
|
if (mults.crime_success !== 1)
|
2021-09-05 01:09:30 +02:00
|
|
|
desc = (
|
|
|
|
<>
|
|
|
|
{desc}
|
2022-07-15 00:43:33 +02:00
|
|
|
<br />+{f(mults.crime_success - 1)} crime success rate
|
2021-09-05 01:09:30 +02:00
|
|
|
</>
|
|
|
|
);
|
2022-07-15 00:43:33 +02:00
|
|
|
if (mults.work_money !== 1)
|
2021-09-05 01:09:30 +02:00
|
|
|
desc = (
|
|
|
|
<>
|
|
|
|
{desc}
|
2022-07-15 00:43:33 +02:00
|
|
|
<br />+{f(mults.work_money - 1)} work money
|
2021-09-05 01:09:30 +02:00
|
|
|
</>
|
|
|
|
);
|
|
|
|
|
2022-07-15 00:43:33 +02:00
|
|
|
if (mults.hacknet_node_money !== 1)
|
2021-09-05 01:09:30 +02:00
|
|
|
desc = (
|
|
|
|
<>
|
|
|
|
{desc}
|
2022-07-15 00:43:33 +02:00
|
|
|
<br />+{f(mults.hacknet_node_money - 1)} hacknet production
|
2021-09-05 01:09:30 +02:00
|
|
|
</>
|
|
|
|
);
|
2022-07-15 00:43:33 +02:00
|
|
|
if (mults.hacknet_node_purchase_cost !== 1)
|
2021-09-05 01:09:30 +02:00
|
|
|
desc = (
|
|
|
|
<>
|
|
|
|
{desc}
|
2022-07-15 00:43:33 +02:00
|
|
|
<br />-{f(-(mults.hacknet_node_purchase_cost - 1))} hacknet nodes cost
|
2021-09-05 01:09:30 +02:00
|
|
|
</>
|
|
|
|
);
|
2022-07-15 00:43:33 +02:00
|
|
|
if (mults.hacknet_node_level_cost !== 1)
|
2021-09-05 01:09:30 +02:00
|
|
|
desc = (
|
|
|
|
<>
|
|
|
|
{desc}
|
2022-07-15 00:43:33 +02:00
|
|
|
<br />-{f(-(mults.hacknet_node_level_cost - 1))} hacknet nodes upgrade cost
|
2021-09-05 01:09:30 +02:00
|
|
|
</>
|
|
|
|
);
|
|
|
|
|
2022-07-15 00:43:33 +02:00
|
|
|
if (mults.bladeburner_max_stamina !== 1)
|
2021-09-05 01:09:30 +02:00
|
|
|
desc = (
|
|
|
|
<>
|
|
|
|
{desc}
|
2022-07-15 00:43:33 +02:00
|
|
|
<br />+{f(mults.bladeburner_max_stamina - 1)} Bladeburner Max Stamina
|
2021-09-05 01:09:30 +02:00
|
|
|
</>
|
|
|
|
);
|
2022-07-15 00:43:33 +02:00
|
|
|
if (mults.bladeburner_stamina_gain !== 1)
|
2021-09-05 01:09:30 +02:00
|
|
|
desc = (
|
|
|
|
<>
|
|
|
|
{desc}
|
2022-07-15 00:43:33 +02:00
|
|
|
<br />+{f(mults.bladeburner_stamina_gain - 1)} Bladeburner Stamina gain
|
2021-09-05 01:09:30 +02:00
|
|
|
</>
|
|
|
|
);
|
2022-07-15 00:43:33 +02:00
|
|
|
if (mults.bladeburner_analysis !== 1)
|
2021-09-05 01:09:30 +02:00
|
|
|
desc = (
|
|
|
|
<>
|
|
|
|
{desc}
|
2022-07-15 00:43:33 +02:00
|
|
|
<br />+{f(mults.bladeburner_analysis - 1)} Bladeburner Field Analysis effectiveness
|
2021-09-05 01:09:30 +02:00
|
|
|
</>
|
|
|
|
);
|
2022-07-15 00:43:33 +02:00
|
|
|
if (mults.bladeburner_success_chance !== 1)
|
2021-09-05 01:09:30 +02:00
|
|
|
desc = (
|
|
|
|
<>
|
|
|
|
{desc}
|
2022-07-15 00:43:33 +02:00
|
|
|
<br />+{f(mults.bladeburner_success_chance - 1)} Bladeburner Contracts and Operations success chance
|
2021-09-05 01:09:30 +02:00
|
|
|
</>
|
|
|
|
);
|
|
|
|
if (startingMoney)
|
|
|
|
desc = (
|
|
|
|
<>
|
|
|
|
{desc}
|
|
|
|
<br />
|
2021-09-09 05:47:34 +02:00
|
|
|
Start with <Money money={startingMoney} /> after installing Augmentations.
|
2021-09-05 01:09:30 +02:00
|
|
|
</>
|
|
|
|
);
|
|
|
|
|
|
|
|
if (programs)
|
|
|
|
desc = (
|
|
|
|
<>
|
|
|
|
{desc}
|
|
|
|
<br />
|
|
|
|
Start with {programs.join(" and ")} after installing Augmentations.
|
|
|
|
</>
|
|
|
|
);
|
|
|
|
return desc;
|
2019-01-15 14:11:14 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
export class Augmentation {
|
2022-04-14 19:39:38 +02:00
|
|
|
// How much money this costs to buy before multipliers
|
2021-09-05 01:09:30 +02:00
|
|
|
baseCost = 0;
|
2019-01-15 14:11:14 +01:00
|
|
|
|
2022-04-14 19:39:38 +02:00
|
|
|
// How much faction reputation is required to unlock this before multipliers
|
2021-09-05 01:09:30 +02:00
|
|
|
baseRepRequirement = 0;
|
2019-01-15 14:11:14 +01:00
|
|
|
|
2021-09-05 01:09:30 +02:00
|
|
|
// Description of what this Aug is and what it does
|
|
|
|
info: string | JSX.Element;
|
2019-01-15 14:11:14 +01:00
|
|
|
|
2021-09-05 01:09:30 +02:00
|
|
|
// Description of the stats, often autogenerated, sometimes manually written.
|
2021-09-25 07:06:17 +02:00
|
|
|
stats: JSX.Element | null;
|
2019-01-15 14:11:14 +01:00
|
|
|
|
2021-09-05 01:09:30 +02:00
|
|
|
// Any Augmentation not immediately available in BitNode-1 is special (e.g. Bladeburner augs)
|
|
|
|
isSpecial = false;
|
2021-08-15 06:24:31 +02:00
|
|
|
|
2021-09-05 01:09:30 +02:00
|
|
|
// Name of Augmentation
|
|
|
|
name = "";
|
2019-01-15 14:11:14 +01:00
|
|
|
|
2021-09-05 01:09:30 +02:00
|
|
|
// Array of names of all prerequisites
|
|
|
|
prereqs: string[] = [];
|
2019-01-15 14:11:14 +01:00
|
|
|
|
2021-09-05 01:09:30 +02:00
|
|
|
// Multipliers given by this Augmentation. Must match the property name in
|
|
|
|
// The Player/Person classes
|
2022-07-15 00:43:33 +02:00
|
|
|
mults: Multipliers = defaultMultipliers();
|
2019-01-15 14:11:14 +01:00
|
|
|
|
2022-03-19 05:15:24 +01:00
|
|
|
// Factions that offer this aug.
|
|
|
|
factions: string[] = [];
|
|
|
|
|
2021-09-05 01:09:30 +02:00
|
|
|
constructor(
|
|
|
|
params: IConstructorParams = {
|
|
|
|
info: "",
|
|
|
|
moneyCost: 0,
|
|
|
|
name: "",
|
|
|
|
repCost: 0,
|
2022-03-19 05:15:24 +01:00
|
|
|
factions: [],
|
2021-09-05 01:09:30 +02:00
|
|
|
},
|
|
|
|
) {
|
|
|
|
this.name = params.name;
|
|
|
|
this.info = params.info;
|
|
|
|
this.prereqs = params.prereqs ? params.prereqs : [];
|
2019-02-09 03:46:30 +01:00
|
|
|
|
2022-04-07 16:39:13 +02:00
|
|
|
this.baseRepRequirement = params.repCost;
|
2022-04-15 05:17:27 +02:00
|
|
|
Object.freeze(this.baseRepRequirement);
|
2022-04-07 16:39:13 +02:00
|
|
|
this.baseCost = params.moneyCost;
|
2022-04-15 05:17:27 +02:00
|
|
|
Object.freeze(this.baseCost);
|
2022-03-19 05:15:24 +01:00
|
|
|
this.factions = params.factions;
|
2019-01-15 14:11:14 +01:00
|
|
|
|
2021-09-05 01:09:30 +02:00
|
|
|
if (params.isSpecial) {
|
|
|
|
this.isSpecial = true;
|
|
|
|
}
|
2019-01-15 14:11:14 +01:00
|
|
|
|
2021-09-05 01:09:30 +02:00
|
|
|
// Set multipliers
|
2022-07-15 00:43:33 +02:00
|
|
|
if (params.hacking) {
|
|
|
|
this.mults.hacking = params.hacking;
|
2021-09-05 01:09:30 +02:00
|
|
|
}
|
2022-07-15 00:43:33 +02:00
|
|
|
if (params.strength) {
|
|
|
|
this.mults.strength = params.strength;
|
2021-09-05 01:09:30 +02:00
|
|
|
}
|
2022-07-15 00:43:33 +02:00
|
|
|
if (params.defense) {
|
|
|
|
this.mults.defense = params.defense;
|
2021-09-05 01:09:30 +02:00
|
|
|
}
|
2022-07-15 00:43:33 +02:00
|
|
|
if (params.dexterity) {
|
|
|
|
this.mults.dexterity = params.dexterity;
|
2021-09-05 01:09:30 +02:00
|
|
|
}
|
2022-07-15 00:43:33 +02:00
|
|
|
if (params.agility) {
|
|
|
|
this.mults.agility = params.agility;
|
2021-09-05 01:09:30 +02:00
|
|
|
}
|
2022-07-15 00:43:33 +02:00
|
|
|
if (params.charisma) {
|
|
|
|
this.mults.charisma = params.charisma;
|
2021-09-05 01:09:30 +02:00
|
|
|
}
|
2022-07-15 00:43:33 +02:00
|
|
|
if (params.hacking_exp) {
|
|
|
|
this.mults.hacking_exp = params.hacking_exp;
|
2021-09-05 01:09:30 +02:00
|
|
|
}
|
2022-07-15 00:43:33 +02:00
|
|
|
if (params.strength_exp) {
|
|
|
|
this.mults.strength_exp = params.strength_exp;
|
2021-09-05 01:09:30 +02:00
|
|
|
}
|
2022-07-15 00:43:33 +02:00
|
|
|
if (params.defense_exp) {
|
|
|
|
this.mults.defense_exp = params.defense_exp;
|
2021-09-05 01:09:30 +02:00
|
|
|
}
|
2022-07-15 00:43:33 +02:00
|
|
|
if (params.dexterity_exp) {
|
|
|
|
this.mults.dexterity_exp = params.dexterity_exp;
|
2021-09-05 01:09:30 +02:00
|
|
|
}
|
2022-07-15 00:43:33 +02:00
|
|
|
if (params.agility_exp) {
|
|
|
|
this.mults.agility_exp = params.agility_exp;
|
2021-09-05 01:09:30 +02:00
|
|
|
}
|
2022-07-15 00:43:33 +02:00
|
|
|
if (params.charisma_exp) {
|
|
|
|
this.mults.charisma_exp = params.charisma_exp;
|
2021-09-05 01:09:30 +02:00
|
|
|
}
|
2022-07-15 00:43:33 +02:00
|
|
|
if (params.hacking_chance) {
|
|
|
|
this.mults.hacking_chance = params.hacking_chance;
|
2021-09-05 01:09:30 +02:00
|
|
|
}
|
2022-07-15 00:43:33 +02:00
|
|
|
if (params.hacking_speed) {
|
|
|
|
this.mults.hacking_speed = params.hacking_speed;
|
2021-09-05 01:09:30 +02:00
|
|
|
}
|
2022-07-15 00:43:33 +02:00
|
|
|
if (params.hacking_money) {
|
|
|
|
this.mults.hacking_money = params.hacking_money;
|
2021-09-05 01:09:30 +02:00
|
|
|
}
|
2022-07-15 00:43:33 +02:00
|
|
|
if (params.hacking_grow) {
|
|
|
|
this.mults.hacking_grow = params.hacking_grow;
|
2021-09-05 01:09:30 +02:00
|
|
|
}
|
2022-07-15 00:43:33 +02:00
|
|
|
if (params.company_rep) {
|
|
|
|
this.mults.company_rep = params.company_rep;
|
2021-09-05 01:09:30 +02:00
|
|
|
}
|
2022-07-15 00:43:33 +02:00
|
|
|
if (params.faction_rep) {
|
|
|
|
this.mults.faction_rep = params.faction_rep;
|
2021-09-05 01:09:30 +02:00
|
|
|
}
|
2022-07-15 00:43:33 +02:00
|
|
|
if (params.crime_money) {
|
|
|
|
this.mults.crime_money = params.crime_money;
|
2021-09-05 01:09:30 +02:00
|
|
|
}
|
2022-07-15 00:43:33 +02:00
|
|
|
if (params.crime_success) {
|
|
|
|
this.mults.crime_success = params.crime_success;
|
2021-09-05 01:09:30 +02:00
|
|
|
}
|
2022-07-15 00:43:33 +02:00
|
|
|
if (params.work_money) {
|
|
|
|
this.mults.work_money = params.work_money;
|
2021-09-05 01:09:30 +02:00
|
|
|
}
|
2022-07-15 00:43:33 +02:00
|
|
|
if (params.hacknet_node_money) {
|
|
|
|
this.mults.hacknet_node_money = params.hacknet_node_money;
|
2021-09-05 01:09:30 +02:00
|
|
|
}
|
2022-07-15 00:43:33 +02:00
|
|
|
if (params.hacknet_node_purchase_cost) {
|
|
|
|
this.mults.hacknet_node_purchase_cost = params.hacknet_node_purchase_cost;
|
2021-09-05 01:09:30 +02:00
|
|
|
}
|
2022-07-15 00:43:33 +02:00
|
|
|
if (params.hacknet_node_ram_cost) {
|
|
|
|
this.mults.hacknet_node_ram_cost = params.hacknet_node_ram_cost;
|
2021-09-05 01:09:30 +02:00
|
|
|
}
|
2022-07-15 00:43:33 +02:00
|
|
|
if (params.hacknet_node_core_cost) {
|
|
|
|
this.mults.hacknet_node_core_cost = params.hacknet_node_core_cost;
|
2022-03-27 06:26:43 +02:00
|
|
|
}
|
2022-07-15 00:43:33 +02:00
|
|
|
if (params.hacknet_node_level_cost) {
|
|
|
|
this.mults.hacknet_node_level_cost = params.hacknet_node_level_cost;
|
2022-03-27 06:26:43 +02:00
|
|
|
}
|
2022-07-15 00:43:33 +02:00
|
|
|
if (params.bladeburner_max_stamina) {
|
|
|
|
this.mults.bladeburner_max_stamina = params.bladeburner_max_stamina;
|
2022-03-27 06:26:43 +02:00
|
|
|
}
|
2022-07-15 00:43:33 +02:00
|
|
|
if (params.bladeburner_stamina_gain) {
|
|
|
|
this.mults.bladeburner_stamina_gain = params.bladeburner_stamina_gain;
|
2022-03-27 06:26:43 +02:00
|
|
|
}
|
2022-07-15 00:43:33 +02:00
|
|
|
if (params.bladeburner_analysis) {
|
|
|
|
this.mults.bladeburner_analysis = params.bladeburner_analysis;
|
2022-03-27 06:26:43 +02:00
|
|
|
}
|
2022-07-15 00:43:33 +02:00
|
|
|
if (params.bladeburner_success_chance) {
|
|
|
|
this.mults.bladeburner_success_chance = params.bladeburner_success_chance;
|
2022-03-27 06:26:43 +02:00
|
|
|
}
|
|
|
|
|
2021-09-25 07:06:17 +02:00
|
|
|
if (params.stats === undefined)
|
|
|
|
this.stats = generateStatsDescription(this.mults, params.programs, params.startingMoney);
|
|
|
|
else this.stats = params.stats;
|
2021-09-05 01:09:30 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// 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) {
|
2021-09-09 05:47:34 +02:00
|
|
|
console.warn(`In Augmentation.addToFactions(), could not find faction with this name: ${factionList[i]}`);
|
2021-09-05 01:09:30 +02:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
faction.augmentations.push(this.name);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-04-14 19:39:38 +02:00
|
|
|
getCost(player: IPlayer): AugmentationCosts {
|
|
|
|
const augmentationReference = StaticAugmentations[this.name];
|
|
|
|
let moneyCost = augmentationReference.baseCost;
|
|
|
|
let repCost = augmentationReference.baseRepRequirement;
|
|
|
|
|
|
|
|
if (augmentationReference.name === AugmentationNames.NeuroFluxGovernor) {
|
|
|
|
let nextLevel = this.getLevel(player);
|
|
|
|
--nextLevel;
|
|
|
|
const multiplier = Math.pow(CONSTANTS.NeuroFluxGovernorLevelMult, nextLevel);
|
|
|
|
repCost = augmentationReference.baseRepRequirement * multiplier * BitNodeMultipliers.AugmentationRepCost;
|
|
|
|
moneyCost = augmentationReference.baseCost * multiplier * BitNodeMultipliers.AugmentationMoneyCost;
|
|
|
|
|
|
|
|
for (let i = 0; i < player.queuedAugmentations.length; ++i) {
|
2022-04-15 05:14:16 +02:00
|
|
|
moneyCost *= getBaseAugmentationPriceMultiplier();
|
2022-04-14 19:39:38 +02:00
|
|
|
}
|
2022-04-23 04:34:41 +02:00
|
|
|
} else if (augmentationReference.factions.includes(FactionNames.ShadowsOfAnarchy)) {
|
2022-04-23 04:47:19 +02:00
|
|
|
const soaAugmentationNames = initSoAAugmentations().map((augmentation) => augmentation.name);
|
|
|
|
const soaMultiplier = Math.pow(
|
|
|
|
CONSTANTS.SoACostMult,
|
|
|
|
soaAugmentationNames.filter((augmentationName) => player.hasAugmentation(augmentationName)).length,
|
|
|
|
);
|
|
|
|
moneyCost = augmentationReference.baseCost * soaMultiplier;
|
|
|
|
if (soaAugmentationNames.find((augmentationName) => augmentationName === augmentationReference.name)) {
|
|
|
|
repCost = augmentationReference.baseRepRequirement * soaMultiplier;
|
2022-04-14 19:39:38 +02:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
moneyCost =
|
|
|
|
augmentationReference.baseCost *
|
|
|
|
getGenericAugmentationPriceMultiplier() *
|
|
|
|
BitNodeMultipliers.AugmentationMoneyCost;
|
2022-05-14 02:02:32 +02:00
|
|
|
repCost = augmentationReference.baseRepRequirement * BitNodeMultipliers.AugmentationRepCost;
|
2022-04-14 19:39:38 +02:00
|
|
|
}
|
|
|
|
return { moneyCost, repCost };
|
|
|
|
}
|
|
|
|
|
|
|
|
getLevel(player: IPlayer): number {
|
|
|
|
// Get current Neuroflux level based on Player's augmentations
|
|
|
|
if (this.name === AugmentationNames.NeuroFluxGovernor) {
|
|
|
|
let currLevel = 0;
|
|
|
|
for (let i = 0; i < player.augmentations.length; ++i) {
|
|
|
|
if (player.augmentations[i].name === AugmentationNames.NeuroFluxGovernor) {
|
|
|
|
currLevel = player.augmentations[i].level;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Account for purchased but uninstalled Augmentations
|
|
|
|
for (let i = 0; i < player.queuedAugmentations.length; ++i) {
|
|
|
|
if (player.queuedAugmentations[i].name == AugmentationNames.NeuroFluxGovernor) {
|
|
|
|
++currLevel;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return currLevel + 1;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2021-09-05 01:09:30 +02:00
|
|
|
// Adds this Augmentation to all Factions
|
|
|
|
addToAllFactions(): void {
|
2022-01-16 01:45:03 +01:00
|
|
|
for (const fac of Object.keys(Factions)) {
|
2021-09-05 01:09:30 +02:00
|
|
|
if (Factions.hasOwnProperty(fac)) {
|
|
|
|
const facObj: Faction | null = Factions[fac];
|
|
|
|
if (facObj == null) {
|
2021-09-09 05:47:34 +02:00
|
|
|
console.warn(`Invalid Faction object in addToAllFactions(). Key value: ${fac}`);
|
2021-09-05 01:09:30 +02:00
|
|
|
continue;
|
|
|
|
}
|
2021-10-12 00:56:51 +02:00
|
|
|
if (facObj.getInfo().special) continue;
|
2021-09-05 01:09:30 +02:00
|
|
|
facObj.augmentations.push(this.name);
|
|
|
|
}
|
2021-05-01 09:17:31 +02:00
|
|
|
}
|
2021-09-05 01:09:30 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// Serialize the current object to a JSON save state.
|
2022-07-15 01:00:10 +02:00
|
|
|
toJSON(): IReviverValue {
|
2021-09-05 01:09:30 +02:00
|
|
|
return Generic_toJSON("Augmentation", this);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Initiatizes a Augmentation object from a JSON save state.
|
2022-07-15 01:00:10 +02:00
|
|
|
static fromJSON(value: IReviverValue): Augmentation {
|
2021-09-05 01:09:30 +02:00
|
|
|
return Generic_fromJSON(Augmentation, value.data);
|
|
|
|
}
|
2019-01-15 14:11:14 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
Reviver.constructors.Augmentation = Augmentation;
|