diff --git a/eos/saveddata/drone.py b/eos/saveddata/drone.py index e49aeb2ad..b07484848 100755 --- a/eos/saveddata/drone.py +++ b/eos/saveddata/drone.py @@ -164,8 +164,14 @@ class Drone(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut): def canBeApplied(self, projectedOnto): """Check if drone can engage specific fitting""" item = self.item - if (item.offensive and projectedOnto.ship.getModifiedItemAttr("disallowOffensiveModifiers") == 1 and "energyDestabilizationNew" not in item.effects) or \ - (item.assistive and projectedOnto.ship.getModifiedItemAttr("disallowAssistance") == 1): + # Do not allow to apply offensive modules on ship with offensive module immunite, with few exceptions + # (all effects which apply instant modification are exception, generally speaking) + if item.offensive and projectedOnto.ship.getModifiedItemAttr("disallowOffensiveModifiers") == 1: + offensiveNonModifiers = set(("energyDestabilizationNew", "leech")) + if not offensiveNonModifiers.intersection(set(item.effects)): + return False + # If assistive modules are not allowed, do not let to apply these altogether + if item.assistive and projectedOnto.ship.getModifiedItemAttr("disallowAssistance") == 1: return False else: return True diff --git a/eos/saveddata/module.py b/eos/saveddata/module.py index 9b5dad369..c27f065da 100755 --- a/eos/saveddata/module.py +++ b/eos/saveddata/module.py @@ -464,11 +464,16 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut): return currActive <= maxGroupActive # For projected, we're checking if ship is vulnerable to given item else: - if (item.offensive and projectedOnto.ship.getModifiedItemAttr("disallowOffensiveModifiers") == 1 and "energyDestabilizationNew" not in item.effects) or \ - (item.assistive and projectedOnto.ship.getModifiedItemAttr("disallowAssistance") == 1): + # Do not allow to apply offensive modules on ship with offensive module immunite, with few exceptions + # (all effects which apply instant modification are exception, generally speaking) + if item.offensive and projectedOnto.ship.getModifiedItemAttr("disallowOffensiveModifiers") == 1: + offensiveNonModifiers = set(("energyDestabilizationNew", "leech")) + if not offensiveNonModifiers.intersection(set(item.effects)): + return False + # If assistive modules are not allowed, do not let to apply these altogether + if item.assistive and projectedOnto.ship.getModifiedItemAttr("disallowAssistance") == 1: return False - else: - return True + return True def isValidCharge(self, charge): #Check sizes, if 'charge size > module volume' it won't fit @@ -641,4 +646,4 @@ class Rack(Module): This is simply the Module class named something else to differentiate it for app logic. This class does not do anything special ''' - pass \ No newline at end of file + pass