def getLoogedEfficiency(self, types):
     """
     Returns logged efficiency by the given type mask.
     :param types: damage types represented by bit mask (see PERSONAL_EFFICIENCY_TYPE)
     :return: list of _DamageInfo objects
     """
     return [ d for d in reversed(self.__efficiencyLog) if BitmaskHelper.hasAnyBitSet(types, d.getType()) ]
示例#2
0
 def __init__(self, yaw = 0, attackerID = 0, attackerVehName = '', attackerVehClassTag = None, playerVehMaxHP = 0, damage = 0, critFlags = 0, isAlly = False, isBlocked = False, isHighExplosive = False):
     """
     Constructor.
     
     :param yaw: YAW.
     :param attackerID: Attacker ID.
     :param attackerVehName: Attacker vehicle name with IGR prefix.
     :param attackerVehClassTag: Attacker vehicle class tag.
     :param attackerVehMaxHP: Attacker vehicle max health points.
     :param isEnemy: Indicates whether the attacker is enemy.
     :param damage: Damage value (received or blocked).
     :param isBlocked: Indicates whether the damage is blocked.
     :param critFlags: Bit mask of critical damages (modules and crew).
     :param isHighExplosive: Indicates whether the hit is caused by high explosive shell.
     """
     super(HitData, self).__init__()
     self.__yaw = yaw
     self.__attackerID = attackerID
     self.__damage = damage
     self.__attackerVehName = attackerVehName
     self.__attackerVehClassTag = attackerVehClassTag or ''
     self.__playerVehMaxHP = playerVehMaxHP
     self.__critFlags = critFlags
     self.__critsCount = BitmaskHelper.getSetBitsCount(self.__critFlags)
     self.__hitFlags = self.__buildFlags(attackerID=attackerID, damage=damage, isAlly=isAlly, isBlocked=isBlocked, critFlags=critFlags, isHighExplosive=isHighExplosive)
示例#3
0
 def _onEfficiencyReceived(self, events):
     if self.__logViewMode == _DETAILS_LOG_VIEW_MODE.HIDE:
         return
     for e in events:
         if BitmaskHelper.hasAnyBitSet(self.__contentMask, e.getType()):
             vo = self._buildLogMessageVO(e)
             self.as_addDetailMessageS(**vo)
示例#4
0
def critsParserGenerator(mask):
    """
    Returns types of critical hits of the given crit mask. Types are represented by strings
    (see VEHICLE_DEVICE_TYPE_NAMES and VEHICLE_TANKMAN_TYPE_NAMES).
    Note that generator returns types according to priority rules (
    destroyed devices/devices with critical damage/destroyed tank mans).
    
    The mask has the following format: |destroyed tankmans|destroyed devices|critical devices|. For
    details see ..\\scripts\\item_defs\x0behicles\\common\x0behicle.xml and buildCritsFromDevicesHit
    method of ..\\scripts\\cell\\helpers module.
    
    :param mask: Crits bit mask
    :return: string of crit type (from VEHICLE_DEVICE_TYPE_NAMES or VEHICLE_TANKMAN_TYPE_NAMES)
    """
    maskMap = {CRIT_MASK_SUB_TYPES.DESTROYED_DEVICES: (mask >> 12 & 4095, VEHICLE_DEVICE_TYPE_NAMES),
     CRIT_MASK_SUB_TYPES.CRITICAL_DEVICES: (mask & 4095, VEHICLE_DEVICE_TYPE_NAMES),
     CRIT_MASK_SUB_TYPES.DESTROYED_TANKMENS: (mask >> 24 & 255, VEHICLE_TANKMAN_TYPE_NAMES)}
    for subType, (subMask, types) in maskMap.iteritems():
        if subMask > 0:
            for index in BitmaskHelper.iterateInt64SetBitsIndexes(subMask):
                yield (subType, types[index])
示例#5
0
 def isHighExplosive(self):
     return BitmaskHelper.hasAnyBitSet(self.__hitFlags, HIT_FLAGS.IS_HIGH_EXPLOSIVE)
示例#6
0
 def isCritical(self):
     return BitmaskHelper.hasAnyBitSet(self.__hitFlags, HIT_FLAGS.IS_CRITICAL)
示例#7
0
 def isBlocked(self):
     return BitmaskHelper.hasAnyBitSet(self.__hitFlags, HIT_FLAGS.IS_BLOCKED)
示例#8
0
 def isAttackerAlly(self):
     return BitmaskHelper.hasAnyBitSet(self.__hitFlags, HIT_FLAGS.IS_ALLAY)
示例#9
0
 def isNonPlayerAttackReason(self):
     return BitmaskHelper.hasAnyBitSet(
         self.__hitFlags, HIT_FLAGS.IS_NON_PLAYER_ATTACK_REASON)
示例#10
0
 def isBattleConsumables(self):
     return BitmaskHelper.hasAnyBitSet(self.__hitFlags,
                                       HIT_FLAGS.IS_BATTLE_CONSUMABLES)
示例#11
0
 def isHighExplosive(self):
     return BitmaskHelper.hasAnyBitSet(self.__hitFlags,
                                       HIT_FLAGS.IS_HIGH_EXPLOSIVE)
示例#12
0
 def isCritical(self):
     return BitmaskHelper.hasAnyBitSet(self.__hitFlags,
                                       HIT_FLAGS.IS_CRITICAL)
示例#13
0
 def isBlocked(self):
     return BitmaskHelper.hasAnyBitSet(self.__hitFlags,
                                       HIT_FLAGS.IS_BLOCKED)
示例#14
0
 def isAttackerAlly(self):
     return BitmaskHelper.hasAnyBitSet(self.__hitFlags, HIT_FLAGS.IS_ALLAY)
示例#15
0
 def isBattleConsumables(self):
     return BitmaskHelper.hasAnyBitSet(self.__hitFlags, HIT_FLAGS.IS_BATTLE_CONSUMABLES)
示例#16
0
 def extend(self, hitData):
     self.__yaw = hitData.getYaw()
     self.__hitFlags |= hitData.getHitFlags()
     self.__critFlags |= hitData.getCriticalFlags()
     self.__critsCount = BitmaskHelper.getSetBitsCount(self.__critFlags)
     self.__damage += hitData.getDamage()
示例#17
0
 def extend(self, hitData):
     super(HitData, self).extend(hitData)
     self.__hitFlags |= hitData.getHitFlags()
     self.__critFlags |= hitData.getCriticalFlags()
     self.__critsCount = BitmaskHelper.getSetBitsCount(self.__critFlags)
     self.__damage += hitData.getDamage()
示例#18
0
 def __formatTotalDamage(self, etype, value):
     if BitmaskHelper.hasAnyBitSet(self.__contentMask, etype):
         return _summaryDamageFormatter(value)
     else:
         return None
示例#19
0
 def getLoogedEfficiency(self, types):
     return [
         d for d in reversed(self.__efficiencyLog)
         if BitmaskHelper.hasAnyBitSet(types, d.getType())
     ]