diff --git a/gameloop.py b/gameloop.py index 5d466bc..b51df40 100644 --- a/gameloop.py +++ b/gameloop.py @@ -716,24 +716,39 @@ def game(send, notice, voice, devoice, get_event): notice(nick, 'Only the czar can choose now') continue - if len(choices) != 1: - notice(nick, 'Select one choice') - continue - choice = choices[0] + if len(choices) == 1: + choice = choices[0] - if 0 <= choice < len(choosers): - player = choosers[choice] - player.points += 1 + if 0 <= choice < len(choosers): + player = choosers[choice] + player.points += 1 - # Winner is Czar semantics - czar = player + # Winner is Czar semantics + czar = player - send('The winner is %s with: %s' % (player.nick, combine_cards(round_call_card.text, [player.hand[i].text for i in card_choices[player]]))) + send('The winner is %s with: %s' % (player.nick, combine_cards(round_call_card.text, [player.hand[i].text for i in card_choices[player]]))) + + break + + else: + notice(nick, '%i not in range' % choice) + + elif len(choices) == 0: + # Special case: award everyone a point + # and randomize czar + for player in card_choices: + player.points += 1 + + # If we set czar to None, setup_round() + # will handle ramdomizing it for us + czar = None + + send('Everyone is a winner!') break else: - notice(nick, '%i not in range' % choice) + notice(nick, 'Select one or zero choices') elif event == events.origins: nick, = args