Fix BC and bunker calculation
@@ -508,6 +508,7 @@ class Unit:
:param ignore_armor:
:param include_overkill_damage:
"""
+ if self.type_id not in {UnitTypeId.BATTLECRUISER, UnitTypeId.BUNKER}:
if not self.can_attack:
return 0, 0, 0
if target.type_id != UnitTypeId.COLOSSUS:
@@ -546,14 +547,10 @@ class Unit:
if target_has_guardian_shield:
enemy_armor += 2
enemy_shield_armor += 2
- weapon_damage = 8 + self.attack_upgrade_level if not target.is_flying else 5 + self.attack_upgrade_level
+ weapon_damage = (8 if not target.is_flying else 5) + self.attack_upgrade_level
weapon_damage = weapon_damage - enemy_shield_armor if target.shield else weapon_damage - enemy_armor
return weapon_damage, 0.224, 6
- required_target_type: Set[
- int
- ] = TARGET_BOTH if target.type_id == UnitTypeId.COLOSSUS else TARGET_GROUND if not target.is_flying else TARGET_AIR
-
# Fast return for bunkers, since they don't have a weapon similar to BCs
if self.type_id == UnitTypeId.BUNKER:
if self.is_enemy:
@@ -565,6 +562,9 @@ class Unit:
# TODO if bunker belongs to us, use passengers and upgrade level to calculate damage
pass
+ required_target_type: Set[
+ int
+ ] = TARGET_BOTH if target.type_id == UnitTypeId.COLOSSUS else TARGET_GROUND if not target.is_flying else TARGET_AIR
# Contains total damage, attack speed and attack range
damages: List[Tuple[float, float, float]] = []
for weapon in self._weapons:
