| 28 | |
| 29 | |
| 30 | class Ship(ItemAttrShortcut, HandledItem): |
| 31 | EXTRA_ATTRIBUTES = { |
| 32 | "armorRepair": 0, |
| 33 | "armorRepairPreSpool": 0, |
| 34 | "armorRepairFullSpool": 0, |
| 35 | "hullRepair": 0, |
| 36 | "shieldRepair": 0, |
| 37 | "maxActiveDrones": 0, |
| 38 | "maxTargetsLockedFromSkills": 2, |
| 39 | "droneControlRange": 20000, |
| 40 | "cloaked": False, |
| 41 | # We also have speedLimit for Entosis Link, but there seems to be an |
| 42 | # issue with naming it exactly "speedLimit" due to unknown reasons. |
| 43 | # Regardless, we don't have to put it here anyways - it will come up |
| 44 | # as None unless the Entosis effect sets it. |
| 45 | } |
| 46 | |
| 47 | def __init__(self, item, owner=None): |
| 48 | self.validate(item) |
| 49 | |
| 50 | self.__item = item |
| 51 | self.__modeItems = self.__getModeItems() |
| 52 | self.__itemModifiedAttributes = ModifiedAttributeDict(parent=self) |
| 53 | self.__itemModifiedAttributes.original = dict(self.item.attributes) |
| 54 | self.__itemModifiedAttributes.original.update(self.EXTRA_ATTRIBUTES) |
| 55 | self.__itemModifiedAttributes.overrides = self.item.overrides |
| 56 | |
| 57 | if "maximumRangeCap" in self.__itemModifiedAttributes.original: |
| 58 | maxLimitAttrKeyCache["maxTargetRange"] = "maximumRangeCap" |
| 59 | |
| 60 | self.owner = owner |
| 61 | self.commandBonus = 0 |
| 62 | |
| 63 | def validate(self, item): |
| 64 | if item.category.name != "Ship": |
| 65 | pyfalog.error("Passed item '{0}' (category: {1}) is not under Ship category", item.name, item.category.name) |
| 66 | raise ValueError( |
| 67 | 'Passed item "%s" (category: (%s)) is not under Ship category' % (item.name, item.category.name)) |
| 68 | |
| 69 | @property |
| 70 | def item(self): |
| 71 | return self.__item |
| 72 | |
| 73 | @property |
| 74 | def name(self): |
| 75 | # NOTE: add name property |
| 76 | return self.__item.name |
| 77 | |
| 78 | @property |
| 79 | def itemModifiedAttributes(self): |
| 80 | return self.__itemModifiedAttributes |
| 81 | |
| 82 | def clear(self): |
| 83 | self.itemModifiedAttributes.clear() |
| 84 | self.commandBonus = 0 |
| 85 | |
| 86 | def calculateModifiedAttributes(self, fit, runTime, forceProjected=False): |
| 87 | if forceProjected: |
no outgoing calls
no test coverage detected