DamageCombos
app/features/comp-analyzer/core/DamageCombos.tsDamage combos of a comp: the ways hits from different weapons (main, sub and special damages alike) add up to a splat when no single hit does. Combos are searched by backtracking over every damage the comp deals, kept lethal but not excessive, deduplicated and ordered closest to 100 damage first. Damages come from the build analyzer's stats of each weapon.
- Imports
- no other modules
- Used by
- 1 route2 components
Types
A damage of one weapon, as the user excludes it from the combos.
export interface ExcludedDamageKey { weaponId: MainWeaponId; weaponType: "main" | "sub" | "special"; damageType: DamageType; }
Functions & values
Every damage of the comp's weapons once, the ones the user can exclude from the combos.
export function damageKeys( weaponIds: MainWeaponId[], targetSubDefenseAp = 0, ): ExcludedDamageKey[]
The comp's damage combos, best first: lethal ones closest to 100 damage with the fewest hits. Combos span at least two weapons unless includeSingleWeaponCombos, where a weapon's main, sub and special count as separate sources.
export function calculate( weaponIds: MainWeaponId[], excludedKeys: ExcludedDamageKey[] = [], targetSubDefenseAp = 0, maxCombosDisplayed = MAX_COMBOS_DISPLAYED, includeSingleWeaponCombos = false, ): DamageCombo[]
Unit tests (23)
- basic combination generation › generates combos involving 2+ weapons
- basic combination generation › calculates
- constraint enforcement › respects
- constraint enforcement › requires 2+ weapon slots in each combo
- threshold filtering › excludes combos below damage threshold
- threshold filtering › includes combos at or above damage threshold
- one-shot exclusion › excludes all combos containing a 100+ damage hit
- sorting › sorts results by totalDamage closest to 100 (lethal threshold)
- result cap › returns at most MAX_COMBOS_DISPLAYED results
- edge cases › returns
- edge cases › same sub weapon on multiple weapons creates valid combos
- edge cases › all
- excessive combo filtering › filters out excessive combos (200+ damage where removing any hit still kills)
- excessive combo filtering › allows combos where removing any hit drops below lethal threshold
- deduplication › no duplicate combos with bug report weapons
- single weapon combos › returns no combos for a single weapon when disabled
- single weapon combos › generates combos from a single weapon when enabled
- single weapon combos › lets a single weapon pair its main and sub damage when enabled
- single weapon combos › keeps single-weapon combos alongside cross-weapon ones when enabled
Frames of enemy ink damage needed to finish a target after comboDamage. targetResAp is Ink Resistance Up AP (0-57). Null when the combo is already lethal or ink damage can't finish it.
export function inkTimeToKill( comboDamage: number, targetResAp: number, ): number | null
Unit tests (8)
- returns
- calculates
- higher RES increases ink time
- handles
Unit tests not about one export (6)
Not shown, only used by tests: damageSources