dotApplication.py (2612B)
1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\packages\dotWeapons\common\dotApplication.py 2 import gametime 3 import mathext 4 from dotWeapons.common.dotAppInfo import DotApplicationInfo 5 from dotWeapons.common.dotConst import DOT_IDLE 6 from dotWeapons.common.dotUtil import GetEffectiveDamage 7 from utillib import KeyVal 8 9 class DotApplication(object): 10 11 def __init__(self, addedTimestamp, missileInfo, targetID): 12 self._id = id(self) 13 self._missileInfo = missileInfo 14 self._addedTimestamp = addedTimestamp 15 self._maxHpPercentage = mathext.clamp(missileInfo.maxHPPercentagePerTick, 0, 100) 16 self._maxHPNormalizedRatio = mathext.clamp(self._maxHpPercentage / 100.0, 0, 1) 17 self._expiryTime = missileInfo.duration + addedTimestamp 18 self._activityState = DOT_IDLE 19 self._targetID = targetID 20 21 @property 22 def id(self): 23 return self._id 24 25 @property 26 def sourceShipItem(self): 27 return self._missileInfo.sourceShipItem 28 29 @property 30 def sourceTypeID(self): 31 return self.sourceShipItem.typeID 32 33 @property 34 def weaponItem(self): 35 return self._missileInfo.weaponItem 36 37 @property 38 def weaponTypeID(self): 39 return self.weaponItem.typeID 40 41 @property 42 def charID(self): 43 return self._missileInfo.charID 44 45 @property 46 def maxHPNormalizedRatio(self): 47 return self._maxHPNormalizedRatio 48 49 @property 50 def maxDamage(self): 51 return self._missileInfo.maxDamagePerTick 52 53 @property 54 def expiryTime(self): 55 return self._expiryTime 56 57 @property 58 def isExpired(self): 59 return self._expiryTime < gametime.GetSimTime() 60 61 @property 62 def activityState(self): 63 return self._activityState 64 65 @activityState.setter 66 def activityState(self, value): 67 self._activityState = value 68 69 def GetValues(self): 70 return KeyVal(duration=self._missileInfo.duration, addedTimestamp=self._addedTimestamp, expiryTime=self._expiryTime, maxDamage=self.maxDamage, maxHpPercentage=self._maxHpPercentage) 71 72 def GetBasicInfoForClientUpdate(self): 73 return DotApplicationInfo(attackerID=self.charID, weaponTypeID=self.weaponTypeID, expiryTime=self.expiryTime, maxDamage=self.maxDamage, maxHPNormalizedRatio=self.maxHPNormalizedRatio, activityState=self.activityState, targetID=self._targetID) 74 75 def GetEffectiveDamage(self, totalHP): 76 return GetEffectiveDamage(self.maxDamage, self.maxHPNormalizedRatio, totalHP) 77 78 def __repr__(self): 79 return '<DotApplication %s>, %s' % (self.__dict__, id(self))