diff --git a/eos/db/gamedata/effect.py b/eos/db/gamedata/effect.py index e43bffa22..5ea5bb457 100644 --- a/eos/db/gamedata/effect.py +++ b/eos/db/gamedata/effect.py @@ -34,7 +34,8 @@ effects_table = Table("dgmeffects", gamedata_meta, Column("description", String), Column("published", Boolean), Column("isAssistance", Boolean), - Column("isOffensive", Boolean)) + Column("isOffensive", Boolean), + Column("resistanceID", Integer)) mapper(Effect, effects_table, properties={ diff --git a/eos/effects/npcentityweapondisruptor.py b/eos/effects/npcentityweapondisruptor.py index e2fb7bf4a..28661af18 100644 --- a/eos/effects/npcentityweapondisruptor.py +++ b/eos/effects/npcentityweapondisruptor.py @@ -5,14 +5,14 @@ type = "projected", "active" -def handler(fit, module, context): +def handler(fit, module, context, *args, **kwargs): if "projected" in context: fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Gunnery"), "trackingSpeed", module.getModifiedItemAttr("trackingSpeedBonus"), - stackingPenalties=True, remoteResists=True) + stackingPenalties=True, *args, **kwargs) fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Gunnery"), "maxRange", module.getModifiedItemAttr("maxRangeBonus"), - stackingPenalties=True, remoteResists=True) + stackingPenalties=True, *args, **kwargs) fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Gunnery"), "falloff", module.getModifiedItemAttr("falloffBonus"), - stackingPenalties=True, remoteResists=True) + stackingPenalties=True, *args, **kwargs) diff --git a/eos/effects/remotesensordampentity.py b/eos/effects/remotesensordampentity.py index adb0b1ac3..642b55411 100644 --- a/eos/effects/remotesensordampentity.py +++ b/eos/effects/remotesensordampentity.py @@ -5,12 +5,12 @@ type = "projected", "active" -def handler(fit, module, context): +def handler(fit, module, context, *args, **kwargs): if "projected" not in context: return fit.ship.boostItemAttr("maxTargetRange", module.getModifiedItemAttr("maxTargetRangeBonus"), - stackingPenalties=True, remoteResists=True) + stackingPenalties=True, *args, **kwargs) fit.ship.boostItemAttr("scanResolution", module.getModifiedItemAttr("scanResolutionBonus"), - stackingPenalties=True, remoteResists=True) + stackingPenalties=True, *args, **kwargs) diff --git a/eos/effects/remotesensordampfalloff.py b/eos/effects/remotesensordampfalloff.py index e04b573c1..81ae5dfa1 100644 --- a/eos/effects/remotesensordampfalloff.py +++ b/eos/effects/remotesensordampfalloff.py @@ -5,12 +5,12 @@ type = "projected", "active" -def handler(fit, module, context): +def handler(fit, module, context, *args, **kwargs): if "projected" not in context: return fit.ship.boostItemAttr("maxTargetRange", module.getModifiedItemAttr("maxTargetRangeBonus"), - stackingPenalties=True, remoteResists=True) + stackingPenalties=True, *args, **kwargs) fit.ship.boostItemAttr("scanResolution", module.getModifiedItemAttr("scanResolutionBonus"), - stackingPenalties=True, remoteResists=True) + stackingPenalties=True, *args, **kwargs) diff --git a/eos/effects/remotetargetpaintentity.py b/eos/effects/remotetargetpaintentity.py index 4ee7c9fc0..07b8c9169 100644 --- a/eos/effects/remotetargetpaintentity.py +++ b/eos/effects/remotetargetpaintentity.py @@ -5,7 +5,7 @@ type = "projected", "active" -def handler(fit, container, context): +def handler(fit, container, context, *args, **kwargs): if "projected" in context: fit.ship.boostItemAttr("signatureRadius", container.getModifiedItemAttr("signatureRadiusBonus"), - stackingPenalties=True, remoteResists=True) + stackingPenalties=True, *args, **kwargs) diff --git a/eos/effects/remotetargetpaintfalloff.py b/eos/effects/remotetargetpaintfalloff.py index b9f5a6ef1..0e80806ca 100644 --- a/eos/effects/remotetargetpaintfalloff.py +++ b/eos/effects/remotetargetpaintfalloff.py @@ -5,7 +5,7 @@ type = "projected", "active" -def handler(fit, container, context): +def handler(fit, container, context, *args, **kwargs): if "projected" in context: fit.ship.boostItemAttr("signatureRadius", container.getModifiedItemAttr("signatureRadiusBonus"), - stackingPenalties=True, remoteResists=True) + stackingPenalties=True, *args, **kwargs) diff --git a/eos/effects/remotewebifierentity.py b/eos/effects/remotewebifierentity.py index cf9905405..ca4b34de7 100644 --- a/eos/effects/remotewebifierentity.py +++ b/eos/effects/remotewebifierentity.py @@ -5,8 +5,8 @@ type = "active", "projected" -def handler(fit, module, context): +def handler(fit, module, context, *args, **kwargs): if "projected" not in context: return fit.ship.boostItemAttr("maxVelocity", module.getModifiedItemAttr("speedFactor"), - stackingPenalties=True, remoteResists=True) + stackingPenalties=True, *args, **kwargs) diff --git a/eos/effects/remotewebifierfalloff.py b/eos/effects/remotewebifierfalloff.py index 1db5eb858..4d5bc770c 100644 --- a/eos/effects/remotewebifierfalloff.py +++ b/eos/effects/remotewebifierfalloff.py @@ -6,8 +6,8 @@ type = "active", "projected" -def handler(fit, module, context): +def handler(fit, module, context, *args, **kwargs): if "projected" not in context: return fit.ship.boostItemAttr("maxVelocity", module.getModifiedItemAttr("speedFactor"), - stackingPenalties=True, remoteResists=True) + stackingPenalties=True, *args, **kwargs) diff --git a/eos/effects/shipmoduleguidancedisruptor.py b/eos/effects/shipmoduleguidancedisruptor.py index 1588d52d7..a48eb6e78 100644 --- a/eos/effects/shipmoduleguidancedisruptor.py +++ b/eos/effects/shipmoduleguidancedisruptor.py @@ -5,7 +5,7 @@ type = "active", "projected" -def handler(fit, module, context): +def handler(fit, module, context, *args, **kwargs): if "projected" in context: for srcAttr, tgtAttr in ( ("aoeCloudSizeBonus", "aoeCloudSize"), @@ -15,4 +15,4 @@ def handler(fit, module, context): ): fit.modules.filteredChargeBoost(lambda mod: mod.charge.requiresSkill("Missile Launcher Operation"), tgtAttr, module.getModifiedItemAttr(srcAttr), - stackingPenalties=True, remoteResists=True) + stackingPenalties=True, *args, **kwargs) diff --git a/eos/effects/shipmoduletrackingdisruptor.py b/eos/effects/shipmoduletrackingdisruptor.py index e970dae3c..1ddd85f94 100644 --- a/eos/effects/shipmoduletrackingdisruptor.py +++ b/eos/effects/shipmoduletrackingdisruptor.py @@ -5,14 +5,14 @@ type = "projected", "active" -def handler(fit, module, context): +def handler(fit, module, context, *args, **kwargs): if "projected" in context: fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Gunnery"), "trackingSpeed", module.getModifiedItemAttr("trackingSpeedBonus"), - stackingPenalties=True, remoteResists=True) + stackingPenalties=True, *args, **kwargs) fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Gunnery"), "maxRange", module.getModifiedItemAttr("maxRangeBonus"), - stackingPenalties=True, remoteResists=True) + stackingPenalties=True, *args, **kwargs) fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Gunnery"), "falloff", module.getModifiedItemAttr("falloffBonus"), - stackingPenalties=True, remoteResists=True) + stackingPenalties=True, *args, **kwargs) diff --git a/eos/effects/structuremoduleeffectremotesensordampener.py b/eos/effects/structuremoduleeffectremotesensordampener.py index 7260ef623..08aa61e57 100644 --- a/eos/effects/structuremoduleeffectremotesensordampener.py +++ b/eos/effects/structuremoduleeffectremotesensordampener.py @@ -3,12 +3,12 @@ type = "projected", "active" -def handler(fit, module, context): +def handler(fit, module, context, *args, **kwargs): if "projected" not in context: return fit.ship.boostItemAttr("maxTargetRange", module.getModifiedItemAttr("maxTargetRangeBonus"), - stackingPenalties=True, remoteResists=True) + stackingPenalties=True, *args, **kwargs) fit.ship.boostItemAttr("scanResolution", module.getModifiedItemAttr("scanResolutionBonus"), - stackingPenalties=True, remoteResists=True) + stackingPenalties=True, *args, **kwargs) diff --git a/eos/effects/structuremoduleeffectstasiswebifier.py b/eos/effects/structuremoduleeffectstasiswebifier.py index 0aa907fc6..aa0b0d553 100644 --- a/eos/effects/structuremoduleeffectstasiswebifier.py +++ b/eos/effects/structuremoduleeffectstasiswebifier.py @@ -2,8 +2,8 @@ type = "active", "projected" -def handler(fit, module, context): +def handler(fit, module, context, *args, **kwargs): if "projected" not in context: return fit.ship.boostItemAttr("maxVelocity", module.getModifiedItemAttr("speedFactor"), - stackingPenalties=True, remoteResists=True) + stackingPenalties=True, *args, **kwargs) diff --git a/eos/effects/structuremoduleeffecttargetpainter.py b/eos/effects/structuremoduleeffecttargetpainter.py index aac9005ba..7c15140e3 100644 --- a/eos/effects/structuremoduleeffecttargetpainter.py +++ b/eos/effects/structuremoduleeffecttargetpainter.py @@ -2,7 +2,7 @@ type = "projected", "active" -def handler(fit, container, context): +def handler(fit, container, context, *args, **kwargs): if "projected" in context: fit.ship.boostItemAttr("signatureRadius", container.getModifiedItemAttr("signatureRadiusBonus"), - stackingPenalties=True, remoteResists=True) + stackingPenalties=True, *args, **kwargs) diff --git a/eos/effects/structuremoduleeffectweapondisruption.py b/eos/effects/structuremoduleeffectweapondisruption.py index 82e67797e..3b6365e37 100644 --- a/eos/effects/structuremoduleeffectweapondisruption.py +++ b/eos/effects/structuremoduleeffectweapondisruption.py @@ -3,7 +3,7 @@ type = "active", "projected" -def handler(fit, module, context): +def handler(fit, module, context, *args, **kwargs): if "projected" in context: for srcAttr, tgtAttr in ( ("aoeCloudSizeBonus", "aoeCloudSize"), @@ -13,14 +13,14 @@ def handler(fit, module, context): ): fit.modules.filteredChargeBoost(lambda mod: mod.charge.requiresSkill("Missile Launcher Operation"), tgtAttr, module.getModifiedItemAttr(srcAttr), - stackingPenalties=True, remoteResists=True) + stackingPenalties=True, *args, **kwargs) fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Gunnery"), "trackingSpeed", module.getModifiedItemAttr("trackingSpeedBonus"), - stackingPenalties=True, remoteResists=True) + stackingPenalties=True, *args, **kwargs) fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Gunnery"), "maxRange", module.getModifiedItemAttr("maxRangeBonus"), - stackingPenalties=True, remoteResists=True) + stackingPenalties=True, *args, **kwargs) fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Gunnery"), "falloff", module.getModifiedItemAttr("falloffBonus"), - stackingPenalties=True, remoteResists=True) + stackingPenalties=True, *args, **kwargs) diff --git a/eos/modifiedAttributeDict.py b/eos/modifiedAttributeDict.py index 3488cb93e..c8482f15e 100644 --- a/eos/modifiedAttributeDict.py +++ b/eos/modifiedAttributeDict.py @@ -325,7 +325,7 @@ class ModifiedAttributeDict(collections.MutableMapping): self.__placehold(attributeName) self.__afflict(attributeName, "+", increase, increase != 0) - def multiply(self, attributeName, multiplier, stackingPenalties=False, penaltyGroup="default", skill=None): + def multiply(self, attributeName, multiplier, stackingPenalties=False, penaltyGroup="default", skill=None, resist=True, *args, **kwargs): """Multiply value of given attribute by given factor""" if multiplier is None: # See GH issue 397 return @@ -349,28 +349,44 @@ class ModifiedAttributeDict(collections.MutableMapping): self.__multipliers[attributeName] *= multiplier self.__placehold(attributeName) - self.__afflict(attributeName, "%s*" % ("s" if stackingPenalties else ""), multiplier, multiplier != 1) - def boost(self, attributeName, boostFactor, skill=None, remoteResists=False, *args, **kwargs): + afflictPenal = "" + if stackingPenalties: + afflictPenal += "s" + if resist: + afflictPenal += "r" + + self.__afflict(attributeName, "%s*" % (afflictPenal), multiplier, multiplier != 1) + + def boost(self, attributeName, boostFactor, skill=None, *args, **kwargs): """Boost value by some percentage""" if skill: boostFactor *= self.__handleSkill(skill) - if remoteResists: - # @todo: this is such a disgusting hack. Look into sending these checks to the module class before the - # effect is applied. - mod = self.fit.getModifier() - remoteResistID = mod.getModifiedItemAttr("remoteResistanceID") or None - attrInfo = getAttributeInfo(int(remoteResistID)) + resist = None + + # Goddammit CCP, make up you mind where you want this information >.< See #1139 + if 'effect' in kwargs: + remoteResistID = kwargs['effect'].resistanceID + + # If it doesn't exist on the effect, check the modifying modules attributes. If it's there, set it on the + # effect for this session so that we don't have to look here again (won't always work when it's None, but + # will catch most) + if not remoteResistID: + mod = self.fit.getModifier() + kwargs['effect'].resistanceID = int(mod.getModifiedItemAttr("remoteResistanceID")) or None + remoteResistID = kwargs['effect'].resistanceID + + attrInfo = getAttributeInfo(remoteResistID) # Get the attribute of the resist resist = self.fit.ship.itemModifiedAttributes[attrInfo.attributeName] or None - if remoteResistID and resist: + if resist: boostFactor *= resist # We just transform percentage boost into multiplication factor - self.multiply(attributeName, 1 + boostFactor / 100.0, *args, **kwargs) + self.multiply(attributeName, 1 + boostFactor / 100.0, resist=(True if resist else False), *args, **kwargs) def force(self, attributeName, value): """Force value to attribute and prohibit any changes to it""" diff --git a/eve.db b/eve.db index f48a57a45..4b5bd1001 100644 Binary files a/eve.db and b/eve.db differ diff --git a/gui/itemStats.py b/gui/itemStats.py index 41226464c..cc8ab0ceb 100644 --- a/gui/itemStats.py +++ b/gui/itemStats.py @@ -1141,11 +1141,13 @@ class ItemAffectedBy(wx.Panel): if projected: displayStr += " (projected)" - if attrModifier == "s*": - attrModifier = "*" - penalized = "(penalized)" - else: - penalized = "" + penalized = "" + if '*' in attrModifier: + if 's' in attrModifier: + penalized += "(penalized)" + if 'r' in attrModifier: + penalized += "(resisted)" + attrModifier = "*" # this is the Module node, the attribute will be attached to this display = "%s %s %.2f %s" % (displayStr, attrModifier, attrAmount, penalized) @@ -1271,11 +1273,13 @@ class ItemAffectedBy(wx.Panel): else: attrIcon = self.imageList.Add(BitmapLoader.getBitmap("7_15", "icons")) - if attrModifier == "s*": - attrModifier = "*" - penalized = "(penalized)" - else: - penalized = "" + penalized = "" + if '*' in attrModifier: + if 's' in attrModifier: + penalized += "(penalized)" + if 'r' in attrModifier: + penalized += "(resisted)" + attrModifier = "*" attributes.append((attrName, (displayName if displayName != "" else attrName), attrModifier, attrAmount, penalized, attrIcon))