refactor: verbessere die Aufteilung der Klassen
This commit is contained in:
@@ -0,0 +1,67 @@
|
||||
import enum
|
||||
|
||||
|
||||
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)
|
||||
Reference in New Issue
Block a user