From 89c388e1c35a2f967dd7c85c0224aef7cfac9fb6 Mon Sep 17 00:00:00 2001 From: Kalle <38327916+Sendouc@users.noreply.github.com> Date: Sat, 22 Oct 2022 12:08:20 +0300 Subject: [PATCH] Fix hp showed wrong for Crab Tank/brellas --- app/modules/analyzer/objectHitPoints.ts | 11 ++++++++--- app/modules/analyzer/stats.ts | 7 ++++--- app/modules/analyzer/utils.ts | 2 ++ 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/app/modules/analyzer/objectHitPoints.ts b/app/modules/analyzer/objectHitPoints.ts index 21f71320e..d3b9136e6 100644 --- a/app/modules/analyzer/objectHitPoints.ts +++ b/app/modules/analyzer/objectHitPoints.ts @@ -7,6 +7,7 @@ import type { SpecialWeaponParams, SubWeaponParams, } from "./types"; +import { hpDivided } from "./utils"; import weaponParams from "./weapon-params.json"; const PLACEHOLDER_HP = 1000; @@ -35,11 +36,15 @@ export const objectHitPoints = (abilityPoints: AbilityPoints): HitPoints => { return { BulletUmbrellaCanopyNormal: PLACEHOLDER_HP, // ?? needs defaults - BulletUmbrellaCanopyWide: weaponParams.mainWeapons[6010].CanopyHP, - BulletUmbrellaCanopyCompact: weaponParams.mainWeapons[6020].CanopyHP, + BulletUmbrellaCanopyWide: hpDivided( + weaponParams.mainWeapons[6010].CanopyHP + ), + BulletUmbrellaCanopyCompact: hpDivided( + weaponParams.mainWeapons[6020].CanopyHP + ), Wsb_Shield, Bomb_TorpedoBullet: PLACEHOLDER_HP, // ?? - Chariot: weaponParams.specialWeapons[CRAB_TANK_ID].ArmorHP, + Chariot: hpDivided(weaponParams.specialWeapons[CRAB_TANK_ID].ArmorHP), Gachihoko_Barrier: PLACEHOLDER_HP, // ?? GreatBarrier_Barrier, GreatBarrier_WeakPoint, diff --git a/app/modules/analyzer/stats.ts b/app/modules/analyzer/stats.ts index 185f21289..c6059f83c 100644 --- a/app/modules/analyzer/stats.ts +++ b/app/modules/analyzer/stats.ts @@ -17,6 +17,7 @@ import { abilityPointsToEffects, apFromMap, hasEffect, + hpDivided, weaponParams, } from "./utils"; import { assertUnreachable } from "~/utils/types"; @@ -789,7 +790,7 @@ export function subStats( case "NO_CHANGE": return roundToTwoDecimalPlaces(effect); case "HP": - return roundToTwoDecimalPlaces(effect / 10); + return roundToTwoDecimalPlaces(hpDivided(effect)); case "TIME": return framesToSeconds(effect); default: @@ -1170,8 +1171,8 @@ export function specialDeviceHp( }); return { - baseValue: Math.round(baseEffect / 10), - value: Math.round(effect / 10), + baseValue: Math.round(hpDivided(baseEffect)), + value: Math.round(hpDivided(effect)), modifiedBy: SPECIAL_DEVICE_HP_KEY, }; } diff --git a/app/modules/analyzer/utils.ts b/app/modules/analyzer/utils.ts index 8dcff6526..543b207ed 100644 --- a/app/modules/analyzer/utils.ts +++ b/app/modules/analyzer/utils.ts @@ -165,3 +165,5 @@ export function validatedWeaponIdFromSearchParams( return weaponCategories[0].weaponIds[0]; } + +export const hpDivided = (hp: number) => hp / 10;