Add ability to pass multiple afflictors to no-afflictor getter

This commit is contained in:
DarkPhoenix
2019-08-23 09:13:40 +03:00
parent 67462c3278
commit 0e57258cc5
2 changed files with 11 additions and 11 deletions

View File

@@ -72,9 +72,9 @@ class ItemAttrShortcut:
return_value = self.itemModifiedAttributes.getWithExtraMods(key, extraMultipliers=extraMultipliers)
return return_value or default
def getModifiedItemAttrWithoutAfflictor(self, key, afflictor, default=0):
"""Returns attribute value with passed afflictor modification removed."""
return_value = self.itemModifiedAttributes.getWithoutAfflictor(key, afflictor)
def getModifiedItemAttrWithoutAfflictors(self, key, afflictors, default=0):
"""Returns attribute value with passed afflictors' modification removed."""
return_value = self.itemModifiedAttributes.getWithoutAfflictors(key, afflictors)
return return_value or default
def getItemBaseAttrValue(self, key, default=0):
@@ -93,9 +93,9 @@ class ChargeAttrShortcut:
return_value = self.chargeModifiedAttributes.getWithExtraMods(key, extraMultipliers=extraMultipliers)
return return_value or default
def getModifiedChargeAttrWithoutAfflictor(self, key, afflictor, default=0):
"""Returns attribute value with passed modifiers applied to it."""
return_value = self.chargeModifiedAttributes.getWithoutAfflictor(key, afflictor)
def getModifiedChargeAttrWithoutAfflictors(self, key, afflictors, default=0):
"""Returns attribute value with passed afflictors' modification removed."""
return_value = self.chargeModifiedAttributes.getWithoutAfflictors(key, afflictors)
return return_value or default
def getChargeBaseAttrValue(self, key, default=0):
@@ -236,7 +236,7 @@ class ModifiedAttributeDict(collections.MutableMapping):
# Passed in default value
return default
def getWithoutAfflictor(self, key, afflictor, default=0):
def getWithoutAfflictors(self, key, ignoredAfflictors, default=0):
# Here we do not have support for preAssigns/forceds, as doing them would
# mean that we have to store all of them in a list which increases memory use,
# and we do not actually need those operators atm
@@ -245,8 +245,8 @@ class ModifiedAttributeDict(collections.MutableMapping):
ignorePenalizedMultipliers = {}
postIncreaseAdjustment = 0
for fit, afflictors in self.getAfflictions(key).items():
for innerAfflictor, operator, stackingGroup, preResAmount, postResAmount, used in afflictors:
if innerAfflictor is afflictor:
for afflictor, operator, stackingGroup, preResAmount, postResAmount, used in afflictors:
if afflictor in ignoredAfflictors:
if operator == Operator.MULTIPLY:
if stackingGroup is None:
multiplierAdjustment /= postResAmount

View File

@@ -1320,8 +1320,8 @@ class Fit:
"""Return how much cap regen do we gain from having this module"""
currentRegen = self.calculateCapRecharge()
nomodRegen = self.calculateCapRecharge(
capacity=self.ship.getModifiedItemAttrWithoutAfflictor("capacitorCapacity", mod),
rechargeRate=self.ship.getModifiedItemAttrWithoutAfflictor("rechargeRate", mod) / 1000.0)
capacity=self.ship.getModifiedItemAttrWithoutAfflictors("capacitorCapacity", [mod]),
rechargeRate=self.ship.getModifiedItemAttrWithoutAfflictors("rechargeRate", [mod]) / 1000.0)
return currentRegen - nomodRegen
def getRemoteReps(self, spoolOptions=None):