refactor of previous commits

refactor to enum

typing and many other fixes

fix tests

attempt to fix some typescript

more typescript fixes

more typescript test fixes

revert all API changes

update to pydcs

mypy fixes

Use properties to check if player is blue/red/neutral

update requirements.txt

black -_-

bump pydcs and fix mypy

add opponent property

bump pydcs
This commit is contained in:
Eclipse/Druss99
2025-01-17 17:02:07 -05:00
committed by Raffson
parent 362ce66f80
commit 31c80dfd02
78 changed files with 739 additions and 350 deletions

View File

@@ -19,7 +19,7 @@ from game.config import REWARDS
from game.data.building_data import FORTIFICATION_BUILDINGS
from game.server import EventStream
from game.sim.gameupdateevents import GameUpdateEvents
from game.theater import ControlPoint, TheaterGroundObject
from game.theater import ControlPoint, TheaterGroundObject, Player
from game.theater.theatergroundobject import (
BuildingGroundObject,
)
@@ -87,12 +87,12 @@ class QGroundObjectMenu(QDialog):
if isinstance(self.ground_object, BuildingGroundObject):
self.mainLayout.addWidget(self.buildingBox)
if self.cp.captured:
if self.cp.captured.is_blue:
self.mainLayout.addWidget(self.financesBox)
else:
self.mainLayout.addWidget(self.intelBox)
self.mainLayout.addWidget(self.orientationBox)
if self.ground_object.is_iads and self.cp.is_friendly(to_player=False):
if self.ground_object.is_iads and self.cp.is_friendly(to_player=Player.RED):
self.mainLayout.addWidget(self.hiddenBox)
self.actionLayout = QHBoxLayout()
@@ -118,8 +118,10 @@ class QGroundObjectMenu(QDialog):
@property
def show_buy_sell_actions(self) -> bool:
if self.cp.captured.is_neutral:
return False
buysell_allowed = self.game.settings.enable_enemy_buy_sell
buysell_allowed |= self.cp.captured
buysell_allowed |= self.cp.captured.is_blue
return buysell_allowed
def doLayout(self):
@@ -133,7 +135,7 @@ class QGroundObjectMenu(QDialog):
QLabel(f"<b>Unit {str(unit.display_name)}</b>"), i, 0
)
if not unit.alive and unit.repairable and self.cp.captured:
if not unit.alive and unit.repairable and self.cp.captured.is_blue:
price = unit.unit_type.price if unit.unit_type else 0
repair = QPushButton(f"Repair [{price}M]")
repair.setProperty("style", "btn-success")