Skip to content

Comp analyzer · Modules

3 modules · 19 exports · 0 repositories · 4 e2e tests · 1 route

Who imports who · hover a node
Depends onComp analyzer modulesUsed byDamageCombos4 exportsSpecialWeaponRange4 exp…WeaponRange11 exportsRoutes1 fileComponents6 files

DamageCombos

app/features/comp-analyzer/core/DamageCombos.ts

Damage 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

interface

ExcludedDamageKey

:131

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

function

damageKeys

:138

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[]
function

calculate

:175

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)
function

inkTimeToKill

:412

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)
Unit tests not about one export (6)

Not shown, only used by tests: damageSources

SpecialWeaponRange

app/features/comp-analyzer/core/SpecialWeaponRange.ts

Range circles of special weapons, as drawn on the map planner and the comp analyzer. Projectile specials (Trizooka, Crab Tank…) reuse the main weapon trajectory model of WeaponRange, area specials carry a radius in their params.

Imports
WeaponRange
Used by
2 components

Types

interface

SpecialWeaponRangeResult

:19

Range of a special: how far its projectile flies, or the radius of its area.

export interface SpecialWeaponRangeResult {
	/** In game distance units. */
	range: number;
	/** Extra outer radius of the projectile's blast, in game distance units. */
	blastRadius?: number;
	rangeType: "projectile" | "radius";
}
Only used inside the module
interface

SpecialWeaponWithRange

:75

A special with its range.

export interface SpecialWeaponWithRange extends SpecialWeaponRangeResult {
	specialWeaponId: SpecialWeaponId;
}

Functions & values

function

ofSpecial

:31

Range circle of a special, or null when it has none worth drawing. Values come from weapon-params.ts: projectile specials reuse the main weapon trajectory model, the rest carry a radius.

export function ofSpecial(
	specialWeaponId: SpecialWeaponId,
): SpecialWeaponRangeResult | null
Unit tests (6)
function

allSpecials

:80

Every special with a range to draw, widest first.

export function allSpecials(): SpecialWeaponWithRange[]

WeaponRange

app/features/comp-analyzer/core/WeaponRange.ts

How far main weapons shoot: a frame by frame simulation of a shot's flight (straight, braking, then falling) from the weapon's params, chargers reaching their full charge distance in a line. Distances are in game units, measured from a player standing on flat ground.

Imports
no other modules
Used by
1 module3 components

Types

interface

TrajectoryParams

:12

Flight params of a shot, Range_* of the weapon's params with the game's defaults filled in.

export interface TrajectoryParams {
	spawnSpeed: number;
	goStraightStateEndMaxSpeed: number;
	goStraightToBrakeStateFrame: number;
	freeGravity: number;
	freeAirResist: number;
	brakeAirResist: number;
	brakeGravity: number;
	brakeToFreeFrame: number;
	burstFrame?: number;
	bounceAfterMaxSpeed?: number;
}
interface

TrajectoryPoint

:26

A shot's position: z the distance travelled forward, y the height above the ground.

export interface TrajectoryPoint {
	z: number;
	y: number;
}
interface

WeaponRangeResult

:171

Range of a main weapon, unsupported for weapons the model can't simulate.

export interface WeaponRangeResult {
	range: number;
	blastRadius?: number;
	rangeType: "calculated" | "direct" | "unsupported";
	trajectory?: TrajectoryPoint[];
}
Only used inside the module
interface

WeaponWithRange

:234

A comp's weapon with its range.

export interface WeaponWithRange {
	weaponId: MainWeaponId;
	/** Position in the comp, kept through the filtering so duplicates stay apart */
	slot: number;
	range: number;
	blastRadius?: number;
	rangeType: "calculated" | "direct" | "unsupported";
	trajectory?: TrajectoryPoint[];
}
interface

BenchmarkTrajectory

:262

Trajectory of a benchmark weapon.

export interface BenchmarkTrajectory {
	id: MainWeaponId;
	range: number;
	trajectory?: TrajectoryPoint[];
}
Only used inside the module

Functions & values

function

groundRange

:49

Distance at which a trajectory first reaches the ground, its last point's when it never does.

export function groundRange(trajectory: TrajectoryPoint[]): number
function

simulateTrajectory

:71

The shot's position on every frame until it lands, bursts or stops. Bouncing shots (bounceAfterMaxSpeed set) bounce burstFrame times instead of landing.

export function simulateTrajectory(
	params: TrajectoryParams,
): TrajectoryPoint[]
function

ofMainWeapon

:179

Range of a main weapon with the trajectory it was measured from.

export function ofMainWeapon(weaponId: MainWeaponId): WeaponRangeResult
function

ofWeapons

:245

Ranges of a comp's weapons, the ones the model can't simulate left out.

export function ofWeapons(weaponIds: MainWeaponId[]): WeaponWithRange[]
Unit tests (2)
const

BENCHMARK_WEAPON_IDS

:259

Weapons drawn under every comp's ranges for scale: Splattershot and Snipewriter 5H.

export const BENCHMARK_WEAPON_IDS = [40, 2070] satisfies MainWeaponId[];
function

benchmarkTrajectories

:269

Trajectories of the benchmark weapons.

export function benchmarkTrajectories(): BenchmarkTrajectory[]