draw method reset draw counter on empty deck
This commit is contained in:
parent
d5b76c5c12
commit
73365f49fc
1 changed files with 9 additions and 4 deletions
13
player.py
13
player.py
|
@ -112,11 +112,16 @@ class Player(object):
|
||||||
"""Draws 1+ cards from the deck, depending on the draw counter"""
|
"""Draws 1+ cards from the deck, depending on the draw counter"""
|
||||||
_amount = self.game.draw_counter or 1
|
_amount = self.game.draw_counter or 1
|
||||||
|
|
||||||
for i in range(_amount):
|
try:
|
||||||
self.cards.append(self.game.deck.draw())
|
for i in range(_amount):
|
||||||
|
self.cards.append(self.game.deck.draw())
|
||||||
|
|
||||||
self.game.draw_counter = 0
|
except DeckEmptyError:
|
||||||
self.drew = True
|
raise
|
||||||
|
|
||||||
|
finally:
|
||||||
|
self.game.draw_counter = 0
|
||||||
|
self.drew = True
|
||||||
|
|
||||||
def play(self, card):
|
def play(self, card):
|
||||||
"""Plays a card and removes it from hand"""
|
"""Plays a card and removes it from hand"""
|
||||||
|
|
Loading…
Reference in a new issue