+4 on +4, skip turn

This commit is contained in:
Jannes Höke 2016-03-08 12:54:16 +01:00
parent 9d543653c7
commit cebffecc35
2 changed files with 6 additions and 4 deletions

4
bot.py
View file

@ -316,7 +316,9 @@ def do_draw(game, player):
player.cards.append(game.deck.draw()) player.cards.append(game.deck.draw())
game.draw_counter = 0 game.draw_counter = 0
player.drew = True player.drew = True
if game.last_card.value == c.DRAW_TWO and draw_counter_before > 0: if (game.last_card.value == c.DRAW_TWO or
game.last_card.special == c.DRAW_FOUR) and \
draw_counter_before > 0:
game.turn() game.turn()

View file

@ -102,11 +102,11 @@ class Player(object):
self.logger.debug("Card's color or value doesn't match") self.logger.debug("Card's color or value doesn't match")
is_playable = False is_playable = False
if last.value == c.DRAW_TWO and not \ if last.value == c.DRAW_TWO and not \
(card.value == c.DRAW_TWO or card.value == c.DRAW_TWO and self.game.draw_counter:
not self.game.draw_counter):
self.logger.debug("Player has to draw and can't counter") self.logger.debug("Player has to draw and can't counter")
is_playable = False is_playable = False
if last.special == c.DRAW_FOUR and self.game.draw_counter: if last.special == c.DRAW_FOUR and not \
card.special == c.DRAW_FOUR and self.game.draw_counter:
self.logger.debug("Player has to draw and can't counter") self.logger.debug("Player has to draw and can't counter")
is_playable = False is_playable = False
if not last.color or card in playable: if not last.color or card in playable: