Proper fix to attribute caps
This commit is contained in:
@@ -20,7 +20,7 @@
|
||||
from sqlalchemy import Table, Column, Integer, ForeignKey, Boolean
|
||||
from sqlalchemy.orm import mapper
|
||||
from eos.db import saveddata_meta
|
||||
from eos.types import Fighter
|
||||
from eos.types import Fighter, Fit
|
||||
from sqlalchemy.orm import *
|
||||
from sqlalchemy.sql import and_
|
||||
from eos.effectHandlerHelpers import *
|
||||
@@ -42,6 +42,7 @@ fighter_abilities_table = Table("fightersAbilities", saveddata_meta,
|
||||
|
||||
mapper(Fighter, fighters_table,
|
||||
properties = {
|
||||
"owner": relation(Fit),
|
||||
"_Fighter__abilities": relation(
|
||||
FighterAbility,
|
||||
backref="fighter",
|
||||
|
||||
@@ -154,13 +154,23 @@ class ModifiedAttributeDict(collections.MutableMapping):
|
||||
cappingId = cappingAttrKeyCache[key] = None
|
||||
else:
|
||||
# see GH issue #620
|
||||
cappingId = cappingAttrKeyCache[key] = None if attrInfo.maxAttributeID == 797 else attrInfo.maxAttributeID
|
||||
cappingId = cappingAttrKeyCache[key] = attrInfo.maxAttributeID
|
||||
if cappingId is None:
|
||||
cappingKey = None
|
||||
else:
|
||||
cappingAttrInfo = getAttributeInfo(cappingId)
|
||||
cappingKey = None if cappingAttrInfo is None else cappingAttrInfo.name
|
||||
cappingValue = self.__calculateValue(cappingKey) if cappingKey is not None else None
|
||||
|
||||
if cappingKey:
|
||||
if cappingKey in self.original:
|
||||
# some items come with their own caps (ie: carriers). If they do, use this
|
||||
cappingValue = self.original.get(cappingKey).value
|
||||
else:
|
||||
# If not, get info about the default value
|
||||
cappingValue = self.__calculateValue(cappingKey)
|
||||
else:
|
||||
cappingValue = None
|
||||
|
||||
# If value is forced, we don't have to calculate anything,
|
||||
# just return forced value instead
|
||||
force = self.__forced[key] if key in self.__forced else None
|
||||
|
||||
@@ -48,7 +48,7 @@ class Ship(ItemAttrShortcut, HandledItem):
|
||||
|
||||
self.__item = item
|
||||
self.__modeItems = self.__getModeItems()
|
||||
self.__itemModifiedAttributes = ModifiedAttributeDict()
|
||||
self.__itemModifiedAttributes = ModifiedAttributeDict(parent=self)
|
||||
self.__itemModifiedAttributes.original = dict(self.item.attributes)
|
||||
self.__itemModifiedAttributes.original.update(self.EXTRA_ATTRIBUTES)
|
||||
self.__itemModifiedAttributes.overrides = self.item.overrides
|
||||
|
||||
Reference in New Issue
Block a user