From a1a39058e0f5b71d029eaf26c6950ae8e7a23ad6 Mon Sep 17 00:00:00 2001 From: Olivier Gayot Date: Thu, 21 May 2020 19:14:13 +0200 Subject: Fix reception of cards after playing Signed-off-by: Olivier Gayot --- swiftstory/Game.py | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) (limited to 'swiftstory/Game.py') diff --git a/swiftstory/Game.py b/swiftstory/Game.py index 9fc5f17..1282c0e 100644 --- a/swiftstory/Game.py +++ b/swiftstory/Game.py @@ -12,11 +12,8 @@ class Game: WAITING_DESIGNATION = 2, def __init__(self, white_desc, black_desc): - self.white_desc = white_desc - self.black_desc = black_desc - - white_pick = [i for i in enumerate(self.white_desc)] - black_pick = [i for i in enumerate(self.black_desc)] + white_pick = [i for i in enumerate(white_desc)] + black_pick = [i for i in enumerate(black_desc)] self.state = self.WAITING_NEW_JUDGE @@ -155,15 +152,13 @@ class Game: for p in self.players: if p.has_played: idx = p.receive_card(self.board.pick_white_card()) - card_idx = p.cards[idx] - card_desc = self.white_desc[card_idx] await p.send_notification({ 'op': 'received_card', 'content': { 'card': { - 'id': idx, - 'desc': card_desc, + 'id': p.cards[idx][0], + 'desc': p.cards[idx][1], }, }, }) @@ -206,16 +201,14 @@ class Game: await p.send_notification({'op': 'judge_needed'}) for card, p in self.board.played_cards: - idx = p.receive_card(card) - card_idx = p.cards[idx] - card_desc = self.white_desc[card_idx] + p.receive_card(card) await p.send_notification({ 'op': 'received_card', 'content': { 'card': { - 'id': idx, - 'desc': card_desc, + 'id': card[0], + 'desc': card[1], }, }, }) -- cgit v1.2.3