Add modifier to list of things affecting current item
(self, attributeName, operator, stackingGroup, preResAmount, postResAmount, used=True)
| 460 | return self.__affectedBy.__iter__() |
| 461 | |
| 462 | def __afflict(self, attributeName, operator, stackingGroup, preResAmount, postResAmount, used=True): |
| 463 | """Add modifier to list of things affecting current item""" |
| 464 | # Do nothing if no fit is assigned |
| 465 | fit = self.fit |
| 466 | if fit is None: |
| 467 | return |
| 468 | # Create dictionary for given attribute and give it alias |
| 469 | if attributeName not in self.__affectedBy: |
| 470 | self.__affectedBy[attributeName] = {} |
| 471 | affs = self.__affectedBy[attributeName] |
| 472 | origin = fit.getOrigin() |
| 473 | fit = origin if origin and origin != fit else fit |
| 474 | # If there's no set for current fit in dictionary, create it |
| 475 | if fit not in affs: |
| 476 | affs[fit] = [] |
| 477 | # Reassign alias to list |
| 478 | affs = affs[fit] |
| 479 | # Get modifier which helps to compose 'Affected by' map |
| 480 | |
| 481 | if self.__tmpModifier: |
| 482 | modifier = self.__tmpModifier |
| 483 | self.__tmpModifier = None |
| 484 | else: |
| 485 | modifier = fit.getModifier() |
| 486 | |
| 487 | # Add current affliction to list |
| 488 | affs.append((modifier, operator, stackingGroup, preResAmount, postResAmount, used)) |
| 489 | |
| 490 | def preAssign(self, attributeName, value, **kwargs): |
| 491 | """Overwrites original value of the entity with given one, allowing further modification""" |