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

Function getDroneMult

graphs/data/fitDamageStats/calc/application.py:270–311  ·  view source on GitHub ↗
(drone, src, tgt, atkSpeed, atkAngle, distance, tgtSpeed, tgtAngle, tgtSigRadius)

Source from the content-addressed store, hash-verified

268
269
270def getDroneMult(drone, src, tgt, atkSpeed, atkAngle, distance, tgtSpeed, tgtAngle, tgtSigRadius):
271 if (
272 distance is not None and (
273 (not GraphSettings.getInstance().get('ignoreDCR') and distance > src.item.extraAttributes['droneControlRange']) or
274 (not GraphSettings.getInstance().get('ignoreLockRange') and distance > src.item.maxTargetRange))
275 ):
276 return 0
277 droneSpeed = drone.getModifiedItemAttr('maxVelocity')
278 # Hard to simulate drone behavior, so assume chance to hit is 1 for mobile drones
279 # which catch up with target
280 droneOpt = GraphSettings.getInstance().get('mobileDroneMode')
281 if (
282 droneSpeed > 1 and (
283 (droneOpt == GraphDpsDroneMode.auto and droneSpeed >= tgtSpeed) or
284 droneOpt == GraphDpsDroneMode.followTarget)
285 ):
286 cth = 1
287 # Otherwise put the drone into center of the ship, move it at its max speed or ship's speed
288 # (whichever is lower) towards direction of attacking ship and see how well it projects
289 else:
290 droneRadius = drone.getModifiedItemAttr('radius')
291 if distance is None:
292 cthDistance = None
293 else:
294 # As distance is ship surface to ship surface, we adjust it according
295 # to attacker ship's radiuses to have drone surface to ship surface distance
296 cthDistance = distance + src.getRadius() - droneRadius
297 cth = _calcTurretChanceToHit(
298 atkSpeed=min(atkSpeed, droneSpeed),
299 atkAngle=atkAngle,
300 atkRadius=droneRadius,
301 atkOptimalRange=drone.maxRange or 0,
302 atkFalloffRange=drone.falloff or 0,
303 atkTracking=drone.getModifiedItemAttr('trackingSpeed'),
304 atkOptimalSigRadius=drone.getModifiedItemAttr('optimalSigRadius'),
305 distance=cthDistance,
306 tgtSpeed=tgtSpeed,
307 tgtAngle=tgtAngle,
308 tgtRadius=tgt.getRadius(),
309 tgtSigRadius=tgtSigRadius)
310 mult = _calcTurretMult(cth)
311 return mult
312
313
314def getFighterAbilityMult(fighter, ability, src, tgt, distance, tgtSpeed, tgtSigRadius):

Callers 1

getApplicationPerKeyFunction · 0.85

Calls 6

_calcTurretChanceToHitFunction · 0.85
_calcTurretMultFunction · 0.85
getRadiusMethod · 0.80
getMethod · 0.45
getInstanceMethod · 0.45
getModifiedItemAttrMethod · 0.45

Tested by

no test coverage detected