mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-08-09 15:13:53 -05:00
Splat/Suction/Burst Bomb to damage table
This commit is contained in:
parent
36f38cc791
commit
f4b893dfa5
|
|
@ -8,6 +8,7 @@ import type {
|
|||
InkConsumeType,
|
||||
MainWeaponParams,
|
||||
StatFunctionInput,
|
||||
SubWeaponParams,
|
||||
} from "./types";
|
||||
import { DAMAGE_TYPE } from "./types";
|
||||
import { INK_CONSUME_TYPES } from "./types";
|
||||
|
|
@ -238,7 +239,10 @@ function inkConsumeTypeToParamsKeys(
|
|||
}
|
||||
}
|
||||
|
||||
const damageTypeToParamsKey: Record<DamageType, keyof MainWeaponParams> = {
|
||||
const damageTypeToParamsKey: Record<
|
||||
DamageType,
|
||||
keyof MainWeaponParams | keyof SubWeaponParams
|
||||
> = {
|
||||
NORMAL_MIN: "DamageParam_ValueMin",
|
||||
NORMAL_MAX: "DamageParam_ValueMax",
|
||||
DIRECT: "DamageParam_ValueDirect",
|
||||
|
|
@ -246,6 +250,7 @@ const damageTypeToParamsKey: Record<DamageType, keyof MainWeaponParams> = {
|
|||
FULL_CHARGE: "DamageParam_ValueFullCharge",
|
||||
MAX_CHARGE: "DamageParam_ValueMaxCharge",
|
||||
TAP_SHOT: "DamageParam_ValueMinCharge",
|
||||
BOMB_NORMAL: "DistanceDamage",
|
||||
};
|
||||
|
||||
function damages(args: StatFunctionInput): AnalyzedBuild["stats"]["damages"] {
|
||||
|
|
@ -253,7 +258,9 @@ function damages(args: StatFunctionInput): AnalyzedBuild["stats"]["damages"] {
|
|||
|
||||
for (const type of DAMAGE_TYPE) {
|
||||
const key = damageTypeToParamsKey[type];
|
||||
const value = args.mainWeaponParams[key];
|
||||
const value =
|
||||
args.mainWeaponParams[key as keyof MainWeaponParams] ??
|
||||
args.subWeaponParams[key as keyof SubWeaponParams];
|
||||
|
||||
if (Array.isArray(value)) {
|
||||
for (const subValue of value) {
|
||||
|
|
|
|||
|
|
@ -141,6 +141,7 @@ export const DAMAGE_TYPE = [
|
|||
"MAX_CHARGE",
|
||||
"TAP_SHOT",
|
||||
"DISTANCE",
|
||||
"BOMB_NORMAL",
|
||||
] as const;
|
||||
|
||||
export type DamageType = typeof DAMAGE_TYPE[number];
|
||||
|
|
|
|||
|
|
@ -90,6 +90,7 @@ export default function BuildAnalyzerPage() {
|
|||
<DamageTable
|
||||
values={analyzed.stats.damages}
|
||||
isTripleShooter={analyzed.weapon.isTripleShooter}
|
||||
subWeaponId={analyzed.weapon.subWeaponSplId}
|
||||
/>
|
||||
</StatCategory>
|
||||
)}
|
||||
|
|
@ -224,21 +225,25 @@ function StatCard({
|
|||
function DamageTable({
|
||||
values,
|
||||
isTripleShooter,
|
||||
subWeaponId,
|
||||
}: {
|
||||
values: AnalyzedBuild["stats"]["damages"];
|
||||
isTripleShooter: AnalyzedBuild["weapon"]["isTripleShooter"];
|
||||
subWeaponId: SubWeaponId;
|
||||
}) {
|
||||
const { t } = useTranslation("analyzer");
|
||||
const { t } = useTranslation(["weapons", "analyzer"]);
|
||||
|
||||
const showDistanceColumn = values.some((val) => val.distance);
|
||||
|
||||
return (
|
||||
<>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{t("damage.header.type")}</th>
|
||||
<th>{t("damage.header.damage")}</th>
|
||||
{values.some((val) => val.distance) && (
|
||||
<th>{t("damage.header.distance")}</th>
|
||||
<th>{t("analyzer:damage.header.type")}</th>
|
||||
<th>{t("analyzer:damage.header.damage")}</th>
|
||||
{showDistanceColumn && (
|
||||
<th>{t("analyzer:damage.header.distance")}</th>
|
||||
)}
|
||||
</tr>
|
||||
</thead>
|
||||
|
|
@ -248,18 +253,25 @@ function DamageTable({
|
|||
? `${val.value}+${val.value}+${val.value}`
|
||||
: val.value;
|
||||
|
||||
const typeRowName = val.type.startsWith("BOMB_")
|
||||
? t(`weapons:SUB_${subWeaponId}`)
|
||||
: // xxx: maybe this could use a sub type where "BOMB_" starting are filtered out
|
||||
t(`analyzer:damage.${val.type as "NORMAL_MIN"}`);
|
||||
|
||||
return (
|
||||
<tr key={val.id}>
|
||||
<td>{t(`damage.${val.type}`)}</td>
|
||||
<td>{typeRowName}</td>
|
||||
<td>
|
||||
{damage}{" "}
|
||||
{val.shotsToSplat && (
|
||||
<span className="analyzer__shots-to-splat">
|
||||
{t("damage.toSplat", { count: val.shotsToSplat })}
|
||||
{t("analyzer:damage.toSplat", {
|
||||
count: val.shotsToSplat,
|
||||
})}
|
||||
</span>
|
||||
)}
|
||||
</td>
|
||||
{val.distance && <td>{val.distance}</td>}
|
||||
{showDistanceColumn && <td>{val.distance}</td>}
|
||||
</tr>
|
||||
);
|
||||
})}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user