MCPcopy Index your code
hub / github.com/pyfa-org/Pyfa / calculateRangeFactor

Function calculateRangeFactor

eos/calc.py:53–65  ·  view source on GitHub ↗

Range strength/chance factor, applicable to guns, ewar, RRs, etc.

(srcOptimalRange, srcFalloffRange, distance, restrictedRange=True)

Source from the content-addressed store, hash-verified

51
52
53def calculateRangeFactor(srcOptimalRange, srcFalloffRange, distance, restrictedRange=True):
54 """Range strength/chance factor, applicable to guns, ewar, RRs, etc."""
55 if distance is None:
56 return 1
57 if srcFalloffRange > 0:
58 # Most modules cannot be activated when at 3x falloff range, with few exceptions like guns
59 if restrictedRange and distance > srcOptimalRange + 3 * srcFalloffRange:
60 return 0
61 return 0.5 ** ((max(0, distance - srcOptimalRange) / srcFalloffRange) ** 2)
62 elif distance <= srcOptimalRange:
63 return 1
64 else:
65 return 0
66
67
68def calculateLockTime(srcScanRes, tgtSigRadius):

Callers 15

_calculatePointMethod · 0.90
_calculatePointMethod · 0.90
_calculatePointMethod · 0.90
_calculatePointMethod · 0.90
_calculatePointMethod · 0.90
_calculatePointMethod · 0.90
_calculatePointMethod · 0.90
getVortonMultFunction · 0.90
getFighterAbilityMultFunction · 0.90
_calcTurretChanceToHitFunction · 0.90
getTackledSpeedFunction · 0.90
getSigRadiusMultFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected