MCPcopy Index your code
hub / github.com/pyfa-org/Pyfa / multiply

Method multiply

eos/modifiedAttributeDict.py:520–562  ·  view source on GitHub ↗

Multiply value of given attribute by given factor

(self, attributeName, multiplier, stackingPenalties=False, penaltyGroup="default", skill=None, **kwargs)

Source from the content-addressed store, hash-verified

518 self.__afflict(attributeName, operator, None, increase, increase, increase != 0)
519
520 def multiply(self, attributeName, multiplier, stackingPenalties=False, penaltyGroup="default", skill=None, **kwargs):
521 """Multiply value of given attribute by given factor"""
522 if multiplier is None: # See GH issue 397
523 return
524
525 if skill:
526 multiplier *= self.__handleSkill(skill)
527
528 preResMultiplier = multiplier
529 resisted = False
530 # Goddammit CCP, make up your mind where you want this information >.< See #1139
531 if 'effect' in kwargs:
532 resistFactor = ModifiedAttributeDict.getResistance(self.fit, kwargs['effect']) or 1
533 if resistFactor != 1:
534 resisted = True
535 multiplier = (multiplier - 1) * resistFactor + 1
536
537 # If we're asked to do stacking penalized multiplication, append values
538 # to per penalty group lists
539 if stackingPenalties:
540 if attributeName not in self.__penalizedMultipliers:
541 self.__penalizedMultipliers[attributeName] = {}
542 if penaltyGroup not in self.__penalizedMultipliers[attributeName]:
543 self.__penalizedMultipliers[attributeName][penaltyGroup] = []
544 tbl = self.__penalizedMultipliers[attributeName][penaltyGroup]
545 tbl.append(multiplier)
546 # Non-penalized multiplication factors go to the single list
547 else:
548 if attributeName not in self.__multipliers:
549 self.__multipliers[attributeName] = 1
550 self.__multipliers[attributeName] *= multiplier
551
552 self.__placehold(attributeName)
553
554 afflictPenal = ""
555 if stackingPenalties:
556 afflictPenal += "s"
557 if resisted:
558 afflictPenal += "r"
559
560 self.__afflict(
561 attributeName, Operator.MULTIPLY, penaltyGroup if stackingPenalties else None,
562 preResMultiplier, multiplier, multiplier != 1)
563
564 def boost(self, attributeName, boostFactor, skill=None, **kwargs):
565 """Boost value by some percentage"""

Callers 3

boostMethod · 0.95
multiplyItemAttrMethod · 0.80
multiplyChargeAttrMethod · 0.80

Calls 5

__handleSkillMethod · 0.95
__placeholdMethod · 0.95
__afflictMethod · 0.95
getResistanceMethod · 0.80
appendMethod · 0.45

Tested by

no test coverage detected