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

Function getSigRadiusMult

graphs/data/fitDamageStats/calc/projected.py:141–189  ·  view source on GitHub ↗
(src, tgt, tgtSpeed, srcScramRange, tgtScrammables, tpMods, tpDrones, tpFighters, distance)

Source from the content-addressed store, hash-verified

139
140
141def getSigRadiusMult(src, tgt, tgtSpeed, srcScramRange, tgtScrammables, tpMods, tpDrones, tpFighters, distance):
142 # Can blow non-immune ships and target profiles
143 if tgt.isFit and tgt.item.ship.getModifiedItemAttr('disallowOffensiveModifiers'):
144 return 1
145 inLockRange = checkLockRange(src=src, distance=distance)
146 inDroneRange = checkDroneControlRange(src=src, distance=distance)
147 initSig = tgt.getSigRadius()
148 # No scrams or distance is longer than longest scram - nullify scrammables list
149 if not inLockRange or srcScramRange is None or (distance is not None and distance > srcScramRange):
150 tgtScrammables = ()
151 # TPing modules
152 appliedMultipliers = {}
153 if inLockRange:
154 for tpData in tpMods:
155 appliedBoost = tpData.boost * calculateRangeFactor(
156 srcOptimalRange=tpData.optimal,
157 srcFalloffRange=tpData.falloff,
158 distance=distance)
159 if appliedBoost:
160 appliedMultipliers.setdefault(tpData.stackingGroup, []).append((1 + appliedBoost / 100, tpData.resAttrID))
161 # TPing drones
162 mobileTps = []
163 if inLockRange:
164 mobileTps.extend(tpFighters)
165 if inLockRange and inDroneRange:
166 mobileTps.extend(tpDrones)
167 droneOpt = GraphSettings.getInstance().get('mobileDroneMode')
168 atkRadius = src.getRadius()
169 for mtpData in mobileTps:
170 # Faster than target or set to follow it - apply full TP
171 if (droneOpt == GraphDpsDroneMode.auto and mtpData.speed >= tgtSpeed) or droneOpt == GraphDpsDroneMode.followTarget:
172 appliedMtpBoost = mtpData.boost
173 # Otherwise project from the center of the ship
174 else:
175 if distance is None:
176 rangeFactorDistance = None
177 else:
178 rangeFactorDistance = distance + atkRadius - mtpData.radius
179 appliedMtpBoost = mtpData.boost * calculateRangeFactor(
180 srcOptimalRange=mtpData.optimal,
181 srcFalloffRange=mtpData.falloff,
182 distance=rangeFactorDistance)
183 appliedMultipliers.setdefault(mtpData.stackingGroup, []).append((1 + appliedMtpBoost / 100, mtpData.resAttrID))
184 modifiedSig = tgt.getSigRadius(extraMultipliers=appliedMultipliers, ignoreAfflictors=tgtScrammables)
185 if modifiedSig == math.inf and initSig == math.inf:
186 return 1
187 mult = modifiedSig / initSig
188 # Ensure consistent results - round off a little to avoid float errors
189 return floatUnerr(mult)

Callers 4

_calculatePointMethod · 0.85
_calculatePointMethod · 0.85
_getCommonDataMethod · 0.85

Calls 10

checkLockRangeFunction · 0.90
checkDroneControlRangeFunction · 0.90
calculateRangeFactorFunction · 0.90
floatUnerrFunction · 0.90
getSigRadiusMethod · 0.80
getRadiusMethod · 0.80
getModifiedItemAttrMethod · 0.45
appendMethod · 0.45
getMethod · 0.45
getInstanceMethod · 0.45

Tested by

no test coverage detected