Add optional parameter to cycle parameter getters

This commit is contained in:
DarkPhoenix
2019-05-12 02:55:42 +03:00
parent 7d37b9e0e0
commit 7305c0a017
3 changed files with 9 additions and 5 deletions

View File

@@ -164,7 +164,7 @@ class Drone(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
explosive=volley.explosive * dpsFactor)
return dps
def getCycleParameters(self):
def getCycleParameters(self, reloadOverride=None):
return CycleInfo(self.cycleTime, 0, math.inf)
def getRemoteReps(self, ignoreState=False):

View File

@@ -241,9 +241,10 @@ class Fighter(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
def getCycleParametersPerEffectInfinite(self):
return {a.effectID: CycleInfo(a.cycleTime, 0, math.inf) for a in self.abilities if a.numShots == 0}
def getCycleParametersPerEffect(self):
def getCycleParametersPerEffect(self, reloadOverride=None):
factorReload = reloadOverride if reloadOverride is not None else self.owner.factorReload
# Assume it can cycle infinitely
if not self.owner.factorReload:
if not factorReload:
return {a.effectID: CycleInfo(a.cycleTime, 0, math.inf) for a in self.abilities}
limitedAbilities = [a for a in self.abilities if a.numShots > 0]
if len(limitedAbilities) == 0:

View File

@@ -829,10 +829,13 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
except:
effect.handler(fit, self, context)
def getCycleParameters(self):
def getCycleParameters(self, reloadOverride=None):
"""Copied from new eos as well"""
# Determine if we'll take into account reload time or not
factorReload = self.owner.factorReload if self.forceReload is None else self.forceReload
if reloadOverride is not None:
factorReload = reloadOverride
else:
factorReload = self.owner.factorReload if self.forceReload is None else self.forceReload
cycles_until_reload = self.numShots
if cycles_until_reload == 0: