Archived
fix draw function being recursive
This commit is contained in:
+3
-5
@@ -71,7 +71,7 @@ class Player(Serializable):
|
||||
async def draw(self, amount: int):
|
||||
"""Draw a card from the stack. Handles stack rebuild from discard automatically"""
|
||||
try:
|
||||
while amount <= 0:
|
||||
while amount > 0:
|
||||
if len(self.stack_pile) == 0:
|
||||
if len(self.discard_pile) == 0:
|
||||
raise RuntimeWarning("No more cards to draw !")
|
||||
@@ -79,8 +79,6 @@ class Player(Serializable):
|
||||
|
||||
if len(self.stack_pile) > 0:
|
||||
self.hand.append(self.stack_pile.pop())
|
||||
return self.draw(amount - 1)
|
||||
amount = amount - 1
|
||||
finally:
|
||||
await self.team.notify_controller(
|
||||
"update", {"uuid": self.uuid, "hand": self.serialize_team()["hand"]}
|
||||
)
|
||||
await self.team.notify_controller("update", self.serialize_team())
|
||||
|
||||
Reference in New Issue
Block a user