From 0e57258cc5b7fe2057bb647e0265fe4ea485ef43 Mon Sep 17 00:00:00 2001 From: DarkPhoenix Date: Fri, 23 Aug 2019 09:13:40 +0300 Subject: [PATCH] Add ability to pass multiple afflictors to no-afflictor getter --- eos/modifiedAttributeDict.py | 18 +++++++++--------- eos/saveddata/fit.py | 4 ++-- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/eos/modifiedAttributeDict.py b/eos/modifiedAttributeDict.py index b1fcbdb5d..ea80992e7 100644 --- a/eos/modifiedAttributeDict.py +++ b/eos/modifiedAttributeDict.py @@ -72,9 +72,9 @@ class ItemAttrShortcut: return_value = self.itemModifiedAttributes.getWithExtraMods(key, extraMultipliers=extraMultipliers) return return_value or default - def getModifiedItemAttrWithoutAfflictor(self, key, afflictor, default=0): - """Returns attribute value with passed afflictor modification removed.""" - return_value = self.itemModifiedAttributes.getWithoutAfflictor(key, afflictor) + def getModifiedItemAttrWithoutAfflictors(self, key, afflictors, default=0): + """Returns attribute value with passed afflictors' modification removed.""" + return_value = self.itemModifiedAttributes.getWithoutAfflictors(key, afflictors) return return_value or default def getItemBaseAttrValue(self, key, default=0): @@ -93,9 +93,9 @@ class ChargeAttrShortcut: return_value = self.chargeModifiedAttributes.getWithExtraMods(key, extraMultipliers=extraMultipliers) return return_value or default - def getModifiedChargeAttrWithoutAfflictor(self, key, afflictor, default=0): - """Returns attribute value with passed modifiers applied to it.""" - return_value = self.chargeModifiedAttributes.getWithoutAfflictor(key, afflictor) + def getModifiedChargeAttrWithoutAfflictors(self, key, afflictors, default=0): + """Returns attribute value with passed afflictors' modification removed.""" + return_value = self.chargeModifiedAttributes.getWithoutAfflictors(key, afflictors) return return_value or default def getChargeBaseAttrValue(self, key, default=0): @@ -236,7 +236,7 @@ class ModifiedAttributeDict(collections.MutableMapping): # Passed in default value return default - def getWithoutAfflictor(self, key, afflictor, default=0): + def getWithoutAfflictors(self, key, ignoredAfflictors, default=0): # Here we do not have support for preAssigns/forceds, as doing them would # mean that we have to store all of them in a list which increases memory use, # and we do not actually need those operators atm @@ -245,8 +245,8 @@ class ModifiedAttributeDict(collections.MutableMapping): ignorePenalizedMultipliers = {} postIncreaseAdjustment = 0 for fit, afflictors in self.getAfflictions(key).items(): - for innerAfflictor, operator, stackingGroup, preResAmount, postResAmount, used in afflictors: - if innerAfflictor is afflictor: + for afflictor, operator, stackingGroup, preResAmount, postResAmount, used in afflictors: + if afflictor in ignoredAfflictors: if operator == Operator.MULTIPLY: if stackingGroup is None: multiplierAdjustment /= postResAmount diff --git a/eos/saveddata/fit.py b/eos/saveddata/fit.py index c200dd52a..a40a27ded 100644 --- a/eos/saveddata/fit.py +++ b/eos/saveddata/fit.py @@ -1320,8 +1320,8 @@ class Fit: """Return how much cap regen do we gain from having this module""" currentRegen = self.calculateCapRecharge() nomodRegen = self.calculateCapRecharge( - capacity=self.ship.getModifiedItemAttrWithoutAfflictor("capacitorCapacity", mod), - rechargeRate=self.ship.getModifiedItemAttrWithoutAfflictor("rechargeRate", mod) / 1000.0) + capacity=self.ship.getModifiedItemAttrWithoutAfflictors("capacitorCapacity", [mod]), + rechargeRate=self.ship.getModifiedItemAttrWithoutAfflictors("rechargeRate", [mod]) / 1000.0) return currentRegen - nomodRegen def getRemoteReps(self, spoolOptions=None):