tests: verarbeite kritische Treffer auch bei großen Bauteilen

This commit is contained in:
2026-07-09 17:11:09 +02:00
parent 0c985589a2
commit d8df5db7f4
5 changed files with 57 additions and 32 deletions
+2 -2
View File
@@ -1,6 +1,6 @@
from Hangar.mech import Mech
from MechFabrik.bauteile import InnerStructure, Gyroskope, Area, AreaNames, OuterAmor, ZoneNames
from MechFabrik.bauteile.items import Activator, Cockpit, Joint, Reaktor, Sensors, Sustainment
from MechFabrik.bauteile import InnerStructure, Area, AreaNames, OuterAmor, ZoneNames
from MechFabrik.bauteile.items import Activator, Cockpit, Gyroskope, Joint, Reaktor, Sensors, Sustainment
from MechFabrik.reader import ComponentReader
-9
View File
@@ -98,15 +98,6 @@ class StrikeEvent:
return self
class Gyroskope:
def __init__(self, tonnage: float):
self._tonnage = tonnage
@property
def tonnage(self) -> float:
return self._tonnage
class InnerStructure:
def __init__(self, tonnage: float, gyroskope: Gyroskope):
+19 -7
View File
@@ -18,7 +18,7 @@ class ItemStatus(enum.Flag):
class Item(object):
def __init__(self, item_type: ItemTypes):
def __init__(self, item_type: ItemTypes, **another: dict):
self._type = item_type
self._state = ItemStatus.FINE
@@ -37,8 +37,8 @@ class Item(object):
class BigItem(Item):
def __init__(self, item_type: ItemTypes, tonnage: float):
super().__init__(item_type)
def __init__(self, item_type: ItemTypes, tonnage: float, **another: dict):
super().__init__(item_type, **another)
self._tonnage = tonnage
@property
@@ -46,15 +46,27 @@ class BigItem(Item):
return self._tonnage
class DurableItem(Item):
def __init__(self, item_type: ItemTypes, max_strike: int, **another):
super().__init__(item_type)
self._max_strike = max_strike
class Gyroskope(BigItem, DurableItem):
def __init__(self, tonnage: float):
super().__init__(item_type = ItemTypes.GYROSKOPE, tonnage=tonnage, max_strike=2)
class Cockpit(BigItem):
def __init__(self):
super().__init__(ItemTypes.COCKPIT, 3.0)
class Reaktor(BigItem):
class Reaktor(BigItem, DurableItem):
def __init__(self, value: int, tonnage: float):
super().__init__(ItemTypes.REAKTOR, tonnage)
super().__init__(item_type = ItemTypes.REAKTOR, tonnage=tonnage, max_strike=3)
self._value = value
@property
@@ -72,9 +84,9 @@ class Joint(Item):
super().__init__(ItemTypes.JOINT)
class Sensors(Item):
class Sensors(DurableItem):
def __init__(self):
super().__init__(ItemTypes.SENSORS)
super().__init__(ItemTypes.SENSORS, 2)
class Sustainment(Item):