refactor: kleine Korrekturen

This commit is contained in:
2026-06-29 16:25:03 +02:00
parent d64a3eb5ff
commit 472b928950
4 changed files with 13 additions and 18 deletions
+7 -8
View File
@@ -1,5 +1,4 @@
import enum
from typing import Any
class ZoneNames(enum.Enum):
@@ -103,8 +102,8 @@ class Zone:
def __init__(self):
self.__dict__['_armor'] = 0
self.__dict__['_parent']= None
self.__dict__['_state']= AreaStatus.FINE
self.__dict__['_parent'] = None
self.__dict__['_state'] = AreaStatus.FINE
def __setattr__(self, key, value):
self.__dict__['_' + key] = value
@@ -117,17 +116,17 @@ class Area(Zone):
def __init__(self):
super().__init__()
self.__dict__['_outer_amor']= list()
self.__dict__['_children']= list()
self.__dict__['_items']= dict()
self.__dict__['_outer_amor'] = list()
self.__dict__['_children'] = list()
self.__dict__['_items'] = dict()
class OuterAmor(Zone):
def __init__(self, area: Area):
super().__init__()
self.__dict__['_parent']= area
self.__dict__['_area']= area
self.__dict__['_parent'] = area
self.__dict__['_area'] = area
class StrikeEvent:
+4 -7
View File
@@ -15,18 +15,19 @@ class CsvDialect (csv.Dialect):
class ComponentReader:
def __init__(self):
my_dirname = str(os.path.dirname(__file__))
self._inner_structure_data = {}
self._reactor_data = {}
self._weapon_data = {}
with open(os.path.join(os.path.dirname(__file__), 'tabellen', 'bauteile.csv')) as csvfile:
with open(os.path.join(my_dirname, 'tabellen', 'bauteile.csv')) as csvfile:
component_reader = csv.DictReader(csvfile, dialect=CsvDialect)
for row in component_reader:
self._inner_structure_data[float(row['GTonnage'])] = row
with open(os.path.join(os.path.dirname(__file__), 'tabellen', 'reaktoren.csv')) as csvfile:
with open(os.path.join(my_dirname, 'tabellen', 'reaktoren.csv')) as csvfile:
component_reader = csv.DictReader(csvfile, dialect=CsvDialect)
for row in component_reader:
self._reactor_data[float(row['RW'])] = row
with open(os.path.join(os.path.dirname(__file__), 'tabellen', 'waffen.csv')) as csvfile:
with open(os.path.join(my_dirname, 'tabellen', 'waffen.csv')) as csvfile:
component_reader = csv.DictReader(csvfile, dialect=CsvDialect)
for row in component_reader:
self._weapon_data[row['Waffentyp']] = row
@@ -43,13 +44,9 @@ class ComponentReader:
return 3
case AreaNames.MIDDLE_TORSO:
return int(self._inner_structure_data.get(tonnage, {}).get('TorsoMitte', 0))
pass
case AreaNames.RIGHT_TORSO | AreaNames.LEFT_TORSO:
return int(self._inner_structure_data.get(tonnage, {}).get('TorsoSeite', 0))
pass
case AreaNames.RIGHT_ARM | AreaNames.LEFT_ARM:
return int(self._inner_structure_data.get(tonnage, {}).get('Arm', 0))
pass
case AreaNames.RIGHT_LEG | AreaNames.LEFT_LEG:
return int(self._inner_structure_data.get(tonnage, {}).get('Bein', 0))
return 0