Increase value of given attribute by given number
(self, attributeName, increase, position="pre", skill=None, **kwargs)
| 494 | self.__afflict(attributeName, Operator.PREASSIGN, None, value, value, value != self.getOriginal(attributeName)) |
| 495 | |
| 496 | def increase(self, attributeName, increase, position="pre", skill=None, **kwargs): |
| 497 | """Increase value of given attribute by given number""" |
| 498 | if skill: |
| 499 | increase *= self.__handleSkill(skill) |
| 500 | |
| 501 | if 'effect' in kwargs: |
| 502 | increase *= ModifiedAttributeDict.getResistance(self.fit, kwargs['effect']) or 1 |
| 503 | |
| 504 | # Increases applied before multiplications and after them are |
| 505 | # written in separate maps |
| 506 | if position == "pre": |
| 507 | operator = Operator.PREINCREASE |
| 508 | tbl = self.__preIncreases |
| 509 | elif position == "post": |
| 510 | operator = Operator.POSTINCREASE |
| 511 | tbl = self.__postIncreases |
| 512 | else: |
| 513 | raise ValueError("position should be either pre or post") |
| 514 | if attributeName not in tbl: |
| 515 | tbl[attributeName] = 0 |
| 516 | tbl[attributeName] += increase |
| 517 | self.__placehold(attributeName) |
| 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""" |
no test coverage detected