Initialize a fighter from the program
(self, item)
| 42 | DAMAGE_TYPES2 = ("EM", "Kin", "Exp", "Therm") |
| 43 | |
| 44 | def __init__(self, item): |
| 45 | """Initialize a fighter from the program""" |
| 46 | self.__item = item |
| 47 | |
| 48 | if self.isInvalid: |
| 49 | raise ValueError("Passed item is not a Fighter") |
| 50 | |
| 51 | self.itemID = item.ID if item is not None else None |
| 52 | self.projected = False |
| 53 | self.projectionRange = None |
| 54 | self.active = True |
| 55 | |
| 56 | # -1 is a placeholder that represents max squadron size, which we may not know yet as ships may modify this with |
| 57 | # their effects. If user changes this, it is then overridden with user value. |
| 58 | self._amount = -1 |
| 59 | |
| 60 | self.__abilities = self.__getAbilities() |
| 61 | |
| 62 | self.build() |
| 63 | |
| 64 | standardAttackActive = False |
| 65 | for ability in self.abilities: |
| 66 | if ability.effect.isImplemented and ability.effect.name == 'fighterAbilityAttackM': |
| 67 | # Activate "standard attack" if available |
| 68 | ability.active = True |
| 69 | standardAttackActive = True |
| 70 | else: |
| 71 | # Activate all other abilities (Neut, Web, etc) except propmods if no standard attack is active |
| 72 | if ability.effect.isImplemented and \ |
| 73 | standardAttackActive is False and \ |
| 74 | ability.effect.name != 'fighterAbilityMicroWarpDrive' and \ |
| 75 | ability.effect.name != 'fighterAbilityEvasiveManeuvers': |
| 76 | ability.active = True |
| 77 | |
| 78 | @reconstructor |
| 79 | def init(self): |
no test coverage detected