From fcfc6cf7d10f6662b44c63d96fa60621829d061b Mon Sep 17 00:00:00 2001 From: Phil-hacker <61991187+Phil-hacker@users.noreply.github.com> Date: Sat, 24 Aug 2024 07:20:24 +0200 Subject: [PATCH] Split ink vac sucking radius into min and max (#1839) * split ink vac stats into two * add missing translations for analyzer:stat.special.radiusRangeMin and analyzer:stat.special.radiusRangeMin * add pt-BR translation * added roundToNDecimalPlaces to min and max radius values --- app/features/build-analyzer/analyzer-types.ts | 3 +- app/features/build-analyzer/core/stats.ts | 50 ++++++++++++------- .../build-analyzer/routes/analyzer.tsx | 17 +++++-- locales/da/analyzer.json | 3 +- locales/de/analyzer.json | 3 +- locales/en/analyzer.json | 3 +- locales/es-ES/analyzer.json | 3 +- locales/es-US/analyzer.json | 3 +- locales/fr-CA/analyzer.json | 3 +- locales/fr-EU/analyzer.json | 3 +- locales/he/analyzer.json | 3 +- locales/it/analyzer.json | 3 +- locales/ja/analyzer.json | 3 +- locales/ko/analyzer.json | 3 +- locales/nl/analyzer.json | 3 +- locales/pl/analyzer.json | 3 +- locales/pt-BR/analyzer.json | 3 +- locales/ru/analyzer.json | 3 +- locales/zh/analyzer.json | 3 +- 19 files changed, 80 insertions(+), 38 deletions(-) diff --git a/app/features/build-analyzer/analyzer-types.ts b/app/features/build-analyzer/analyzer-types.ts index f00086071..687778aec 100644 --- a/app/features/build-analyzer/analyzer-types.ts +++ b/app/features/build-analyzer/analyzer-types.ts @@ -280,7 +280,8 @@ export interface AnalyzedBuild { specialMoveSpeed?: Stat; specialAutoChargeRate?: Stat; specialMaxRadius?: Stat; - specialRadiusRange?: Stat; + specialRadiusRangeMin?: Stat; + specialRadiusRangeMax?: Stat; specialPowerUpDuration?: Stat; }; } diff --git a/app/features/build-analyzer/core/stats.ts b/app/features/build-analyzer/core/stats.ts index 33831b5ee..02944c6ae 100644 --- a/app/features/build-analyzer/core/stats.ts +++ b/app/features/build-analyzer/core/stats.ts @@ -173,7 +173,8 @@ export function buildStats({ specialMoveSpeed: specialMoveSpeed(input), specialAutoChargeRate: specialAutoChargeRate(input), specialMaxRadius: specialMaxRadius(input), - specialRadiusRange: specialRadiusRange(input), + specialRadiusRangeMin: specialRadiusRangeMin(input), + specialRadiusRangeMax: specialRadiusRangeMax(input), specialPowerUpDuration: specialPowerUpDuration(input), }, }; @@ -1742,14 +1743,39 @@ function specialMaxRadius( }; } -function specialRadiusRange( +function specialRadiusRangeMax( args: StatFunctionInput, -): AnalyzedBuild["stats"]["specialRadiusRange"] { +): AnalyzedBuild["stats"]["specialRadiusRangeMax"] { if ( !hasEffect({ key: "RadiusMax", weapon: args.specialWeaponParams, - }) || + }) + ) { + return; + } + + const SPECIAL_RADIUS_RANGE_KEY = "SPU"; + + const radiusMax = abilityPointsToEffects({ + abilityPoints: apFromMap({ + abilityPoints: args.abilityPoints, + ability: SPECIAL_RADIUS_RANGE_KEY, + }), + key: "RadiusMax", + weapon: args.specialWeaponParams, + }); + + return { + baseValue: roundToNDecimalPlaces(radiusMax.baseEffect), + value: roundToNDecimalPlaces(radiusMax.effect), + modifiedBy: SPECIAL_RADIUS_RANGE_KEY, + }; +} +function specialRadiusRangeMin( + args: StatFunctionInput, +): AnalyzedBuild["stats"]["specialRadiusRangeMin"] { + if ( !hasEffect({ key: "RadiusMin", weapon: args.specialWeaponParams, @@ -1768,22 +1794,10 @@ function specialRadiusRange( key: "RadiusMin", weapon: args.specialWeaponParams, }); - const radiusMax = abilityPointsToEffects({ - abilityPoints: apFromMap({ - abilityPoints: args.abilityPoints, - ability: SPECIAL_RADIUS_RANGE_KEY, - }), - key: "RadiusMax", - weapon: args.specialWeaponParams, - }); return { - baseValue: `${roundToNDecimalPlaces( - radiusMin.baseEffect, - )}-${roundToNDecimalPlaces(radiusMax.baseEffect)}`, - value: `${roundToNDecimalPlaces(radiusMin.effect)}-${roundToNDecimalPlaces( - radiusMax.effect, - )}`, + baseValue: roundToNDecimalPlaces(radiusMin.baseEffect), + value: roundToNDecimalPlaces(radiusMin.effect), modifiedBy: SPECIAL_RADIUS_RANGE_KEY, }; } diff --git a/app/features/build-analyzer/routes/analyzer.tsx b/app/features/build-analyzer/routes/analyzer.tsx index 3d215d141..e31dfdcf0 100644 --- a/app/features/build-analyzer/routes/analyzer.tsx +++ b/app/features/build-analyzer/routes/analyzer.tsx @@ -649,11 +649,22 @@ function BuildAnalyzerPage() { popoverInfo={t("analyzer:stat.special.maxRadius.explanation")} /> )} - {analyzed.stats.specialRadiusRange && ( + {analyzed.stats.specialRadiusRangeMin && ( + )} + {analyzed.stats.specialRadiusRangeMax && ( +