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