From 8f18bee200655aa60c3dc1581be7c00f50344935 Mon Sep 17 00:00:00 2001 From: Alberto Xamin Date: Wed, 23 Dec 2020 14:57:33 +0100 Subject: [PATCH] il reverendo --- backend/bang/cards.py | 3 +++ backend/bang/expansions/high_noon/card_events.py | 8 +++++++- backend/bang/players.py | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/backend/bang/cards.py b/backend/bang/cards.py index 979441d..3662673 100644 --- a/backend/bang/cards.py +++ b/backend/bang/cards.py @@ -209,6 +209,9 @@ class Birra(Card): self.desc_eng = "Play this card to regain a life point. You cannot heal more than your character's maximum limit. If you are about to lose your last life point, you can also play this card on your opponent's turn. Beer no longer takes effect if there are only two players" def play_card(self, player, against, _with=None): + import bang.expansions.high_noon.card_events as ceh + if player.game.check_event(ceh.IlReverendo): + return False if len(player.game.players) != 2: super().play_card(player, against=against) player.lives = min(player.lives+1, player.max_lives) diff --git a/backend/bang/expansions/high_noon/card_events.py b/backend/bang/expansions/high_noon/card_events.py index acf0e7f..51548ee 100644 --- a/backend/bang/expansions/high_noon/card_events.py +++ b/backend/bang/expansions/high_noon/card_events.py @@ -31,6 +31,12 @@ class IlTreno(CardEvent): self.desc = "I giocatori pescano 1 carta extra" self.desc_eng = "" +class IlReverendo(CardEvent): + def __init__(self): + super().__init__("Il Reverendo", "⛪️") + self.desc = "Non si possono giocare birre" + self.desc_eng = "" + class MezzogiornoDiFuoco(CardEvent): def __init__(self): super().__init__("Mezzogiorno di Fuoco", "🔥") @@ -45,7 +51,7 @@ def get_all_events(): # CorsaAllOro(), # IDalton(), # IlDottore(), - # IlReverendo(), + IlReverendo(), IlTreno(), Sbornia(), # Seromone(), diff --git a/backend/bang/players.py b/backend/bang/players.py index 0d2d8f5..f6fed02 100644 --- a/backend/bang/players.py +++ b/backend/bang/players.py @@ -229,7 +229,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) and not c.usable_next_turn) or isinstance(c, cs.Diligenza) or isinstance(c, cs.Emporio) or (isinstance(c, cs.Birra) and self.lives < self.max_lives)] + misc = [c for c in self.hand if (isinstance(c, cs.WellsFargo) and not c.usable_next_turn) 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))] 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.has_played_bang and not (any([isinstance(c, cs.Volcanic) for c in self.equipment]) and not self.game.check_event(ce.Lazo))) and not ( isinstance(c, cs.Prigione) and self.game.check_event(ce.IlGiudice))] green_cards = [c for c in self.equipment if not self.game.check_event(ce.Lazo) and not isinstance(c, cs.Mancato) and c.usable_next_turn and c.can_be_used_now] if len(equippables) > 0 and not self.game.check_event(ce.IlGiudice):