summaryrefslogtreecommitdiff
path: root/swiftstory
diff options
context:
space:
mode:
authorOlivier Gayot <olivier.gayot@sigexec.com>2020-05-21 19:14:13 +0200
committerOlivier Gayot <olivier.gayot@sigexec.com>2020-05-21 19:15:13 +0200
commita1a39058e0f5b71d029eaf26c6950ae8e7a23ad6 (patch)
treef45f6088ab05a79c5be7227975dd5d115018480f /swiftstory
parentb555b521c70b8408abc2675385ea89f62cdc263a (diff)
Fix reception of cards after playing
Signed-off-by: Olivier Gayot <olivier.gayot@sigexec.com>
Diffstat (limited to 'swiftstory')
-rw-r--r--swiftstory/Game.py21
1 files changed, 7 insertions, 14 deletions
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],
},
},
})