From 5df4e1fd30f0105d1b737afb1c9058f97acf7c40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jannes=20H=C3=B6ke?= Date: Thu, 31 Mar 2016 16:07:35 +0200 Subject: [PATCH] rule fixes and interface optimizations --- bot.py | 5 ++++- player.py | 7 +++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/bot.py b/bot.py index 659fc84..ee4ebc7 100644 --- a/bot.py +++ b/bot.py @@ -152,6 +152,8 @@ def start_game(bot, update): bot.sendPhoto(chat_id, photo=game.last_card.get_image_link(), caption="First Card") + bot.sendMessage(chat_id, text="First player: " + + display_name(game)) else: help(bot, update) @@ -366,7 +368,8 @@ def process_result(bot, update): else: do_play_card(bot, chat_id, game, player, result_id, user) - bot.sendMessage(chat_id, text="Next player: " + display_name(game)) + if game.current_player is not game.current_player.next: + bot.sendMessage(chat_id, text="Next player: " + display_name(game)) def do_play_card(bot, chat_id, game, player, result_id, user): diff --git a/player.py b/player.py index ecd50e5..90bb280 100644 --- a/player.py +++ b/player.py @@ -110,10 +110,13 @@ class Player(object): card.value == c.DRAW_TWO and self.game.draw_counter: self.logger.debug("Player has to draw and can't counter") is_playable = False - if last.special == c.DRAW_FOUR and not \ - card.special == c.DRAW_FOUR and self.game.draw_counter: + if last.special == c.DRAW_FOUR and self.game.draw_counter: self.logger.debug("Player has to draw and can't counter") is_playable = False + if (last.special == c.CHOOSE or last.special == c.DRAW_FOUR) and \ + (card.special == c.CHOOSE or card.special == c.DRAW_FOUR): + self.logger.debug("Can't play colorchooser on another one") + is_playable = False if not last.color or card in playable: self.logger.debug("Last card has no color or the card was " "already added to the list")