mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
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:
30
game/theater/player.py
Normal file
30
game/theater/player.py
Normal file
@@ -0,0 +1,30 @@
|
||||
from enum import Enum
|
||||
|
||||
|
||||
class Player(Enum):
|
||||
NEUTRAL = "Neutral"
|
||||
BLUE = "Blue"
|
||||
RED = "Red"
|
||||
|
||||
@property
|
||||
def is_red(self) -> bool:
|
||||
"""Returns True if the player is Red."""
|
||||
return self == Player.RED
|
||||
|
||||
@property
|
||||
def is_blue(self) -> bool:
|
||||
"""Returns True if the player is Blue."""
|
||||
return self == Player.BLUE
|
||||
|
||||
@property
|
||||
def is_neutral(self) -> bool:
|
||||
"""Returns True if the player is Neutral."""
|
||||
return self == Player.NEUTRAL
|
||||
|
||||
@property
|
||||
def opponent(self) -> "Player":
|
||||
"""Returns the opponent player."""
|
||||
if self.is_blue:
|
||||
return Player.RED
|
||||
else:
|
||||
return Player.BLUE
|
||||
Reference in New Issue
Block a user