TargetResists: drones work. Also cleaned up redundancy in module.damageStats()
This commit is contained in:
@@ -22,7 +22,7 @@ from eos.effectHandlerHelpers import HandledItem, HandledCharge
|
|||||||
from sqlalchemy.orm import validates, reconstructor
|
from sqlalchemy.orm import validates, reconstructor
|
||||||
|
|
||||||
class Drone(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
|
class Drone(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
|
||||||
DAMAGE_ATTRIBUTES = ("emDamage", "kineticDamage", "explosiveDamage", "thermalDamage")
|
DAMAGE_TYPES = ("em", "kinetic", "explosive", "thermal")
|
||||||
MINING_ATTRIBUTES = ("miningAmount",)
|
MINING_ATTRIBUTES = ("miningAmount",)
|
||||||
|
|
||||||
def __init__(self, item):
|
def __init__(self, item):
|
||||||
@@ -111,6 +111,9 @@ class Drone(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def dps(self):
|
def dps(self):
|
||||||
|
return self.damageStats()
|
||||||
|
|
||||||
|
def damageStats(self, targetResists = None):
|
||||||
if self.__dps == None:
|
if self.__dps == None:
|
||||||
if self.dealsDamage is True and self.amountActive > 0:
|
if self.dealsDamage is True and self.amountActive > 0:
|
||||||
if self.hasAmmo:
|
if self.hasAmmo:
|
||||||
@@ -121,7 +124,9 @@ class Drone(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
|
|||||||
getter = self.getModifiedItemAttr
|
getter = self.getModifiedItemAttr
|
||||||
|
|
||||||
cycleTime = self.getModifiedItemAttr(attr)
|
cycleTime = self.getModifiedItemAttr(attr)
|
||||||
volley = sum(map(lambda d: getter(d), self.DAMAGE_ATTRIBUTES)) * self.amountActive
|
|
||||||
|
volley = sum(map(lambda d: (getter("%sDamage"%d) or 0) * (1-getattr(targetResists, "%sAmount"%d, 0)), self.DAMAGE_TYPES))
|
||||||
|
volley *= self.amountActive
|
||||||
volley *= self.getModifiedItemAttr("damageMultiplier") or 1
|
volley *= self.getModifiedItemAttr("damageMultiplier") or 1
|
||||||
self.__dps = volley / (cycleTime / 1000.0)
|
self.__dps = volley / (cycleTime / 1000.0)
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -827,7 +827,7 @@ class Fit(object):
|
|||||||
weaponVolley += volley
|
weaponVolley += volley
|
||||||
|
|
||||||
for drone in self.drones:
|
for drone in self.drones:
|
||||||
droneDPS += drone.dps
|
droneDPS += drone.damageStats(self.targetResists)
|
||||||
|
|
||||||
self.__weaponDPS = weaponDPS
|
self.__weaponDPS = weaponDPS
|
||||||
self.__weaponVolley = weaponVolley
|
self.__weaponVolley = weaponVolley
|
||||||
|
|||||||
@@ -310,28 +310,21 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
|
|||||||
|
|
||||||
def damageStats(self, targetResists):
|
def damageStats(self, targetResists):
|
||||||
if self.__dps == None:
|
if self.__dps == None:
|
||||||
if self.isEmpty:
|
self.__dps = 0
|
||||||
self.__dps = 0
|
self.__volley = 0
|
||||||
self.__volley = 0
|
|
||||||
else:
|
|
||||||
if self.state >= State.ACTIVE:
|
|
||||||
if self.charge:
|
|
||||||
func = self.getModifiedChargeAttr
|
|
||||||
else:
|
|
||||||
func = self.getModifiedItemAttr
|
|
||||||
|
|
||||||
volley = sum(map(lambda attr: (func("%sDamage"%attr) or 0) * (1-getattr(targetResists, "%sAmount"%attr, 0)), self.DAMAGE_TYPES))
|
if not self.isEmpty and self.state >= State.ACTIVE:
|
||||||
volley *= self.getModifiedItemAttr("damageMultiplier") or 1
|
if self.charge:
|
||||||
if volley:
|
func = self.getModifiedChargeAttr
|
||||||
cycleTime = self.cycleTime
|
|
||||||
self.__volley = volley
|
|
||||||
self.__dps = volley / (cycleTime / 1000.0)
|
|
||||||
else:
|
|
||||||
self.__volley = 0
|
|
||||||
self.__dps = 0
|
|
||||||
else:
|
else:
|
||||||
self.__volley = 0
|
func = self.getModifiedItemAttr
|
||||||
self.__dps = 0
|
|
||||||
|
volley = sum(map(lambda attr: (func("%sDamage"%attr) or 0) * (1-getattr(targetResists, "%sAmount"%attr, 0)), self.DAMAGE_TYPES))
|
||||||
|
volley *= self.getModifiedItemAttr("damageMultiplier") or 1
|
||||||
|
if volley:
|
||||||
|
cycleTime = self.cycleTime
|
||||||
|
self.__volley = volley
|
||||||
|
self.__dps = volley / (cycleTime / 1000.0)
|
||||||
|
|
||||||
return self.__dps, self.__volley
|
return self.__dps, self.__volley
|
||||||
|
|
||||||
@@ -355,11 +348,11 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def dps(self):
|
def dps(self):
|
||||||
return self.damageStats[0]
|
return self.damageStats(None)[0]
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def volley(self):
|
def volley(self):
|
||||||
return self.damageStats[1]
|
return self.damageStats(None)[1]
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def reloadTime(self):
|
def reloadTime(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user