(fighter, ability, src, tgt, distance, tgtSpeed, tgtSigRadius)
| 312 | |
| 313 | |
| 314 | def getFighterAbilityMult(fighter, ability, src, tgt, distance, tgtSpeed, tgtSigRadius): |
| 315 | fighterSpeed = fighter.getModifiedItemAttr('maxVelocity') |
| 316 | attrPrefix = ability.attrPrefix |
| 317 | # It's bomb attack |
| 318 | if attrPrefix == 'fighterAbilityLaunchBomb': |
| 319 | # Just assume we can land bomb anywhere |
| 320 | return _calcBombFactor( |
| 321 | atkEr=fighter.getModifiedChargeAttr('aoeCloudSize'), |
| 322 | tgtSigRadius=tgtSigRadius) |
| 323 | droneOpt = GraphSettings.getInstance().get('mobileDroneMode') |
| 324 | # It's regular missile-based attack |
| 325 | if (droneOpt == GraphDpsDroneMode.auto and fighterSpeed >= tgtSpeed) or droneOpt == GraphDpsDroneMode.followTarget: |
| 326 | rangeFactor = 1 |
| 327 | # Same as with drones, if fighters are slower - put them to center of |
| 328 | # the ship and see how they apply |
| 329 | else: |
| 330 | if distance is None: |
| 331 | rangeFactorDistance = None |
| 332 | else: |
| 333 | rangeFactorDistance = distance + src.getRadius() - fighter.getModifiedItemAttr('radius') |
| 334 | rangeFactor = calculateRangeFactor( |
| 335 | srcOptimalRange=fighter.getModifiedItemAttr('{}RangeOptimal'.format(attrPrefix)) or fighter.getModifiedItemAttr('{}Range'.format(attrPrefix)), |
| 336 | srcFalloffRange=fighter.getModifiedItemAttr('{}RangeFalloff'.format(attrPrefix)), |
| 337 | distance=rangeFactorDistance) |
| 338 | drf = fighter.getModifiedItemAttr('{}ReductionFactor'.format(attrPrefix), None) |
| 339 | if drf is None: |
| 340 | drf = fighter.getModifiedItemAttr('{}DamageReductionFactor'.format(attrPrefix)) |
| 341 | drs = fighter.getModifiedItemAttr('{}ReductionSensitivity'.format(attrPrefix), None) |
| 342 | if drs is None: |
| 343 | drs = fighter.getModifiedItemAttr('{}DamageReductionSensitivity'.format(attrPrefix)) |
| 344 | missileFactor = _calcMissileFactor( |
| 345 | atkEr=fighter.getModifiedItemAttr('{}ExplosionRadius'.format(attrPrefix)), |
| 346 | atkEv=fighter.getModifiedItemAttr('{}ExplosionVelocity'.format(attrPrefix)), |
| 347 | atkDrf=_calcAggregatedDrf(reductionFactor=drf, reductionSensitivity=drs), |
| 348 | tgtSpeed=tgtSpeed, |
| 349 | tgtSigRadius=tgtSigRadius) |
| 350 | resistMult = 1 |
| 351 | if tgt.isFit: |
| 352 | resistAttrID = fighter.getModifiedItemAttr('{}ResistanceID'.format(attrPrefix)) |
| 353 | if resistAttrID: |
| 354 | resistAttrInfo = Attribute.getInstance().getAttributeInfo(resistAttrID) |
| 355 | if resistAttrInfo is not None: |
| 356 | resistMult = tgt.item.ship.getModifiedItemAttr(resistAttrInfo.name, 1) |
| 357 | mult = rangeFactor * missileFactor * resistMult |
| 358 | return mult |
| 359 | |
| 360 | |
| 361 | # Turret-specific math |
no test coverage detected