diff --git a/eos/saveddata/module.py b/eos/saveddata/module.py index 68faedf3d..973e2fb05 100644 --- a/eos/saveddata/module.py +++ b/eos/saveddata/module.py @@ -330,24 +330,51 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut): else: if chargeName in ("Scanner Probe", "Survey Probe"): return None + missileMaxRangeData = self.missileMaxRangeData + if missileMaxRangeData is None: + return None + lowerRange, higherRange, higherChance = missileMaxRangeData + maxRange = lowerRange * (1 - higherChance) + higherRange * higherChance + return maxRange + + @property + def missileMaxRangeData(self): + if self.charge is None: + return None + try: + chargeName = self.charge.group.name + except AttributeError: + pass + else: + if chargeName in ("Scanner Probe", "Survey Probe"): + return None + + def calculateRange(maxVelocity, mass, agility, flightTime): # Source: http://www.eveonline.com/ingameboard.asp?a=topic&threadID=1307419&page=1#15 # D_m = V_m * (T_m + T_0*[exp(- T_m/T_0)-1]) - maxVelocity = self.getModifiedChargeAttr("maxVelocity") - flightTime = self.getModifiedChargeAttr("explosionDelay") / 1000.0 - mass = self.getModifiedChargeAttr("mass") - agility = self.getModifiedChargeAttr("agility") - if maxVelocity and (flightTime or mass or agility): - accelTime = min(flightTime, mass * agility / 1000000) - # Average distance done during acceleration - duringAcceleration = maxVelocity / 2 * accelTime - # Distance done after being at full speed - fullSpeed = maxVelocity * (flightTime - accelTime) - maxRange = duringAcceleration + fullSpeed - if 'fofMissileLaunching' in self.charge.effects: - rangeLimit = self.getModifiedChargeAttr("maxFOFTargetRange") - if rangeLimit: - maxRange = min(maxRange, rangeLimit) - return maxRange + accelTime = min(flightTime, mass * agility / 1000000) + # Average distance done during acceleration + duringAcceleration = maxVelocity / 2 * accelTime + # Distance done after being at full speed + fullSpeed = maxVelocity * (flightTime - accelTime) + maxRange = duringAcceleration + fullSpeed + return maxRange + + maxVelocity = self.getModifiedChargeAttr("maxVelocity") + flightTime = floatUnerr(self.getModifiedChargeAttr("explosionDelay") / 1000.0) + mass = self.getModifiedChargeAttr("mass") + agility = self.getModifiedChargeAttr("agility") + lowerTime = math.floor(flightTime) + higherTime = math.ceil(flightTime) + lowerRange = calculateRange(maxVelocity, mass, agility, lowerTime) + higherRange = calculateRange(maxVelocity, mass, agility, higherTime) + if 'fofMissileLaunching' in self.charge.effects: + rangeLimit = self.getModifiedChargeAttr("maxFOFTargetRange") + if rangeLimit: + lowerRange = min(lowerRange, rangeLimit) + higherRange = min(higherRange, rangeLimit) + higherChance = flightTime - lowerTime + return lowerRange, higherRange, higherChance @property def falloff(self): diff --git a/graphs/data/fitDamageStats/calc/application.py b/graphs/data/fitDamageStats/calc/application.py index dbb0cda2f..f0f9f4cd5 100644 --- a/graphs/data/fitDamageStats/calc/application.py +++ b/graphs/data/fitDamageStats/calc/application.py @@ -152,18 +152,23 @@ def getTurretMult(mod, src, tgt, atkSpeed, atkAngle, distance, tgtSpeed, tgtAngl def getLauncherMult(mod, src, distance, tgtSpeed, tgtSigRadius): - modRange = mod.maxRange - if modRange is None: + missileMaxRangeData = mod.missileMaxRangeData + if missileMaxRangeData is None: return 0 - if distance is not None and distance + src.getRadius() > modRange: - return 0 - mult = _calcMissileFactor( + lowerRange, higherRange, higherChance = missileMaxRangeData + if distance is None or distance + src.getRadius() <= lowerRange: + distanceFactor = 1 + elif lowerRange < distance + src.getRadius() <= higherRange: + distanceFactor = higherChance + else: + distanceFactor = 0 + applicationFactor = _calcMissileFactor( atkEr=mod.getModifiedChargeAttr('aoeCloudSize'), atkEv=mod.getModifiedChargeAttr('aoeVelocity'), atkDrf=mod.getModifiedChargeAttr('aoeDamageReductionFactor'), tgtSpeed=tgtSpeed, tgtSigRadius=tgtSigRadius) - return mult + return distanceFactor * applicationFactor def getSmartbombMult(mod, distance):