Add "starting cap" parameter to cap graph
This commit is contained in:
@@ -22,7 +22,7 @@ from . import fitDamageStats
|
||||
from . import fitEwarStats
|
||||
from . import fitRemoteReps
|
||||
from . import fitShieldRegen
|
||||
from . import fitCapRegen
|
||||
from . import fitCapacitor
|
||||
from . import fitMobility
|
||||
from . import fitWarpTime
|
||||
from . import fitLockTime
|
||||
|
||||
@@ -22,7 +22,6 @@ from collections import namedtuple
|
||||
|
||||
|
||||
VectorDef = namedtuple('VectorDef', ('lengthHandle', 'lengthUnit', 'angleHandle', 'angleUnit', 'label'))
|
||||
InputCheckbox = namedtuple('InputCheckbox', ('handle', 'label', 'defaultValue'))
|
||||
|
||||
|
||||
class YDef:
|
||||
@@ -111,3 +110,25 @@ class Input:
|
||||
self.mainTooltip == other.mainTooltip,
|
||||
self.secondaryTooltip == other.secondaryTooltip,
|
||||
self.conditions == other.conditions))
|
||||
|
||||
|
||||
class InputCheckbox:
|
||||
|
||||
def __init__(self, handle, label, defaultValue, conditions=()):
|
||||
self.handle = handle
|
||||
self.label = label
|
||||
self.defaultValue = defaultValue
|
||||
# Format: ((x condition, y condition), (x condition, y condition), ...)
|
||||
self.conditions = tuple(conditions)
|
||||
|
||||
def __hash__(self):
|
||||
return hash((self.handle, self.label, self.defaultValue, self.conditions))
|
||||
|
||||
def __eq__(self, other):
|
||||
if not isinstance(other, Input):
|
||||
return False
|
||||
return all((
|
||||
self.handle == other.handle,
|
||||
self.label == other.label,
|
||||
self.defaultValue == other.defaultValue,
|
||||
self.conditions == other.conditions))
|
||||
|
||||
@@ -35,6 +35,7 @@ class Time2CapAmountGetter(SmoothPointGetter):
|
||||
capAmount = calculateCapAmount(
|
||||
maxCapAmount=commonData['maxCapAmount'],
|
||||
capRegenTime=commonData['capRegenTime'],
|
||||
capAmountT0=miscParams['capAmountT0'] or 0,
|
||||
time=time)
|
||||
return capAmount
|
||||
|
||||
@@ -51,6 +52,7 @@ class Time2CapRegenGetter(SmoothPointGetter):
|
||||
capAmount = calculateCapAmount(
|
||||
maxCapAmount=commonData['maxCapAmount'],
|
||||
capRegenTime=commonData['capRegenTime'],
|
||||
capAmountT0=miscParams['capAmountT0'] or 0,
|
||||
time=time)
|
||||
capRegen = calculateCapRegen(
|
||||
maxCapAmount=commonData['maxCapAmount'],
|
||||
@@ -83,9 +85,9 @@ class CapAmount2CapRegenGetter(SmoothPointGetter):
|
||||
return capRegen
|
||||
|
||||
|
||||
def calculateCapAmount(maxCapAmount, capRegenTime, time):
|
||||
def calculateCapAmount(maxCapAmount, capRegenTime, capAmountT0, time):
|
||||
# https://wiki.eveuniversity.org/Capacitor#Capacitor_recharge_rate
|
||||
return maxCapAmount * (1 + math.exp(5 * -time / capRegenTime) * -1) ** 2
|
||||
return maxCapAmount * (1 + math.exp(5 * -time / capRegenTime) * (math.sqrt(capAmountT0 / maxCapAmount) - 1)) ** 2
|
||||
|
||||
|
||||
def calculateCapRegen(maxCapAmount, capRegenTime, currentCapAmount):
|
||||
@@ -39,12 +39,18 @@ class FitCapRegenGraph(FitGraph):
|
||||
(('time', 's'), None)]),
|
||||
Input(handle='capAmount', unit='%', label='Cap amount', iconID=1668, defaultValue=25, defaultRange=(0, 100), conditions=[
|
||||
(('capAmount', 'GJ'), None),
|
||||
(('capAmount', '%'), None)])]
|
||||
(('capAmount', '%'), None)]),
|
||||
Input(handle='capAmountT0', unit='%', label='Starting cap amount', iconID=1668, defaultValue=0, defaultRange=(0, 100), conditions=[
|
||||
(('time', 's'), None)])]
|
||||
srcExtraCols = ('CapAmount', 'CapTime')
|
||||
|
||||
# Calculation stuff
|
||||
_normalizers = {('capAmount', '%'): lambda v, src, tgt: v / 100 * src.item.ship.getModifiedItemAttr('capacitorCapacity')}
|
||||
_limiters = {'capAmount': lambda src, tgt: (0, src.item.ship.getModifiedItemAttr('capacitorCapacity'))}
|
||||
_normalizers = {
|
||||
('capAmount', '%'): lambda v, src, tgt: v / 100 * src.item.ship.getModifiedItemAttr('capacitorCapacity'),
|
||||
('capAmountT0', '%'): lambda v, src, tgt: None if v is None else v / 100 * src.item.ship.getModifiedItemAttr('capacitorCapacity')}
|
||||
_limiters = {
|
||||
'capAmount': lambda src, tgt: (0, src.item.ship.getModifiedItemAttr('capacitorCapacity')),
|
||||
'capAmountT0': lambda src, tgt: (0, src.item.ship.getModifiedItemAttr('capacitorCapacity'))}
|
||||
_getters = {
|
||||
('time', 'capAmount'): Time2CapAmountGetter,
|
||||
('time', 'capRegen'): Time2CapRegenGetter,
|
||||
Reference in New Issue
Block a user