From 3bb7db8e339128549b56a7b0b6ac91b7c4aaed19 Mon Sep 17 00:00:00 2001 From: Giulio Date: Sat, 12 Jun 2021 13:10:38 +0200 Subject: [PATCH] fixing bot, Whisky & Rissa Co-authored-by: Alberto Xamin --- backend/bang/players.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/backend/bang/players.py b/backend/bang/players.py index a26ea09..689955d 100644 --- a/backend/bang/players.py +++ b/backend/bang/players.py @@ -219,7 +219,7 @@ class Player: self.draw('') elif self.pending_action == PendingAction.PLAY: equippables = [c for c in self.hand if (c.is_equipment or c.usable_next_turn) and not isinstance(c, cs.Prigione) and not any([type(c) == type(x) for x in self.equipment])] - misc = [c for c in self.hand if (isinstance(c, cs.WellsFargo) or isinstance(c, cs.Indiani) or isinstance(c, cs.Gatling) or isinstance(c, cs.Diligenza) or isinstance(c, cs.Emporio) or (isinstance(c, cs.Birra) and self.lives < self.max_lives and not self.game.check_event(ceh.IlReverendo))) + misc = [c for c in self.hand if (isinstance(c, cs.WellsFargo) or isinstance(c, cs.Indiani) or isinstance(c, cs.Gatling) or isinstance(c, cs.Diligenza) or isinstance(c, cs.Emporio) or (isinstance(c, cs.Birra) and self.lives < self.max_lives and not self.game.check_event(ceh.IlReverendo)) or (c.need_with and len(self.hand) > 1 and not c.need_target and not (isinstance(c, csd.Whisky) and self.lives == self.max_lives))) and not (not c.can_be_used_now and self.game.check_event(ce.IlGiudice))] need_target = [c for c in self.hand if c.need_target and c.can_be_used_now and not (c.need_with and len(self.hand) < 2) and not ( (self.game.check_event(ceh.Sermone) or self.has_played_bang and not (any([isinstance(c, cs.Volcanic) for c in self.equipment]) and type(c) == type(cs.Bang) @@ -231,7 +231,9 @@ class Player: return elif len(misc) > 0: for c in misc: - if self.play_card(self.hand.index(c)): + if c.need_with and self.play_card(self.hand.index(c), _with=sample([j for j in range(len(self.hand)) if j != self.hand.index(c)], 1)[0]): + return + elif self.play_card(self.hand.index(c)): return elif len(need_target) > 0: for c in need_target: