Implemented projected fighters, and various fighter bugfixes / improvements
This commit is contained in:
@@ -137,6 +137,12 @@ mapper(Fit, fits_table,
|
||||
cascade='all, delete, delete-orphan',
|
||||
single_parent=True,
|
||||
primaryjoin=and_(drones_table.c.fitID == fits_table.c.ID, drones_table.c.projected == True)),
|
||||
"_Fit__projectedFighters": relation(
|
||||
Fighter,
|
||||
collection_class=HandledProjectedDroneList,
|
||||
cascade='all, delete, delete-orphan',
|
||||
single_parent=True,
|
||||
primaryjoin=and_(fighters_table.c.fitID == fits_table.c.ID, fighters_table.c.projected == True)),
|
||||
"_Fit__implants": relation(
|
||||
Implant,
|
||||
collection_class=HandledImplantBoosterList,
|
||||
|
||||
@@ -13,6 +13,6 @@ type = "projected", "active"
|
||||
def handler(fit, module, context):
|
||||
if "projected" not in context: return
|
||||
# jam formula: 1 - (1- (jammer str/ship str))^(# of jam mods with same str))
|
||||
strModifier = 1 - module.getModifiedItemAttr("{}Srength{}".format(prefix, fit.scanType))/fit.scanStrength
|
||||
strModifier = 1 - module.getModifiedItemAttr("{}Strength{}".format(prefix, fit.scanType))/fit.scanStrength
|
||||
|
||||
fit.ecmProjectedStr *= strModifier
|
||||
|
||||
@@ -12,8 +12,7 @@ prefix = "fighterAbilityEnergyNeutralizer"
|
||||
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
|
||||
if "projected" in context:
|
||||
amount = container.getModifiedItemAttr("{}Amount".format(prefix))
|
||||
time = container.getModifiedItemAttr("{}Duration".format(prefix))
|
||||
fit.addDrain(time, amount * multiplier, 0)
|
||||
fit.addDrain(time, amount, 0)
|
||||
@@ -13,5 +13,4 @@ type = "active", "projected"
|
||||
|
||||
def handler(fit, src, context):
|
||||
if "projected" not in context: return
|
||||
multiplier = src.amountActive if hasattr(src, "amountActive") else 1
|
||||
fit.ship.boostItemAttr("maxVelocity", src.getModifiedItemAttr("{}SpeedPenalty") * multiplier)
|
||||
fit.ship.boostItemAttr("maxVelocity", src.getModifiedItemAttr("{}SpeedPenalty".format(prefix)))
|
||||
|
||||
@@ -239,6 +239,9 @@ class Fighter(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
|
||||
return True
|
||||
|
||||
def calculateModifiedAttributes(self, fit, runTime, forceProjected = False):
|
||||
if not self.active:
|
||||
return
|
||||
|
||||
if self.projected or forceProjected:
|
||||
context = "projected", "fighter"
|
||||
projected = True
|
||||
|
||||
@@ -68,6 +68,7 @@ class Fit(object):
|
||||
#self.__projectedFits = {}
|
||||
self.__projectedModules = HandledProjectedModList()
|
||||
self.__projectedDrones = HandledProjectedDroneList()
|
||||
self.__projectedFighters = HandledProjectedDroneList()
|
||||
self.__character = None
|
||||
self.__owner = None
|
||||
|
||||
@@ -231,6 +232,10 @@ class Fit(object):
|
||||
def projectedDrones(self):
|
||||
return self.__projectedDrones
|
||||
|
||||
@property
|
||||
def projectedFighters(self):
|
||||
return self.__projectedFighters
|
||||
|
||||
@property
|
||||
def weaponDPS(self):
|
||||
if self.__weaponDPS is None:
|
||||
@@ -386,6 +391,7 @@ class Fit(object):
|
||||
self.implants,
|
||||
self.projectedDrones,
|
||||
self.projectedModules,
|
||||
self.projectedFighters,
|
||||
(self.character, self.extraAttributes),
|
||||
)
|
||||
|
||||
@@ -508,7 +514,7 @@ class Fit(object):
|
||||
|
||||
# Items that are restricted. These items are only run on the local
|
||||
# fit. They are NOT projected onto the target fit. # See issue 354
|
||||
r = [(self.mode,), self.projectedDrones, self.projectedModules]
|
||||
r = [(self.mode,), self.projectedDrones, self.projectedFighters, self.projectedModules]
|
||||
|
||||
# chain unrestricted and restricted into one iterable
|
||||
c = chain.from_iterable(u+r)
|
||||
@@ -1049,7 +1055,7 @@ class Fit(object):
|
||||
copy.damagePattern = self.damagePattern
|
||||
copy.targetResists = self.targetResists
|
||||
|
||||
toCopy = ("modules", "drones", "fighters", "cargo", "implants", "boosters", "projectedModules", "projectedDrones")
|
||||
toCopy = ("modules", "drones", "fighters", "cargo", "implants", "boosters", "projectedModules", "projectedDrones", "projectedFighters")
|
||||
for name in toCopy:
|
||||
orig = getattr(self, name)
|
||||
c = getattr(copy, name)
|
||||
|
||||
@@ -29,7 +29,6 @@ from eos.saveddata.module import Module, State, Slot, Hardpoint, Rack
|
||||
from eos.saveddata.drone import Drone
|
||||
from eos.saveddata.fighterAbility import FighterAbility
|
||||
from eos.saveddata.fighter import Fighter
|
||||
|
||||
from eos.saveddata.cargo import Cargo
|
||||
from eos.saveddata.implant import Implant
|
||||
from eos.saveddata.implantSet import ImplantSet
|
||||
|
||||
Reference in New Issue
Block a user