Merge branch 'singularity'

This commit is contained in:
DarkPhoenix
2019-09-10 14:30:51 +03:00
15 changed files with 150 additions and 67 deletions

View File

@@ -90,9 +90,12 @@ class FittingHardpoint(IntEnum):
@unique
class SpoolType(IntEnum):
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
# Spool and cycle scale are different in case if max spool amount cannot
# be divided by spool step without remainder
SPOOL_SCALE = 0 # [0..1]
CYCLE_SCALE = 1 # [0..1]
TIME = 2 # Expressed via time in seconds since spool up started
CYCLES = 3 # Expressed in amount of cycles since spool up started
@unique

View File

@@ -5851,6 +5851,7 @@ class Effect2008(BaseEffect):
cynosuralDurationBonus
Used by:
Ships from group: Black Ops (5 of 5)
Ships from group: Force Recon Ship (8 of 9)
"""
@@ -5858,7 +5859,7 @@ class Effect2008(BaseEffect):
@staticmethod
def handler(fit, ship, context, **kwargs):
fit.modules.filteredItemBoost(lambda mod: mod.item.group.name == 'Cynosural Field Generator',
fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill('Cynosural Field Theory'),
'duration', ship.getModifiedItemAttr('durationBonus'), **kwargs)
@@ -35297,10 +35298,10 @@ class Effect7166(BaseEffect):
repSpoolMax = container.getModifiedItemAttr('repairMultiplierBonusMax')
repSpoolPerCycle = container.getModifiedItemAttr('repairMultiplierBonusPerCycle')
defaultSpoolValue = eos.config.settings['globalDefaultSpoolupPercentage']
spoolType, spoolAmount = resolveSpoolOptions(SpoolOptions(SpoolType.SCALE, defaultSpoolValue, False), container)
spoolType, spoolAmount = resolveSpoolOptions(SpoolOptions(SpoolType.SPOOL_SCALE, defaultSpoolValue, False), container)
rps = repAmountBase * (1 + calculateSpoolup(repSpoolMax, repSpoolPerCycle, cycleTime, spoolType, spoolAmount)[0]) / cycleTime
rpsPreSpool = repAmountBase * (1 + calculateSpoolup(repSpoolMax, repSpoolPerCycle, cycleTime, SpoolType.SCALE, 0)[0]) / cycleTime
rpsFullSpool = repAmountBase * (1 + calculateSpoolup(repSpoolMax, repSpoolPerCycle, cycleTime, SpoolType.SCALE, 1)[0]) / cycleTime
rpsPreSpool = repAmountBase * (1 + calculateSpoolup(repSpoolMax, repSpoolPerCycle, cycleTime, SpoolType.SPOOL_SCALE, 0)[0]) / cycleTime
rpsFullSpool = repAmountBase * (1 + calculateSpoolup(repSpoolMax, repSpoolPerCycle, cycleTime, SpoolType.SPOOL_SCALE, 1)[0]) / cycleTime
fit.extraAttributes.increase('armorRepair', rps, **kwargs)
fit.extraAttributes.increase('armorRepairPreSpool', rpsPreSpool, **kwargs)
fit.extraAttributes.increase('armorRepairFullSpool', rpsFullSpool, **kwargs)
@@ -35806,3 +35807,58 @@ class Effect7231(BaseEffect):
fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill('Repair Systems'),
'armorDamageAmount', ship.getModifiedItemAttr('shipBonusGC3'),
skill='Gallente Cruiser', **kwargs)
class Effect7232(BaseEffect):
"""
modifyDamageMultiplierBonusMax
Used by:
Implants named like: Low Grade Kostenadza (5 of 6)
"""
type = 'passive'
@staticmethod
def handler(fit, implant, context, **kwargs):
fit.modules.filteredItemBoost(
lambda mod: mod.item.group.name == 'Precursor Weapon', 'damageMultiplierBonusMax',
implant.getModifiedItemAttr('damageMultiplierBonusMaxModifier'), **kwargs)
class Effect7233(BaseEffect):
"""
modifyDamageMultiplierBonusPerCycle
Used by:
Implants named like: Low Grade Kostenadza (5 of 6)
"""
type = 'passive'
@staticmethod
def handler(fit, implant, context, **kwargs):
fit.modules.filteredItemBoost(
lambda mod: mod.item.group.name == 'Precursor Weapon', 'damageMultiplierBonusPerCycle',
implant.getModifiedItemAttr('damageMultiplierBonusPerCycleModifier'), **kwargs)
class Effect7234(BaseEffect):
"""
implantSetKostenadza
Used by:
Implants named like: Low Grade Kostenadza (6 of 6)
"""
runTime = 'early'
type = 'passive'
@staticmethod
def handler(fit, implant, context, **kwargs):
fit.appliedImplants.filteredItemMultiply(
lambda imp: imp.item.group.name == 'Cyberimplant', 'damageMultiplierBonusMaxModifier',
implant.getModifiedItemAttr('setBonusKostenadza'), **kwargs)
fit.appliedImplants.filteredItemMultiply(
lambda imp: imp.item.group.name == 'Cyberimplant', 'damageMultiplierBonusPerCycleModifier',
implant.getModifiedItemAttr('setBonusKostenadza'), **kwargs)

View File

@@ -339,7 +339,12 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
duringAcceleration = maxVelocity / 2 * accelTime
# Distance done after being at full speed
fullSpeed = maxVelocity * (flightTime - accelTime)
return duringAcceleration + fullSpeed
maxRange = duringAcceleration + fullSpeed
if 'fofMissileLaunching' in self.charge.effects:
rangeLimit = self.getModifiedChargeAttr("maxFOFTargetRange")
if rangeLimit:
maxRange = min(maxRange, rangeLimit)
return maxRange
@property
def falloff(self):

View File

@@ -18,6 +18,7 @@
# ===============================================================================
import math
from collections import namedtuple
from eos.const import SpoolType
@@ -36,15 +37,33 @@ def calculateSpoolup(modMaxValue, modStepValue, modCycleTime, spoolType, spoolAm
"""
if not modMaxValue or not modStepValue:
return 0, 0, 0
if spoolType == SpoolType.SCALE:
cycles = int(floatUnerr(spoolAmount * modMaxValue / modStepValue))
return cycles * modStepValue, cycles, cycles * modCycleTime
if spoolType == SpoolType.SPOOL_SCALE:
# Find out at which point of spoolup scale we're on, find out how many cycles
# is enough to reach it and recalculate spoolup value for that amount of cycles
cycles = math.ceil(floatUnerr(modMaxValue * spoolAmount / modStepValue))
spoolValue = min(modMaxValue, cycles * modStepValue)
return spoolValue, cycles, cycles * modCycleTime
elif spoolType == SpoolType.CYCLE_SCALE:
# For cycle scale, find out max amount of cycles and scale against it
cycles = round(spoolAmount * math.ceil(floatUnerr(modMaxValue / modStepValue)))
spoolValue = min(modMaxValue, cycles * modStepValue)
return spoolValue, cycles, cycles * modCycleTime
elif spoolType == SpoolType.TIME:
cycles = min(int(floatUnerr(spoolAmount / modCycleTime)), int(floatUnerr(modMaxValue / modStepValue)))
return cycles * modStepValue, cycles, cycles * modCycleTime
cycles = min(
# How many full cycles mod had by passed time
math.floor(floatUnerr(spoolAmount / modCycleTime)),
# Max amount of cycles
math.ceil(floatUnerr(modMaxValue / modStepValue)))
spoolValue = min(modMaxValue, cycles * modStepValue)
return spoolValue, cycles, cycles * modCycleTime
elif spoolType == SpoolType.CYCLES:
cycles = min(int(spoolAmount), int(floatUnerr(modMaxValue / modStepValue)))
return cycles * modStepValue, cycles, cycles * modCycleTime
cycles = min(
# Consider full cycles only
math.floor(spoolAmount),
# Max amount of cycles
math.ceil(floatUnerr(modMaxValue / modStepValue)))
spoolValue = min(modMaxValue, cycles * modStepValue)
return spoolValue, cycles, cycles * modCycleTime
else:
return 0, 0, 0