Implement ewar resists (#597)
This commit is contained in:
@@ -14,4 +14,4 @@ def handler(fit, src, context):
|
||||
):
|
||||
fit.modules.filteredChargeBoost(lambda mod: mod.charge.requiresSkill("Missile Launcher Operation"),
|
||||
tgtAttr, src.getModifiedItemAttr(srcAttr),
|
||||
stackingPenalties=True)
|
||||
stackingPenalties=True, remoteResists=True)
|
||||
|
||||
@@ -7,7 +7,11 @@ type= "projected", "active"
|
||||
def handler(fit, module, context):
|
||||
if "projected" not in context:
|
||||
return
|
||||
|
||||
print "in sensor damp projection on ", fit, module.getModifiedItemAttr("maxTargetRangeBonus")
|
||||
print fit.ship.getModifiedItemAttr('maxTargetRange')
|
||||
fit.ship.boostItemAttr("maxTargetRange", module.getModifiedItemAttr("maxTargetRangeBonus"),
|
||||
stackingPenalties = True)
|
||||
stackingPenalties = True, remoteResists=True)
|
||||
print fit.ship.getModifiedItemAttr('maxTargetRange')
|
||||
fit.ship.boostItemAttr("scanResolution", module.getModifiedItemAttr("scanResolutionBonus"),
|
||||
stackingPenalties = True)
|
||||
stackingPenalties = True, remoteResists=True)
|
||||
|
||||
@@ -7,4 +7,4 @@ type = "projected", "active"
|
||||
def handler(fit, container, context):
|
||||
if "projected" in context:
|
||||
fit.ship.boostItemAttr("signatureRadius", container.getModifiedItemAttr("signatureRadiusBonus"),
|
||||
stackingPenalties = True)
|
||||
stackingPenalties = True, remoteResists=True)
|
||||
|
||||
@@ -8,10 +8,10 @@ def handler(fit, module, context):
|
||||
if "projected" in context:
|
||||
fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Gunnery"),
|
||||
"trackingSpeed", module.getModifiedItemAttr("trackingSpeedBonus"),
|
||||
stackingPenalties = True)
|
||||
stackingPenalties = True, remoteResists=True)
|
||||
fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Gunnery"),
|
||||
"maxRange", module.getModifiedItemAttr("maxRangeBonus"),
|
||||
stackingPenalties = True)
|
||||
stackingPenalties = True, remoteResists=True)
|
||||
fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Gunnery"),
|
||||
"falloff", module.getModifiedItemAttr("falloffBonus"),
|
||||
stackingPenalties = True)
|
||||
stackingPenalties = True, remoteResists=True)
|
||||
|
||||
@@ -8,4 +8,4 @@ type = "active", "projected"
|
||||
def handler(fit, module, context):
|
||||
if "projected" not in context: return
|
||||
fit.ship.boostItemAttr("maxVelocity", module.getModifiedItemAttr("speedFactor"),
|
||||
stackingPenalties = True)
|
||||
stackingPenalties = True, remoteResists=True)
|
||||
|
||||
@@ -313,14 +313,27 @@ class ModifiedAttributeDict(collections.MutableMapping):
|
||||
if not attributeName in self.__multipliers:
|
||||
self.__multipliers[attributeName] = 1
|
||||
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, *args, **kwargs):
|
||||
def boost(self, attributeName, boostFactor, skill=None, remoteResists=False, *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
|
||||
|
||||
# We really don't have a way of getting a ships attribute by ID. Fail.
|
||||
resist = next((x for x in self.fit.ship.item.attributes.values() if x.ID == remoteResistID), None)
|
||||
|
||||
if remoteResistID and resist:
|
||||
boostFactor *= resist.value
|
||||
|
||||
# We just transform percentage boost into multiplication factor
|
||||
self.multiply(attributeName, 1 + boostFactor / 100.0, *args, **kwargs)
|
||||
|
||||
|
||||
@@ -315,7 +315,10 @@ class Skill(HandledItem):
|
||||
return self.__item
|
||||
|
||||
def getModifiedItemAttr(self, key):
|
||||
return self.item.attributes[key].value
|
||||
if key in self.item.attributes:
|
||||
return self.item.attributes[key].value
|
||||
else:
|
||||
return None
|
||||
|
||||
def calculateModifiedAttributes(self, fit, runTime):
|
||||
if self.__suppressed: # or not self.learned - removed for GH issue 101
|
||||
|
||||
Reference in New Issue
Block a user