Calculate damage multiplier increment based on passed parameters. Module cycle time is specified in seconds. Returns spoolup value, amount of cycles to reach it and time to reach it.
(modMaxValue, modStepValue, modCycleTime, spoolType, spoolAmount)
| 29 | |
| 30 | |
| 31 | def calculateSpoolup(modMaxValue, modStepValue, modCycleTime, spoolType, spoolAmount): |
| 32 | """ |
| 33 | Calculate damage multiplier increment based on passed parameters. Module cycle time |
| 34 | is specified in seconds. |
| 35 | |
| 36 | Returns spoolup value, amount of cycles to reach it and time to reach it. |
| 37 | """ |
| 38 | if not modMaxValue or not modStepValue: |
| 39 | return 0, 0, 0 |
| 40 | if spoolType == SpoolType.SPOOL_SCALE: |
| 41 | # Find out at which point of spoolup scale we're on, find out how many cycles |
| 42 | # is enough to reach it and recalculate spoolup value for that amount of cycles |
| 43 | cycles = math.ceil(floatUnerr(modMaxValue * spoolAmount / modStepValue)) |
| 44 | spoolValue = min(modMaxValue, cycles * modStepValue) |
| 45 | return spoolValue, cycles, cycles * modCycleTime |
| 46 | elif spoolType == SpoolType.CYCLE_SCALE: |
| 47 | # For cycle scale, find out max amount of cycles and scale against it |
| 48 | cycles = round(spoolAmount * math.ceil(floatUnerr(modMaxValue / modStepValue))) |
| 49 | spoolValue = min(modMaxValue, cycles * modStepValue) |
| 50 | return spoolValue, cycles, cycles * modCycleTime |
| 51 | elif spoolType == SpoolType.TIME: |
| 52 | cycles = min( |
| 53 | # How many full cycles mod had by passed time |
| 54 | math.floor(floatUnerr(spoolAmount / modCycleTime)), |
| 55 | # Max amount of cycles |
| 56 | math.ceil(floatUnerr(modMaxValue / modStepValue))) |
| 57 | spoolValue = min(modMaxValue, cycles * modStepValue) |
| 58 | return spoolValue, cycles, cycles * modCycleTime |
| 59 | elif spoolType == SpoolType.CYCLES: |
| 60 | cycles = min( |
| 61 | # Consider full cycles only |
| 62 | math.floor(spoolAmount), |
| 63 | # Max amount of cycles |
| 64 | math.ceil(floatUnerr(modMaxValue / modStepValue))) |
| 65 | spoolValue = min(modMaxValue, cycles * modStepValue) |
| 66 | return spoolValue, cycles, cycles * modCycleTime |
| 67 | else: |
| 68 | return 0, 0, 0 |
| 69 | |
| 70 | |
| 71 | def resolveSpoolOptions(spoolOptions, module): |
no test coverage detected