From 30755fbb73702a07e18b6a595d98662a8138261b Mon Sep 17 00:00:00 2001 From: "Mr. Nukealizer" Date: Fri, 30 Sep 2016 23:44:12 -0700 Subject: [PATCH] Made fighter DPS calculations more accurate when factoring in reload time. --- eos/saveddata/fighter.py | 20 ++++++++++++++++++++ eos/saveddata/fighterAbility.py | 20 ++++++++++++++------ 2 files changed, 34 insertions(+), 6 deletions(-) diff --git a/eos/saveddata/fighter.py b/eos/saveddata/fighter.py index ebbffb814..efdc73c12 100644 --- a/eos/saveddata/fighter.py +++ b/eos/saveddata/fighter.py @@ -164,6 +164,26 @@ class Fighter(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut): dps, volley = ability.damageStats(targetResists) self.__dps += dps self.__volley += volley + + # For forward compatability this assumes a fighter can have more than 2 damaging abilities and/or multiple that use charges. + if self.owner.factorReload: + activeTimes = [] + reloadTimes = [] + constantDps = 0 + for ability in self.abilities: + if not ability.active: + continue + if ability.numShots == 0: + dps, volley = ability.damageStats(targetResists) + constantDps += dps + continue + activeTimes.append(ability.numShots * ability.cycleTime) + reloadTimes.append(ability.reloadTime) + + if(len(activeTimes) > 0): + shortestActive = sorted(activeTimes)[0] + longestReload = sorted(reloadTimes, reverse=True)[0] + self.__dps = max(constantDps, self.__dps * shortestActive / (shortestActive + longestReload)) return self.__dps, self.__volley diff --git a/eos/saveddata/fighterAbility.py b/eos/saveddata/fighterAbility.py index 39129483a..64b5dee2c 100644 --- a/eos/saveddata/fighterAbility.py +++ b/eos/saveddata/fighterAbility.py @@ -30,10 +30,18 @@ class FighterAbility(object): # with the fighter squadron role NUM_SHOTS_MAPPING = { 1: 0, # Superiority fighter / Attack - 2: 12, # Light fighter / Attack + 2: 12, # Light fighter / Attack 4: 6, # Heavy fighter / Heavy attack 5: 3, # Heavy fighter / Long range attack } + # Same as above + REARM_TIME_MAPPING = { + 1: 0, # Superiority fighter / Attack + 2: 4000, # Light fighter / Attack + 4: 6000, # Heavy fighter / Heavy attack + 5: 20000, # Heavy fighter / Long range attack + } + def __init__(self, effect): """Initialize from the program""" @@ -86,7 +94,7 @@ class FighterAbility(object): @property def reloadTime(self): - return self.fighter.getModifiedItemAttr("fighterRefuelingTime") * self.numShots + return self.fighter.getModifiedItemAttr("fighterRefuelingTime") + (self.REARM_TIME_MAPPING[self.fighter.getModifiedItemAttr("fighterSquadronRole")] or 0 if self.hasCharges else 0) * self.numShots @property def numShots(self): @@ -97,10 +105,10 @@ class FighterAbility(object): speed = self.fighter.getModifiedItemAttr("{}Duration".format(self.attrPrefix)) reload = self.reloadTime - if self.fighter.owner.factorReload: - numShots = self.numShots - # Speed here already takes into consideration reactivation time - speed = (speed * numShots + reload) / numShots if numShots > 0 else speed + #if self.fighter.owner.factorReload: + # numShots = self.numShots + # # Speed here already takes into consideration reactivation time + # speed = (speed * numShots + reload) / numShots if numShots > 0 else speed return speed