rule fixes and interface optimizations

This commit is contained in:
Jannes Höke 2016-03-31 16:07:35 +02:00
parent 6aff43eb99
commit 5df4e1fd30
2 changed files with 9 additions and 3 deletions

3
bot.py
View file

@ -152,6 +152,8 @@ def start_game(bot, update):
bot.sendPhoto(chat_id, bot.sendPhoto(chat_id,
photo=game.last_card.get_image_link(), photo=game.last_card.get_image_link(),
caption="First Card") caption="First Card")
bot.sendMessage(chat_id, text="First player: " +
display_name(game))
else: else:
help(bot, update) help(bot, update)
@ -366,6 +368,7 @@ def process_result(bot, update):
else: else:
do_play_card(bot, chat_id, game, player, result_id, user) do_play_card(bot, chat_id, game, player, result_id, user)
if game.current_player is not game.current_player.next:
bot.sendMessage(chat_id, text="Next player: " + display_name(game)) bot.sendMessage(chat_id, text="Next player: " + display_name(game))

View file

@ -110,10 +110,13 @@ class Player(object):
card.value == c.DRAW_TWO and self.game.draw_counter: card.value == c.DRAW_TWO 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 last.special == c.DRAW_FOUR and not \ if last.special == c.DRAW_FOUR and self.game.draw_counter:
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 (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: if not last.color or card in playable:
self.logger.debug("Last card has no color or the card was " self.logger.debug("Last card has no color or the card was "
"already added to the list") "already added to the list")