Minor fixes

This commit is contained in:
DarkPhoenix
2024-11-12 14:45:41 +01:00
parent 5721beacf5
commit 7664b00b59
3 changed files with 12 additions and 6 deletions

View File

@@ -106,9 +106,13 @@ class DmgTypes:
yield self.thermal
yield self.kinetic
yield self.explosive
yield self.breacher
yield self.pure
yield self.total
@property
def pure(self):
return self.breacher
def __eq__(self, other):
if not isinstance(other, DmgTypes):
return NotImplemented
@@ -189,8 +193,11 @@ class DmgTypes:
return makeReprStr(self, spec=['em', 'thermal', 'kinetic', 'explosive', 'breacher', 'total'])
@staticmethod
def names(short=None, postProcessor=None):
value = [_t('em'), _t('th'), _t('kin'), _t('exp'), _t('breacher')] if short else [_t('em'), _t('thermal'), _t('kinetic'), _t('explosive'), _t('breacher')]
def names(short=None, postProcessor=None, includePure=False):
value = [_t('em'), _t('th'), _t('kin'), _t('exp')] if short else [_t('em'), _t('thermal'), _t('kinetic'), _t('explosive')]
if includePure:
value += [_t('pure')]
if postProcessor:
value = [postProcessor(x) for x in value]

View File

@@ -173,10 +173,9 @@ class FirepowerViewFull(StatsView):
if hasSpool:
lines.append("")
lines.append(_t("Current") + ": {}".format(formatAmount(normal.total, prec, lowest, highest)))
for dmgType in normal.names():
for dmgType in normal.names(includePure=True):
val = getattr(normal, dmgType, None)
if val:
dmgType = {'breacher': 'pure'}.get(dmgType, dmgType)
lines.append("{}{}: {}%".format(
" " if hasSpool else "",
_t(dmgType).capitalize(),

View File

@@ -69,7 +69,7 @@ class Ammo:
falloff = (mod.item.getAttribute('falloff') or 0) * \
(charge.getAttribute('fallofMultiplier') or 1)
for type_ in DmgTypes.names():
d = charge.getAttribute('%sDamage' % type_)
d = charge.getAttribute('%sDamage' % type_, default=0)
if d > 0:
damage += d
# Take optimal and falloff as range factor