Calculate amount of cycles for spoolup

This commit is contained in:
DarkPhoenix
2018-12-12 10:20:17 +03:00
parent 85a834d1a3
commit e83e081548
3 changed files with 14 additions and 13 deletions

View File

@@ -15,5 +15,5 @@ def handler(fit, container, context, **kwargs):
repSpoolMax = container.getModifiedItemAttr("repairMultiplierBonusMax")
repSpoolPerCycle = container.getModifiedItemAttr("repairMultiplierBonusPerCycle")
# TODO: use spoolup options to fetch main value
repAmount = repAmountBase * (1 + calculateSpoolup(repSpoolMax, repSpoolPerCycle, cycleTime, SpoolType.SCALE, 1))
repAmount = repAmountBase * (1 + calculateSpoolup(repSpoolMax, repSpoolPerCycle, cycleTime, SpoolType.SCALE, 1)[0])
fit.extraAttributes.increase("armorRepair", repAmount / cycleTime, **kwargs)

View File

@@ -450,7 +450,7 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
spoolType if spoolType is not None else self.spoolType,
# Using spool type as condition as it should define if we're using
# passed spoolup parameters or not
spoolAmount if spoolType is not None else self.spoolAmount)
spoolAmount if spoolType is not None else self.spoolAmount)[0]
volley = DmgTypes(
em=self.__baseVolley.em * spoolMultiplier * (1 - getattr(targetResists, "emAmount", 0)),
thermal=self.__baseVolley.thermal * spoolMultiplier * (1 - getattr(targetResists, "thermalAmount", 0)),
@@ -518,7 +518,7 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
spoolType if spoolType is not None else self.spoolType,
# Using spool type as condition as it should define if we're using
# passed spoolup parameters or not
spoolAmount if spoolType is not None else self.spoolAmount)
spoolAmount if spoolType is not None else self.spoolAmount)[0]
rrAmount *= spoolMultiplier
return rrType, rrAmount

View File

@@ -25,9 +25,9 @@ from eos.utils.float import floatUnerr
@unique
class SpoolType(IntEnum):
SCALE = 0 # [0..1]
TIME = 1 # Expressed via time in seconds since spoolup started
CYCLES = 2 # Expressed in amount of cycles since spoolup started
SCALE = 0 # [0..1]
TIME = 1 # Expressed via time in seconds since spool up started
CYCLES = 2 # Expressed in amount of cycles since spool up started
def calculateSpoolup(modMaxValue, modStepValue, modCycleTime, spoolType, spoolAmount):
@@ -36,14 +36,15 @@ def calculateSpoolup(modMaxValue, modStepValue, modCycleTime, spoolType, spoolAm
is specified in seconds.
"""
if not modMaxValue or not modStepValue:
return 0
return 0, 0
if spoolType == SpoolType.SCALE:
return int(floatUnerr(spoolAmount * modMaxValue / modStepValue)) * modStepValue
cycles = int(floatUnerr(spoolAmount * modMaxValue / modStepValue))
return cycles * modStepValue, cycles * modCycleTime
elif spoolType == SpoolType.TIME:
cycles = int(floatUnerr(spoolAmount / modCycleTime))
return min(modMaxValue, cycles * modStepValue)
cycles = min(int(floatUnerr(spoolAmount / modCycleTime)), int(floatUnerr(modMaxValue / modStepValue)))
return cycles * modStepValue, cycles * modCycleTime
elif spoolType == SpoolType.CYCLES:
cycles = int(spoolAmount)
return min(modMaxValue, cycles * modStepValue)
cycles = min(int(spoolAmount), int(floatUnerr(modMaxValue / modStepValue)))
return cycles * modStepValue, cycles * modCycleTime
else:
return 0
return 0, 0