Build Analyzer: Compare in ink consumption table

This commit is contained in:
Kalle 2023-01-28 19:43:05 +02:00
parent 27cb5be472
commit d4ffd8f35b
13 changed files with 56 additions and 27 deletions

View File

@ -263,7 +263,8 @@ function fullInkTankOptions(
value: effectToRounded(
(inkTankSize(args.weaponSplId) -
subWeaponInkConsume * subsFromFullInkTank) /
mainWeaponInkConsume
mainWeaponInkConsume,
2
),
});
}
@ -272,8 +273,8 @@ function fullInkTankOptions(
return result;
}
function effectToRounded(effect: number) {
return Number(effect.toFixed(3));
function effectToRounded(effect: number, decimals = 3) {
return Number(effect.toFixed(decimals));
}
function subWeaponConsume({

View File

@ -731,7 +731,11 @@ export default function BuildAnalyzerPage() {
<div className="analyzer__stat-card-highlighted" />
) : null}
<ConsumptionTable
options={analyzed.stats.fullInkTankOptions}
isComparing={isComparing}
options={[
analyzed.stats.fullInkTankOptions,
analyzed2.stats.fullInkTankOptions,
]}
subWeaponId={analyzed.weapon.subWeaponSplId}
/>
</StatCategory>
@ -1310,18 +1314,25 @@ function DamageTable({
}
function ConsumptionTable({
isComparing,
options,
subWeaponId,
}: {
options: AnalyzedBuild["stats"]["fullInkTankOptions"];
isComparing: boolean;
options: [
AnalyzedBuild["stats"]["fullInkTankOptions"],
AnalyzedBuild["stats"]["fullInkTankOptions"]
];
subWeaponId: SubWeaponId;
}) {
const [options1, options2] = options;
const { t } = useTranslation(["analyzer", "weapons"]);
const maxSubsToUse =
subWeaponId === TORPEDO_ID
? 1
: Math.max(...options.map((opt) => opt.subsUsed));
const types = Array.from(new Set(options.map((opt) => opt.type)));
: Math.max(...options.flat().map((opt) => opt.subsUsed));
const types = Array.from(new Set(options1.map((opt) => opt.type)));
return (
<>
@ -1336,23 +1347,51 @@ function ConsumptionTable({
</thead>
<tbody>
{new Array(maxSubsToUse + 1).fill(null).map((_, subsUsed) => {
const options1ForThisSubsUsed = options1.filter(
(opt) => opt.subsUsed === subsUsed
);
const options2ForThisSubsUsed = options2.filter(
(opt) => opt.subsUsed === subsUsed
);
const cells: React.ReactNode[] = [];
// weird using basic for loop in react code but here we are essentially
// zipping these two arrays into one cell and if one of the arrays
// doesn't have value then it shows as a dash instead
for (
let i = 0;
i <
Math.max(
options1ForThisSubsUsed.length,
options2ForThisSubsUsed.length
);
i++
) {
const opt1 = options1ForThisSubsUsed[i];
const opt2 = options2ForThisSubsUsed[i];
const contents = !isComparing
? opt1!.value
: `${opt1?.value ?? "-"}/${opt2?.value ?? "-"}`;
cells.push(<td key={opt1?.id ?? opt2!.id}>{contents}</td>);
}
return (
<tr key={subsUsed}>
<td>×{subsUsed}</td>
{options
.filter((opt) => opt.subsUsed === subsUsed)
.map((opt) => {
return <td key={opt.id}>{opt.value}</td>;
})}
{cells}
</tr>
);
})}
</tbody>
</table>
<div className="analyzer__consumption-table-explanation">
{t("analyzer:consumptionExplanation", { maxSubsToUse })}
{subWeaponId === TORPEDO_ID && <> {t("analyzer:torpedoExplanation")}</>}
</div>
{subWeaponId === TORPEDO_ID && (
<div className="analyzer__consumption-table-explanation">
<> {t("analyzer:torpedoExplanation")}</>
</div>
)}
</>
);
}

View File

@ -106,7 +106,6 @@
"patch": "Patch:",
"abilityPoints.short": "AP",
"abilityChunks": "Pris i Egenskabs-fragmenter",
"consumptionExplanation": "Dette diagram viser, hvor mange handlinger man kan udføre med det primære våben efter brug af det sekundære våben 0-{{maxSubsToUse}} gange. Du kan bruge {{maxSubsToUse}} sekundære våben per fuld blæktank.",
"torpedoExplanation": "Man kan kun have én aktiv torpedo ad gangen.",
"trackingSubDefExplanation": "Point, sensor, Ink Mine og Angle shooter sporingsvarighedsværdier er udregnet for fjender, der bruger 0AP af Sub power up. (opgraderet sekundærvåben)",
"distanceInline": "Afstand: {{value}}",

View File

@ -100,7 +100,6 @@
"patch": "Patch:",
"abilityPoints.short": "EP",
"abilityChunks": "Effekt-Fragmente erforderlich",
"consumptionExplanation": "Dieses Diagramm zeigt die Anzahl der Aktionen, die mit der Hauptwaffe noch durchgeführt werden können, nachdem die Sekundärwaffe 0-{{maxSubsToUse}} mal benutzt wurde. Die maximale Anzahl an aufeinanderfolgenden Sekundärwaffen, die bei vollem Tintentank verwendet werden können, ist {{maxSubsToUse}}.",
"torpedoExplanation": "Es ist unmöglich, mehr als einen Torpedo gleichzeitig abzufeuern (wegen der Spielmechanik).",
"trackingSubDefExplanation": "Die Markierungsdauern von Detektor, Tintenmine and Winkelmarker basieren auf einem Gegner mit 0 EP Sekundärstärke +.",
"distanceInline": "Reichweite: {{value}}",

View File

@ -110,7 +110,6 @@
"patch": "Patch:",
"abilityPoints.short": "AP",
"abilityChunks": "Ability Chunks Required",
"consumptionExplanation": "This chart shows the amount of actions left to perform with main weapon after using sub 0-{{maxSubsToUse}} times. Max amount of consecutive subs to use with full ink tank is {{maxSubsToUse}}.",
"torpedoExplanation": "You can't launch more than one torpedo at a time due to game mechanics.",
"trackingSubDefExplanation": "Point Sensor, Ink Mine and Angle Shooter tracking times are calculated against an opponent with 0AP of Sub Power Up.",
"distanceInline": "Distance: {{value}}",

View File

@ -88,6 +88,5 @@
"build": "Build",
"patch": "Parche:",
"abilityPoints.short": "AP",
"consumptionExplanation": "Este gráfico muestra la cantidad de acciones restantes con el arma principal después de usar un arma secundaria 0-{{maxSubsToUse}} veces. La cantidad máxima de armas secundarias consecutivas que se pueden usar con el tanque lleno es {{maxSubsToUse}}.",
"trackingSubDefExplanation": "Tiempos de rastreo de Rastreador, Mina de Tinta y Dardo Resaltador son calculados contra un oponente con 0AP de Resistencia Secundaria."
}

View File

@ -88,6 +88,5 @@
"build": "Build",
"patch": "Parche:",
"abilityPoints.short": "AP",
"consumptionExplanation": "Este gráfico muestra la cantidad de acciones restantes con el arma principal después de usar un arma secundaria 0-{{maxSubsToUse}} veces. La cantidad máxima de armas secundarias consecutivas que se pueden usar con el tanque lleno es {{maxSubsToUse}}.",
"trackingSubDefExplanation": "Tiempos de rastreo de Rastreador, Mina de Tinta y Dardo Resaltador son calculados contra un oponente con 0AP de Resistencia Secundaria."
}

View File

@ -104,7 +104,6 @@
"patch": "Version:",
"abilityPoints.short": " PC",
"abilityChunks": "Fragments de bonus requis",
"consumptionExplanation": "Ce tableau montre le nombre d'actions restantes à effectuer avec l'arme principale après avoir utilisé l'arme secondaire 0-{{maxSubsToUse}} fois. Le nombre max d'utilisations d'armes secondaires consécutives à utiliser avec un réservoir d'encre plein est de {{maxSubsToUse}}.",
"torpedoExplanation": "Vous ne pouvez pas lancer plus d'une torpille à la fois à cause d'une mécanique du jeu",
"trackingSubDefExplanation": "Les temps de traçage de détecteur, de la mine et du ricocheur sont calculés contre un adversaire avec 0 PC d'arme secondaire +.",
"distanceInline": "Distance : {{value}}",

View File

@ -100,7 +100,6 @@
"patch": "Versione gioco:",
"abilityPoints.short": "AP",
"abilityChunks": "Frammenti abilità necessari",
"consumptionExplanation": "Questa tabella mostra la quantità di azioni rimaste da eseguire con l'arma principale dopo aver usato l'arma secondaria da 0 a {{maxSubsToUse}} volte. Il numero massimo di armi secondarie da utilizzare consecutivamente con un serbatoio pieno è {{maxSubsToUse}}.",
"torpedoExplanation": "Non puoi lanciare più di un Torpedinatore alla volta.",
"trackingSubDefExplanation": "I tempi di localizzazione della cimice, la mina e lo sparalinee sono calcolati contro un nemico con 0AP di Arma sec. impermeabile.",
"distanceInline": "Distanza: {{value}}",

View File

@ -99,7 +99,6 @@
"patch": "Patch:",
"abilityPoints.short": "GP",
"abilityChunks": "ギアパワーのかけらが必要です",
"consumptionExplanation": "このチャートはサブを 0-{{maxSubsToUse}} 回使用したあとに何回メインを使用できるかを表しています。インクタンクが満タンの状態でサブが連続使用できる回数は {{maxSubsToUse}} です。",
"torpedoExplanation": "ゲームの仕様上、1度に1つ以上のトーピードを使用することはできません。",
"trackingSubDefExplanation": "ポイントセンサー、トラップ、ラインマーカーのマーキング時間は、サブ性能アップのギアなしで計算しています。",
"distanceInline": "距離: {{value}}",

View File

@ -67,7 +67,6 @@
"build": "Uitrusting",
"patch": "Softwareversie:",
"abilityPoints.short": "EP",
"consumptionExplanation": "Deze tabel laat zien hoeveel keer je nog een bepaalde actie kunt doen met het hoofdwapen na het 0-{{maxSubsToUse}} keer gebruiken van een subwapen. Het maximale aantal dat je een subwapen achter elkaar kan gebruiken is {{maxSubsToUse}} keer.",
"trackingSubDefExplanation": "Detector, Inktmijn en Ketskogel markeringstijden worden berekend voor een tegenstander met 0 Subtopper EP.",
"stat.jumpShotSpread": "Kogel spreiding in graden (in de lucht)",
"stat.groundShotSpread": "Kogel spreiding in graden (op de grond)",

View File

@ -104,7 +104,6 @@
"patch": "Патч:",
"abilityPoints.short": "AP",
"abilityChunks": "Требуется чанков свойства",
"consumptionExplanation": "Данная таблица показывает, сколько действий можно совершить после 0-{{maxSubsToUse}}кратного использования запасного оружия. С полным баллоном запасное оружие можно использовать {{maxSubsToUse}} раз(а) подряд.",
"torpedoExplanation": "Из-за внутриигровых ограничений невозможно бросить 2 и более торпеды подряд.",
"trackingSubDefExplanation": "В расчётах продолжительности маркировки Маркера Движения, Мины и Углострела используется игрок с 0AP Стойкости Запаса.",
"distanceInline": "Расстояние: {{value}}",

View File

@ -98,7 +98,6 @@
"patch": "游戏版本:",
"abilityPoints.short": "AP",
"abilityChunks": "所需碎片",
"consumptionExplanation": "表中的数据表示在使用了副武器 0-{{maxSubsToUse}} 次后主武器的可攻击次数。在满墨下的最大副武器连续使用次数为 {{maxSubsToUse}}。",
"torpedoExplanation": "根据游戏机制,你无法同时使用多个鱼雷。",
"trackingSubDefExplanation": "定点侦测器, 墨汁陷阱和标线器的索敌标记时间是根据没有携带副武器强化的敌人计算得出。",
"distanceInline": "距离: {{value}}",