Remove nos immunity from ewar immune ships as well

This commit is contained in:
DarkPhoenix
2014-05-22 01:05:35 +04:00
parent 0ea8a7a921
commit 9dea4a26bf
2 changed files with 18 additions and 7 deletions

View File

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

View File

@@ -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
pass