ships.Function.damageFalloff - Elite-Dangerous-Almanac/Almanac-Core GitHub Wiki

@elite-dangerous-almanac/core / ships / damageFalloff

Function: damageFalloff()

damageFalloff(weapon, metres): number

Defined in: src/ships/weapons.ts:449

How much of a weapon's damage still lands at a given range.

Parameters

weapon

WeaponStats

The weapon's stats.

metres

number

The range to the target, in metres.

Returns

number

A factor in [0, 1]: 1 inside the falloff range, tapering linearly to 0 at maximum range and staying there beyond it. A weapon with no falloff data reports 1 up to its maximum range. Projectile boundary parameters are deliberately ignored: this function calculates attenuation, not projectile reach.

Example

import { damageFalloff } from '@elite-dangerous-almanac/core/ships/weapons';

const mc = { maximumRange: 4000, falloffRange: 2000 };
damageFalloff(mc, 1500); // -> 1
damageFalloff(mc, 3000); // -> 0.5
damageFalloff(mc, 5000); // -> 0
⚠️ **GitHub.com Fallback** ⚠️