| 22 | |
| 23 | |
| 24 | class Mode(ItemAttrShortcut, HandledItem): |
| 25 | |
| 26 | def __init__(self, item, owner=None): |
| 27 | if item.group.name != "Ship Modifiers": |
| 28 | raise ValueError( |
| 29 | 'Passed item "%s" (category: (%s)) is not a Ship Modifier' % (item.name, item.category.name)) |
| 30 | self.owner = owner |
| 31 | self.__item = item |
| 32 | self.__itemModifiedAttributes = ModifiedAttributeDict() |
| 33 | self.__itemModifiedAttributes.original = self.item.attributes |
| 34 | self.__itemModifiedAttributes.overrides = self.item.overrides |
| 35 | |
| 36 | @property |
| 37 | def item(self): |
| 38 | return self.__item |
| 39 | |
| 40 | @property |
| 41 | def itemModifiedAttributes(self): |
| 42 | return self.__itemModifiedAttributes |
| 43 | |
| 44 | # @todo: rework to fit only on t3 dessy |
| 45 | def fits(self, fit): |
| 46 | raise NotImplementedError() |
| 47 | |
| 48 | def clear(self): |
| 49 | self.itemModifiedAttributes.clear() |
| 50 | |
| 51 | def calculateModifiedAttributes(self, fit, runTime, forceProjected=False): |
| 52 | if self.item: |
| 53 | for effect in self.item.effects.values(): |
| 54 | if effect.runTime == runTime and effect.activeByDefault: |
| 55 | effect.handler(fit, self, ("module",), None, effect=effect) |
| 56 | |
| 57 | def __deepcopy__(self, memo): |
| 58 | copy = Mode(self.item) |
| 59 | return copy |
| 60 | |
| 61 | def __repr__(self): |
| 62 | return "Mode(ID={}, name={}) at {}".format( |
| 63 | self.item.ID, self.item.name, hex(id(self)) |
| 64 | ) |
no outgoing calls
no test coverage detected