fix: variable most optimal shell

This commit is contained in:
TrèsAbhi committed 2024-08-15 14:06:57 -05:00
1 parent 3e00860f7f
commit f07aa9a2a7
3 files changed
+30 -15

No files matched your search

@@ -193,7 +193,7 @@ export function Characteristics() {
{gun.type === 'autoReloader' ? (
<>
<Info indent name="Most optimal shell index">
{stats.mostOptimalShellIndex}
{stats.mostOptimalShellIndex! + 1}
</Info>
<Info name="Shell reloads" unit="s" />
{stats.shellReloads!.map((reload, index) => (
+15 -9
View File
@@ -18,15 +18,21 @@ export function resolveDpm(
(gun.reload * reloadCoefficient +
(gun.count - 1) * gun.intraClip * intraClipCoefficient);
} else {
if (gun.reload[0] < gun.reload[1] + gun.intraClip) {
// first shell's the best
dps = alpha / (gun.reload[0] * reloadCoefficient);
} else {
dps =
alpha /
(gun.reload.at(-1)! * reloadCoefficient +
gun.intraClip * intraClipCoefficient);
}
const mostOptimalShell = gun.reload.reduce<null | {
index: number;
reload: number;
}>((current, reloadRaw, index) => {
const reload =
reloadRaw * reloadCoefficient +
(index > 0 ? gun.intraClip * intraClipCoefficient : 0);
if (current === null || reload < current.reload) {
return { index, reload };
}
return current;
}, null)!;
dps = alpha / mostOptimalShell?.reload;
}
return dps * 60;
+14 -5
View File
@@ -330,11 +330,22 @@ export function tankCharacteristics(
reloadCoefficient,
intraClipCoefficient,
);
const intraClip =
gun.type === 'regular' ? undefined : gun.intraClip * intraClipCoefficient;
const mostOptimalShellIndex =
gun.type === 'autoReloader'
? gun.reload[0] + gun.intraClip < gun.reload[1]
? 1
: gun.reload.length
? gun.reload.reduce<null | { index: number; reload: number }>(
(current, reloadRaw, index) => {
const reload =
reloadRaw * reloadCoefficient + (index > 0 ? intraClip! : 0);
if (current === null || reload < current.reload) {
return { index, reload };
}
return current;
},
null,
)!.index
: undefined;
const damage = shell.damage.armor * damageCoefficient;
const dpmEffective =
@@ -366,8 +377,6 @@ export function tankCharacteristics(
: undefined;
const shellReload =
gun.type === 'autoReloader' ? undefined : gun.reload * reloadCoefficient;
const intraClip =
gun.type === 'regular' ? undefined : gun.intraClip * intraClipCoefficient;
const caliber = shell.caliber;
const penetration =
resolveNearPenetration(shell.penetration) * penetrationCoefficient;