Merge pull request #756 from MrNukealizer/FighterFixes

Fixed a few fighter/carrier bugs:
This commit is contained in:
Ryan Holmes
2016-10-08 23:07:01 -04:00
committed by GitHub
7 changed files with 76 additions and 15 deletions

View File

@@ -0,0 +1,24 @@
# Not used by any item
"""
Since fighter abilities do not have any sort of item entity in the EVE database, we must derive the abilities from the
effects, and thus this effect file contains some custom information useful only to fighters.
"""
# User-friendly name for the ability
displayName = "Evasive Maneuvers"
prefix = "fighterAbilityEvasiveManeuvers"
# Is ability applied to the fighter squad as a whole, or per fighter?
grouped = True
type = "active"
runTime = "late"
def handler(fit, module, context):
module.boostItemAttr("maxVelocity", module.getModifiedItemAttr("fighterAbilityEvasiveManeuversSpeedBonus"))
module.boostItemAttr("signatureRadius", module.getModifiedItemAttr("fighterAbilityEvasiveManeuversSignatureRadiusBonus"), stackingPenalties = True)
# These may not have stacking penalties, but there's nothing else that affects the attributes yet to check.
module.multiplyItemAttr("shieldEmDamageResonance", module.getModifiedItemAttr("fighterAbilityEvasiveManeuversEmResonance"), stackingPenalties = True)
module.multiplyItemAttr("shieldThermalDamageResonance", module.getModifiedItemAttr("fighterAbilityEvasiveManeuversThermResonance"), stackingPenalties = True)
module.multiplyItemAttr("shieldKineticDamageResonance", module.getModifiedItemAttr("fighterAbilityEvasiveManeuversKinResonance"), stackingPenalties = True)
module.multiplyItemAttr("shieldExplosiveDamageResonance", module.getModifiedItemAttr("fighterAbilityEvasiveManeuversExpResonance"), stackingPenalties = True)

View File

@@ -4,13 +4,13 @@
# Module: Networked Sensor Array
type = "active"
def handler(fit, src, context):
fit.ship.multiplyItemAttr("maxTargetRange", src.getModifiedItemAttr("maxTargetRangeMultiplier"), stackingPenalties=True, penaltyGroup="postMul")
fit.ship.boostItemAttr("scanResolution", src.getModifiedItemAttr("scanResolutionBonus"), stackingPenalties=True)
for scanType in ('Magnetometric', 'Ladar', 'Gravimetric', 'Radar'):
fit.ship.boostItemAttr("scan{}Strength".format(scanType),
src.getModifiedItemAttr("scan{}StrengthPercent".format(scanType)),
stackingPenalties=True)
attr = "scan{}Strength".format(scanType)
bonus = src.getModifiedItemAttr("scan{}StrengthPercent".format(scanType))
fit.ship.boostItemAttr(attr, bonus, stackingPenalties=True)
fit.fighters.filteredItemBoost(lambda mod: mod.item.requiresSkill("Fighters"), attr, bonus, stackingPenalties=True)
# EW cap need increase
groups = [

View File

@@ -4,6 +4,9 @@
# Modules from group: Drone Tracking Modules (10 of 10)
type = "overheat"
def handler(fit, module, context):
module.boostItemAttr("maxRangeBonus", module.getModifiedItemAttr("overloadTrackingModuleStrengthBonus"))
module.boostItemAttr("falloffBonus", module.getModifiedItemAttr("overloadTrackingModuleStrengthBonus"))
module.boostItemAttr("trackingSpeedBonus", module.getModifiedItemAttr("overloadTrackingModuleStrengthBonus"))
overloadBonus = module.getModifiedItemAttr("overloadTrackingModuleStrengthBonus")
module.boostItemAttr("maxRangeBonus", overloadBonus)
module.boostItemAttr("falloffBonus", overloadBonus)
module.boostItemAttr("trackingSpeedBonus", overloadBonus)
module.boostItemAttr("aoeCloudSizeBonus", overloadBonus)
module.boostItemAttr("aoeVelocityBonus", overloadBonus)

View File

@@ -164,6 +164,26 @@ class Fighter(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
dps, volley = ability.damageStats(targetResists)
self.__dps += dps
self.__volley += volley
# For forward compatability this assumes a fighter can have more than 2 damaging abilities and/or multiple that use charges.
if self.owner.factorReload:
activeTimes = []
reloadTimes = []
constantDps = 0
for ability in self.abilities:
if not ability.active:
continue
if ability.numShots == 0:
dps, volley = ability.damageStats(targetResists)
constantDps += dps
continue
activeTimes.append(ability.numShots * ability.cycleTime)
reloadTimes.append(ability.reloadTime)
if(len(activeTimes) > 0):
shortestActive = sorted(activeTimes)[0]
longestReload = sorted(reloadTimes, reverse=True)[0]
self.__dps = max(constantDps, self.__dps * shortestActive / (shortestActive + longestReload))
return self.__dps, self.__volley

View File

@@ -29,10 +29,19 @@ class FighterAbility(object):
# 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
1: 0, # Superiority fighter / Attack
2: 12, # Light fighter / Attack
4: 6, # Heavy fighter / Heavy attack
5: 2, # Heavy fighter / Long range attack
5: 3, # Heavy fighter / Long range attack
}
# Same as above
REARM_TIME_MAPPING = {
1: 0, # Superiority fighter / Attack
2: 4000, # Light fighter / Attack
4: 6000, # Heavy fighter / Heavy attack
5: 20000, # Heavy fighter / Long range attack
}
def __init__(self, effect):
"""Initialize from the program"""
@@ -85,7 +94,7 @@ class FighterAbility(object):
@property
def reloadTime(self):
return self.fighter.getModifiedItemAttr("fighterRefuelingTime") * self.numShots
return self.fighter.getModifiedItemAttr("fighterRefuelingTime") + (self.REARM_TIME_MAPPING[self.fighter.getModifiedItemAttr("fighterSquadronRole")] or 0 if self.hasCharges else 0) * self.numShots
@property
def numShots(self):
@@ -96,10 +105,10 @@ class FighterAbility(object):
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
#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

View File

@@ -17,7 +17,7 @@
# along with eos. If not, see <http://www.gnu.org/licenses/>.
#===============================================================================
from eos.modifiedAttributeDict import ModifiedAttributeDict, ItemAttrShortcut
from eos.modifiedAttributeDict import ModifiedAttributeDict, ItemAttrShortcut, cappingAttrKeyCache
from eos.effectHandlerHelpers import HandledItem
from eos.saveddata.mode import Mode
import eos.db
@@ -50,6 +50,9 @@ class Ship(ItemAttrShortcut, HandledItem):
self.__itemModifiedAttributes.original = dict(self.item.attributes)
self.__itemModifiedAttributes.original.update(self.EXTRA_ATTRIBUTES)
self.__itemModifiedAttributes.overrides = self.item.overrides
if "maximumRangeCap" in self.__itemModifiedAttributes.original:
cappingAttrKeyCache["maxTargetRange"] = "maximumRangeCap"
# there are occasions when we need to get to the parent fit of the ship, such as when we need the character
# skills for ship-role gang boosts (Titans)

View File

@@ -373,6 +373,8 @@ class Character(object):
subThing = getattr(thing, attr, None)
subReqs = {}
if subThing is not None:
if isinstance(thing, eos.types.Fighter) and attr == "charge":
continue
self._checkRequirements(fit, fit.character, subThing, subReqs)
if subReqs:
reqs[subThing] = subReqs