Don't deal cards to the czar
This commit is contained in:
parent
8408e7f3a3
commit
68b485da63
1 changed files with 10 additions and 4 deletions
14
gameloop.py
14
gameloop.py
|
@ -376,6 +376,10 @@ def game():
|
||||||
def setup_round():
|
def setup_round():
|
||||||
nonlocal players, round_call_card, czar, card_choices
|
nonlocal players, round_call_card, czar, card_choices
|
||||||
|
|
||||||
|
# Select a czar randomly, if we need to
|
||||||
|
if czar not in players.values():
|
||||||
|
czar = random.choice(list(players.values()))
|
||||||
|
|
||||||
# Clear out previous round's cards
|
# Clear out previous round's cards
|
||||||
card_choices = {}
|
card_choices = {}
|
||||||
|
|
||||||
|
@ -392,6 +396,9 @@ def game():
|
||||||
# Find out how many response cards we need
|
# Find out how many response cards we need
|
||||||
need_responses = 0
|
need_responses = 0
|
||||||
for player in players.values():
|
for player in players.values():
|
||||||
|
# Don't deal cards to the czar this round
|
||||||
|
if player is czar: continue
|
||||||
|
|
||||||
if len(player.hand) < 10:
|
if len(player.hand) < 10:
|
||||||
need_responses += 10 - len(player.hand)
|
need_responses += 10 - len(player.hand)
|
||||||
need_responses += player.hand.count(None)
|
need_responses += player.hand.count(None)
|
||||||
|
@ -407,6 +414,9 @@ def game():
|
||||||
|
|
||||||
# Add responses to players' inventories
|
# Add responses to players' inventories
|
||||||
for player in players.values():
|
for player in players.values():
|
||||||
|
# We skipped the czar in the counts, so skip here too
|
||||||
|
if player is czar: continue
|
||||||
|
|
||||||
while len(player.hand) < 10:
|
while len(player.hand) < 10:
|
||||||
player.hand.append(responses.pop())
|
player.hand.append(responses.pop())
|
||||||
|
|
||||||
|
@ -414,10 +424,6 @@ def game():
|
||||||
if player.hand[index] is None:
|
if player.hand[index] is None:
|
||||||
player.hand[index] = responses.pop()
|
player.hand[index] = responses.pop()
|
||||||
|
|
||||||
# Select a czar randomly, if we need to
|
|
||||||
if czar not in players.values():
|
|
||||||
czar = random.choice(list(players.values()))
|
|
||||||
|
|
||||||
return top_of_round
|
return top_of_round
|
||||||
|
|
||||||
def sanitize(text):
|
def sanitize(text):
|
||||||
|
|
Loading…
Reference in a new issue