Display L-3/H-3 damage better

This commit is contained in:
Kalle 2022-09-15 13:36:35 +03:00
parent 3e28818269
commit dc4b670869
5 changed files with 51 additions and 19 deletions

View File

@ -49,6 +49,7 @@ export function buildStats({
subWeaponSplId: mainWeaponParams.subWeaponId,
specialWeaponSplId: mainWeaponParams.specialWeaponId,
speedType: mainWeaponParams.WeaponSpeedType ?? "Normal",
isTripleShooter: Boolean(mainWeaponParams.TripleShotSpanFrame),
},
stats: {
specialPoint: specialPoint(input),
@ -272,17 +273,31 @@ function damages(args: StatFunctionInput): AnalyzedBuild["stats"]["damages"] {
id: semiRandomId(),
type,
value: value / 10,
shotsToSplat: shotsToSplat({ value, type }),
shotsToSplat: shotsToSplat({
value,
type,
isTripleShooter: Boolean(args.mainWeaponParams.TripleShotSpanFrame),
}),
});
}
return result;
}
function shotsToSplat({ value, type }: { value: number; type: DamageType }) {
function shotsToSplat({
value,
type,
isTripleShooter,
}: {
value: number;
type: DamageType;
isTripleShooter: boolean;
}) {
if (type !== "NORMAL_MAX") return;
return Math.ceil(1000 / value);
const multiplier = isTripleShooter ? 3 : 1;
return Math.ceil(1000 / (value * multiplier));
}
const framesToSeconds = (frames: number) =>

View File

@ -13,6 +13,9 @@ export interface MainWeaponParams {
SpecialPoint: number;
/** Weapon's weight class. "Light/Heavy weapon" */
WeaponSpeedType?: "Slow" | "Fast";
// xxx: verify
/** Total frames it takes the weapon to shoot out three times */
TripleShotSpanFrame?: number;
DamageParam_ValueMax?: number;
DamageParam_ValueMin?: number;
DamageParam_ValueDirect?: number;
@ -151,6 +154,7 @@ export interface AnalyzedBuild {
subWeaponSplId: SubWeaponId;
specialWeaponSplId: SpecialWeaponId;
speedType: NonNullable<MainWeaponParams["WeaponSpeedType"]> | "Normal";
isTripleShooter: boolean;
};
stats: {
specialPoint: Stat;

View File

@ -245,6 +245,7 @@
"SpecialPoint": 200,
"subWeaponId": 6,
"specialWeaponId": 12,
"TripleShotSpanFrame": 8,
"DamageParam_ValueMax": 290,
"DamageParam_ValueMin": 145,
"InkConsume": 0.0115
@ -263,6 +264,7 @@
"Mid": -1
}
},
"TripleShotSpanFrame": 20,
"DamageParam_ValueMax": 410,
"DamageParam_ValueMin": 205,
"InkConsume": 0.0225

View File

@ -78,7 +78,10 @@ export default function BuildAnalyzerPage() {
title={t("stat.category.damage")}
containerClassName="analyzer__table-container"
>
<DamageTable values={analyzed.stats.damages} />
<DamageTable
values={analyzed.stats.damages}
isTripleShooter={analyzed.weapon.isTripleShooter}
/>
</StatCategory>
)}
<StatCategory
@ -209,11 +212,12 @@ function StatCard({
);
}
// xxx: L-3
function DamageTable({
values,
isTripleShooter,
}: {
values: AnalyzedBuild["stats"]["damages"];
isTripleShooter: AnalyzedBuild["weapon"]["isTripleShooter"];
}) {
const { t } = useTranslation("analyzer");
@ -230,20 +234,26 @@ function DamageTable({
</tr>
</thead>
<tbody>
{values.map((val) => (
<tr key={val.id}>
<td>{t(`damage.${val.type}`)}</td>
<td>
{val.value}{" "}
{val.shotsToSplat && (
<span className="analyzer__shots-to-splat">
{t("damage.toSplat", { count: val.shotsToSplat })}
</span>
)}
</td>
{val.distance && <td>{val.distance}</td>}
</tr>
))}
{values.map((val) => {
const damage = isTripleShooter
? `${val.value}+${val.value}+${val.value}`
: val.value;
return (
<tr key={val.id}>
<td>{t(`damage.${val.type}`)}</td>
<td>
{damage}{" "}
{val.shotsToSplat && (
<span className="analyzer__shots-to-splat">
{t("damage.toSplat", { count: val.shotsToSplat })}
</span>
)}
</td>
{val.distance && <td>{val.distance}</td>}
</tr>
);
})}
</tbody>
</table>
</>

View File

@ -127,6 +127,7 @@ function parametersToMainWeaponResult(
subWeaponId: resolveSubWeaponId(weapon),
specialWeaponId: resolveSpecialWeaponId(weapon),
overwrites: resolveOverwrites(params),
TripleShotSpanFrame: params["WeaponParam"]?.["TripleShotSpanFrame"],
WeaponSpeedType: params["MainWeaponSetting"]?.["WeaponSpeedType"],
DamageParam_ValueMax: !DamageParam_ValueDirect
? params["DamageParam"]?.["ValueMax"]