From 7c502598c78c5d9f62c488187553c1142927a1e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jannes=20H=C3=B6ke?= Date: Tue, 1 Mar 2016 01:56:33 +0100 Subject: [PATCH] bluffing and calling a bluff --- bot.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/bot.py b/bot.py index e4dcb32..05a3cf6 100644 --- a/bot.py +++ b/bot.py @@ -187,6 +187,23 @@ def chosen_card(bot, update): if result_id in ('hand', 'not_your_turn'): return + elif result_id == 'call_bluff': + if player.prev.bluffing: + bot.sendMessage(chat_id, text="Bluff called! Giving %d cards to %s" + % (game.draw_counter + 2, + player.prev.user.first_name)) + for i in range(game.draw_counter + 2): + player.prev.cards.append(game.deck.draw()) + else: + bot.sendMessage(chat_id, text="%s didn't bluff! Giving %d cards to" + " %s" + % (player.prev.user.first_name, + game.draw_counter, + player.user.first_name)) + for i in range(game.draw_counter): + player.cards.append(game.deck.draw()) + + game.turn() elif result_id == 'draw': for n in range(game.draw_counter or 1): player.cards.append(game.deck.draw())