Merge branch 'spoolup_support'

This commit is contained in:
DarkPhoenix
2018-12-10 09:19:40 +03:00
7 changed files with 120 additions and 86 deletions

View File

@@ -75,7 +75,7 @@ class FitDpsGraph(Graph):
pyfalog.critical(e)
for mod in fit.modules:
dps, _ = mod.damageStats(fit.targetResists)
dps = mod.damageStats(fit.targetResists)[1]
if mod.hardpoint == Hardpoint.TURRET:
if mod.state >= State.ACTIVE:
total += dps * self.calculateTurretMultiplier(mod, data)
@@ -88,7 +88,7 @@ class FitDpsGraph(Graph):
for drone in fit.drones:
multiplier = 1 if drone.getModifiedItemAttr("maxVelocity") > 1 else self.calculateTurretMultiplier(
drone, data)
dps, _ = drone.damageStats(fit.targetResists)
dps = drone.damageStats(fit.targetResists)[0]
total += dps * multiplier
# this is janky as fuck
@@ -98,7 +98,7 @@ class FitDpsGraph(Graph):
for ability in fighter.abilities:
if ability.dealsDamage and ability.active:
multiplier = self.calculateFighterMissileMultiplier(ability, data)
dps, _ = ability.damageStats(fit.targetResists)
dps = ability.damageStats(fit.targetResists)[0]
total += dps * multiplier
return total

View File

@@ -120,9 +120,11 @@ class Drone(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
def hasAmmo(self):
return self.charge is not None
@property
def dps(self):
return self.damageStats()
def getDps(self):
return self.damageStats()[0]
def getVolley(self):
return self.damageStats()[1]
def changeType(self, typeID):
self.itemID = typeID

View File

@@ -172,9 +172,11 @@ class Fighter(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
def hasAmmo(self):
return self.charge is not None
@property
def dps(self):
return self.damageStats()
def getDps(self):
return self.damageStats()[0]
def getVolley(self):
return self.damageStats()[1]
def damageStats(self, targetResists=None):
if self.__dps is None:

View File

@@ -120,10 +120,10 @@ class Fit(object):
def build(self):
self.__extraDrains = []
self.__ehp = None
self.__weaponDPS = None
self.__weaponDps = None
self.__minerYield = None
self.__weaponVolley = None
self.__droneDPS = None
self.__droneDps = None
self.__droneVolley = None
self.__droneYield = None
self.__sustainableTank = None
@@ -154,9 +154,11 @@ class Fit(object):
@targetResists.setter
def targetResists(self, targetResists):
self.__targetResists = targetResists
self.__weaponDPS = None
self.__weaponDps = None
self.__weaponDpsSpool = None
self.__weaponVolley = None
self.__droneDPS = None
self.__weaponVolleySpool = None
self.__droneDps = None
self.__droneVolley = None
@property
@@ -277,41 +279,41 @@ class Fit(object):
def projectedFighters(self):
return self.__projectedFighters
@property
def weaponDPS(self):
if self.__weaponDPS is None:
def getWeaponDps(self, spool=False):
if spool:
if self.__weaponDpsSpool is None:
self.calculateWeaponStats()
return self.__weaponDpsSpool
else:
if self.__weaponDps is None:
self.calculateWeaponStats()
return self.__weaponDps
def getWeaponVolley(self, spool=False):
if spool:
if self.__weaponVolleySpool is None:
self.calculateWeaponStats()
return self.__weaponVolleySpool
else:
if self.__weaponVolley is None:
self.calculateWeaponStats()
return self.__weaponVolley
def getDroneDps(self):
if self.__droneDps is None:
self.calculateWeaponStats()
return self.__droneDps
return self.__weaponDPS
@property
def weaponVolley(self):
if self.__weaponVolley is None:
self.calculateWeaponStats()
return self.__weaponVolley
@property
def droneDPS(self):
if self.__droneDPS is None:
self.calculateWeaponStats()
return self.__droneDPS
@property
def droneVolley(self):
def getDroneVolley(self):
if self.__droneVolley is None:
self.calculateWeaponStats()
return self.__droneVolley
@property
def totalDPS(self):
return self.droneDPS + self.weaponDPS
def getTotalDps(self, spool=False):
return self.getDroneDps() + self.getWeaponDps(spool=spool)
@property
def totalVolley(self):
return self.droneVolley + self.weaponVolley
def getTotalVolley(self, spool=False):
return self.getDroneVolley() + self.getWeaponVolley(spool=spool)
@property
def minerYield(self):
@@ -409,12 +411,14 @@ class Fit(object):
def clear(self, projected=False, command=False):
self.__effectiveTank = None
self.__weaponDPS = None
self.__minerYield = None
self.__weaponDps = None
self.__weaponDpsSpool = None
self.__weaponVolley = None
self.__weaponVolleySpool = None
self.__minerYield = None
self.__effectiveSustainableTank = None
self.__sustainableTank = None
self.__droneDPS = None
self.__droneDps = None
self.__droneVolley = None
self.__droneYield = None
self.__ehp = None
@@ -1538,29 +1542,35 @@ class Fit(object):
self.__droneYield = droneYield
def calculateWeaponStats(self):
weaponDPS = 0
droneDPS = 0
weaponDps = 0
weaponDpsSpool = 0
droneDps = 0
weaponVolley = 0
weaponVolleySpool = 0
droneVolley = 0
for mod in self.modules:
dps, volley = mod.damageStats(self.targetResists)
weaponDPS += dps
dps, dpsSpool, volley, volleySpool = mod.damageStats(self.targetResists)
weaponDps += dps
weaponDpsSpool += dpsSpool
weaponVolley += volley
weaponVolleySpool += volleySpool
for drone in self.drones:
dps, volley = drone.damageStats(self.targetResists)
droneDPS += dps
droneDps += dps
droneVolley += volley
for fighter in self.fighters:
dps, volley = fighter.damageStats(self.targetResists)
droneDPS += dps
droneDps += dps
droneVolley += volley
self.__weaponDPS = weaponDPS
self.__weaponDps = weaponDps
self.__weaponDpsSpool = weaponDpsSpool
self.__weaponVolley = weaponVolley
self.__droneDPS = droneDPS
self.__weaponVolleySpool = weaponVolleySpool
self.__droneDps = droneDps
self.__droneVolley = droneVolley
@property

View File

@@ -169,8 +169,10 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
self.__charge = None
self.__dps = None
self.__miningyield = None
self.__dpsSpool = None
self.__volley = None
self.__volleySpool = None
self.__miningyield = None
self.__reloadTime = None
self.__reloadForce = None
self.__chargeCycles = None
@@ -414,7 +416,9 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
def damageStats(self, targetResists):
if self.__dps is None:
self.__dps = 0
self.__dpsSpool = 0
self.__volley = 0
self.__volleySpool = 0
if not self.isEmpty and self.state >= State.ACTIVE:
if self.charge:
@@ -425,7 +429,7 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
volley = sum([(func("%sDamage" % attr) or 0) * (1 - getattr(targetResists, "%sAmount" % attr, 0)) for attr in self.DAMAGE_TYPES])
volley *= self.getModifiedItemAttr("damageMultiplier") or 1
# Disintegrator-specific ramp-up multiplier
volley *= (self.getModifiedItemAttr("damageMultiplierBonusMax") or 0) + 1
volleySpool = volley * ((self.getModifiedItemAttr("damageMultiplierBonusMax") or 0) + 1)
if volley:
cycleTime = self.cycleTime
# Some weapons repeat multiple times in one cycle (think doomsdays)
@@ -436,9 +440,12 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
)
self.__volley = volley
self.__dps = (volley * weaponDoT) / (cycleTime / 1000.0)
self.__volleySpool = volleySpool
dpsFactor = weaponDoT / (cycleTime / 1000.0)
self.__dps = volley * dpsFactor
self.__dpsSpool = volleySpool * dpsFactor
return self.__dps, self.__volley
return self.__dps, self.__dpsSpool, self.__volley, self.__volleySpool
@property
def miningStats(self):
@@ -459,13 +466,17 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
return self.__miningyield
@property
def dps(self):
return self.damageStats(None)[0]
def getDps(self, spool=False):
if spool:
return self.damageStats(None)[1]
else:
return self.damageStats(None)[0]
@property
def volley(self):
return self.damageStats(None)[1]
def getVolley(self, spool=False):
if spool:
return self.damageStats(None)[3]
else:
return self.damageStats(None)[2]
@property
def reloadTime(self):