diff --git a/eos/effects.py b/eos/effects.py index ec6d417ba..c3b2202eb 100644 --- a/eos/effects.py +++ b/eos/effects.py @@ -24749,7 +24749,7 @@ class Effect6185(BaseEffect): srcFalloffRange=module.getModifiedItemAttr('falloffEffectiveness'), distance=projectionRange) duration = module.getModifiedItemAttr('duration') / 1000.0 - fit.extraAttributes.increase('hullRepair', bonus / duration, **kwargs) + fit._hullRr.append((bonus, duration)) class Effect6186(BaseEffect): @@ -24774,7 +24774,7 @@ class Effect6186(BaseEffect): srcFalloffRange=container.getModifiedItemAttr('falloffEffectiveness'), distance=projectionRange) duration = container.getModifiedItemAttr('duration') / 1000.0 - fit.extraAttributes.increase('shieldRepair', bonus / duration, **kwargs) + fit._shieldRr.append((bonus, duration)) class Effect6187(BaseEffect): @@ -24828,10 +24828,9 @@ class Effect6188(BaseEffect): srcFalloffRange=container.getModifiedItemAttr('falloffEffectiveness'), distance=projectionRange) duration = container.getModifiedItemAttr('duration') / 1000.0 - rps = bonus / duration - fit.extraAttributes.increase('armorRepair', rps, **kwargs) - fit.extraAttributes.increase('armorRepairPreSpool', rps, **kwargs) - fit.extraAttributes.increase('armorRepairFullSpool', rps, **kwargs) + fit._armorRr.append((bonus, duration)) + fit._armorRrPreSpool.append((bonus, duration)) + fit._armorRrFullSpool.append((bonus, duration)) class Effect6195(BaseEffect): @@ -29788,10 +29787,9 @@ class Effect6651(BaseEffect): srcFalloffRange=module.getModifiedItemAttr('falloffEffectiveness'), distance=projectionRange) speed = module.getModifiedItemAttr('duration') / 1000.0 - rps = amount / speed - fit.extraAttributes.increase('armorRepair', rps, **kwargs) - fit.extraAttributes.increase('armorRepairPreSpool', rps, **kwargs) - fit.extraAttributes.increase('armorRepairFullSpool', rps, **kwargs) + fit._armorRr.append((amount, speed)) + fit._armorRrPreSpool.append((amount, speed)) + fit._armorRrFullSpool.append((amount, speed)) class Effect6652(BaseEffect): @@ -29817,7 +29815,7 @@ class Effect6652(BaseEffect): srcFalloffRange=module.getModifiedItemAttr('falloffEffectiveness'), distance=projectionRange) speed = module.getModifiedItemAttr('duration') / 1000.0 - fit.extraAttributes.increase('shieldRepair', amount / speed, **kwargs) + fit._shieldRr.append((amount, speed)) class Effect6653(BaseEffect): @@ -30446,10 +30444,9 @@ class Effect6687(BaseEffect): return bonus = container.getModifiedItemAttr('armorDamageAmount') duration = container.getModifiedItemAttr('duration') / 1000.0 - rps = bonus / duration - fit.extraAttributes.increase('armorRepair', rps, **kwargs) - fit.extraAttributes.increase('armorRepairPreSpool', rps, **kwargs) - fit.extraAttributes.increase('armorRepairFullSpool', rps, **kwargs) + fit._armorRr.append((bonus, duration)) + fit._armorRrPreSpool.append((bonus, duration)) + fit._armorRrFullSpool.append((bonus, duration)) class Effect6688(BaseEffect): @@ -30472,7 +30469,7 @@ class Effect6688(BaseEffect): return bonus = container.getModifiedItemAttr('shieldBonus') duration = container.getModifiedItemAttr('duration') / 1000.0 - fit.extraAttributes.increase('shieldRepair', bonus / duration, **kwargs) + fit._shieldRr.append((bonus, duration)) class Effect6689(BaseEffect): @@ -30496,7 +30493,7 @@ class Effect6689(BaseEffect): return bonus = module.getModifiedItemAttr('structureDamageAmount') duration = module.getModifiedItemAttr('duration') / 1000.0 - fit.extraAttributes.increase('hullRepair', bonus / duration, **kwargs) + fit._hullRr.append((bonus, duration)) class Effect6690(BaseEffect): @@ -35047,12 +35044,12 @@ class Effect7166(BaseEffect): repSpoolPerCycle = container.getModifiedItemAttr('repairMultiplierBonusPerCycle') defaultSpoolValue = eos.config.settings['globalDefaultSpoolupPercentage'] spoolType, spoolAmount = resolveSpoolOptions(SpoolOptions(SpoolType.SPOOL_SCALE, defaultSpoolValue, False), container) - rps = repAmountBase * (1 + calculateSpoolup(repSpoolMax, repSpoolPerCycle, cycleTime, spoolType, spoolAmount)[0]) / cycleTime - rpsPreSpool = repAmountBase * (1 + calculateSpoolup(repSpoolMax, repSpoolPerCycle, cycleTime, SpoolType.SPOOL_SCALE, 0)[0]) / cycleTime - rpsFullSpool = repAmountBase * (1 + calculateSpoolup(repSpoolMax, repSpoolPerCycle, cycleTime, SpoolType.SPOOL_SCALE, 1)[0]) / cycleTime - fit.extraAttributes.increase('armorRepair', rps, **kwargs) - fit.extraAttributes.increase('armorRepairPreSpool', rpsPreSpool, **kwargs) - fit.extraAttributes.increase('armorRepairFullSpool', rpsFullSpool, **kwargs) + amount = repAmountBase * (1 + calculateSpoolup(repSpoolMax, repSpoolPerCycle, cycleTime, spoolType, spoolAmount)[0]) + amountPreSpool = repAmountBase * (1 + calculateSpoolup(repSpoolMax, repSpoolPerCycle, cycleTime, SpoolType.SPOOL_SCALE, 0)[0]) + amountFullSpool = repAmountBase * (1 + calculateSpoolup(repSpoolMax, repSpoolPerCycle, cycleTime, SpoolType.SPOOL_SCALE, 1)[0]) + fit._armorRr.append((amount, cycleTime)) + fit._armorRrPreSpool.append((amountPreSpool, cycleTime)) + fit._armorRrFullSpool.append((amountFullSpool, cycleTime)) class Effect7167(BaseEffect): diff --git a/eos/saveddata/fit.py b/eos/saveddata/fit.py index e640fc998..d43929376 100644 --- a/eos/saveddata/fit.py +++ b/eos/saveddata/fit.py @@ -159,6 +159,12 @@ class Fit: self.gangBoosts = None self.__ecmProjectedList = [] self.commandBonuses = {} + # Reps received, as a list of (amount, cycle time in seconds) + self._hullRr = [] + self._armorRr = [] + self._armorRrPreSpool = [] + self._armorRrFullSpool = [] + self._shieldRr = [] def clearFactorReloadDependentData(self): # Here we clear all data known to rely on cycle parameters @@ -550,6 +556,12 @@ class Fit: if stuff is not None and stuff != self: stuff.clear() + self._hullRr.clear() + self._armorRr.clear() + self._armorRrPreSpool.clear() + self._armorRrFullSpool.clear() + self._shieldRr.clear() + # If this is the active fit that we are clearing, not a projected fit, # then this will run and clear the projected ships and flag the next # iteration to skip this part to prevent recursion. @@ -1478,11 +1490,11 @@ class Fit: def tank(self): reps = { "passiveShield": self.calculateShieldRecharge(), - "shieldRepair": self.extraAttributes["shieldRepair"], - "armorRepair": self.extraAttributes["armorRepair"], - "armorRepairPreSpool": self.extraAttributes["armorRepairPreSpool"], - "armorRepairFullSpool": self.extraAttributes["armorRepairFullSpool"], - "hullRepair": self.extraAttributes["hullRepair"] + "shieldRepair": self.extraAttributes["shieldRepair"] + self._getAppliedShieldRr(), + "armorRepair": self.extraAttributes["armorRepair"] + self._getAppliedArmorRr(), + "armorRepairPreSpool": self.extraAttributes["armorRepairPreSpool"] + self._getAppliedArmorPreSpoolRr(), + "armorRepairFullSpool": self.extraAttributes["armorRepairFullSpool"] + self._getAppliedArmorFullSpoolRr(), + "hullRepair": self.extraAttributes["hullRepair"] + self._getAppliedHullRr() } return reps @@ -1519,11 +1531,11 @@ class Fit: if self.__sustainableTank is None: sustainable = { "passiveShield": self.calculateShieldRecharge(), - "shieldRepair": self.extraAttributes["shieldRepair"], - "armorRepair": self.extraAttributes["armorRepair"], - "armorRepairPreSpool": self.extraAttributes["armorRepairPreSpool"], - "armorRepairFullSpool": self.extraAttributes["armorRepairFullSpool"], - "hullRepair": self.extraAttributes["hullRepair"] + "shieldRepair": self.extraAttributes["shieldRepair"] + self._getAppliedShieldRr(), + "armorRepair": self.extraAttributes["armorRepair"] + self._getAppliedArmorRr(), + "armorRepairPreSpool": self.extraAttributes["armorRepairPreSpool"] + self._getAppliedArmorPreSpoolRr(), + "armorRepairFullSpool": self.extraAttributes["armorRepairFullSpool"] + self._getAppliedArmorFullSpoolRr(), + "hullRepair": self.extraAttributes["hullRepair"] + self._getAppliedHullRr() } if not self.capStable or self.factorReload: # Map a local repairer type to the attribute it uses @@ -1760,6 +1772,38 @@ class Fit: mults.setdefault(stackingGroup, []).append((1 + strength / 100, None)) return calculateMultiplier(mults) + def _getAppliedHullRr(self): + return self.__getAppliedRr(self._hullRr) + + def _getAppliedArmorRr(self): + return self.__getAppliedRr(self._armorRr) + + def _getAppliedArmorPreSpoolRr(self): + return self.__getAppliedRr(self._armorRrPreSpool) + + def _getAppliedArmorFullSpoolRr(self): + return self.__getAppliedRr(self._armorRrFullSpool) + + def _getAppliedShieldRr(self): + return self.__getAppliedRr(self._shieldRr) + + @staticmethod + def __getAppliedRr(rrList): + totalRaw = 0 + for amount, cycleTime in rrList: + # That's right, for considerations of RR diminishing returns cycle time is rounded this way + totalRaw += amount / int(cycleTime) + RR_ADDITION = 7000 + RR_MULTIPLIER = 10 + appliedRr = 0 + for amount, cycleTime in rrList: + rrps = amount / int(cycleTime) + modified_rrps = RR_ADDITION + (rrps * RR_MULTIPLIER) + rrps_mult = 1 - (((rrps + modified_rrps) / (totalRaw + modified_rrps)) - 1) ** 2 + appliedRr += rrps_mult * amount / cycleTime + return appliedRr + + def __deepcopy__(self, memo=None): fitCopy = Fit() # Character and owner are not copied