From e3e6b449d4f441fd8c0ab08151992451e5d11a26 Mon Sep 17 00:00:00 2001 From: Olivier Gagnon Date: Fri, 1 Apr 2022 16:59:23 -0400 Subject: [PATCH] Make Stanek hacknet cost percentage better. --- src/CotMG/FragmentType.ts | 2 +- src/CotMG/ui/FragmentInspector.tsx | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/CotMG/FragmentType.ts b/src/CotMG/FragmentType.ts index 8c38b7285..09f3387e6 100644 --- a/src/CotMG/FragmentType.ts +++ b/src/CotMG/FragmentType.ts @@ -61,7 +61,7 @@ export function Effect(tpe: FragmentType): string { return "+x% hacknet production"; } case FragmentType.HacknetCost: { - return "x% cheaper hacknet cost"; + return "-x% cheaper hacknet cost"; } case FragmentType.Rep: { return "+x% reputation from factions and companies"; diff --git a/src/CotMG/ui/FragmentInspector.tsx b/src/CotMG/ui/FragmentInspector.tsx index 8ab8253de..7365ad4a9 100644 --- a/src/CotMG/ui/FragmentInspector.tsx +++ b/src/CotMG/ui/FragmentInspector.tsx @@ -54,8 +54,12 @@ export function FragmentInspector(props: IProps): React.ReactElement { if ([FragmentType.Booster, FragmentType.None, FragmentType.Delete].includes(f.type)) { charge = "N/A"; effect = `${f.power}x adjacent fragment power`; - } else { + } else if (Effect(f.type).includes("+x%")) { effect = Effect(f.type).replace(/-*x%/, numeralWrapper.formatPercentage(props.gift.effect(props.fragment) - 1)); + } else if (Effect(f.type).includes("-x%")) { + const effectAmt = props.gift.effect(props.fragment); + const perc = numeralWrapper.formatPercentage(1 - 1 / effectAmt); + effect = Effect(f.type).replace(/-x%/, perc); } return (