Merge pull request #1134 from blitzmann/bug/drones

Drone bugs
This commit is contained in:
Ryan Holmes
2017-04-19 21:43:39 -04:00
committed by GitHub
3 changed files with 45 additions and 18 deletions

View File

@@ -100,6 +100,10 @@ class Drone(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
def charge(self):
return self.__charge
@property
def cycleTime(self):
return max(self.getModifiedItemAttr("duration"), 0)
@property
def dealsDamage(self):
for attr in ("emDamage", "kineticDamage", "explosiveDamage", "thermalDamage"):

View File

@@ -29,6 +29,7 @@ from eos import capSim
from eos.effectHandlerHelpers import HandledModuleList, HandledDroneCargoList, HandledImplantBoosterList, HandledProjectedDroneList, HandledProjectedModList
from eos.enum import Enum
from eos.saveddata.ship import Ship
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
@@ -1186,24 +1187,28 @@ class Fit(object):
if force_recalc is False:
return self.__remoteReps
# We are rerunning the recalcs. Explicitly set to 0 to make sure we don't duplicate anything and correctly set all values to 0.
# We are rerunning the recalcs. Explicitly set to 0 to make sure we don't duplicate anything and correctly
# set all values to 0.
for remote_type in self.__remoteReps:
self.__remoteReps[remote_type] = 0
for module in self.modules:
# Skip empty and non-Active modules
if module.isEmpty or module.state < State.ACTIVE:
for stuff in chain(self.modules, self.drones):
remote_type = None
modifier = stuff.getModifiedItemAttr("chargedArmorDamageMultiplier", 1)
if isinstance(stuff, Module) and (stuff.isEmpty or stuff.state < State.ACTIVE):
continue
elif isinstance(stuff, Drone):
# drones don't have fueled charges, so siomply override modifier with the amount of drones active
modifier = stuff.amountActive
# Covert cycleTime to seconds
duration = module.cycleTime / 1000
duration = stuff.cycleTime / 1000
# Skip modules with no duration.
if not duration:
continue
fueledMultiplier = module.getModifiedItemAttr("chargedArmorDamageMultiplier", 1)
remote_module_groups = {
"Remote Armor Repairer" : "Armor",
"Ancillary Remote Armor Repairer": "Armor",
@@ -1213,26 +1218,38 @@ class Fit(object):
"Remote Capacitor Transmitter" : "Capacitor",
}
module_group = module.item.group.name
module_group = stuff.item.group.name
if module_group in remote_module_groups:
remote_type = remote_module_groups[module_group]
else:
elif not isinstance(stuff, Drone):
# Module isn't in our list of remote rep modules, bail
continue
if remote_type == "Hull":
hp = module.getModifiedItemAttr("structureDamageAmount", 0)
hp = stuff.getModifiedItemAttr("structureDamageAmount", 0)
elif remote_type == "Armor":
hp = module.getModifiedItemAttr("armorDamageAmount", 0)
hp = stuff.getModifiedItemAttr("armorDamageAmount", 0)
elif remote_type == "Shield":
hp = module.getModifiedItemAttr("shieldBonus", 0)
hp = stuff.getModifiedItemAttr("shieldBonus", 0)
elif remote_type == "Capacitor":
hp = module.getModifiedItemAttr("powerTransferAmount", 0)
hp = stuff.getModifiedItemAttr("powerTransferAmount", 0)
else:
hp = 0
self.__remoteReps[remote_type] += (hp * fueledMultiplier) / duration
droneShield = stuff.getModifiedItemAttr("shieldBonus", 0)
droneArmor = stuff.getModifiedItemAttr("armorDamageAmount", 0)
droneHull = stuff.getModifiedItemAttr("structureDamageAmount", 0)
if droneShield:
remote_type = "Shield"
hp = droneShield
elif droneArmor:
remote_type = "Armor"
hp = droneArmor
elif droneHull:
remote_type = "Hull"
hp = droneHull
else:
hp = 0
self.__remoteReps[remote_type] += (hp * modifier) / duration
return self.__remoteReps

View File

@@ -27,6 +27,7 @@ from gui.viewColumn import ViewColumn
from gui.bitmapLoader import BitmapLoader
from gui.utils.numberFormatter import formatAmount
from gui.utils.listFormatter import formatList
from eos.saveddata.drone import Drone
class Miscellanea(ViewColumn):
@@ -417,7 +418,11 @@ class Miscellanea(ViewColumn):
cycleTime = stuff.getModifiedItemAttr("duration")
if not repAmount or not cycleTime:
return "", None
repPerSec = float(repAmount) * 1000 / cycleTime
repPerSecPerDrone = repPerSec = float(repAmount) * 1000 / cycleTime
if isinstance(stuff, Drone):
repPerSec *= stuff.amount
text = "{0}/s".format(formatAmount(repPerSec, 3, 0, 3))
ttEntries = []
if hullAmount is not None and repAmount == hullAmount:
@@ -426,7 +431,8 @@ class Miscellanea(ViewColumn):
ttEntries.append("armor")
if shieldAmount is not None and repAmount == shieldAmount:
ttEntries.append("shield")
tooltip = "{0} repaired per second".format(formatList(ttEntries)).capitalize()
tooltip = "{0} HP repaired per second\n{1} HP/s per drone".format(formatList(ttEntries).capitalize(), repPerSecPerDrone)
return text, tooltip
elif itemGroup == "Energy Neutralizer Drone":
neutAmount = stuff.getModifiedItemAttr("energyNeutralizerAmount")