refactor: verbessere die Aufteilung der Klassen
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
import enum
|
||||
|
||||
from MechFabrik.bauteile.items import Item
|
||||
|
||||
|
||||
class ZoneNames(enum.Enum):
|
||||
HEAD = 'Kopf'
|
||||
@@ -32,72 +34,6 @@ class AreaStatus(enum.Flag):
|
||||
DESTROYED = 2
|
||||
|
||||
|
||||
class ItemTypes(enum.Enum):
|
||||
COCKPIT = 1
|
||||
REAKTOR = 2
|
||||
GYROSKOPE = 3
|
||||
ACTIVATOR = 4
|
||||
JOINT = 5
|
||||
SENSORS = 6
|
||||
SUSTAINMENT = 7
|
||||
|
||||
|
||||
class Item(object):
|
||||
def __init__(self, item_type: ItemTypes):
|
||||
self._type = item_type
|
||||
|
||||
@property
|
||||
def type(self):
|
||||
return self._type
|
||||
|
||||
|
||||
class BigItem(Item):
|
||||
|
||||
def __init__(self, item_type: ItemTypes, tonnage: float):
|
||||
super().__init__(item_type)
|
||||
self._tonnage = tonnage
|
||||
|
||||
@property
|
||||
def tonnage(self) -> float:
|
||||
return self._tonnage
|
||||
|
||||
|
||||
class Cockpit(BigItem):
|
||||
def __init__(self):
|
||||
super().__init__(ItemTypes.COCKPIT, 3.0)
|
||||
|
||||
|
||||
class Reaktor(BigItem):
|
||||
|
||||
def __init__(self, value: int, tonnage: float):
|
||||
super().__init__(ItemTypes.REAKTOR, tonnage)
|
||||
self._value = value
|
||||
|
||||
@property
|
||||
def value(self):
|
||||
return self._value
|
||||
|
||||
|
||||
class Activator(Item):
|
||||
def __init__(self):
|
||||
super().__init__(ItemTypes.ACTIVATOR)
|
||||
|
||||
|
||||
class Joint(Item):
|
||||
def __init__(self):
|
||||
super().__init__(ItemTypes.JOINT)
|
||||
|
||||
|
||||
class Sensors(Item):
|
||||
def __init__(self):
|
||||
super().__init__(ItemTypes.SENSORS)
|
||||
|
||||
|
||||
class Sustainment(Item):
|
||||
def __init__(self):
|
||||
super().__init__(ItemTypes.SUSTAINMENT)
|
||||
|
||||
|
||||
class Zone:
|
||||
|
||||
def __init__(self):
|
||||
@@ -201,36 +137,3 @@ class InnerStructure:
|
||||
def add_zone(self, index: ZoneNames, zone: Zone):
|
||||
self._zones[index] = zone
|
||||
|
||||
|
||||
class Mech(object):
|
||||
|
||||
def __init__(self, name: str, tonnage: float, movement_rate: int, inner_structure: InnerStructure):
|
||||
self._movement_rate = movement_rate
|
||||
self._tonnage = tonnage
|
||||
self._name = name
|
||||
self._inner_structure = inner_structure
|
||||
|
||||
@property
|
||||
def name(self) -> str:
|
||||
return self._name
|
||||
|
||||
@property
|
||||
def tonnage(self) -> float:
|
||||
return self._tonnage
|
||||
|
||||
@property
|
||||
def inner_structure(self) -> InnerStructure:
|
||||
return self._inner_structure
|
||||
|
||||
@property
|
||||
def movement_rate(self) -> int:
|
||||
return self._movement_rate
|
||||
|
||||
def set_item(self, key: tuple, item: Item):
|
||||
pass
|
||||
|
||||
def strike(self, zone_name: ZoneNames, hits: int) -> StrikeEvent:
|
||||
zone = self._inner_structure.zones.get(zone_name)
|
||||
if zone is None:
|
||||
raise Exception(f"Zone {zone_name} not found")
|
||||
return StrikeEvent(zone, hits)
|
||||
|
||||
Reference in New Issue
Block a user