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

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

Function: armourPiercingFactor()

armourPiercingFactor(armourPiercing, hardness): number

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

How much of a weapon's damage a hull's hardness lets through.

Parameters

armourPiercing

number

The weapon's piercing rating.

hardness

number

The target hull's finite, non-negative Ship.hardness. Pass 0 when the hardness is unknown, which disables hardness scaling.

Returns

number

A factor in [0, 1]: 1 when the weapon out-pierces the hull, otherwise armourPiercing / hardness. A zero piercing rating returns 0 when hardness is positive; zero hardness always returns 1 because it disables hardness scaling. Applies to hull damage only — shields do not care.

Throws

If either argument is not a finite non-negative number.

Example

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

armourPiercingFactor(22, 65); // -> 0.338…  a small multi-cannon against an Anaconda
armourPiercingFactor(100, 65); // -> 1      a rail gun goes straight through
⚠️ **GitHub.com Fallback** ⚠️