Returns the text of the repairs section
(fit)
| 87 | return header, linesList |
| 88 | |
| 89 | def repsSection(fit): |
| 90 | """ Returns the text of the repairs section""" |
| 91 | selfRep = [fit.effectiveTank[tankType + "Repair"] for tankType in tankTypes] |
| 92 | sustainRep = [fit.effectiveSustainableTank[tankType + "Repair"] for tankType in tankTypes] |
| 93 | remoteRepObj = fit.getRemoteReps() |
| 94 | remoteRep = [remoteRepObj.shield, remoteRepObj.armor, remoteRepObj.hull] |
| 95 | shieldRegen = [fit.effectiveSustainableTank["passiveShield"], 0, 0] |
| 96 | shieldRechargeModuleMultipliers = [module.item.attributes["shieldRechargeRateMultiplier"].value for module in |
| 97 | fit.modules if |
| 98 | module.item and "shieldRechargeRateMultiplier" in module.item.attributes] |
| 99 | shieldRechargeMultiplierByModules = reduce(lambda x, y: x * y, shieldRechargeModuleMultipliers, 1) |
| 100 | if shieldRechargeMultiplierByModules >= 0.9: # If the total affect of modules on the shield recharge is negative or insignificant, we don't care about it |
| 101 | shieldRegen[0] = 0 |
| 102 | totalRep = list(zip(selfRep, remoteRep, shieldRegen)) |
| 103 | totalRep = list(map(sum, totalRep)) |
| 104 | |
| 105 | selfRep.append(sum(selfRep)) |
| 106 | sustainRep.append(sum(sustainRep)) |
| 107 | remoteRep.append(sum(remoteRep)) |
| 108 | shieldRegen.append(sum(shieldRegen)) |
| 109 | totalRep.append(sum(totalRep)) |
| 110 | |
| 111 | totalSelfRep = selfRep[-1] |
| 112 | totalRemoteRep = remoteRep[-1] |
| 113 | totalShieldRegen = shieldRegen[-1] |
| 114 | |
| 115 | text = "" |
| 116 | |
| 117 | if sum(totalRep) > 0: # Most commonly, there are no reps at all; then we skip this section |
| 118 | singleTypeRep = None |
| 119 | singleTypeRepName = None |
| 120 | if totalRemoteRep == 0 and totalShieldRegen == 0: # Only self rep |
| 121 | singleTypeRep = selfRep[:-1] |
| 122 | singleTypeRepName = "Self" |
| 123 | if totalSelfRep == 0 and totalShieldRegen == 0: # Only remote rep |
| 124 | singleTypeRep = remoteRep[:-1] |
| 125 | singleTypeRepName = "Remote" |
| 126 | if totalSelfRep == 0 and totalRemoteRep == 0: # Only shield regen |
| 127 | singleTypeRep = shieldRegen[:-1] |
| 128 | singleTypeRepName = "Regen" |
| 129 | if singleTypeRep and sum( |
| 130 | x > 0 for x in singleTypeRep) == 1: # Only one type of reps and only one tank type is repaired |
| 131 | index = next(i for i, v in enumerate(singleTypeRep) if v > 0) |
| 132 | if singleTypeRepName == "Regen": |
| 133 | text += "Shield regeneration: {} EHP/s".format(formatAmount(singleTypeRep[index], 3, 0, 9)) |
| 134 | else: |
| 135 | text += "{} {} repair: {} EHP/s".format(singleTypeRepName, tankTypes[index], |
| 136 | formatAmount(singleTypeRep[index], 3, 0, 9)) |
| 137 | if (singleTypeRepName == "Self") and (sustainRep[index] != singleTypeRep[index]): |
| 138 | text += " (Sustained: {} EHP/s)".format(formatAmount(sustainRep[index], 3, 0, 9)) |
| 139 | text += "\n" |
| 140 | else: # Otherwise show a table |
| 141 | selfRepStr = [formatAmount(rep, 3, 0, 9) for rep in selfRep] |
| 142 | sustainRepStr = [formatAmount(rep, 3, 0, 9) for rep in sustainRep] |
| 143 | remoteRepStr = [formatAmount(rep, 3, 0, 9) for rep in remoteRep] |
| 144 | shieldRegenStr = [formatAmount(rep, 3, 0, 9) if rep != 0 else "" for rep in shieldRegen] |
| 145 | totalRepStr = [formatAmount(rep, 3, 0, 9) for rep in totalRep] |
| 146 |
no test coverage detected