From e262aa7daad0d304080433e790c4dfdc094a2f69 Mon Sep 17 00:00:00 2001 From: DarkPhoenix Date: Mon, 8 Jul 2019 10:27:06 +0300 Subject: [PATCH] Move resistance calculation to multiplication method --- eos/modifiedAttributeDict.py | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/eos/modifiedAttributeDict.py b/eos/modifiedAttributeDict.py index 4fb1ac078..40f3d2abe 100644 --- a/eos/modifiedAttributeDict.py +++ b/eos/modifiedAttributeDict.py @@ -398,7 +398,7 @@ class ModifiedAttributeDict(collections.MutableMapping): self.__placehold(attributeName) self.__afflict(attributeName, "+", increase, increase != 0) - def multiply(self, attributeName, multiplier, stackingPenalties=False, penaltyGroup="default", skill=None, resist=True, *args, **kwargs): + def multiply(self, attributeName, multiplier, stackingPenalties=False, penaltyGroup="default", skill=None, *args, **kwargs): """Multiply value of given attribute by given factor""" if multiplier is None: # See GH issue 397 return @@ -406,6 +406,14 @@ class ModifiedAttributeDict(collections.MutableMapping): if skill: multiplier *= self.__handleSkill(skill) + resisted = False + # Goddammit CCP, make up your mind where you want this information >.< See #1139 + if 'effect' in kwargs: + resistFactor = ModifiedAttributeDict.getResistance(self.fit, kwargs['effect']) or 1 + if resistFactor != 1: + resisted = True + multiplier *= (multiplier - 1) * resistFactor + 1 + # If we're asked to do stacking penalized multiplication, append values # to per penalty group lists if stackingPenalties: @@ -426,7 +434,7 @@ class ModifiedAttributeDict(collections.MutableMapping): afflictPenal = "" if stackingPenalties: afflictPenal += "s" - if resist: + if resisted: afflictPenal += "r" self.__afflict(attributeName, "%s*" % afflictPenal, multiplier, multiplier != 1) @@ -436,15 +444,8 @@ class ModifiedAttributeDict(collections.MutableMapping): if skill: boostFactor *= self.__handleSkill(skill) - resist = None - - # Goddammit CCP, make up your mind where you want this information >.< See #1139 - if 'effect' in kwargs: - resist = ModifiedAttributeDict.getResistance(self.fit, kwargs['effect']) or 1 - boostFactor *= resist - # We just transform percentage boost into multiplication factor - self.multiply(attributeName, 1 + boostFactor / 100.0, resist=(True if resist else False), *args, **kwargs) + self.multiply(attributeName, 1 + boostFactor / 100.0, *args, **kwargs) def force(self, attributeName, value): """Force value to attribute and prohibit any changes to it"""