Merged differences from master (more catching up)

This commit is contained in:
Ebag333
2016-06-15 19:40:45 -07:00
parent 03d1d8f5a4
commit 47828c38d2
6 changed files with 90 additions and 31 deletions

View File

@@ -6,5 +6,13 @@ type = "active"
def handler(fit, module, context):
for type in ("kinetic", "thermal", "explosive", "em"):
attr = "armor%sDamageResonance" % type.capitalize()
#Adjust RAH to match the current damage pattern
damagePattern = fit.damagePattern
attrDamagePattern = "%sAmount" % type
damagePatternModifier = getattr(damagePattern,attrDamagePattern)/float(sum((damagePattern.emAmount,damagePattern.thermalAmount,damagePattern.kineticAmount,damagePattern.explosiveAmount)))
modifiedResistModifier = (1-(((1-module.getModifiedItemAttr(attr))*4)*(damagePatternModifier)))
module.forceItemAttr(attr, modifiedResistModifier)
fit.ship.multiplyItemAttr(attr, module.getModifiedItemAttr(attr),
stackingPenalties=True, penaltyGroup="preMul")

View File

@@ -11,5 +11,8 @@ prefix = "fighterAbilityLaunchBomb"
type = "active"
# This flag is required for effects that use charges in order to properly calculate reload time
hasCharges = True
def handler(fit, src, context):
pass

View File

@@ -11,5 +11,8 @@ prefix = "fighterAbilityMissiles"
type = "active"
# This flag is required for effects that use charges in order to properly calculate reload time
hasCharges = True
def handler(fit, src, context):
pass

View File

@@ -26,6 +26,14 @@ class FighterAbility(object):
DAMAGE_TYPES = ("em", "kinetic", "explosive", "thermal")
DAMAGE_TYPES2 = ("EM", "Kin", "Exp", "Therm")
# We aren't able to get data on the charges that can be stored with fighters. So we hardcode that data here, keyed
# with the fighter squadron role
NUM_SHOTS_MAPPING = {
2: 8, # Light fighter / Attack
4: 6, # Heavy fighter / Heavy attack
5: 2, # Heavy fighter / Long range attack
}
def __init__(self, effect):
"""Initialize from the program"""
self.__effect = effect
@@ -71,12 +79,36 @@ class FighterAbility(object):
# is the ability applied per fighter (webs, returns False), or as a group (MWD, returned True)
return self.__effect.getattr('grouped')
@property
def hasCharges(self):
return self.__effect.getattr('hasCharges')
@property
def reloadTime(self):
return self.fighter.getModifiedItemAttr("fighterRefuelingTime") * self.numShots
@property
def numShots(self):
return self.NUM_SHOTS_MAPPING[self.fighter.getModifiedItemAttr("fighterSquadronRole")] or 0 if self.hasCharges else 0
@property
def cycleTime(self):
speed = self.fighter.getModifiedItemAttr("{}Duration".format(self.attrPrefix))
reload = self.reloadTime
if self.fighter.owner.factorReload:
numShots = self.numShots
# Speed here already takes into consideration reactivation time
speed = (speed * numShots + reload) / numShots if numShots > 0 else speed
return speed
def damageStats(self, targetResists=None):
if self.__dps is None:
self.__volley = 0
self.__dps = 0
if self.dealsDamage and self.active:
cycleTime = self.fighter.getModifiedItemAttr("{}Duration".format(self.attrPrefix))
cycleTime = self.cycleTime
if self.attrPrefix == "fighterAbilityLaunchBomb":
# bomb calcs