Permalink
Browse files

Added support for Target Painters.

Signed-off-by: Toshimo-Kamiya <timothy.mahone@gmail.com>
  • Loading branch information...
1 parent f3f54f6 commit adc0966417f81dffa78e11609c250908f6f28e55 @Toshimo-Kamiya Toshimo-Kamiya committed with Apr 7, 2011
Showing with 27 additions and 1 deletion.
  1. +25 −0 Common/common.eve.py
  2. +2 −1 WeaponHelper/weaponhelper.py
View
@@ -149,6 +149,16 @@ def setModule(self, module):
self.calculate = self.calculateLauncher
+ elif moduleAttrs.has_key("falloff"):
+ # ECM
+
+ self.optimal = float(moduleAttrs["maxRange"])
+ self.falloff = float(moduleAttrs["falloff"])
+
+ self.calculate = self.calculateECM
+
+
+
def calculateNone(self, targetID, **kwargs):
return 0.0
@@ -195,6 +205,21 @@ def calculateTurret(self, targetID, velocityModifier=1.0, radiusModifier=1.0):
return result
+ def calculateECM(self, targetID, velocityModifier=1.0, radiusModifier=1.0):
+ import blue, foo
+ from common.eve.state import getCachedItem
+ target = getCachedItem(targetID)
+
+ ballpark = sm.services["michelle"].GetBallpark()
+ now = blue.os.GetTime()
+
+ distance = max(ballpark.DistanceBetween(eve.session.shipid, targetID), 0.00001)
+ distanceFactor = max(0.0, distance - self.optimal) / self.falloff
+
+ result = 0.5 ** (distanceFactor ** 2)
+
+ return result
+
def calculateLauncher(self, targetID, velocityModifier=1.0, radiusModifier=1.0):
import blue, foo
from common.eve.state import getCachedItem
@@ -25,7 +25,8 @@
"Missile Launcher Cruise", "Missile Launcher Defender",
"Missile Launcher Heavy", "Missile Launcher Heavy Assault",
"Missile Launcher Rocket", "Missile Launcher Siege",
- "Missile Launcher Standard", "Projectile Weapon"
+ "Missile Launcher Standard", "Projectile Weapon",
+ "Target Painter"
]
def getPref(key, default):

0 comments on commit adc0966

Please sign in to comment.