RAH gets pissy if there is no damage profile

If there is no damage profile (likely from one that's deleted, and
somehow the profile doesn't get set back to uniform), then RAH tries to
apply null values.  This skips making the RAH reactive if that scenario
happens.
This commit is contained in:
Ebag333
2016-07-17 14:10:58 -07:00
parent 23a6849fe3
commit 88384a2fd8

View File

@@ -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")