Merge branch 'master' into fit_export_options

This commit is contained in:
DarkPhoenix
2019-02-21 10:39:50 +03:00
3 changed files with 18 additions and 7 deletions

View File

@@ -11,6 +11,5 @@ def handler(fit, module, context):
bonus = "%s%sDamageResonance" % (attrPrefix, damageType)
bonus = "%s%s" % (bonus[0].lower(), bonus[1:])
booster = "%s%sDamageResonance" % (layer, damageType)
penalize = False if layer == 'hull' else True
fit.ship.multiplyItemAttr(bonus, module.getModifiedItemAttr(booster),
stackingPenalties=penalize, penaltyGroup="preMul")
stackingPenalties=True, penaltyGroup="preMul")

View File

@@ -8,4 +8,6 @@ runtime = "late"
def handler(fit, src, context):
for dmgType in ('em', 'thermal', 'kinetic', 'explosive'):
fit.ship.forceItemAttr('{}DamageResonance'.format(dmgType), src.getModifiedItemAttr("hull{}DamageResonance".format(dmgType.title())))
fit.ship.multiplyItemAttr('{}DamageResonance'.format(dmgType),
src.getModifiedItemAttr("hull{}DamageResonance".format(dmgType.title())),
stackingPenalties=True, penaltyGroup="postMul")

View File

@@ -46,8 +46,18 @@ class ItemMutator(wx.Panel):
for m in sorted(stuff.mutators.values(), key=lambda x: x.attribute.displayName):
# Format: [raw value, modifier applied to base raw value, display value]
minRange = (m.minValue, m.attribute.unit.SimplifyValue(m.minValue))
maxRange = (m.maxValue, m.attribute.unit.SimplifyValue(m.maxValue))
range1 = (m.minValue, m.attribute.unit.SimplifyValue(m.minValue))
range2 = (m.maxValue, m.attribute.unit.SimplifyValue(m.maxValue))
# minValue/maxValue do not always correspond to min/max, because these are
# just base value multiplied by minMod/maxMod, and in case base is negative
# minValue is actually bigger than maxValue
if range1[0] <= range2[0]:
minRange = range1
maxRange = range2
else:
minRange = range2
maxRange = range1
if (m.highIsGood and minRange[0] >= maxRange[0]) or (not m.highIsGood and minRange[0] <= maxRange[0]):
betterRange = minRange
@@ -66,10 +76,10 @@ class ItemMutator(wx.Panel):
# If base value is outside of mutation range, make sure that center of slider
# corresponds to the value which is closest available to actual base value. It's
# how EVE handles it
if m.minValue <= m.baseValue <= m.maxValue:
if minRange[0] <= m.baseValue <= maxRange[0]:
sliderBaseValue = m.baseValue
else:
sliderBaseValue = max(m.minValue, min(m.maxValue, m.baseValue))
sliderBaseValue = max(minRange[0], min(maxRange[0], m.baseValue))
headingSizer = wx.BoxSizer(wx.HORIZONTAL)