Skip to content

Commit

Permalink
Merge pull request pyfa-org#684 from Ebag333/Neuts
Browse files Browse the repository at this point in the history
Applied size reduction effect to neut/nos
  • Loading branch information
blitzmann authored Jul 24, 2016
2 parents b9b72eb + 071dfaf commit 7a715fc
Show file tree
Hide file tree
Showing 9 changed files with 62 additions and 47 deletions.
13 changes: 6 additions & 7 deletions eos/effects/energydestabilizationnew.py
Original file line number Diff line number Diff line change
@@ -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)
14 changes: 8 additions & 6 deletions eos/effects/energyneutralizerentity.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@
# Drones from group: Energy Neutralizer Drone (3 of 3)
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")):
amount = container.getModifiedItemAttr("energyNeutralizerAmount")
time = container.getModifiedItemAttr("duration")
fit.addDrain(time, amount, 0)


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")

fit.addDrain(src, time, amount, 0)
14 changes: 8 additions & 6 deletions eos/effects/energyneutralizerfalloff.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@
# Modules from group: Energy Neutralizer (51 of 51)
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")):
amount = container.getModifiedItemAttr("energyNeutralizerAmount")
time = container.getModifiedItemAttr("duration")
fit.addDrain(time, amount, 0)


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")

fit.addDrain(src, time, amount, 0)
13 changes: 8 additions & 5 deletions eos/effects/energynosferatufalloff.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@
# Modules from group: Energy Nosferatu (51 of 51)
type = "active", "projected"
runTime = "late"
def handler(fit, module, context):
amount = module.getModifiedItemAttr("powerTransferAmount")
time = module.getModifiedItemAttr("duration")


def handler(fit, src, context):
amount = src.getModifiedItemAttr("powerTransferAmount")
time = src.getModifiedItemAttr("duration")

if "projected" in context:
fit.addDrain(time, amount, 0)
fit.addDrain(src, time, amount, 0)
elif "module" in context:
module.itemModifiedAttributes.force("capacitorNeed", -amount)
src.itemModifiedAttributes.force("capacitorNeed", -amount)
8 changes: 4 additions & 4 deletions eos/effects/energytransfer.py
Original file line number Diff line number Diff line change
@@ -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)
14 changes: 8 additions & 6 deletions eos/effects/entityenergyneutralizerfalloff.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@
# Drones from group: Energy Neutralizer Drone (3 of 3)
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")):
amount = container.getModifiedItemAttr("energyNeutralizerAmount")
time = container.getModifiedItemAttr("energyNeutralizerDuration")
fit.addDrain(time, amount, 0)


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")

fit.addDrain(src, time, amount, 0)
14 changes: 6 additions & 8 deletions eos/effects/fighterabilityenergyneutralizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,15 @@
Since fighter abilities do not have any sort of item entity in the EVE database, we must derive the abilities from the
effects, and thus this effect file contains some custom information useful only to fighters.
"""
from eos.types import State

# User-friendly name for the ability
displayName = "Energy Neutralizer"

prefix = "fighterAbilityEnergyNeutralizer"

type = "active", "projected"

def handler(fit, container, context):

def handler(fit, src, context):
if "projected" in context:
amount = container.getModifiedItemAttr("{}Amount".format(prefix))
time = container.getModifiedItemAttr("{}Duration".format(prefix))
fit.addDrain(time, amount, 0)
amount = src.getModifiedItemAttr("{}Amount".format(prefix))
time = src.getModifiedItemAttr("{}Duration".format(prefix))

fit.addDrain(src, time, amount, 0)
8 changes: 4 additions & 4 deletions eos/effects/remoteenergytransferfalloff.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
11 changes: 10 additions & 1 deletion eos/saveddata/fit.py
Original file line number Diff line number Diff line change
Expand Up @@ -873,8 +873,17 @@ def calculateShieldRecharge(self, percent = PEAK_RECHARGE):
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")

#Signature reduction, uses the bomb formula as per CCP Larrikin
if energyNeutralizerSignatureResolution:
capNeed = capNeed*min(1, signatureRadius/energyNeutralizerSignatureResolution)

resistance = self.ship.getModifiedItemAttr("energyWarfareResistance") or 1 if capNeed > 0 else 1
self.__extraDrains.append((cycleTime, capNeed * resistance, clipSize))

Expand Down

0 comments on commit 7a715fc

Please sign in to comment.