rewrite augmentation stats description so it's autogenerated and consistent with the actual effects.

This commit is contained in:
Olivier Gagnon 2021-08-15 00:24:31 -04:00
parent 0671c48c86
commit be8d56ced9
9 changed files with 298 additions and 401 deletions

@ -1,14 +1,18 @@
// Class definition for a single Augmentation object
import * as React from "react";
import { IMap } from "../types";
import { BitNodeMultipliers } from "../BitNode/BitNodeMultipliers";
import { Faction } from "../Faction/Faction";
import { Factions } from "../Faction/Factions";
import { numeralWrapper } from "../ui/numeralFormat";
import { Money } from "../ui/React/Money";
import { Generic_fromJSON, Generic_toJSON, Reviver } from "../../utils/JSONReviver";
interface IConstructorParams {
info: string | JSX.Element;
stats?: JSX.Element;
isSpecial?: boolean;
moneyCost: number;
name: string;
@ -45,6 +49,129 @@ interface IConstructorParams {
bladeburner_stamina_gain_mult?: number;
bladeburner_analysis_mult?: number;
bladeburner_success_chance_mult?: number;
startingMoney?: number;
programs?: string[];
}
function generateStatsDescription(mults: IMap<number>, programs?: string[], startingMoney?: number): JSX.Element {
const f = (x: number, decimals: number = 0) => {
// 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 = <>This augmentation: </>;
if(mults.hacking_mult &&
mults.hacking_mult == mults.strength_mult &&
mults.hacking_mult == mults.defense_mult &&
mults.hacking_mult == mults.dexterity_mult &&
mults.hacking_mult == mults.agility_mult &&
mults.hacking_mult == mults.charisma_mult){
desc = <>{desc}<br />- Increases all skills by {f(mults.hacking_mult-1)}</>
} else {
if(mults.hacking_mult)
desc = <>{desc}<br />- Increases Hacking by {f(mults.hacking_mult-1)}</>
if(mults.strength_mult &&
mults.strength_mult == mults.defense_mult &&
mults.strength_mult == mults.dexterity_mult &&
mults.strength_mult == mults.agility_mult) {
desc = <>{desc}<br />- Increases all combat skills by {f(mults.strength_mult-1)}</>
} else {
if(mults.strength_mult)
desc = <>{desc}<br />- Increases Strength by {f(mults.strength_mult-1)}</>
if(mults.defense_mult)
desc = <>{desc}<br />- Increases Defense by {f(mults.defense_mult-1)}</>
if(mults.dexterity_mult)
desc = <>{desc}<br />- Increases Dexterity by {f(mults.dexterity_mult-1)}</>
if(mults.agility_mult)
desc = <>{desc}<br />- Increases Agility by {f(mults.agility_mult-1)}</>
}
if(mults.charisma_mult)
desc = <>{desc}<br />- Increases Charisma by {f(mults.charisma_mult-1)}</>
}
if(mults.hacking_exp_mult &&
mults.hacking_exp_mult === mults.strength_exp_mult &&
mults.hacking_exp_mult === mults.defense_exp_mult &&
mults.hacking_exp_mult === mults.dexterity_exp_mult &&
mults.hacking_exp_mult === mults.agility_exp_mult &&
mults.hacking_exp_mult === mults.charisma_exp_mult) {
desc = <>{desc}<br />- Increases experience gain for all skills by {f(mults.hacking_exp_mult-1)}</>
} else {
if(mults.hacking_exp_mult)
desc = <>{desc}<br />- Increases Hacking experience gain by {f(mults.hacking_exp_mult-1)}</>
if(mults.strength_exp_mult &&
mults.strength_exp_mult === mults.defense_exp_mult &&
mults.strength_exp_mult === mults.dexterity_exp_mult &&
mults.strength_exp_mult === mults.agility_exp_mult) {
desc = <>{desc}<br />- Increases experience gain for all combat skills by {f(mults.strength_exp_mult-1)}</>
} else {
if(mults.strength_exp_mult)
desc = <>{desc}<br />- Increases Strength experience gain by {f(mults.strength_exp_mult-1)}</>
if(mults.defense_exp_mult)
desc = <>{desc}<br />- Increases Defense experience gain by {f(mults.defense_exp_mult-1)}</>
if(mults.dexterity_exp_mult)
desc = <>{desc}<br />- Increases Dexterity experience gain by {f(mults.dexterity_exp_mult-1)}</>
if(mults.agility_exp_mult)
desc = <>{desc}<br />- Increases Agility experience gain by {f(mults.agility_exp_mult-1)}</>
}
if(mults.charisma_exp_mult)
desc = <>{desc}<br />- Increases Charisma experience gain by {f(mults.charisma_exp_mult-1)}</>
}
if(mults.hacking_speed_mult)
desc = <>{desc}<br />- Increases Hacking speed by {f(mults.hacking_speed_mult-1)}</>
if(mults.hacking_chance_mult)
desc = <>{desc}<br />- Increases hack() success chance by {f(mults.hacking_chance_mult-1)}</>
if(mults.hacking_money_mult)
desc = <>{desc}<br />- Increases hack() power by {f(mults.hacking_money_mult-1)}</>
if(mults.hacking_grow_mult)
desc = <>{desc}<br />- Increases grow() by {f(mults.hacking_grow_mult-1)}</>
if(mults.faction_rep_mult &&
mults.faction_rep_mult === mults.company_rep_mult) {
desc = <>{desc}<br />- Increases reputation gain from factions and companies by {f(mults.faction_rep_mult-1)}</>
} else {
if(mults.faction_rep_mult)
desc = <>{desc}<br />- Increases reputation gain from factions by {f(mults.faction_rep_mult-1)}</>
if(mults.company_rep_mult)
desc = <>{desc}<br />- Increases reputation gain from companies by {f(mults.company_rep_mult-1)}</>
}
if(mults.crime_money_mult)
desc = <>{desc}<br />- Increases money gained from committing crimes by {f(mults.crime_money_mult-1)}</>
if(mults.crime_success_mult)
desc = <>{desc}<br />- Increases crime success rate by {f(mults.crime_success_mult-1)}</>
if(mults.work_money_mult)
desc = <>{desc}<br />- Increases money gained from working by {f(mults.work_money_mult-1)}</>
if(mults.hacknet_node_money_mult)
desc = <>{desc}<br />- Increases Hacknet production by {f(mults.hacknet_node_money_mult-1)}</>
if(mults.hacknet_node_purchase_cost_mult)
desc = <>{desc}<br />- Decreases the purchase cost of Hacknet Nodes by {f(-(mults.hacknet_node_purchase_cost_mult-1))}</>
if(mults.hacknet_node_level_cost_mult)
desc = <>{desc}<br />- Decreases the upgrade cost of Hacknet Nodes by {f(-(mults.hacknet_node_level_cost_mult-1))}</>
if(mults.bladeburner_max_stamina_mult)
desc = <>{desc}<br />- Increases Bladeburner Max Stamina by {f(mults.bladeburner_max_stamina_mult-1)}</>
if(mults.bladeburner_stamina_gain_mult)
desc = <>{desc}<br />- Increases Bladeburner Stamina gain by {f(mults.bladeburner_stamina_gain_mult-1)}</>
if(mults.bladeburner_analysis_mult)
desc = <>{desc}<br />- Increases Bladeburner Field Analysis effectiveness by {f(mults.bladeburner_analysis_mult-1)}</>
if(mults.bladeburner_success_chance_mult)
desc = <>{desc}<br />- Increases success chance in Bladeburner Contracts and Operations by {f(mults.bladeburner_success_chance_mult-1)}</>
if(startingMoney)
desc = <>{desc}<br />- Provides {Money(startingMoney)} after a reset.</>
if(programs)
desc = <>{desc}<br />- Provides {programs.join(' and ')} after a reset.</>
return desc;
}
export class Augmentation {
@ -58,6 +185,9 @@ export class Augmentation {
// Description of what this Aug is and what it does
info: string | JSX.Element;
// Description of the stats, often autogenerated, sometimes manually written.
stats: JSX.Element;
// Any Augmentation not immediately available in BitNode-1 is special (e.g. Bladeburner augs)
isSpecial = false;
@ -126,6 +256,11 @@ export class Augmentation {
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; }
if(params.stats)
this.stats = params.stats;
else
this.stats = generateStatsDescription(this.mults, params.programs, params.startingMoney);
}
// Adds this Augmentation to the specified Factions

File diff suppressed because it is too large Load Diff

@ -47,6 +47,7 @@ export const AugmentationNames: IMap<string> = {
PCDNI: "PC Direct-Neural Interface",
PCDNIOptimizer: "PC Direct-Neural Interface Optimization Submodule",
PCDNINeuralNetwork: "PC Direct-Neural Interface NeuroNet Injector",
PCMatrix: "PCMatrix",
ADRPheromone1: "ADR-V1 Pheromone Gene",
ADRPheromone2: "ADR-V2 Pheromone Gene",
ShadowsSimulacrum: "The Shadow's Simulacrum",

@ -6,7 +6,7 @@
import { IMap } from "./types";
export const CONSTANTS: IMap<any> = {
Version: "0.52.1",
Version: "0.52.2",
/** Max level for any skill, assuming no multipliers. Determined by max numerical value in javascript for experience
* and the skill level formula in Player.js. Note that all this means it that when experience hits MAX_INT, then
@ -225,24 +225,11 @@ export const CONSTANTS: IMap<any> = {
TotalNumBitNodes: 24,
LatestUpdate: `
v0.52.1 - 2021-07-10 bugfixing (hydroflame & community)
v0.52.2 - 2021-07-10 TITLE (hydroflame & community)
-------------------------------------------
**Misc.**
* Fix game crash/corruption when quitting a job while working for it unfocused.
* Fix typo in corporation Market Data.
* Fix typo in docs for hackPercent.
* The tutorial encourages the players to connect to home before creating 'n00dles.script'
* The dark web 'buy' command now accepts '-1' (one) and '--list' instead of just
'-l'. Helps some confused players.
* Character overview screen no longer hidden on the corporation screen.
* Infiltration difficulty display is now more explicit (It's a big arrow instead
of just one word.)
* Fix wrong ram value in tutorial. (@MageKing17)
* Plenty of augmentation description cleanup (@Kwazygloo)
* Plenty of typo/description fixed (@MageKing17)
* Cleanup description of singularity function on readthedocs (@PurePandemonium)
* Fix bug when autolinking a server while backdooring (@schroederIT)
** Augmentations **
* New Augmentation offered by Aevum, themed around 777 and offers some basic
programs.
`,
}

@ -76,6 +76,7 @@ class DevMenuComponent extends Component {
this.setSF = this.setSF.bind(this);
this.setAllSF = this.setAllSF.bind(this);
this.clearExploits = this.clearExploits.bind(this);
this.processStocks = this.processStocks.bind(this);
this.setStockPrice = this.setStockPrice.bind(this);
this.viewStockCaps = this.viewStockCaps.bind(this);
@ -378,6 +379,10 @@ class DevMenuComponent extends Component {
}
}
clearExploits() {
Player.exploits = [];
}
addProgram() {
const program = this.state.program;
if(!Player.hasProgram(program)) {
@ -953,6 +958,12 @@ class DevMenuComponent extends Component {
</div>
<table>
<tbody>
<tr>
<td><span className="text">Exploits:</span></td>
<td>
<button className="std-button touch-right" onClick={this.clearExploits()}>Clear</button>
</td>
</tr>
<tr key={'sf-all'}>
<td><span className="text">All:</span></td>
<td>

@ -137,6 +137,12 @@ export class PurchaseableAugmentation extends React.Component<IProps, any> {
btnTxt += ` - Level ${getNextNeurofluxLevel()}`;
}
let tooltip = <></>;
if(typeof this.aug.info === "string")
tooltip = <><span dangerouslySetInnerHTML={{__html: this.aug.info}} /><br /><br />{this.aug.stats}</>
else
tooltip = <>{this.aug.info}<br /><br />{this.aug.stats}</>
return (
<li>
<span style={spanStyleMarkup}>
@ -145,7 +151,7 @@ export class PurchaseableAugmentation extends React.Component<IProps, any> {
onClick={this.handleClick}
style={inlineStyleMarkup}
text={btnTxt}
tooltip={this.aug.info}
tooltip={tooltip}
/>
<p style={txtStyle}>{status}</p>
</span>

@ -59,6 +59,8 @@ export function createSleevePurchaseAugsPopup(sleeve: Sleeve, p: IPlayer): void
if(typeof tooltip !== 'string') {
tooltip = renderToStaticMarkup(tooltip);
}
tooltip += "<br /><br />";
tooltip += renderToStaticMarkup(aug.stats);
ownedAugsDiv.appendChild(createElement("div", {
class: "gang-owned-upgrade", // Reusing a class from the Gang UI
@ -92,6 +94,8 @@ export function createSleevePurchaseAugsPopup(sleeve: Sleeve, p: IPlayer): void
if(typeof info !== 'string') {
info = renderToStaticMarkup(info);
}
info += "<br /><br />";
info += renderToStaticMarkup(aug.stats);
div.appendChild(createElement("p", {
fontSize: "12px",

@ -97,6 +97,11 @@ function prestigeAugmentation() {
Player.setMoney(1e6);
homeComp.programs.push(Programs.BruteSSHProgram.name);
}
if (augmentationExists(AugmentationNames.PCMatrix) &&
Augmentations[AugmentationNames.PCMatrix].owned) {
homeComp.programs.push(Programs.DeepscanV1.name);
homeComp.programs.push(Programs.AutoLink.name);
}
// Re-create foreign servers
initForeignServers(Player.getHomeComputer());

@ -28,7 +28,7 @@ export function AugmentationAccordion(props: IProps): React.ReactElement {
return (
<Accordion
headerContent={<>{displayName}</>}
panelContent={<p dangerouslySetInnerHTML={{__html: props.aug.info}}></p>}
panelContent={<p><span dangerouslySetInnerHTML={{__html: props.aug.info}} /><br /><br />{props.aug.stats}</p>}
/>
)
}
@ -36,7 +36,7 @@ export function AugmentationAccordion(props: IProps): React.ReactElement {
return (
<Accordion
headerContent={<>{displayName}</>}
panelContent={<p>{props.aug.info}</p>}
panelContent={<p>{props.aug.info}<br /><br />{props.aug.stats}</p>}
/>
)
}