diff --git a/graphs/data/fitEwarStats/getter.py b/graphs/data/fitEwarStats/getter.py index ea850437b..b5cd89331 100644 --- a/graphs/data/fitEwarStats/getter.py +++ b/graphs/data/fitEwarStats/getter.py @@ -20,9 +20,8 @@ import math -from graphs.calc import calculateMultiplier, calculateRangeFactor +from graphs.calc import calculateMultiplier, calculateRangeFactor, checkLockRange, checkDroneControlRange from graphs.data.base import SmoothPointGetter -from service.settings import GraphSettings class Distance2NeutingStrGetter(SmoothPointGetter): @@ -38,34 +37,37 @@ class Distance2NeutingStrGetter(SmoothPointGetter): if effectName in mod.item.effects: neuts.append(( mod.getModifiedItemAttr('energyNeutralizerAmount') / self.__getDuration(mod) * resonance, - mod.maxRange or 0, mod.falloff or 0)) + mod.maxRange or 0, mod.falloff or 0, True, False)) if 'energyNosferatuFalloff' in mod.item.effects and mod.getModifiedItemAttr('nosOverride'): neuts.append(( mod.getModifiedItemAttr('powerTransferAmount') / self.__getDuration(mod) * resonance, - mod.maxRange or 0, mod.falloff or 0)) + mod.maxRange or 0, mod.falloff or 0, True, False)) if 'doomsdayAOENeut' in mod.item.effects: neuts.append(( mod.getModifiedItemAttr('energyNeutralizerAmount') / self.__getDuration(mod) * resonance, max(0, (mod.maxRange or 0) + mod.getModifiedItemAttr('doomsdayAOERange') - src.getRadius()), - mod.falloff or 0)) + mod.falloff or 0, False, False)) for drone in src.item.activeDronesIter(): if 'entityEnergyNeutralizerFalloff' in drone.item.effects: neuts.extend(drone.amountActive * (( drone.getModifiedItemAttr('energyNeutralizerAmount') / (drone.getModifiedItemAttr('energyNeutralizerDuration') / 1000) * resonance, - math.inf if GraphSettings.getInstance().get('ignoreDCR') else src.item.extraAttributes['droneControlRange'], - 0),)) + math.inf, 0, True, True),)) for fighter, ability in src.item.activeFighterAbilityIter(): if ability.effect.name == 'fighterAbilityEnergyNeutralizer': nps = fighter.getModifiedItemAttr('fighterAbilityEnergyNeutralizerAmount') / (ability.cycleTime / 1000) neuts.append(( nps * fighter.amount * resonance, - math.inf, 0)) + math.inf, 0, True, False)) return {'neuts': neuts} def _calculatePoint(self, x, miscParams, src, tgt, commonData): distance = x + inLockRange = checkLockRange(src=src, distance=distance) + inDroneRange = checkDroneControlRange(src=src, distance=distance) combinedStr = 0 - for strength, optimal, falloff in commonData['neuts']: + for strength, optimal, falloff, needsLock, needsDcr in commonData['neuts']: + if (needsLock and not inLockRange) or (needsDcr and not inDroneRange): + continue combinedStr += strength * calculateRangeFactor(srcOptimalRange=optimal, srcFalloffRange=falloff, distance=distance) return combinedStr @@ -86,29 +88,32 @@ class Distance2WebbingStrGetter(SmoothPointGetter): if effectName in mod.item.effects: webs.append(( mod.getModifiedItemAttr('speedFactor') * resonance, - mod.maxRange or 0, mod.falloff or 0, 'default')) + mod.maxRange or 0, mod.falloff or 0, 'default', True, False)) if 'doomsdayAOEWeb' in mod.item.effects: webs.append(( mod.getModifiedItemAttr('speedFactor') * resonance, max(0, (mod.maxRange or 0) + mod.getModifiedItemAttr('doomsdayAOERange') - src.getRadius()), - mod.falloff or 0, 'default')) + mod.falloff or 0, 'default', False, False)) for drone in src.item.activeDronesIter(): if 'remoteWebifierEntity' in drone.item.effects: webs.extend(drone.amountActive * (( drone.getModifiedItemAttr('speedFactor') * resonance, - math.inf if GraphSettings.getInstance().get('ignoreDCR') else src.item.extraAttributes['droneControlRange'], - 0, 'default'),)) + math.inf, 0, 'default', True, True),)) for fighter, ability in src.item.activeFighterAbilityIter(): if ability.effect.name == 'fighterAbilityStasisWebifier': webs.append(( fighter.getModifiedItemAttr('fighterAbilityStasisWebifierSpeedPenalty') * fighter.amount * resonance, - math.inf, 0, 'default')) + math.inf, 0, 'default', True, False)) return {'webs': webs} def _calculatePoint(self, x, miscParams, src, tgt, commonData): distance = x + inLockRange = checkLockRange(src=src, distance=distance) + inDroneRange = checkDroneControlRange(src=src, distance=distance) strMults = {} - for strength, optimal, falloff, stackingGroup in commonData['webs']: + for strength, optimal, falloff, stackingGroup, needsLock, needsDcr in commonData['webs']: + if (needsLock and not inLockRange) or (needsDcr and not inDroneRange): + continue strength *= calculateRangeFactor(srcOptimalRange=optimal, srcFalloffRange=falloff, distance=distance) strMults.setdefault(stackingGroup, []).append((1 + strength / 100, None)) strMult = calculateMultiplier(strMults) @@ -132,29 +137,32 @@ class Distance2EcmStrMaxGetter(SmoothPointGetter): if effectName in mod.item.effects: ecms.append(( max(mod.getModifiedItemAttr(a) for a in self.ECM_ATTRS_GENERAL) * resonance, - mod.maxRange or 0, mod.falloff or 0)) + mod.maxRange or 0, mod.falloff or 0, True, False)) if 'doomsdayAOEECM' in mod.item.effects: ecms.append(( max(mod.getModifiedItemAttr(a) for a in self.ECM_ATTRS_GENERAL) * resonance, max(0, (mod.maxRange or 0) + mod.getModifiedItemAttr('doomsdayAOERange') - src.getRadius()), - mod.falloff or 0)) + mod.falloff or 0, False, False)) for drone in src.item.activeDronesIter(): if 'entityECMFalloff' in drone.item.effects: ecms.extend(drone.amountActive * (( max(drone.getModifiedItemAttr(a) for a in self.ECM_ATTRS_GENERAL) * resonance, - math.inf if GraphSettings.getInstance().get('ignoreDCR') else src.item.extraAttributes['droneControlRange'], - 0),)) + math.inf, 0, True, True),)) for fighter, ability in src.item.activeFighterAbilityIter(): if ability.effect.name == 'fighterAbilityECM': ecms.append(( max(fighter.getModifiedItemAttr(a) for a in self.ECM_ATTRS_FIGHTERS) * fighter.amount * resonance, - math.inf, 0)) + math.inf, 0, True, False)) return {'ecms': ecms} def _calculatePoint(self, x, miscParams, src, tgt, commonData): distance = x + inLockRange = checkLockRange(src=src, distance=distance) + inDroneRange = checkDroneControlRange(src=src, distance=distance) combinedStr = 0 - for strength, optimal, falloff in commonData['ecms']: + for strength, optimal, falloff, needsLock, needsDcr in commonData['ecms']: + if (needsLock and not inLockRange) or (needsDcr and not inDroneRange): + continue combinedStr += strength * calculateRangeFactor(srcOptimalRange=optimal, srcFalloffRange=falloff, distance=distance) return combinedStr @@ -172,24 +180,27 @@ class Distance2DampStrLockRangeGetter(SmoothPointGetter): if effectName in mod.item.effects: damps.append(( mod.getModifiedItemAttr('maxTargetRangeBonus') * resonance, - mod.maxRange or 0, mod.falloff or 0, 'default')) + mod.maxRange or 0, mod.falloff or 0, 'default', True, False)) if 'doomsdayAOEDamp' in mod.item.effects: damps.append(( mod.getModifiedItemAttr('maxTargetRangeBonus') * resonance, max(0, (mod.maxRange or 0) + mod.getModifiedItemAttr('doomsdayAOERange') - src.getRadius()), - mod.falloff or 0, 'default')) + mod.falloff or 0, 'default', False, False)) for drone in src.item.activeDronesIter(): if 'remoteSensorDampEntity' in drone.item.effects: damps.extend(drone.amountActive * (( drone.getModifiedItemAttr('maxTargetRangeBonus') * resonance, - math.inf if GraphSettings.getInstance().get('ignoreDCR') else src.item.extraAttributes['droneControlRange'], - 0, 'default'),)) + math.inf, 0, 'default', True, True),)) return {'damps': damps} def _calculatePoint(self, x, miscParams, src, tgt, commonData): distance = x + inLockRange = checkLockRange(src=src, distance=distance) + inDroneRange = checkDroneControlRange(src=src, distance=distance) strMults = {} - for strength, optimal, falloff, stackingGroup in commonData['damps']: + for strength, optimal, falloff, stackingGroup, needsLock, needsDcr in commonData['damps']: + if (needsLock and not inLockRange) or (needsDcr and not inDroneRange): + continue strength *= calculateRangeFactor(srcOptimalRange=optimal, srcFalloffRange=falloff, distance=distance) strMults.setdefault(stackingGroup, []).append((1 + strength / 100, None)) strMult = calculateMultiplier(strMults) @@ -210,24 +221,27 @@ class Distance2TdStrOptimalGetter(SmoothPointGetter): if effectName in mod.item.effects: tds.append(( mod.getModifiedItemAttr('maxRangeBonus') * resonance, - mod.maxRange or 0, mod.falloff or 0, 'default')) + mod.maxRange or 0, mod.falloff or 0, 'default', True, False)) if 'doomsdayAOETrack' in mod.item.effects: tds.append(( mod.getModifiedItemAttr('maxRangeBonus') * resonance, max(0, (mod.maxRange or 0) + mod.getModifiedItemAttr('doomsdayAOERange') - src.getRadius()), - mod.falloff or 0, 'default')) + mod.falloff or 0, 'default', False, False)) for drone in src.item.activeDronesIter(): if 'npcEntityWeaponDisruptor' in drone.item.effects: tds.extend(drone.amountActive * (( drone.getModifiedItemAttr('maxRangeBonus') * resonance, - math.inf if GraphSettings.getInstance().get('ignoreDCR') else src.item.extraAttributes['droneControlRange'], - 0, 'default'),)) + math.inf, 0, 'default', True, True),)) return {'tds': tds} def _calculatePoint(self, x, miscParams, src, tgt, commonData): distance = x + inLockRange = checkLockRange(src=src, distance=distance) + inDroneRange = checkDroneControlRange(src=src, distance=distance) strMults = {} - for strength, optimal, falloff, stackingGroup in commonData['tds']: + for strength, optimal, falloff, stackingGroup, needsLock, needsDcr in commonData['tds']: + if (needsLock and not inLockRange) or (needsDcr and not inDroneRange): + continue strength *= calculateRangeFactor(srcOptimalRange=optimal, srcFalloffRange=falloff, distance=distance) strMults.setdefault(stackingGroup, []).append((1 + strength / 100, None)) strMult = calculateMultiplier(strMults) @@ -249,20 +263,24 @@ class Distance2GdStrRangeGetter(SmoothPointGetter): gds.append(( mod.getModifiedItemAttr('missileVelocityBonus') * resonance, mod.getModifiedItemAttr('explosionDelayBonus') * resonance, - mod.maxRange or 0, mod.falloff or 0, 'default')) + mod.maxRange or 0, mod.falloff or 0, 'default', True, False)) if 'doomsdayAOETrack' in mod.item.effects: gds.append(( mod.getModifiedItemAttr('missileVelocityBonus') * resonance, mod.getModifiedItemAttr('explosionDelayBonus') * resonance, max(0, (mod.maxRange or 0) + mod.getModifiedItemAttr('doomsdayAOERange') - src.getRadius()), - mod.falloff or 0, 'default')) + mod.falloff or 0, 'default', False, False)) return {'gds': gds} def _calculatePoint(self, x, miscParams, src, tgt, commonData): distance = x + inLockRange = checkLockRange(src=src, distance=distance) + inDroneRange = checkDroneControlRange(src=src, distance=distance) velocityStrMults = {} timeStrMults = {} - for velocityStr, timeStr, optimal, falloff, stackingGroup in commonData['gds']: + for velocityStr, timeStr, optimal, falloff, stackingGroup, needsLock, needsDcr in commonData['gds']: + if (needsLock and not inLockRange) or (needsDcr and not inDroneRange): + continue rangeFactor = calculateRangeFactor(srcOptimalRange=optimal, srcFalloffRange=falloff, distance=distance) velocityStr *= rangeFactor timeStr *= rangeFactor @@ -287,24 +305,27 @@ class Distance2TpStrGetter(SmoothPointGetter): if effectName in mod.item.effects: tps.append(( mod.getModifiedItemAttr('signatureRadiusBonus') * resonance, - mod.maxRange or 0, mod.falloff or 0, 'default')) + mod.maxRange or 0, mod.falloff or 0, 'default', True, False)) if 'doomsdayAOEPaint' in mod.item.effects: tps.append(( mod.getModifiedItemAttr('signatureRadiusBonus') * resonance, max(0, (mod.maxRange or 0) + mod.getModifiedItemAttr('doomsdayAOERange') - src.getRadius()), - mod.falloff or 0, 'default')) + mod.falloff or 0, 'default', False, False)) for drone in src.item.activeDronesIter(): if 'remoteTargetPaintEntity' in drone.item.effects: tps.extend(drone.amountActive * (( drone.getModifiedItemAttr('signatureRadiusBonus') * resonance, - math.inf if GraphSettings.getInstance().get('ignoreDCR') else src.item.extraAttributes['droneControlRange'], - 0, 'default'),)) + math.inf, 0, 'default', True, True),)) return {'tps': tps} def _calculatePoint(self, x, miscParams, src, tgt, commonData): distance = x + inLockRange = checkLockRange(src=src, distance=distance) + inDroneRange = checkDroneControlRange(src=src, distance=distance) strMults = {} - for strength, optimal, falloff, stackingGroup in commonData['tps']: + for strength, optimal, falloff, stackingGroup, needsLock, needsDcr in commonData['tps']: + if (needsLock and not inLockRange) or (needsDcr and not inDroneRange): + continue strength *= calculateRangeFactor(srcOptimalRange=optimal, srcFalloffRange=falloff, distance=distance) strMults.setdefault(stackingGroup, []).append((1 + strength / 100, None)) strMult = calculateMultiplier(strMults)