Apply webs and TPs for all graph types

This commit is contained in:
DarkPhoenix
2019-07-08 19:53:10 +03:00
parent 26d4cfa2de
commit 5110e63809
2 changed files with 62 additions and 11 deletions

View File

@@ -174,9 +174,9 @@ def getFighterAbilityMult(fighter, ability, fit, distance, tgtSpeed, tgtSigRadiu
def getWebbedSpeed(fit, tgt, currentUnwebbedSpeed, webMods, webDrones, webFighters, distance):
if tgt.ship.getModifiedItemAttr('disallowOffensiveModifiers'):
return currentUnwebbedSpeed
unwebbedSpeed = tgt.ship.getModifiedItemAttr('maxVelocity')
maxUnwebbedSpeed = tgt.ship.getModifiedItemAttr('maxVelocity')
try:
speedRatio = currentUnwebbedSpeed / unwebbedSpeed
speedRatio = currentUnwebbedSpeed / maxUnwebbedSpeed
except ZeroDivisionError:
currentWebbedSpeed = 0
else:
@@ -189,7 +189,8 @@ def getWebbedSpeed(fit, tgt, currentUnwebbedSpeed, webMods, webDrones, webFighte
distance=distance)
if appliedBoost:
appliedMultipliers.setdefault(wData.stackingGroup, []).append((1 + appliedBoost / 100, wData.resAttrID))
webbedSpeed = tgt.ship.getModifiedItemAttrWithExtraMods('maxVelocity', extraMultipliers=appliedMultipliers)
maxWebbedSpeed = tgt.ship.getModifiedItemAttrWithExtraMods('maxVelocity', extraMultipliers=appliedMultipliers)
currentWebbedSpeed = maxWebbedSpeed * speedRatio
# Drones and fighters
mobileWebs = []
mobileWebs.extend(webFighters)
@@ -204,7 +205,8 @@ def getWebbedSpeed(fit, tgt, currentUnwebbedSpeed, webMods, webDrones, webFighte
for mwData in longEnoughMws:
appliedMultipliers.setdefault(mwData.stackingGroup, []).append((1 + mwData.boost / 100, mwData.resAttrID))
mobileWebs.remove(mwData)
webbedSpeed = tgt.ship.getModifiedItemAttrWithExtraMods('maxVelocity', extraMultipliers=appliedMultipliers)
maxWebbedSpeed = tgt.ship.getModifiedItemAttrWithExtraMods('maxVelocity', extraMultipliers=appliedMultipliers)
currentWebbedSpeed = maxWebbedSpeed * speedRatio
# Apply remaining webs, from fastest to slowest
droneOpt = GraphSettings.getInstance().get('mobileDroneMode')
while mobileWebs:
@@ -213,7 +215,7 @@ def getWebbedSpeed(fit, tgt, currentUnwebbedSpeed, webMods, webDrones, webFighte
fastestMws = [mw for mw in mobileWebs if mw.speed == fastestMwSpeed]
for mwData in fastestMws:
# Faster than target or set to follow it - apply full slowdown
if (droneOpt == GraphDpsDroneMode.auto and mwData.speed >= webbedSpeed) or droneOpt == GraphDpsDroneMode.followTarget:
if (droneOpt == GraphDpsDroneMode.auto and mwData.speed >= currentWebbedSpeed) or droneOpt == GraphDpsDroneMode.followTarget:
appliedMwBoost = mwData.boost
# Otherwise project from the center of the ship
else:
@@ -223,8 +225,8 @@ def getWebbedSpeed(fit, tgt, currentUnwebbedSpeed, webMods, webDrones, webFighte
distance=distance + atkRadius - mwData.radius)
appliedMultipliers.setdefault(mwData.stackingGroup, []).append((1 + appliedMwBoost / 100, mwData.resAttrID))
mobileWebs.remove(mwData)
webbedSpeed = tgt.ship.getModifiedItemAttrWithExtraMods('maxVelocity', extraMultipliers=appliedMultipliers)
currentWebbedSpeed = webbedSpeed * speedRatio
maxWebbedSpeed = tgt.ship.getModifiedItemAttrWithExtraMods('maxVelocity', extraMultipliers=appliedMultipliers)
currentWebbedSpeed = maxWebbedSpeed * speedRatio
return currentWebbedSpeed

View File

@@ -297,7 +297,7 @@ class FitDamageStatsGraph(FitGraph):
def _xTgtSpeedGetter(self, mainInput, miscInputs, fit, tgt, dmgFunc, timeCachePrepFunc):
xs = []
ys = []
tgtSigRadius = tgt.ship.getModifiedItemAttr('signatureRadius')
applyProjected = GraphSettings.getInstance().get('applyProjected')
# Process inputs into more convenient form
miscInputMap = dict(miscInputs)
# Get all data we need for all target speeds into maps/caches
@@ -305,13 +305,37 @@ class FitDamageStatsGraph(FitGraph):
dmgMap = dmgFunc(fit=fit, time=miscInputMap['time'])
# Go through target speeds and calculate distance-dependent data
for tgtSpeed in self._iterLinear(mainInput[1]):
# Get separate internal speed to calculate proper application, for graph
# itself we still want to show pre-modification speed on X axis
tgtSpeedInternal = tgtSpeed
tgtSigRadius = tgt.ship.getModifiedItemAttr('signatureRadius')
if applyProjected:
webMods, tpMods = self._projectedCache.getProjModData(fit)
webDrones, tpDrones = self._projectedCache.getProjDroneData(fit)
webFighters, tpFighters = self._projectedCache.getProjFighterData(fit)
tgtSpeedInternal = getWebbedSpeed(
fit=fit,
tgt=tgt,
currentUnwebbedSpeed=tgtSpeedInternal,
webMods=webMods,
webDrones=webDrones,
webFighters=webFighters,
distance=miscInputMap['distance'])
tgtSigRadius = tgtSigRadius * getTpMult(
fit=fit,
tgt=tgt,
tgtSpeed=tgtSpeedInternal,
tpMods=tpMods,
tpDrones=tpDrones,
tpFighters=tpFighters,
distance=miscInputMap['distance'])
applicationMap = self._getApplicationPerKey(
fit=fit,
tgt=tgt,
atkSpeed=miscInputMap['atkSpeed'],
atkAngle=miscInputMap['atkAngle'],
distance=miscInputMap['distance'],
tgtSpeed=tgtSpeed,
tgtSpeed=tgtSpeedInternal,
tgtAngle=miscInputMap['tgtAngle'],
tgtSigRadius=tgtSigRadius)
dmg = self._aggregate(dmgMap=dmgMap, applicationMap=applicationMap).total
@@ -324,20 +348,45 @@ class FitDamageStatsGraph(FitGraph):
ys = []
# Process inputs into more convenient form
miscInputMap = dict(miscInputs)
tgtSpeed = miscInputMap['tgtSpeed']
tgtSigMult = 1
if GraphSettings.getInstance().get('applyProjected'):
webMods, tpMods = self._projectedCache.getProjModData(fit)
webDrones, tpDrones = self._projectedCache.getProjDroneData(fit)
webFighters, tpFighters = self._projectedCache.getProjFighterData(fit)
tgtSpeed = getWebbedSpeed(
fit=fit,
tgt=tgt,
currentUnwebbedSpeed=tgtSpeed,
webMods=webMods,
webDrones=webDrones,
webFighters=webFighters,
distance=miscInputMap['distance'])
tgtSigMult = getTpMult(
fit=fit,
tgt=tgt,
tgtSpeed=tgtSpeed,
tpMods=tpMods,
tpDrones=tpDrones,
tpFighters=tpFighters,
distance=miscInputMap['distance'])
# Get all data we need for all target speeds into maps/caches
timeCachePrepFunc(fit, miscInputMap['time'])
dmgMap = dmgFunc(fit=fit, time=miscInputMap['time'])
# Go through target speeds and calculate distance-dependent data
for tgtSigRadius in self._iterLinear(mainInput[1]):
# Separate variable to show base signature on X axis and use modified
# signature in calculations
tgtSigRadiusInternal = tgtSigRadius * tgtSigMult
applicationMap = self._getApplicationPerKey(
fit=fit,
tgt=tgt,
atkSpeed=miscInputMap['atkSpeed'],
atkAngle=miscInputMap['atkAngle'],
distance=miscInputMap['distance'],
tgtSpeed=miscInputMap['tgtSpeed'],
tgtSpeed=tgtSpeed,
tgtAngle=miscInputMap['tgtAngle'],
tgtSigRadius=tgtSigRadius)
tgtSigRadius=tgtSigRadiusInternal)
dmg = self._aggregate(dmgMap=dmgMap, applicationMap=applicationMap).total
xs.append(tgtSigRadius)
ys.append(dmg)