Automatically play cards at start of turn

This commit is contained in:
2024-05-03 16:02:05 +02:00
parent bf07a958e4
commit d1887349c6
2 changed files with 6 additions and 7 deletions
+3 -5
View File
@@ -142,14 +142,12 @@ class Game(Serializable):
self.current_turn = random.choice(self.teams)
await self.notify_controller("update", self.serialize_guest())
draws = []
for p in [p for p in self.players if p.team == self.current_turn]:
draws.append(p.draw(3))
await p.draw(3)
await p.start_turn()
for p in [p for p in self.players if p.team != self.current_turn]:
draws.append(p.draw(5))
await asyncio.gather(*draws)
await p.draw(5)
await self.notify_controller("update", self.serialize_guest())
+3 -2
View File
@@ -71,8 +71,9 @@ class Player(Serializable):
random.shuffle(self.stack_pile)
async def start_turn(self):
for c in self.hand:
await self.play_card(c.uuid)
temp_hand = [*self.hand]
for c in temp_hand:
await self.play_card(str(c.uuid))
await self.turn.start_turn()
async def end_turn(self):