Moved neut reduction logic into fit.py
This commit is contained in:
@@ -1,10 +1,9 @@
|
||||
# Not used by any item
|
||||
from eos.types import State
|
||||
type = "active", "projected"
|
||||
def handler(fit, container, context):
|
||||
if "projected" in context and ((hasattr(container, "state") \
|
||||
and container.state >= State.ACTIVE) or hasattr(container, "amountActive")):
|
||||
multiplier = container.amountActive if hasattr(container, "amountActive") else 1
|
||||
amount = container.getModifiedItemAttr("energyNeutralizerAmount")
|
||||
time = container.getModifiedItemAttr("duration")
|
||||
fit.addDrain(time, amount * multiplier, 0)
|
||||
def handler(fit, src, context):
|
||||
if "projected" in context and ((hasattr(src, "state") and src.state >= State.ACTIVE) or hasattr(src, "amountActive")):
|
||||
multiplier = src.amountActive if hasattr(src, "amountActive") else 1
|
||||
amount = src.getModifiedItemAttr("energyNeutralizerAmount")
|
||||
time = src.getModifiedItemAttr("duration")
|
||||
fit.addDrain(src, time, amount * multiplier, 0)
|
||||
|
||||
@@ -10,30 +10,5 @@ def handler(fit, src, context):
|
||||
if "projected" in context and ((hasattr(src, "state") and src.state >= State.ACTIVE) or hasattr(src, "amountActive")):
|
||||
amount = src.getModifiedItemAttr("energyNeutralizerAmount")
|
||||
time = src.getModifiedItemAttr("duration")
|
||||
rigSize = fit.ship.getModifiedItemAttr("rigSize")
|
||||
modifierLarge = src.getModifiedItemAttr("entityCapacitorLevelModifierLarge")
|
||||
modifierMedium = src.getModifiedItemAttr("entityCapacitorLevelModifierMedium")
|
||||
modifierSmall = src.getModifiedItemAttr("entityCapacitorLevelModifierSmall")
|
||||
energyNeutralizerSignatureResolution = src.getModifiedItemAttr("energyNeutralizerSignatureResolution")
|
||||
signatureRadius = fit.ship.getModifiedItemAttr("signatureRadius")
|
||||
|
||||
#Signature reduction, uses the bomb formula as per CCP Larrikin
|
||||
if energyNeutralizerSignatureResolution:
|
||||
sigRatio = signatureRadius/energyNeutralizerSignatureResolution
|
||||
|
||||
sigReductionList = [1, sigRatio]
|
||||
amount = amount*min(sigReductionList)
|
||||
|
||||
#Small rigged ships
|
||||
if (rigSize == 1) and modifierSmall:
|
||||
amount = amount*modifierSmall
|
||||
|
||||
#Medium rigged ships
|
||||
if (rigSize == 2) and modifierMedium:
|
||||
amount = amount*modifierMedium
|
||||
|
||||
#Large rigged ships
|
||||
if (rigSize == 3) and modifierLarge:
|
||||
amount = amount*modifierLarge
|
||||
|
||||
fit.addDrain(time, amount, 0)
|
||||
fit.addDrain(src, time, amount, 0)
|
||||
|
||||
@@ -10,30 +10,5 @@ def handler(fit, src, context):
|
||||
if "projected" in context and ((hasattr(src, "state") and src.state >= State.ACTIVE) or hasattr(src, "amountActive")):
|
||||
amount = src.getModifiedItemAttr("energyNeutralizerAmount")
|
||||
time = src.getModifiedItemAttr("duration")
|
||||
rigSize = fit.ship.getModifiedItemAttr("rigSize")
|
||||
modifierLarge = src.getModifiedItemAttr("entityCapacitorLevelModifierLarge")
|
||||
modifierMedium = src.getModifiedItemAttr("entityCapacitorLevelModifierMedium")
|
||||
modifierSmall = src.getModifiedItemAttr("entityCapacitorLevelModifierSmall")
|
||||
energyNeutralizerSignatureResolution = src.getModifiedItemAttr("energyNeutralizerSignatureResolution")
|
||||
signatureRadius = fit.ship.getModifiedItemAttr("signatureRadius")
|
||||
|
||||
#Signature reduction, uses the bomb formula as per CCP Larrikin
|
||||
if energyNeutralizerSignatureResolution:
|
||||
sigRatio = signatureRadius/energyNeutralizerSignatureResolution
|
||||
|
||||
sigReductionList = [1, sigRatio]
|
||||
amount = amount*min(sigReductionList)
|
||||
|
||||
#Small rigged ships
|
||||
if (rigSize == 1) and modifierSmall:
|
||||
amount = amount*modifierSmall
|
||||
|
||||
#Medium rigged ships
|
||||
if (rigSize == 2) and modifierMedium:
|
||||
amount = amount*modifierMedium
|
||||
|
||||
#Large rigged ships
|
||||
if (rigSize == 3) and modifierLarge:
|
||||
amount = amount*modifierLarge
|
||||
|
||||
fit.addDrain(time, amount, 0)
|
||||
fit.addDrain(src, time, amount, 0)
|
||||
|
||||
@@ -9,33 +9,8 @@ runTime = "late"
|
||||
def handler(fit, src, context):
|
||||
amount = src.getModifiedItemAttr("powerTransferAmount")
|
||||
time = src.getModifiedItemAttr("duration")
|
||||
rigSize = fit.ship.getModifiedItemAttr("rigSize")
|
||||
modifierLarge = src.getModifiedItemAttr("entityCapacitorLevelModifierLarge")
|
||||
modifierMedium = src.getModifiedItemAttr("entityCapacitorLevelModifierMedium")
|
||||
modifierSmall = src.getModifiedItemAttr("entityCapacitorLevelModifierSmall")
|
||||
energyNeutralizerSignatureResolution = src.getModifiedItemAttr("energyNeutralizerSignatureResolution")
|
||||
signatureRadius = fit.ship.getModifiedItemAttr("signatureRadius")
|
||||
|
||||
if "projected" in context:
|
||||
# Signature reduction, uses the bomb formula as per CCP Larrikin
|
||||
if energyNeutralizerSignatureResolution:
|
||||
sigRatio = signatureRadius / energyNeutralizerSignatureResolution
|
||||
|
||||
sigReductionList = [1, sigRatio]
|
||||
amount = amount * min(sigReductionList)
|
||||
|
||||
#Small rigged ships
|
||||
if (rigSize == 1) and modifierSmall:
|
||||
amount = amount*modifierSmall
|
||||
|
||||
#Medium rigged ships
|
||||
if (rigSize == 2) and modifierMedium:
|
||||
amount = amount*modifierMedium
|
||||
|
||||
#Large rigged ships
|
||||
if (rigSize == 3) and modifierLarge:
|
||||
amount = amount*modifierLarge
|
||||
|
||||
fit.addDrain(time, amount, 0)
|
||||
fit.addDrain(src, time, amount, 0)
|
||||
elif "module" in context:
|
||||
src.itemModifiedAttributes.force("capacitorNeed", -amount)
|
||||
@@ -1,7 +1,7 @@
|
||||
# Not used by any item
|
||||
type = "projected", "active"
|
||||
def handler(fit, module, context):
|
||||
def handler(fit, src, context):
|
||||
if "projected" in context:
|
||||
amount = module.getModifiedItemAttr("powerTransferAmount")
|
||||
duration = module.getModifiedItemAttr("duration")
|
||||
fit.addDrain(duration, -amount, 0)
|
||||
amount = src.getModifiedItemAttr("powerTransferAmount")
|
||||
duration = src.getModifiedItemAttr("duration")
|
||||
fit.addDrain(src, duration, -amount, 0)
|
||||
|
||||
@@ -10,30 +10,5 @@ def handler(fit, src, context):
|
||||
if "projected" in context and ((hasattr(src, "state") and src.state >= State.ACTIVE) or hasattr(src, "amountActive")):
|
||||
amount = src.getModifiedItemAttr("energyNeutralizerAmount")
|
||||
time = src.getModifiedItemAttr("energyNeutralizerDuration")
|
||||
rigSize = fit.ship.getModifiedItemAttr("rigSize")
|
||||
modifierLarge = src.getModifiedItemAttr("entityCapacitorLevelModifierLarge")
|
||||
modifierMedium = src.getModifiedItemAttr("entityCapacitorLevelModifierMedium")
|
||||
modifierSmall = src.getModifiedItemAttr("entityCapacitorLevelModifierSmall")
|
||||
energyNeutralizerSignatureResolution = src.getModifiedItemAttr("energyNeutralizerSignatureResolution")
|
||||
signatureRadius = fit.ship.getModifiedItemAttr("signatureRadius")
|
||||
|
||||
#Signature reduction, uses the bomb formula as per CCP Larrikin
|
||||
if energyNeutralizerSignatureResolution:
|
||||
sigRatio = signatureRadius/energyNeutralizerSignatureResolution
|
||||
|
||||
sigReductionList = [1, sigRatio]
|
||||
amount = amount*min(sigReductionList)
|
||||
|
||||
#Small rigged ships
|
||||
if (rigSize == 1) and modifierSmall:
|
||||
amount = amount*modifierSmall
|
||||
|
||||
#Medium rigged ships
|
||||
if (rigSize == 2) and modifierMedium:
|
||||
amount = amount*modifierMedium
|
||||
|
||||
#Large rigged ships
|
||||
if (rigSize == 3) and modifierLarge:
|
||||
amount = amount*modifierLarge
|
||||
|
||||
fit.addDrain(time, amount, 0)
|
||||
fit.addDrain(src, time, amount, 0)
|
||||
|
||||
@@ -13,30 +13,5 @@ def handler(fit, src, context):
|
||||
if "projected" in context:
|
||||
amount = src.getModifiedItemAttr("{}Amount".format(prefix))
|
||||
time = src.getModifiedItemAttr("{}Duration".format(prefix))
|
||||
rigSize = fit.ship.getModifiedItemAttr("rigSize")
|
||||
modifierLarge = src.getModifiedItemAttr("entityCapacitorLevelModifierLarge")
|
||||
modifierMedium = src.getModifiedItemAttr("entityCapacitorLevelModifierMedium")
|
||||
modifierSmall = src.getModifiedItemAttr("entityCapacitorLevelModifierSmall")
|
||||
energyNeutralizerSignatureResolution = src.getModifiedItemAttr("energyNeutralizerSignatureResolution")
|
||||
signatureRadius = fit.ship.getModifiedItemAttr("signatureRadius")
|
||||
|
||||
#Signature reduction, uses the bomb formula as per CCP Larrikin
|
||||
if energyNeutralizerSignatureResolution:
|
||||
sigRatio = signatureRadius/energyNeutralizerSignatureResolution
|
||||
|
||||
sigReductionList = [1, sigRatio]
|
||||
amount = amount*min(sigReductionList)
|
||||
|
||||
# Small rigged ships
|
||||
if (rigSize == 1) and modifierSmall:
|
||||
amount = amount * modifierSmall
|
||||
|
||||
# Medium rigged ships
|
||||
if (rigSize == 2) and modifierMedium:
|
||||
amount = amount * modifierMedium
|
||||
|
||||
# Large rigged ships
|
||||
if (rigSize == 3) and modifierLarge:
|
||||
amount = amount * modifierLarge
|
||||
|
||||
fit.addDrain(time, amount, 0)
|
||||
fit.addDrain(src, time, amount, 0)
|
||||
@@ -3,8 +3,8 @@
|
||||
# Used by:
|
||||
# Modules from group: Remote Capacitor Transmitter (41 of 41)
|
||||
type = "projected", "active"
|
||||
def handler(fit, module, context):
|
||||
def handler(fit, src, context):
|
||||
if "projected" in context:
|
||||
amount = module.getModifiedItemAttr("powerTransferAmount")
|
||||
duration = module.getModifiedItemAttr("duration")
|
||||
fit.addDrain(duration, -amount, 0)
|
||||
amount = src.getModifiedItemAttr("powerTransferAmount")
|
||||
duration = src.getModifiedItemAttr("duration")
|
||||
fit.addDrain(src, duration, -amount, 0)
|
||||
|
||||
@@ -873,8 +873,24 @@ class Fit(object):
|
||||
rechargeRate = self.ship.getModifiedItemAttr("shieldRechargeRate") / 1000.0
|
||||
return 10 / rechargeRate * sqrt(percent) * (1 - sqrt(percent)) * capacity
|
||||
|
||||
def addDrain(self, cycleTime, capNeed, clipSize=0):
|
||||
def addDrain(self, src, cycleTime, capNeed, clipSize=0):
|
||||
""" Used for both cap drains and cap fills (fills have negative capNeed) """
|
||||
|
||||
rigSize = self.ship.getModifiedItemAttr("rigSize")
|
||||
energyNeutralizerSignatureResolution = src.getModifiedItemAttr("energyNeutralizerSignatureResolution")
|
||||
signatureRadius = self.ship.getModifiedItemAttr("signatureRadius")
|
||||
neutSizes = {1.0: 'Small', 2.0: 'Medium', 3.0: 'Large', 4.0: 'Capital'}
|
||||
|
||||
#Signature reduction, uses the bomb formula as per CCP Larrikin
|
||||
if energyNeutralizerSignatureResolution:
|
||||
capNeed = capNeed*min(1, signatureRadius/energyNeutralizerSignatureResolution)
|
||||
|
||||
#Size reduction, reduces neuts based off ship rig size
|
||||
for sizeInt, sizeName in neutSizes.iteritems():
|
||||
capacitorLevelModifier = src.getModifiedItemAttr("entityCapacitorLevelModifier{}".format(sizeName))
|
||||
if (rigSize == sizeInt) and capacitorLevelModifier:
|
||||
capNeed = capNeed*capacitorLevelModifier
|
||||
|
||||
resistance = self.ship.getModifiedItemAttr("energyWarfareResistance") or 1 if capNeed > 0 else 1
|
||||
self.__extraDrains.append((cycleTime, capNeed * resistance, clipSize))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user