From 9ab96088b9af66d5cda9627448b9860cb602fa77 Mon Sep 17 00:00:00 2001 From: Alberto Xamin Date: Mon, 30 Jan 2023 13:50:53 +0000 Subject: [PATCH] add mira, fix sventagliata --- backend/bang/cards.py | 1 + .../bang/expansions/the_valley_of_shadows/cards.py | 12 +++++++----- backend/bang/players.py | 4 ++-- frontend/src/components/Player.vue | 4 ++-- 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/backend/bang/cards.py b/backend/bang/cards.py index bb4b0ff..21542a8 100644 --- a/backend/bang/cards.py +++ b/backend/bang/cards.py @@ -42,6 +42,7 @@ class Card(ABC): self.can_be_used_now = True # to check wether the green card can be used now self.usable_next_turn = False # it will be True for Green Cards self.need_with = False # it will be true for cards that require a card to be discarded with + self.need_with_only = '' # names of the cards allowed to be discarded with self.must_be_used = False # used by LeggeDelWest def __str__(self): diff --git a/backend/bang/expansions/the_valley_of_shadows/cards.py b/backend/bang/expansions/the_valley_of_shadows/cards.py index 1c0b53e..9982937 100644 --- a/backend/bang/expansions/the_valley_of_shadows/cards.py +++ b/backend/bang/expansions/the_valley_of_shadows/cards.py @@ -126,6 +126,8 @@ class Sventagliata(Bang): # : conta come un normale BANG! del turno. Il BANG! se def play_card(self, player, against, _with=None): if against is not None: + if player.has_played_bang: + return False t = player.game.get_player_named(against) player.available_cards = [dict(p, **{'original_target':against}) for p in player.game.get_visible_players(t) if p['name'] != player.name and p['name'] != t.name and p['dist']] if len(player.available_cards) > 0: @@ -156,15 +158,15 @@ class Mira(Card): def __init__(self, suit, number): super().__init__(suit, 'Mira', number) self.icon = '👌🏻' + self.need_with_only = 'Bang' self.alt_text = "💥🃏💔💔" self.need_target = True self.need_with = True def play_card(self, player, against, _with=None): - if against is not None: - #TODO - # super().play_card(player, against=against) - # player.game.attack(player, against, card_name=self.name) + if against is not None and _with is not None: + super().play_card(player, against=against) + player.game.attack(player, against, card_name=self.name) return True return False @@ -226,7 +228,7 @@ def get_starting_deck() -> List[Card]: # Salvo(Suit.HEARTS, 5), Bandidos(Suit.DIAMONDS,'Q'), # gli altri giocatori scelgono se scartare 2 carte o perdere 1 punto vita Fuga(Suit.HEARTS, 3), # evita l'effetto di carte marroni (tipo panico cat balou) di cui sei bersaglio - # Mira(Suit.CLUBS, 6), + Mira(Suit.CLUBS, 6), Poker(Suit.HEARTS, 'J'), # tutti gli altri scartano 1 carta a scelta, se non ci sono assi allora pesca 2 RitornoDiFiamma(Suit.CLUBS, 'Q'), # un mancato che fa bang Tornado(Suit.CLUBS, "A"), diff --git a/backend/bang/players.py b/backend/bang/players.py index b5a01e3..86051f0 100644 --- a/backend/bang/players.py +++ b/backend/bang/players.py @@ -1181,9 +1181,9 @@ class Player: for i in range(len(self.equipment)): if self.equipment[i].can_be_used_now: print('usable', self.equipment[i]) - if not self.game.is_competitive and not any((isinstance(c, cs.Barile) for c in self.equipment)) and not self.character.check(self.game, chars.Jourdonnais)\ + if (not self.game.is_competitive and not any((isinstance(c, cs.Barile) for c in self.equipment)) and not self.character.check(self.game, chars.Jourdonnais)\ and not any(((isinstance(c, cs.Mancato) and c.can_be_used_now) or (self.character.check(self.game, chars.CalamityJanet) and isinstance(c, cs.Bang)) or self.character.check(self.game, chd.ElenaFuente) for c in self.hand))\ - and not any((c.can_be_used_now and isinstance(c, cs.Mancato) for c in self.equipment)) and not self.can_escape(card_name): + and not any((c.can_be_used_now and isinstance(c, cs.Mancato) for c in self.equipment)) and not self.can_escape(card_name)) or card_name=='Mira': print('Cant defend') if not no_dmg: self.take_damage_response() diff --git a/frontend/src/components/Player.vue b/frontend/src/components/Player.vue index 92554a5..1e96ac7 100644 --- a/frontend/src/components/Player.vue +++ b/frontend/src/components/Player.vue @@ -62,7 +62,7 @@ - + @@ -327,7 +327,7 @@ export default { let cantBePlayed = false let calamity_special = (x.name === 'Mancato!' && this.character.name === 'Calamity Janet') let cant_play_bang = (this.has_played_bang && this.equipment.filter(x => x.name == 'Volcanic').length == 0) - if ((x.name == 'Bang!' || (calamity_special && x.name=='Mancato!')) && (cant_play_bang || (this.eventCard && this.eventCard.name == "Sermone"))) cantBePlayed = true; + if ((x.name == 'Bang!' || x.name == 'Sventagliata' || (calamity_special && x.name=='Mancato!')) && (cant_play_bang || (this.eventCard && this.eventCard.name == "Sermone"))) cantBePlayed = true; else if (this.eventCard && this.eventCard.name == "Il Giudice" && (x.is_equipment || !x.can_be_used_now)) cantBePlayed = true; else if (this.eventCard && this.eventCard.name == "Il Reverendo" && (x.name == "Birra")) cantBePlayed = true; else if (this.need_with && this.hand.length === 1) cantBePlayed = true;