Archived
notify players when cards are initially drawn
This commit is contained in:
+28
-6
@@ -35,12 +35,12 @@ class Game(Serializable):
|
||||
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
self.market_stack = []
|
||||
self.market = [None for _ in range(5)]
|
||||
self.gem_stack = []
|
||||
self.players = []
|
||||
self.cards = []
|
||||
self.teams = []
|
||||
self.market_stack: List[Card] = []
|
||||
self.market: List[Card] = [None for _ in range(5)]
|
||||
self.gem_stack: List[Card] = []
|
||||
self.players: List[Player] = []
|
||||
self.cards: List[Card] = []
|
||||
self.teams: List[Team] = []
|
||||
|
||||
self.started = False
|
||||
|
||||
@@ -179,6 +179,28 @@ class Game(Serializable):
|
||||
|
||||
await asyncio.gather(*draws)
|
||||
|
||||
await self.notify_controller("update", self.serialize_guest())
|
||||
|
||||
notifications = []
|
||||
|
||||
# Send cards in hand to teams
|
||||
for t in self.teams:
|
||||
current_team = [p for p in self.players if p.team == t]
|
||||
for p in current_team:
|
||||
for o in current_team:
|
||||
notifications.append(
|
||||
p.notify_controller("update", o.serialize_team())
|
||||
)
|
||||
|
||||
# Send cards in hand to all others
|
||||
for p in self.players:
|
||||
for o in self.players:
|
||||
if p.team == o.team:
|
||||
continue
|
||||
notifications.append(p.notify_controller("update", o.serialize_guest()))
|
||||
|
||||
await asyncio.gather(*notifications)
|
||||
|
||||
print(
|
||||
"start game with "
|
||||
+ str(len(self.players))
|
||||
|
||||
Reference in New Issue
Block a user