diff --git a/eos/effects/adaptivearmorhardener.py b/eos/effects/adaptivearmorhardener.py index c3955ebf0..1202b1fde 100644 --- a/eos/effects/adaptivearmorhardener.py +++ b/eos/effects/adaptivearmorhardener.py @@ -9,10 +9,10 @@ def handler(fit, module, context): #Adjust RAH to match the current damage pattern damagePattern = fit.damagePattern - attrDamagePattern = "%sAmount" % type - damagePatternModifier = getattr(damagePattern,attrDamagePattern)/float(sum((damagePattern.emAmount,damagePattern.thermalAmount,damagePattern.kineticAmount,damagePattern.explosiveAmount))) - modifiedResistModifier = (1-(((1-module.getModifiedItemAttr(attr))*4)*(damagePatternModifier))) - module.forceItemAttr(attr, modifiedResistModifier) + if damagePattern: + attrDamagePattern = "%sAmount" % type + damagePatternModifier = getattr(damagePattern,attrDamagePattern)/float(sum((damagePattern.emAmount,damagePattern.thermalAmount,damagePattern.kineticAmount,damagePattern.explosiveAmount))) + modifiedResistModifier = (1-(((1-module.getModifiedItemAttr(attr))*4)*(damagePatternModifier))) + module.forceItemAttr(attr, modifiedResistModifier) - fit.ship.multiplyItemAttr(attr, module.getModifiedItemAttr(attr), - stackingPenalties=True, penaltyGroup="preMul") + fit.ship.multiplyItemAttr(attr, module.getModifiedItemAttr(attr), stackingPenalties=True, penaltyGroup="preMul") diff --git a/eos/effects/energydestabilizationnew.py b/eos/effects/energydestabilizationnew.py index d2c3b8e03..fdde53f92 100644 --- a/eos/effects/energydestabilizationnew.py +++ b/eos/effects/energydestabilizationnew.py @@ -1,10 +1,9 @@ # Not used by any item from eos.types import State type = "active", "projected" -def handler(fit, container, context): - if "projected" in context and ((hasattr(container, "state") \ - and container.state >= State.ACTIVE) or hasattr(container, "amountActive")): - multiplier = container.amountActive if hasattr(container, "amountActive") else 1 - amount = container.getModifiedItemAttr("energyNeutralizerAmount") - time = container.getModifiedItemAttr("duration") - fit.addDrain(time, amount * multiplier, 0) +def handler(fit, src, context): + if "projected" in context and ((hasattr(src, "state") and src.state >= State.ACTIVE) or hasattr(src, "amountActive")): + multiplier = src.amountActive if hasattr(src, "amountActive") else 1 + amount = src.getModifiedItemAttr("energyNeutralizerAmount") + time = src.getModifiedItemAttr("duration") + fit.addDrain(src, time, amount * multiplier, 0) diff --git a/eos/effects/energyneutralizerentity.py b/eos/effects/energyneutralizerentity.py index 993df4a39..37ab5ad05 100644 --- a/eos/effects/energyneutralizerentity.py +++ b/eos/effects/energyneutralizerentity.py @@ -4,9 +4,11 @@ # Drones from group: Energy Neutralizer Drone (3 of 3) from eos.types import State type = "active", "projected" -def handler(fit, container, context): - if "projected" in context and ((hasattr(container, "state") \ - and container.state >= State.ACTIVE) or hasattr(container, "amountActive")): - amount = container.getModifiedItemAttr("energyNeutralizerAmount") - time = container.getModifiedItemAttr("duration") - fit.addDrain(time, amount, 0) + + +def handler(fit, src, context): + if "projected" in context and ((hasattr(src, "state") and src.state >= State.ACTIVE) or hasattr(src, "amountActive")): + amount = src.getModifiedItemAttr("energyNeutralizerAmount") + time = src.getModifiedItemAttr("duration") + + fit.addDrain(src, time, amount, 0) diff --git a/eos/effects/energyneutralizerfalloff.py b/eos/effects/energyneutralizerfalloff.py index b0702ad29..5a58dce48 100644 --- a/eos/effects/energyneutralizerfalloff.py +++ b/eos/effects/energyneutralizerfalloff.py @@ -4,9 +4,11 @@ # Modules from group: Energy Neutralizer (51 of 51) from eos.types import State type = "active", "projected" -def handler(fit, container, context): - if "projected" in context and ((hasattr(container, "state") \ - and container.state >= State.ACTIVE) or hasattr(container, "amountActive")): - amount = container.getModifiedItemAttr("energyNeutralizerAmount") - time = container.getModifiedItemAttr("duration") - fit.addDrain(time, amount, 0) + + +def handler(fit, src, context): + if "projected" in context and ((hasattr(src, "state") and src.state >= State.ACTIVE) or hasattr(src, "amountActive")): + amount = src.getModifiedItemAttr("energyNeutralizerAmount") + time = src.getModifiedItemAttr("duration") + + fit.addDrain(src, time, amount, 0) diff --git a/eos/effects/energynosferatufalloff.py b/eos/effects/energynosferatufalloff.py index c2c3cecb7..a0a79273e 100644 --- a/eos/effects/energynosferatufalloff.py +++ b/eos/effects/energynosferatufalloff.py @@ -4,10 +4,13 @@ # Modules from group: Energy Nosferatu (51 of 51) type = "active", "projected" runTime = "late" -def handler(fit, module, context): - amount = module.getModifiedItemAttr("powerTransferAmount") - time = module.getModifiedItemAttr("duration") + + +def handler(fit, src, context): + amount = src.getModifiedItemAttr("powerTransferAmount") + time = src.getModifiedItemAttr("duration") + if "projected" in context: - fit.addDrain(time, amount, 0) + fit.addDrain(src, time, amount, 0) elif "module" in context: - module.itemModifiedAttributes.force("capacitorNeed", -amount) \ No newline at end of file + src.itemModifiedAttributes.force("capacitorNeed", -amount) \ No newline at end of file diff --git a/eos/effects/energytransfer.py b/eos/effects/energytransfer.py index 8390cf52c..d004628bc 100644 --- a/eos/effects/energytransfer.py +++ b/eos/effects/energytransfer.py @@ -1,7 +1,7 @@ # Not used by any item type = "projected", "active" -def handler(fit, module, context): +def handler(fit, src, context): if "projected" in context: - amount = module.getModifiedItemAttr("powerTransferAmount") - duration = module.getModifiedItemAttr("duration") - fit.addDrain(duration, -amount, 0) + amount = src.getModifiedItemAttr("powerTransferAmount") + duration = src.getModifiedItemAttr("duration") + fit.addDrain(src, duration, -amount, 0) diff --git a/eos/effects/entityenergyneutralizerfalloff.py b/eos/effects/entityenergyneutralizerfalloff.py index 138f2e667..342598ebf 100644 --- a/eos/effects/entityenergyneutralizerfalloff.py +++ b/eos/effects/entityenergyneutralizerfalloff.py @@ -4,9 +4,11 @@ # Drones from group: Energy Neutralizer Drone (3 of 3) from eos.types import State type = "active", "projected" -def handler(fit, container, context): - if "projected" in context and ((hasattr(container, "state") \ - and container.state >= State.ACTIVE) or hasattr(container, "amountActive")): - amount = container.getModifiedItemAttr("energyNeutralizerAmount") - time = container.getModifiedItemAttr("energyNeutralizerDuration") - fit.addDrain(time, amount, 0) + + +def handler(fit, src, context): + if "projected" in context and ((hasattr(src, "state") and src.state >= State.ACTIVE) or hasattr(src, "amountActive")): + amount = src.getModifiedItemAttr("energyNeutralizerAmount") + time = src.getModifiedItemAttr("energyNeutralizerDuration") + + fit.addDrain(src, time, amount, 0) diff --git a/eos/effects/fighterabilityenergyneutralizer.py b/eos/effects/fighterabilityenergyneutralizer.py index 0315e4301..bad275c32 100644 --- a/eos/effects/fighterabilityenergyneutralizer.py +++ b/eos/effects/fighterabilityenergyneutralizer.py @@ -3,17 +3,15 @@ Since fighter abilities do not have any sort of item entity in the EVE database, we must derive the abilities from the effects, and thus this effect file contains some custom information useful only to fighters. """ -from eos.types import State - # User-friendly name for the ability displayName = "Energy Neutralizer" - prefix = "fighterAbilityEnergyNeutralizer" - type = "active", "projected" -def handler(fit, container, context): + +def handler(fit, src, context): if "projected" in context: - amount = container.getModifiedItemAttr("{}Amount".format(prefix)) - time = container.getModifiedItemAttr("{}Duration".format(prefix)) - fit.addDrain(time, amount, 0) \ No newline at end of file + amount = src.getModifiedItemAttr("{}Amount".format(prefix)) + time = src.getModifiedItemAttr("{}Duration".format(prefix)) + + fit.addDrain(src, time, amount, 0) \ No newline at end of file diff --git a/eos/effects/remoteenergytransferfalloff.py b/eos/effects/remoteenergytransferfalloff.py index ddb6fab9a..f618d3d3c 100644 --- a/eos/effects/remoteenergytransferfalloff.py +++ b/eos/effects/remoteenergytransferfalloff.py @@ -3,8 +3,8 @@ # Used by: # Modules from group: Remote Capacitor Transmitter (41 of 41) type = "projected", "active" -def handler(fit, module, context): +def handler(fit, src, context): if "projected" in context: - amount = module.getModifiedItemAttr("powerTransferAmount") - duration = module.getModifiedItemAttr("duration") - fit.addDrain(duration, -amount, 0) + amount = src.getModifiedItemAttr("powerTransferAmount") + duration = src.getModifiedItemAttr("duration") + fit.addDrain(src, duration, -amount, 0) diff --git a/eos/saveddata/fit.py b/eos/saveddata/fit.py index 00ad84cbe..a3000267f 100644 --- a/eos/saveddata/fit.py +++ b/eos/saveddata/fit.py @@ -890,8 +890,17 @@ class Fit(object): rechargeRate = self.ship.getModifiedItemAttr("shieldRechargeRate") / 1000.0 return 10 / rechargeRate * sqrt(percent) * (1 - sqrt(percent)) * capacity - def addDrain(self, cycleTime, capNeed, clipSize=0): + def addDrain(self, src, cycleTime, capNeed, clipSize=0): """ Used for both cap drains and cap fills (fills have negative capNeed) """ + + rigSize = self.ship.getModifiedItemAttr("rigSize") + energyNeutralizerSignatureResolution = src.getModifiedItemAttr("energyNeutralizerSignatureResolution") + signatureRadius = self.ship.getModifiedItemAttr("signatureRadius") + + #Signature reduction, uses the bomb formula as per CCP Larrikin + if energyNeutralizerSignatureResolution: + capNeed = capNeed*min(1, signatureRadius/energyNeutralizerSignatureResolution) + resistance = self.ship.getModifiedItemAttr("energyWarfareResistance") or 1 if capNeed > 0 else 1 self.__extraDrains.append((cycleTime, capNeed * resistance, clipSize))