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

View File

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