Fix Beakon Sub Power Up calculation Closes #1323

This commit is contained in:
Kalle
2023-04-08 23:31:37 +03:00
parent 5dc75367b8
commit c4d932ec40
3 changed files with 46 additions and 11 deletions

View File

@@ -103,4 +103,30 @@ AnalyzeBuild(
}
);
const subPowerApToQuickSuperJumpAp = new Map([
[0, 0],
[3, 4],
[6, 9],
[13, 18],
[28, 36],
[57, 57],
]);
AnalyzeBuild("Sub Power Up Beakon AP boost matches Lean", () => {
for (const [subPowerAp, quickSuperJumpAp] of subPowerApToQuickSuperJumpAp) {
const analyzed = buildStats({
weaponSplId: 1011,
abilityPoints: new Map([["BRU" as const, subPowerAp]]),
hasTacticooler: false,
});
assert.ok(
analyzed.stats.subQsjBoost?.value === quickSuperJumpAp,
`Wrong AP boost for ${subPowerAp}AP of Sub Power Up: ${
analyzed.stats.subQsjBoost!.value
} (expected ${quickSuperJumpAp}))`
);
}
});
AnalyzeBuild.run();

View File

@@ -19,6 +19,7 @@ import { INK_CONSUME_TYPES } from "../analyzer-types";
import invariant from "tiny-invariant";
import {
abilityPointsToEffects,
abilityValues,
apFromMap,
hasEffect,
hpDivided,
@@ -1142,18 +1143,26 @@ function subQsjBoost(
}
const SUB_QSJ_BOOST_KEY = "BRU";
const { baseEffect, effect } = abilityPointsToEffects({
abilityPoints: apFromMap({
abilityPoints: args.abilityPoints,
ability: SUB_QSJ_BOOST_KEY,
}),
key: "SubSpecUpParam",
weapon: args.subWeaponParams,
});
// Lean: This is the base that is used with their weird formula (I didn't even bother renaming the vars and just used what my disassembler gave me)
const calculate = (ap: number) => {
const multiplier = abilityValues({
key: "SubSpecUpParam",
weapon: args.subWeaponParams,
});
const v7 =
((multiplier[1] - multiplier[2]) / multiplier[0] - 17.8 / multiplier[0]) /
((17.8 / multiplier[0]) * (17.8 / multiplier[0] + -1.0));
const v8 = (ap / multiplier[0]) * ((ap / multiplier[0]) * v7 + (1.0 - v7));
return Math.floor(multiplier[2] + (multiplier[0] - multiplier[2]) * v8);
};
return {
baseValue: Math.floor(baseEffect),
value: Math.floor(effect),
baseValue: calculate(0),
value: calculate(args.abilityPoints.get(SUB_QSJ_BOOST_KEY) ?? 0),
modifiedBy: SUB_QSJ_BOOST_KEY,
};
}

View File

@@ -69,7 +69,7 @@ export function apFromMap({
return abilityPoints.get(ability) ?? 0;
}
function abilityValues({
export function abilityValues({
key,
weapon,
}: {