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

Function calculateMultiplier

eos/calc.py:27–50  ·  view source on GitHub ↗

multipliers: dictionary in format: {stacking group name: [(mult, resist attr ID), (mult, resist attr ID)]}

(multipliers)

Source from the content-addressed store, hash-verified

25# as multipliers arrive in different form) in here to not make actual attribute
26# calculations slower than they already are due to extra function calls
27def calculateMultiplier(multipliers):
28 """
29 multipliers: dictionary in format:
30 {stacking group name: [(mult, resist attr ID), (mult, resist attr ID)]}
31 """
32 val = 1
33 for penalizedMultipliers in multipliers.values():
34 # A quick explanation of how this works:
35 # 1: Bonuses and penalties are calculated seperately, so we'll have to filter each of them
36 l1 = [v[0] for v in penalizedMultipliers if v[0] > 1]
37 l2 = [v[0] for v in penalizedMultipliers if v[0] < 1]
38 # 2: The most significant bonuses take the smallest penalty,
39 # This means we'll have to sort
40 abssort = lambda _val: -abs(_val - 1)
41 l1.sort(key=abssort)
42 l2.sort(key=abssort)
43 # 3: The first module doesn't get penalized at all
44 # Any module after the first takes penalties according to:
45 # 1 + (multiplier - 1) * math.exp(- math.pow(i, 2) / 7.1289)
46 for l in (l1, l2):
47 for i in range(len(l)):
48 bonus = l[i]
49 val *= 1 + (bonus - 1) * math.exp(- i ** 2 / 7.1289)
50 return val
51
52
53def calculateRangeFactor(srcOptimalRange, srcFalloffRange, distance, restrictedRange=True):

Callers 8

getMaxVelocityMethod · 0.90
getSigRadiusMethod · 0.90
_calculatePointMethod · 0.90
_calculatePointMethod · 0.90
_calculatePointMethod · 0.90
_calculatePointMethod · 0.90
_calculatePointMethod · 0.90
getDampMultScanResMethod · 0.90

Calls 2

valuesMethod · 0.80
sortMethod · 0.45

Tested by

no test coverage detected