Add prespool/fullspool support to non-sustainable tank calculation

This commit is contained in:
DarkPhoenix
2018-12-12 15:48:30 +03:00
parent 25c5abffee
commit de752cbe0a
2 changed files with 21 additions and 13 deletions

View File

@@ -42,13 +42,18 @@ class DamagePattern(object):
return ehp
def calculateEffectiveTank(self, fit, tankInfo):
ehps = {}
passiveShield = fit.calculateShieldRecharge()
ehps["passiveShield"] = self.effectivify(fit, passiveShield, "shield")
for type in ("shield", "armor", "hull"):
ehps["%sRepair" % type] = self.effectivify(fit, tankInfo["%sRepair" % type], type)
return ehps
typeMap = {
"passiveShield": "shield",
"shieldRepair": "shield",
"armorRepair": "armor",
"armorRepairPreSpool": "armor",
"armorRepairFullSpool": "armor",
"hullRepair": "hull"}
ereps = {}
for field in tankInfo:
if field in typeMap:
ereps[field] = self.effectivify(fit, tankInfo[field], typeMap[field])
return ereps
def effectivify(self, fit, amount, type):
type = type if type != "hull" else ""

View File

@@ -1404,11 +1404,14 @@ class Fit(object):
@property
def tank(self):
hps = {"passiveShield": self.calculateShieldRecharge()}
for type in ("shield", "armor", "hull"):
hps["%sRepair" % type] = self.extraAttributes["%sRepair" % type]
return hps
reps = {
"passiveShield": self.calculateShieldRecharge(),
"shieldRepair": self.extraAttributes["shieldRepair"],
"armorRepair": self.extraAttributes["armorRepair"],
"armorRepairPreSpool": self.extraAttributes["armorRepairPreSpool"],
"armorRepairFullSpool": self.extraAttributes["armorRepairFullSpool"],
"hullRepair": self.extraAttributes["hullRepair"]}
return reps
@property
def effectiveTank(self):
@@ -1416,7 +1419,7 @@ class Fit(object):
if self.damagePattern is None:
ehps = self.tank
else:
ehps = self.damagePattern.calculateEffectiveTank(self, self.extraAttributes)
ehps = self.damagePattern.calculateEffectiveTank(self, self.tank)
self.__effectiveTank = ehps