Merge branch 'master' into ammo_graph
This commit is contained in:
@@ -330,24 +330,56 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
|
|||||||
else:
|
else:
|
||||||
if chargeName in ("Scanner Probe", "Survey Probe"):
|
if chargeName in ("Scanner Probe", "Survey Probe"):
|
||||||
return None
|
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
|
# 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])
|
# D_m = V_m * (T_m + T_0*[exp(- T_m/T_0)-1])
|
||||||
maxVelocity = self.getModifiedChargeAttr("maxVelocity")
|
accelTime = min(flightTime, mass * agility / 1000000)
|
||||||
flightTime = self.getModifiedChargeAttr("explosionDelay") / 1000.0
|
# Average distance done during acceleration
|
||||||
mass = self.getModifiedChargeAttr("mass")
|
duringAcceleration = maxVelocity / 2 * accelTime
|
||||||
agility = self.getModifiedChargeAttr("agility")
|
# Distance done after being at full speed
|
||||||
if maxVelocity and (flightTime or mass or agility):
|
fullSpeed = maxVelocity * (flightTime - accelTime)
|
||||||
accelTime = min(flightTime, mass * agility / 1000000)
|
maxRange = duringAcceleration + fullSpeed
|
||||||
# Average distance done during acceleration
|
return maxRange
|
||||||
duringAcceleration = maxVelocity / 2 * accelTime
|
|
||||||
# Distance done after being at full speed
|
maxVelocity = self.getModifiedChargeAttr("maxVelocity")
|
||||||
fullSpeed = maxVelocity * (flightTime - accelTime)
|
flightTime = floatUnerr(self.getModifiedChargeAttr("explosionDelay") / 1000.0)
|
||||||
maxRange = duringAcceleration + fullSpeed
|
mass = self.getModifiedChargeAttr("mass")
|
||||||
if 'fofMissileLaunching' in self.charge.effects:
|
agility = self.getModifiedChargeAttr("agility")
|
||||||
rangeLimit = self.getModifiedChargeAttr("maxFOFTargetRange")
|
lowerTime = math.floor(flightTime)
|
||||||
if rangeLimit:
|
higherTime = math.ceil(flightTime)
|
||||||
maxRange = min(maxRange, rangeLimit)
|
lowerRange = calculateRange(maxVelocity, mass, agility, lowerTime)
|
||||||
return maxRange
|
higherRange = calculateRange(maxVelocity, mass, agility, higherTime)
|
||||||
|
# Fof range limit is supposedly calculated based on overview (surface-to-surface) range
|
||||||
|
if 'fofMissileLaunching' in self.charge.effects:
|
||||||
|
rangeLimit = self.getModifiedChargeAttr("maxFOFTargetRange")
|
||||||
|
if rangeLimit:
|
||||||
|
lowerRange = min(lowerRange, rangeLimit)
|
||||||
|
higherRange = min(higherRange, rangeLimit)
|
||||||
|
# Make range center-to-surface, as missiles spawn in the center of the ship
|
||||||
|
shipRadius = self.owner.ship.getModifiedItemAttr("radius")
|
||||||
|
lowerRange = max(0, lowerRange - shipRadius)
|
||||||
|
higherRange = max(0, higherRange - shipRadius)
|
||||||
|
higherChance = flightTime - lowerTime
|
||||||
|
return lowerRange, higherRange, higherChance
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def falloff(self):
|
def falloff(self):
|
||||||
|
|||||||
@@ -152,18 +152,24 @@ def getTurretMult(mod, src, tgt, atkSpeed, atkAngle, distance, tgtSpeed, tgtAngl
|
|||||||
|
|
||||||
|
|
||||||
def getLauncherMult(mod, src, distance, tgtSpeed, tgtSigRadius):
|
def getLauncherMult(mod, src, distance, tgtSpeed, tgtSigRadius):
|
||||||
modRange = mod.maxRange
|
missileMaxRangeData = mod.missileMaxRangeData
|
||||||
if modRange is None:
|
if missileMaxRangeData is None:
|
||||||
return 0
|
return 0
|
||||||
if distance is not None and distance + src.getRadius() > modRange:
|
# The ranges already consider ship radius
|
||||||
return 0
|
lowerRange, higherRange, higherChance = missileMaxRangeData
|
||||||
mult = _calcMissileFactor(
|
if distance is None or distance <= lowerRange:
|
||||||
|
distanceFactor = 1
|
||||||
|
elif lowerRange < distance <= higherRange:
|
||||||
|
distanceFactor = higherChance
|
||||||
|
else:
|
||||||
|
distanceFactor = 0
|
||||||
|
applicationFactor = _calcMissileFactor(
|
||||||
atkEr=mod.getModifiedChargeAttr('aoeCloudSize'),
|
atkEr=mod.getModifiedChargeAttr('aoeCloudSize'),
|
||||||
atkEv=mod.getModifiedChargeAttr('aoeVelocity'),
|
atkEv=mod.getModifiedChargeAttr('aoeVelocity'),
|
||||||
atkDrf=mod.getModifiedChargeAttr('aoeDamageReductionFactor'),
|
atkDrf=mod.getModifiedChargeAttr('aoeDamageReductionFactor'),
|
||||||
tgtSpeed=tgtSpeed,
|
tgtSpeed=tgtSpeed,
|
||||||
tgtSigRadius=tgtSigRadius)
|
tgtSigRadius=tgtSigRadius)
|
||||||
return mult
|
return distanceFactor * applicationFactor
|
||||||
|
|
||||||
|
|
||||||
def getSmartbombMult(mod, distance):
|
def getSmartbombMult(mod, distance):
|
||||||
|
|||||||
Reference in New Issue
Block a user