Exclude any "combo" that contains 100dmg or more segment

Follow-up/fix to 49ea49a30b
This commit is contained in:
Kalle 2026-01-21 22:34:58 +02:00
parent fce481982a
commit dff8b39ac6
2 changed files with 5 additions and 28 deletions

View File

@ -172,35 +172,14 @@ describe("calculateDamageCombos - threshold filtering", () => {
});
describe("calculateDamageCombos - one-shot exclusion", () => {
test("excludes combos where main/special hit one-shots without sub", () => {
test("excludes all combos containing a 100+ damage hit", () => {
const combos = calculateDamageCombos([SPLAT_CHARGER_ID, SPLATTERSHOT_ID]);
for (const combo of combos) {
const hasNoSubWeapon = combo.segments.every((s) => !s.isSubWeapon);
const hasOneShot = combo.segments.some((s) => s.damageValue >= 100);
const isInvalidCombo = hasNoSubWeapon && hasOneShot;
expect(isInvalidCombo).toBe(false);
expect(hasOneShot).toBe(false);
}
});
test("keeps combos with 100+ damage when sub weapon is present", () => {
const combos = calculateDamageCombos([SPLAT_CHARGER_ID, SPLATTERSHOT_ID]);
const comboWithSubAndOneShot = combos.find((combo) => {
const hasSub = combo.segments.some((s) => s.isSubWeapon);
const hasOneShot = combo.segments.some((s) => s.damageValue >= 100);
return hasSub && hasOneShot;
});
expect(comboWithSubAndOneShot).toBeDefined();
expect(comboWithSubAndOneShot!.segments.some((s) => s.isSubWeapon)).toBe(
true,
);
expect(
comboWithSubAndOneShot!.segments.some((s) => s.damageValue >= 100),
).toBe(true);
});
});
describe("calculateDamageCombos - sorting", () => {

View File

@ -307,7 +307,7 @@ function filterAndSortCombos(combos: DamageCombo[]): DamageCombo[] {
return false;
}
if (hasOneShotWithoutSub(combo)) {
if (hasOneShot(combo)) {
return false;
}
@ -326,10 +326,8 @@ function filterAndSortCombos(combos: DamageCombo[]): DamageCombo[] {
return filtered.slice(0, MAX_COMBOS_DISPLAYED);
}
function hasOneShotWithoutSub(combo: DamageCombo): boolean {
const hasNoSubWeapon = combo.segments.every((s) => !s.isSubWeapon);
const hasOneShot = combo.segments.some((s) => s.damageValue >= 100);
return hasNoSubWeapon && hasOneShot;
function hasOneShot(combo: DamageCombo): boolean {
return combo.segments.some((s) => s.damageValue >= 100);
}
const SPLASH_O_MATIC_ID = 20;