| 171 | |
| 172 | |
| 173 | class DamagePattern: |
| 174 | DAMAGE_TYPES = ('em', 'thermal', 'kinetic', 'explosive') |
| 175 | _builtins = None |
| 176 | |
| 177 | def __init__(self, *args, **kwargs): |
| 178 | self.builtin = False |
| 179 | self.update(*args, **kwargs) |
| 180 | |
| 181 | @reconstructor |
| 182 | def init(self): |
| 183 | self.builtin = False |
| 184 | |
| 185 | def update(self, emAmount=25, thermalAmount=25, kineticAmount=25, explosiveAmount=25): |
| 186 | self.emAmount = emAmount |
| 187 | self.thermalAmount = thermalAmount |
| 188 | self.kineticAmount = kineticAmount |
| 189 | self.explosiveAmount = explosiveAmount |
| 190 | |
| 191 | @classmethod |
| 192 | def getBuiltinList(cls): |
| 193 | if cls._builtins is None: |
| 194 | cls.__generateBuiltins() |
| 195 | return list(cls._builtins.values()) |
| 196 | |
| 197 | @classmethod |
| 198 | def getBuiltinById(cls, id): |
| 199 | if cls._builtins is None: |
| 200 | cls.__generateBuiltins() |
| 201 | return cls._builtins.get(id) |
| 202 | |
| 203 | @classmethod |
| 204 | def getDefaultBuiltin(cls): |
| 205 | if cls._builtins is None: |
| 206 | cls.__generateBuiltins() |
| 207 | return cls._builtins.get(-1) |
| 208 | |
| 209 | @classmethod |
| 210 | def __generateBuiltins(cls): |
| 211 | cls._builtins = OrderedDict() |
| 212 | for id, (rawName, em, therm, kin, explo) in BUILTINS.items(): |
| 213 | pattern = DamagePattern(emAmount=em, thermalAmount=therm, kineticAmount=kin, explosiveAmount=explo) |
| 214 | pattern.ID = id |
| 215 | pattern.rawName = rawName |
| 216 | pattern.builtin = True |
| 217 | cls._builtins[id] = pattern |
| 218 | |
| 219 | def calculateEhp(self, item): |
| 220 | ehp = {} |
| 221 | for (type, attr) in (('shield', 'shieldCapacity'), ('armor', 'armorHP'), ('hull', 'hp')): |
| 222 | rawCapacity = item.getModifiedItemAttr(attr) |
| 223 | ehp[type] = self.effectivify(item, rawCapacity, type) |
| 224 | |
| 225 | return ehp |
| 226 | |
| 227 | def calculateEffectiveTank(self, fit, tankInfo): |
| 228 | typeMap = { |
| 229 | "passiveShield": "shield", |
| 230 | "shieldRepair": "shield", |
no outgoing calls
no test coverage detected