MCPcopy Create free account
hub / github.com/pyfa-org/Pyfa / missileMaxRangeData

Method missileMaxRangeData

eos/saveddata/module.py:327–371  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

325
326 @property
327 def missileMaxRangeData(self):
328 if self.charge is None:
329 return None
330 try:
331 chargeName = self.charge.group.name
332 except AttributeError:
333 pass
334 else:
335 if chargeName in ("Scanner Probe", "Survey Probe"):
336 return None
337
338 def calculateRange(maxVelocity, mass, agility, flightTime):
339 # Source: http://www.eveonline.com/ingameboard.asp?a=topic&threadID=1307419&page=1#15
340 # D_m = V_m * (T_m + T_0*[exp(- T_m/T_0)-1])
341 accelTime = min(flightTime, mass * agility / 1000000)
342 # Average distance done during acceleration
343 duringAcceleration = maxVelocity / 2 * accelTime
344 # Distance done after being at full speed
345 fullSpeed = maxVelocity * (flightTime - accelTime)
346 maxRange = duringAcceleration + fullSpeed
347 return maxRange
348
349 maxVelocity = self.getModifiedChargeAttr("maxVelocity")
350 if not maxVelocity:
351 return None
352 shipRadius = self.owner.ship.getModifiedItemAttr("radius")
353 # Flight time has bonus based on ship radius, see https://github.com/pyfa-org/Pyfa/issues/2083
354 flightTime = floatUnerr(self.getModifiedChargeAttr("explosionDelay") / 1000 + shipRadius / maxVelocity)
355 mass = self.getModifiedChargeAttr("mass")
356 agility = self.getModifiedChargeAttr("agility")
357 lowerTime = math.floor(flightTime)
358 higherTime = math.ceil(flightTime)
359 lowerRange = calculateRange(maxVelocity, mass, agility, lowerTime)
360 higherRange = calculateRange(maxVelocity, mass, agility, higherTime)
361 # Fof range limit is supposedly calculated based on overview (surface-to-surface) range
362 if 'fofMissileLaunching' in self.charge.effects:
363 rangeLimit = self.getModifiedChargeAttr("maxFOFTargetRange")
364 if rangeLimit:
365 lowerRange = min(lowerRange, rangeLimit)
366 higherRange = min(higherRange, rangeLimit)
367 # Make range center-to-surface, as missiles spawn in the center of the ship
368 lowerRange = max(0, lowerRange - shipRadius)
369 higherRange = max(0, higherRange - shipRadius)
370 higherChance = flightTime - lowerTime
371 return lowerRange, higherRange, higherChance
372
373 @property
374 def falloff(self):

Callers

nothing calls this directly

Calls 3

floatUnerrFunction · 0.90
getModifiedChargeAttrMethod · 0.80
getModifiedItemAttrMethod · 0.45

Tested by

no test coverage detected