Expose damage output composition to UI
This commit is contained in:
@@ -34,6 +34,7 @@ from eos.saveddata.drone import Drone
|
||||
from eos.saveddata.character import Character
|
||||
from eos.saveddata.citadel import Citadel
|
||||
from eos.saveddata.module import Module, State, Slot, Hardpoint
|
||||
from eos.utils.stats import DmgTypes
|
||||
from logbook import Logger
|
||||
pyfalog = Logger(__name__)
|
||||
|
||||
@@ -1529,27 +1530,27 @@ class Fit(object):
|
||||
self.__droneYield = droneYield
|
||||
|
||||
def calculateWeaponDmgStats(self, spoolType, spoolAmount):
|
||||
weaponVolley = 0
|
||||
weaponDps = 0
|
||||
weaponVolley = DmgTypes(0, 0, 0, 0)
|
||||
weaponDps = DmgTypes(0, 0, 0, 0)
|
||||
|
||||
for mod in self.modules:
|
||||
weaponVolley += mod.getVolley(spoolType=spoolType, spoolAmount=spoolAmount, targetResists=self.targetResists).total
|
||||
weaponDps += mod.getDps(spoolType=spoolType, spoolAmount=spoolAmount, targetResists=self.targetResists).total
|
||||
weaponVolley += mod.getVolley(spoolType=spoolType, spoolAmount=spoolAmount, targetResists=self.targetResists)
|
||||
weaponDps += mod.getDps(spoolType=spoolType, spoolAmount=spoolAmount, targetResists=self.targetResists)
|
||||
|
||||
self.__weaponVolleyMap[(spoolType, spoolAmount)] = weaponVolley
|
||||
self.__weaponDpsMap[(spoolType, spoolAmount)] = weaponDps
|
||||
|
||||
def calculateDroneDmgStats(self):
|
||||
droneVolley = 0
|
||||
droneDps = 0
|
||||
droneVolley = DmgTypes(0, 0, 0, 0)
|
||||
droneDps = DmgTypes(0, 0, 0, 0)
|
||||
|
||||
for drone in self.drones:
|
||||
droneVolley += drone.getVolley(targetResists=self.targetResists).total
|
||||
droneDps += drone.getDps(targetResists=self.targetResists).total
|
||||
droneVolley += drone.getVolley(targetResists=self.targetResists)
|
||||
droneDps += drone.getDps(targetResists=self.targetResists)
|
||||
|
||||
for fighter in self.fighters:
|
||||
droneVolley += fighter.getVolley(targetResists=self.targetResists).total
|
||||
droneDps += fighter.getDps(targetResists=self.targetResists).total
|
||||
droneVolley += fighter.getVolley(targetResists=self.targetResists)
|
||||
droneDps += fighter.getDps(targetResists=self.targetResists)
|
||||
|
||||
self.__droneDps = droneDps
|
||||
self.__droneVolley = droneVolley
|
||||
|
||||
@@ -26,7 +26,7 @@ class DmgTypes:
|
||||
self.thermal = thermal
|
||||
self.kinetic = kinetic
|
||||
self.explosive = explosive
|
||||
self.total = em + thermal + kinetic + explosive
|
||||
self._calcTotal()
|
||||
|
||||
# Iterator is needed to support tuple-style unpacking
|
||||
def __iter__(self):
|
||||
@@ -51,11 +51,20 @@ class DmgTypes:
|
||||
self.em, self.thermal, self.kinetic,
|
||||
self.explosive, self.total))
|
||||
|
||||
def __hash__(self):
|
||||
return hash((
|
||||
DmgTypes.__qualname__,
|
||||
self.em,
|
||||
self.thermal,
|
||||
self.kinetic,
|
||||
self.explosive,
|
||||
self.total))
|
||||
def _calcTotal(self):
|
||||
self.total = self.em + self.thermal + self.kinetic + self.explosive
|
||||
|
||||
def __add__(self, other):
|
||||
return type(self)(
|
||||
em=self.em + other.em,
|
||||
thermal=self.thermal + other.thermal,
|
||||
kinetic=self.kinetic + other.kinetic,
|
||||
explosive=self.explosive + other.explosive)
|
||||
|
||||
def __iadd__(self, other):
|
||||
self.em += other.em
|
||||
self.thermal += other.thermal
|
||||
self.kinetic += other.kinetic
|
||||
self.explosive += other.explosive
|
||||
self._calcTotal()
|
||||
return self
|
||||
|
||||
Reference in New Issue
Block a user