Add starting shield amount to shield graph as well

This commit is contained in:
DarkPhoenix
2019-08-19 13:20:02 +03:00
parent 348c4d71df
commit 6e3b536d83
2 changed files with 11 additions and 4 deletions

View File

@@ -35,6 +35,7 @@ class Time2ShieldAmountGetter(SmoothPointGetter):
shieldAmount = calculateShieldAmount(
maxShieldAmount=commonData['maxShieldAmount'],
shieldRegenTime=commonData['shieldRegenTime'],
shieldAmountT0=miscParams['shieldAmountT0'] or 0,
time=time)
return shieldAmount
@@ -51,6 +52,7 @@ class Time2ShieldRegenGetter(SmoothPointGetter):
shieldAmount = calculateShieldAmount(
maxShieldAmount=commonData['maxShieldAmount'],
shieldRegenTime=commonData['shieldRegenTime'],
shieldAmountT0=miscParams['shieldAmountT0'] or 0,
time=time)
shieldRegen = calculateShieldRegen(
maxShieldAmount=commonData['maxShieldAmount'],
@@ -83,10 +85,10 @@ class ShieldAmount2ShieldRegenGetter(SmoothPointGetter):
return shieldRegen
def calculateShieldAmount(maxShieldAmount, shieldRegenTime, time):
def calculateShieldAmount(maxShieldAmount, shieldRegenTime, shieldAmountT0, time):
# The same formula as for cap
# https://wiki.eveuniversity.org/Capacitor#Capacitor_recharge_rate
return maxShieldAmount * (1 + math.exp(5 * -time / shieldRegenTime) * -1) ** 2
return maxShieldAmount * (1 + math.exp(5 * -time / shieldRegenTime) * (math.sqrt(shieldAmountT0 / maxShieldAmount) - 1)) ** 2
def calculateShieldRegen(maxShieldAmount, shieldRegenTime, currentShieldAmount):

View File

@@ -36,7 +36,9 @@ class FitShieldRegenGraph(FitGraph):
Input(handle='shieldAmount', unit='%', label='Shield amount', iconID=1384, defaultValue=25, defaultRange=(0, 100), conditions=[
(('shieldAmount', 'EHP'), None),
(('shieldAmount', 'HP'), None),
(('shieldAmount', '%'), None)])]
(('shieldAmount', '%'), None)]),
Input(handle='shieldAmountT0', unit='%', label='Starting shield amount', iconID=1384, defaultValue=0, defaultRange=(0, 100), conditions=[
(('time', 's'), None)])]
srcExtraCols = ('ShieldAmount', 'ShieldTime')
usesHpEffectivity = True
@@ -56,9 +58,12 @@ class FitShieldRegenGraph(FitGraph):
# Calculation stuff
_normalizers = {
('shieldAmount', '%'): lambda v, src, tgt: v / 100 * src.item.ship.getModifiedItemAttr('shieldCapacity'),
('shieldAmountT0', '%'): lambda v, src, tgt: None if v is None else v / 100 * src.item.ship.getModifiedItemAttr('shieldCapacity'),
# Needed only for "x mark" support, to convert EHP x into normalized value
('shieldAmount', 'EHP'): lambda v, src, tgt: v / src.item.damagePattern.effectivify(src.item, 1, 'shield')}
_limiters = {'shieldAmount': lambda src, tgt: (0, src.item.ship.getModifiedItemAttr('shieldCapacity'))}
_limiters = {
'shieldAmount': lambda src, tgt: (0, src.item.ship.getModifiedItemAttr('shieldCapacity')),
'shieldAmountT0': lambda src, tgt: (0, src.item.ship.getModifiedItemAttr('shieldCapacity'))}
_getters = {
('time', 'shieldAmount'): Time2ShieldAmountGetter,
('time', 'shieldRegen'): Time2ShieldRegenGetter,