Fetch spoolup time for gun's misc value from spoolup calculator

This commit is contained in:
DarkPhoenix
2018-12-12 12:36:31 +03:00
parent e76dc2e92b
commit e6b2d15468
2 changed files with 13 additions and 18 deletions

View File

@@ -432,8 +432,8 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
return self.__miningyield
def getVolley(self, spoolType=None, spoolAmount=None, targetResists=None):
if self.isEmpty or self.state < State.ACTIVE:
def getVolley(self, spoolType=None, spoolAmount=None, targetResists=None, ignoreState=False):
if self.isEmpty or (self.state < State.ACTIVE and not ignoreState):
return DmgTypes(0, 0, 0, 0), 0
if self.__baseVolley is None:
dmgGetter = self.getModifiedChargeAttr if self.charge else self.getModifiedItemAttr
@@ -446,7 +446,7 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
spoolBoost, spoolTime = calculateSpoolup(
self.getModifiedItemAttr("damageMultiplierBonusMax", 0),
self.getModifiedItemAttr("damageMultiplierBonusPerCycle", 0),
self.cycleTime / 1000,
self.rawCycleTime / 1000,
spoolType if spoolType is not None else self.spoolType,
# Using spool type as condition as it should define if we're using
# passed spoolup parameters or not
@@ -459,12 +459,11 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
explosive=self.__baseVolley.explosive * spoolMultiplier * (1 - getattr(targetResists, "explosiveAmount", 0)))
return volley, spoolTime
def getDps(self, spoolType=None, spoolAmount=None, targetResists=None):
volley, spoolTime = self.getVolley(spoolType=spoolType, spoolAmount=spoolAmount, targetResists=targetResists)
def getDps(self, spoolType=None, spoolAmount=None, targetResists=None, ignoreState=False):
volley, spoolTime = self.getVolley(spoolType=spoolType, spoolAmount=spoolAmount, targetResists=targetResists, ignoreState=ignoreState)
if not volley:
return DmgTypes(0, 0, 0, 0), 0
# Some weapons repeat multiple times in one cycle (bosonic doomsdays)
# Get the number of times it fires off
# Some weapons repeat multiple times in one cycle (bosonic doomsdays). Get the number of times it fires off
volleysPerCycle = max(self.getModifiedItemAttr("doomsdayDamageDuration", 1) / self.getModifiedItemAttr("doomsdayDamageCycleTime", 1), 1)
dpsFactor = volleysPerCycle / (self.cycleTime / 1000)
dps = DmgTypes(
@@ -517,7 +516,7 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
spoolBoost, spoolTime = calculateSpoolup(
self.getModifiedItemAttr("repairMultiplierBonusMax", 0),
self.getModifiedItemAttr("repairMultiplierBonusPerCycle", 0),
self.cycleTime / 1000,
self.rawCycleTime / 1000,
spoolType if spoolType is not None else self.spoolType,
# Using spool type as condition as it should define if we're using
# passed spoolup parameters or not

View File

@@ -115,16 +115,12 @@ class Miscellanea(ViewColumn):
text = "{0}".format(formatAmount(trackingSpeed, 3, 0, 3))
tooltip = "tracking speed"
info.append((text, tooltip))
maxBonusDamage = stuff.getModifiedItemAttr("damageMultiplierBonusMax")
bonusDamagePerCycle = stuff.getModifiedItemAttr("damageMultiplierBonusPerCycle")
cycleTime = stuff.getModifiedItemAttr("speed")
if maxBonusDamage and bonusDamagePerCycle and cycleTime:
cyclesToFullDamage = int(maxBonusDamage / bonusDamagePerCycle)
timeToFullDamage = (cycleTime / 1000) * cyclesToFullDamage
if cyclesToFullDamage:
text = "{0}s".format(formatAmount(timeToFullDamage, 3, 0, 3))
tooltip = "spool-up time"
info.append((text, tooltip))
# TODO: use spoolup options to fetch main value
volley, spoolTime = stuff.getVolley(spoolType=SpoolType.SCALE, spoolAmount=1, ignoreState=True)
if spoolTime:
text = "{0}s".format(formatAmount(spoolTime, 3, 0, 3))
tooltip = "spool-up time"
info.append((text, tooltip))
if not info:
return "", None
text = ' | '.join(i[0] for i in info)