diff --git a/game/event/event.py b/game/event/event.py index 66770881..01be1f59 100644 --- a/game/event/event.py +++ b/game/event/event.py @@ -206,10 +206,10 @@ class Event: # ------------------------------ # Captured bases - if self.game.player_country in db.BLUEFOR_FACTIONS: - coalition = 2 # Value in DCS mission event for BLUE - else: - coalition = 1 # Value in DCS mission event for RED + #if self.game.player_country in db.BLUEFOR_FACTIONS: + coalition = 2 # Value in DCS mission event for BLUE + #else: + # coalition = 1 # Value in DCS mission event for RED for captured in debriefing.base_capture_events: try: diff --git a/game/game.py b/game/game.py index 0c3b695e..ef99be2d 100644 --- a/game/game.py +++ b/game/game.py @@ -379,37 +379,19 @@ class Game: # 1 = red, 2 = blue def get_player_coalition_id(self): - if self.player_country in db.BLUEFOR_FACTIONS: - return 2 - else: - return 1 + return 2 def get_enemy_coalition_id(self): - if self.get_player_coalition_id() == 1: - return 2 - else: - return 1 + return 1 def get_player_coalition(self): - if self.player_country in db.BLUEFOR_FACTIONS: - return dcs.action.Coalition.Blue - else: - return dcs.action.Coalition.Red + return dcs.action.Coalition.Blue def get_enemy_coalition(self): - if self.player_country == 1: - return dcs.action.Coalition.Blue - else: - return dcs.action.Coalition.Red + return dcs.action.Coalition.Red def get_player_color(self): - if self.get_player_coalition_id() == 1: - return "red" - else: - return "blue" + return "blue" def get_enemy_color(self): - if self.get_player_coalition_id() == 1: - return "blue" - else: - return "red" \ No newline at end of file + return "red" \ No newline at end of file diff --git a/game/operation/operation.py b/game/operation/operation.py index 48fe8dad..fad744ae 100644 --- a/game/operation/operation.py +++ b/game/operation/operation.py @@ -88,12 +88,21 @@ class Operation: # Setup coalition : self.current_mission.coalition["blue"] = Coalition("blue") self.current_mission.coalition["red"] = Coalition("red") - if self.game.player_country and self.game.player_country in db.BLUEFOR_FACTIONS: - self.current_mission.coalition["blue"].add_country(country_dict[db.country_id_from_name(self.game.player_country)]()) - self.current_mission.coalition["red"].add_country(country_dict[db.country_id_from_name(self.game.enemy_country)]()) - else: - self.current_mission.coalition["blue"].add_country(country_dict[db.country_id_from_name(self.game.enemy_country)]()) - self.current_mission.coalition["red"].add_country(country_dict[db.country_id_from_name(self.game.player_country)]()) + + p_country = self.game.player_country + e_country = self.game.enemy_country + if self.game.player_country == self.game.enemy_country: + if self.game.player_country != "USAF Aggresors": + e_country = "USAF Aggresors" + else: + if self.game.player_country != "Russia": + e_country = "Russia" + else: + e_country = "USA" + + self.current_mission.coalition["blue"].add_country(country_dict[db.country_id_from_name(p_country)]()) + self.current_mission.coalition["red"].add_country(country_dict[db.country_id_from_name(e_country)]()) + print([c for c in self.current_mission.coalition["blue"].countries.keys()]) print([c for c in self.current_mission.coalition["red"].countries.keys()]) diff --git a/gen/triggergen.py b/gen/triggergen.py index a88d2029..c62afe7b 100644 --- a/gen/triggergen.py +++ b/gen/triggergen.py @@ -95,8 +95,8 @@ class TriggersGenerator: self.mission.triggerrules.triggers.append(mark_trigger) def generate(self): - player_coalition = self.game.player_country in db.BLUEFOR_FACTIONS and "blue" or "red" - enemy_coalition = player_coalition == "blue" and "red" or "blue" + player_coalition = "blue" + enemy_coalition = "red" self.mission.coalition["blue"].bullseye = {"x": self.conflict.position.x, "y": self.conflict.position.y} diff --git a/qt_ui/widgets/map/QMapControlPoint.py b/qt_ui/widgets/map/QMapControlPoint.py index 939a5677..09061e16 100644 --- a/qt_ui/widgets/map/QMapControlPoint.py +++ b/qt_ui/widgets/map/QMapControlPoint.py @@ -89,10 +89,7 @@ class QMapControlPoint(QGraphicsRectItem): @property def brush_color(self)->QColor: - if self.parent.game.player_country in db.BLUEFOR_FACTIONS: - return self.model.captured and CONST.COLORS["blue"] or CONST.COLORS["super_red"] - else: - return self.model.captured and CONST.COLORS["super_red"] or CONST.COLORS["blue"] + return self.model.captured and CONST.COLORS["blue"] or CONST.COLORS["super_red"] @property def pen_color(self) -> QColor: diff --git a/qt_ui/widgets/map/QMapGroundObject.py b/qt_ui/widgets/map/QMapGroundObject.py index ea867638..dbbf4d79 100644 --- a/qt_ui/widgets/map/QMapGroundObject.py +++ b/qt_ui/widgets/map/QMapGroundObject.py @@ -42,12 +42,9 @@ class QMapGroundObject(QGraphicsRectItem): def paint(self, painter, option, widget=None): #super(QMapControlPoint, self).paint(painter, option, widget) - if self.parent.game.player_country in db.BLUEFOR_FACTIONS: - playerIcons = "_blue" - enemyIcons = "" - else: - playerIcons = "" - enemyIcons = "_blue" + + playerIcons = "_blue" + enemyIcons = "" if self.parent.get_display_rule("go"): painter.save() diff --git a/qt_ui/windows/QNewGameWizard.py b/qt_ui/windows/QNewGameWizard.py index 89a263e9..9b5291f7 100644 --- a/qt_ui/windows/QNewGameWizard.py +++ b/qt_ui/windows/QNewGameWizard.py @@ -30,9 +30,8 @@ class NewGameWizard(QtWidgets.QWizard): def accept(self): - blueFaction = [c for c in db.FACTIONS if db.FACTIONS[c]["side"] == "blue"][self.field("blueFaction")] - redFaction = [c for c in db.FACTIONS if db.FACTIONS[c]["side"] == "red"][self.field("redFaction")] - playerIsBlue = self.field("playerIsBlue") + blueFaction = [c for c in db.FACTIONS][self.field("blueFaction")] + redFaction = [c for c in db.FACTIONS][self.field("redFaction")] isTerrainPg = self.field("isTerrainPg") isTerrainNttr = self.field("isTerrainNttr") isTerrainCaucasusSmall = self.field("isTerrainCaucasusSmall") @@ -48,8 +47,8 @@ class NewGameWizard(QtWidgets.QWizard): midGame = self.field("midGame") multiplier = self.field("multiplier") - player_name = playerIsBlue and blueFaction or redFaction - enemy_name = playerIsBlue and redFaction or blueFaction + player_name = blueFaction + enemy_name = redFaction if isTerrainPg: conflicttheater = persiangulf.PersianGulfTheater() @@ -144,31 +143,28 @@ class FactionSelection(QtWidgets.QWizardPage): self.setMinimumHeight(250) - blues = [c for c in db.FACTIONS if db.FACTIONS[c]["side"] == "blue"] - reds = [c for c in db.FACTIONS if db.FACTIONS[c]["side"] == "red"] - - # Factions selection self.factionsGroup = QtWidgets.QGroupBox("Factions") self.factionsGroupLayout = QtWidgets.QGridLayout() - blueFaction = QtWidgets.QLabel("Blue Faction :") + blueFaction = QtWidgets.QLabel("Player Faction :") self.blueFactionSelect = QtWidgets.QComboBox() - for f in blues: + for f in db.FACTIONS: self.blueFactionSelect.addItem(f) blueFaction.setBuddy(self.blueFactionSelect) - redFaction = QtWidgets.QLabel("Red Faction :") + redFaction = QtWidgets.QLabel("Enemy Faction :") self.redFactionSelect = QtWidgets.QComboBox() - for r in reds: + for i, r in enumerate(db.FACTIONS): self.redFactionSelect.addItem(r) + if r == "Russia 1990": # Default ennemy + self.redFactionSelect.setCurrentIndex(i) redFaction.setBuddy(self.redFactionSelect) self.blueSideRecap = QtWidgets.QLabel("") self.blueSideRecap.setFont(CONST.FONT_PRIMARY_I) self.blueSideRecap.setWordWrap(True) - self.blueGroup = QtWidgets.QGroupBox("Redfor") self.redSideRecap = QtWidgets.QLabel("") self.redSideRecap.setFont(CONST.FONT_PRIMARY_I) self.redSideRecap.setWordWrap(True) @@ -188,28 +184,14 @@ class FactionSelection(QtWidgets.QWizardPage): self.requiredModsGroupLayout.addWidget(self.requiredMods) self.requiredModsGroup.setLayout(self.requiredModsGroupLayout) - # Player faction selection - sideGroup = QtWidgets.QGroupBox("Player Side") - blueforRadioButton = QtWidgets.QRadioButton("BLUEFOR") - redforRadioButton = QtWidgets.QRadioButton("REDFOR") - blueforRadioButton.setChecked(True) - # Link form fields self.registerField('blueFaction', self.blueFactionSelect) self.registerField('redFaction', self.redFactionSelect) - self.registerField('playerIsBlue', blueforRadioButton) - self.registerField('playerIsRed', redforRadioButton) # Build layout - sideGroupLayout = QtWidgets.QVBoxLayout() - sideGroupLayout.addWidget(blueforRadioButton) - sideGroupLayout.addWidget(redforRadioButton) - sideGroup.setLayout(sideGroupLayout) - layout = QtWidgets.QVBoxLayout() layout.addWidget(self.factionsGroup) layout.addWidget(self.requiredModsGroup) - layout.addWidget(sideGroup) self.setLayout(layout) self.updateUnitRecap() diff --git a/theater/start_generator.py b/theater/start_generator.py index 634ee22a..977bea8f 100644 --- a/theater/start_generator.py +++ b/theater/start_generator.py @@ -64,6 +64,7 @@ def generate_groundobjects(theater: ConflictTheater, game): tpls = pickle.load(f) group_id = 0 + cp_to_remove = [] for cp in theater.controlpoints: group_id = generate_cp_ground_points(cp, theater, game, group_id, tpls) @@ -94,6 +95,8 @@ def generate_groundobjects(theater: ConflictTheater, game): # Set new name : if "carrier_names" in db.FACTIONS[faction_name]: cp.name = random.choice(db.FACTIONS[faction_name]["carrier_names"]) + else: + cp_to_remove.append(cp) elif cp.cptype == ControlPointType.LHA_GROUP: # Create ground object group group_id = group_id + 1 @@ -115,6 +118,8 @@ def generate_groundobjects(theater: ConflictTheater, game): # Set new name : if "lhanames" in db.FACTIONS[faction_name]: cp.name = random.choice(db.FACTIONS[faction_name]["lhanames"]) + else: + cp_to_remove.append(cp) else: for i in range(random.randint(3,6)): @@ -181,6 +186,8 @@ def generate_groundobjects(theater: ConflictTheater, game): g.groups.append(group) cp.ground_objects.append(g) + + if "missiles" in db.FACTIONS[faction_name].keys(): missiles_count = 1 @@ -214,6 +221,9 @@ def generate_groundobjects(theater: ConflictTheater, game): g.groups.append(group) cp.ground_objects.append(g) + for cp in cp_to_remove: + theater.controlpoints.remove(cp) + def generate_airbase_defense_group(airbase_defense_group_id, ground_obj:TheaterGroundObject, faction, game, cp):