From 676b09720a8c7be25c60423df893e115f0ec01ee Mon Sep 17 00:00:00 2001 From: DarkPhoenix Date: Fri, 9 Aug 2019 00:29:09 +0300 Subject: [PATCH] Replace reduce with sum --- eos/capSim.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/eos/capSim.py b/eos/capSim.py index 7b83121d7..3dc8a2646 100644 --- a/eos/capSim.py +++ b/eos/capSim.py @@ -92,14 +92,17 @@ class CapSimulator: # Loop over grouped modules, configure staggering and push to the simulation state for (duration, capNeed, clipSize, disableStagger, reloadTime, isInjector), amount in mods.items(): if self.stagger and not disableStagger: + # Stagger all mods if they do not need to be reloaded if clipSize == 0: duration = int(duration / amount) + # Stagger mods after first else: stagger_amount = (duration * clipSize + reloadTime) / (amount * clipSize) for i in range(1, amount): heapq.heappush( self.state, [i * stagger_amount, duration, capNeed, 0, clipSize, reloadTime]) + # If mods are not staggered - just multiply cap use else: capNeed *= amount @@ -195,7 +198,7 @@ class CapSimulator: # calculate EVE's stability value try: - avgDrain = reduce(float.__add__, [x[2] / x[1] for x in self.state], 0.0) + avgDrain = sum(x[2] / x[1] for x in self.state) self.cap_stable_eve = 0.25 * (1.0 + sqrt(-(2.0 * avgDrain * tau - capCapacity) / capCapacity)) ** 2 except ValueError: self.cap_stable_eve = 0.0 @@ -205,7 +208,6 @@ class CapSimulator: self.cap_stable_low = cap_lowest self.cap_stable_high = cap_lowest_pre else: - self.cap_stable_low = \ - self.cap_stable_high = 0.0 + self.cap_stable_low = self.cap_stable_high = 0.0 self.runtime = time.time() - start