From 1d56ffbcca478cd339e31609ee357ba8ae175340 Mon Sep 17 00:00:00 2001 From: Alberto Xamin Date: Sat, 28 Nov 2020 17:13:35 +0100 Subject: [PATCH] fix play outside turn --- backend/bang/players.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/backend/bang/players.py b/backend/bang/players.py index 0db4d72..6b316e5 100644 --- a/backend/bang/players.py +++ b/backend/bang/players.py @@ -249,8 +249,9 @@ class Player: return s def play_card(self, hand_index: int, against=None, _with=None): + if not self.is_my_turn or self.pending_action != PendingAction.PLAY: + return if not (0 <= hand_index < len(self.hand) + len(self.equipment)): - print('illegal') return card: cs.Card = self.hand.pop(hand_index) if hand_index < len(self.hand) else self.equipment.pop(hand_index-len(self.hand)) withCard: cs.Card = None