Add GD graph
This commit is contained in:
@@ -138,3 +138,42 @@ class Distance2TdStrOptimalGetter(SmoothPointGetter):
|
||||
strMult = calculateMultiplier(strMults)
|
||||
strength = (1 - strMult) * 100
|
||||
return strength
|
||||
|
||||
|
||||
class Distance2GdStrRangeGetter(SmoothPointGetter):
|
||||
|
||||
_baseResolution = 50
|
||||
_extraDepth = 2
|
||||
|
||||
def _getCommonData(self, miscParams, src, tgt):
|
||||
resonance = 1 - (miscParams['resist'] or 0)
|
||||
gds = []
|
||||
for mod in src.item.activeModulesIter():
|
||||
for effectName in ('shipModuleGuidanceDisruptor', 'structureModuleEffectWeaponDisruption'):
|
||||
if effectName in mod.item.effects:
|
||||
gds.append((
|
||||
mod.getModifiedItemAttr('missileVelocityBonus') * resonance,
|
||||
mod.getModifiedItemAttr('explosionDelayBonus') * resonance,
|
||||
mod.maxRange or 0, mod.falloff or 0, 'default'))
|
||||
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'))
|
||||
return {'gds': gds}
|
||||
|
||||
def _calculatePoint(self, x, miscParams, src, tgt, commonData):
|
||||
distance = x
|
||||
velocityStrMults = {}
|
||||
timeStrMults = {}
|
||||
for velocityStr, timeStr, optimal, falloff, stackingGroup in commonData['gds']:
|
||||
rangeFactor = calculateRangeFactor(srcOptimalRange=optimal, srcFalloffRange=falloff, distance=distance)
|
||||
velocityStr *= rangeFactor
|
||||
timeStr *= rangeFactor
|
||||
velocityStrMults.setdefault(stackingGroup, []).append((1 + velocityStr / 100, None))
|
||||
timeStrMults.setdefault(stackingGroup, []).append((1 + timeStr / 100, None))
|
||||
velocityStrMult = calculateMultiplier(velocityStrMults)
|
||||
timeStrMult = calculateMultiplier(timeStrMults)
|
||||
strength = (1 - velocityStrMult * timeStrMult) * 100
|
||||
return strength
|
||||
|
||||
@@ -19,7 +19,9 @@
|
||||
|
||||
|
||||
from graphs.data.base import FitGraph, Input, XDef, YDef
|
||||
from .getter import Distance2WebbingStrGetter, Distance2DampStrLockRangeGetter, Distance2TdStrOptimalGetter
|
||||
from .getter import (
|
||||
Distance2WebbingStrGetter, Distance2DampStrLockRangeGetter, Distance2TdStrOptimalGetter,
|
||||
Distance2GdStrRangeGetter)
|
||||
|
||||
|
||||
class FitEwarStatsGraph(FitGraph):
|
||||
@@ -31,7 +33,8 @@ class FitEwarStatsGraph(FitGraph):
|
||||
yDefs = [
|
||||
YDef(handle='webStr', unit='%', label='Speed reduction', selectorLabel='Webs: speed reduction'),
|
||||
YDef(handle='dampStrLockRange', unit='%', label='Lock range reduction', selectorLabel='Damps: lock range reduction'),
|
||||
YDef(handle='tdStrOptimal', unit='%', label='Optimal range reduction', selectorLabel='TDs: optimal range reduction')]
|
||||
YDef(handle='tdStrOptimal', unit='%', label='Turret optimal range reduction', selectorLabel='TDs: turret optimal range reduction'),
|
||||
YDef(handle='gdStrRange', unit='%', label='Missile flight range reduction', selectorLabel='GDs: missile flight range reduction')]
|
||||
inputs = [
|
||||
Input(handle='distance', unit='km', label='Distance', iconID=1391, defaultValue=None, defaultRange=(0, 100)),
|
||||
Input(handle='resist', unit='%', label='Target resistance', iconID=1393, defaultValue=0, defaultRange=(0, 100))]
|
||||
@@ -44,5 +47,6 @@ class FitEwarStatsGraph(FitGraph):
|
||||
_getters = {
|
||||
('distance', 'webStr'): Distance2WebbingStrGetter,
|
||||
('distance', 'dampStrLockRange'): Distance2DampStrLockRangeGetter,
|
||||
('distance', 'tdStrOptimal'): Distance2TdStrOptimalGetter}
|
||||
('distance', 'tdStrOptimal'): Distance2TdStrOptimalGetter,
|
||||
('distance', 'gdStrRange'): Distance2GdStrRangeGetter}
|
||||
_denormalizers = {('distance', 'km'): lambda v, src, tgt: None if v is None else v / 1000}
|
||||
|
||||
Reference in New Issue
Block a user