Separate projected fits from list of affectors. Also, show when affected module is projected. Still need to clean up affector tree stuff
This commit is contained in:
@@ -217,13 +217,16 @@ class ModifiedAttributeDict(collections.MutableMapping):
|
||||
if attributeName not in self.__affectedBy:
|
||||
self.__affectedBy[attributeName] = {}
|
||||
affs = self.__affectedBy[attributeName]
|
||||
origin = self.fit.getOrigin()
|
||||
fit = origin if origin and origin != self.fit else self.fit
|
||||
# If there's no set for current fit in dictionary, create it
|
||||
if self.fit not in affs:
|
||||
affs[self.fit] = []
|
||||
if fit not in affs:
|
||||
affs[fit] = []
|
||||
# Reassign alias to list
|
||||
affs = affs[self.fit]
|
||||
affs = affs[fit]
|
||||
# Get modifier which helps to compose 'Affected by' map
|
||||
modifier = self.fit.getModifier()
|
||||
|
||||
# Add current affliction to list
|
||||
affs.append((modifier, operation, bonus, used))
|
||||
|
||||
|
||||
@@ -285,5 +285,10 @@ class Skill(HandledItem):
|
||||
copy = Skill(self.item, self.level, self.__ro)
|
||||
return copy
|
||||
|
||||
def __repr__(self):
|
||||
return "Skill(ID={}, name={}) at {}".format(
|
||||
self.item.ID, self.item.name, hex(id(self))
|
||||
)
|
||||
|
||||
class ReadOnlyException(Exception):
|
||||
pass
|
||||
|
||||
@@ -381,8 +381,9 @@ class Fit(object):
|
||||
|
||||
#Methods to register and get the thing currently affecting the fit,
|
||||
#so we can correctly map "Affected By"
|
||||
def register(self, currModifier):
|
||||
def register(self, currModifier, origin=None):
|
||||
self.__modifier = currModifier
|
||||
self.__origin = origin
|
||||
if hasattr(currModifier, "itemModifiedAttributes"):
|
||||
currModifier.itemModifiedAttributes.fit = self
|
||||
if hasattr(currModifier, "chargeModifiedAttributes"):
|
||||
@@ -391,6 +392,9 @@ class Fit(object):
|
||||
def getModifier(self):
|
||||
return self.__modifier
|
||||
|
||||
def getOrigin(self):
|
||||
return self.__origin
|
||||
|
||||
def __calculateGangBoosts(self, runTime):
|
||||
logger.debug("Applying gang boosts in `%s` runtime for %s", runTime, self)
|
||||
for name, info in self.gangBoosts.iteritems():
|
||||
@@ -506,7 +510,7 @@ class Fit(object):
|
||||
item.calculateModifiedAttributes(self, runTime, False)
|
||||
if projected is True:
|
||||
for _ in xrange(projectionInfo.amount):
|
||||
targetFit.register(item)
|
||||
targetFit.register(item, origin=self)
|
||||
item.calculateModifiedAttributes(targetFit, runTime, True)
|
||||
|
||||
timer.checkpoint('Done with runtime: %s'%runTime)
|
||||
|
||||
@@ -639,6 +639,14 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
|
||||
copy.state = self.state
|
||||
return copy
|
||||
|
||||
def __repr__(self):
|
||||
if self.item:
|
||||
return "Module(ID={}, name={}) at {}".format(
|
||||
self.item.ID, self.item.name, hex(id(self))
|
||||
)
|
||||
else:
|
||||
return "EmptyModule() at {}".format(hex(id(self)))
|
||||
|
||||
class Rack(Module):
|
||||
'''
|
||||
This is simply the Module class named something else to differentiate
|
||||
|
||||
Reference in New Issue
Block a user