From 502240ad23596b33dd791a49981dee7da855f7bc Mon Sep 17 00:00:00 2001 From: Kalle <38327916+Sendouc@users.noreply.github.com> Date: Sun, 18 Sep 2022 16:53:26 +0300 Subject: [PATCH] Zipcaster SPU effects --- app/modules/analyzer/stats.ts | 62 +++++++++++++++++++++++++++++++++ app/modules/analyzer/types.ts | 2 ++ app/routes/analyzer.tsx | 22 ++++++++++++ public/locales/en/analyzer.json | 2 ++ 4 files changed, 88 insertions(+) diff --git a/app/modules/analyzer/stats.ts b/app/modules/analyzer/stats.ts index f7d7dc738..56342adb5 100644 --- a/app/modules/analyzer/stats.ts +++ b/app/modules/analyzer/stats.ts @@ -112,6 +112,10 @@ export function buildStats({ specialPaintRadius: specialPaintRadius(input), specialFieldHp: specialFieldHp(input), specialDeviceHp: specialDeviceHp(input), + specialHookInkConsumptionPercentage: + specialHookInkConsumptionPercentage(input), + specialInkConsumptionPerSecondPercentage: + specialInkConsumptionPerSecondPercentage(input), }, }; } @@ -1063,3 +1067,61 @@ function specialDeviceHp( modifiedBy: SPECIAL_DEVICE_HP_KEY, }; } + +function specialHookInkConsumptionPercentage( + args: StatFunctionInput +): AnalyzedBuild["stats"]["specialHookInkConsumptionPercentage"] { + if ( + !hasEffect({ + key: "InkConsume_Hook", + weapon: args.specialWeaponParams, + }) + ) { + return; + } + + const SPECIAL_HOOK_INK_CONSUMPTION_PERCENTAGE_KEY = "SPU"; + const { baseEffect, effect } = abilityPointsToEffects({ + abilityPoints: apFromMap({ + abilityPoints: args.abilityPoints, + ability: SPECIAL_HOOK_INK_CONSUMPTION_PERCENTAGE_KEY, + }), + key: "InkConsume_Hook", + weapon: args.specialWeaponParams, + }); + + return { + baseValue: roundToTwoDecimalPlaces(baseEffect * 100), + value: roundToTwoDecimalPlaces(effect * 100), + modifiedBy: SPECIAL_HOOK_INK_CONSUMPTION_PERCENTAGE_KEY, + }; +} + +function specialInkConsumptionPerSecondPercentage( + args: StatFunctionInput +): AnalyzedBuild["stats"]["specialInkConsumptionPerSecondPercentage"] { + if ( + !hasEffect({ + key: "InkConsume_PerSec", + weapon: args.specialWeaponParams, + }) + ) { + return; + } + + const SPECIAL_INK_CONSUMPTION_PER_SECOND_PERCENTAGE_KEY = "SPU"; + const { baseEffect, effect } = abilityPointsToEffects({ + abilityPoints: apFromMap({ + abilityPoints: args.abilityPoints, + ability: SPECIAL_INK_CONSUMPTION_PER_SECOND_PERCENTAGE_KEY, + }), + key: "InkConsume_PerSec", + weapon: args.specialWeaponParams, + }); + + return { + baseValue: roundToTwoDecimalPlaces(baseEffect * 100), + value: roundToTwoDecimalPlaces(effect * 100), + modifiedBy: SPECIAL_INK_CONSUMPTION_PER_SECOND_PERCENTAGE_KEY, + }; +} diff --git a/app/modules/analyzer/types.ts b/app/modules/analyzer/types.ts index 269821da6..d753c1f57 100644 --- a/app/modules/analyzer/types.ts +++ b/app/modules/analyzer/types.ts @@ -231,6 +231,8 @@ export interface AnalyzedBuild { specialPaintRadius?: Stat; specialFieldHp?: Stat; specialDeviceHp?: Stat; + specialHookInkConsumptionPercentage?: Stat; + specialInkConsumptionPerSecondPercentage?: Stat; }; } diff --git a/app/routes/analyzer.tsx b/app/routes/analyzer.tsx index e6b25000c..96914c189 100644 --- a/app/routes/analyzer.tsx +++ b/app/routes/analyzer.tsx @@ -308,6 +308,28 @@ export default function BuildAnalyzerPage() { suffix={t("analyzer:suffix.hp")} /> )} + {analyzed.stats.specialHookInkConsumptionPercentage && ( + + )} + {analyzed.stats.specialInkConsumptionPerSecondPercentage && ( + + )}