diff --git a/backend/bang/expansions/fistful_of_cards/card_events.py b/backend/bang/expansions/fistful_of_cards/card_events.py index 59d3ec8..01dd366 100644 --- a/backend/bang/expansions/fistful_of_cards/card_events.py +++ b/backend/bang/expansions/fistful_of_cards/card_events.py @@ -7,93 +7,93 @@ class CardEvent(ABC): class Agguato(CardEvent): def __init__(self): - super().__init__('Agguato', '🛁') - self.desc = 'La distanza base di tra 2 qualsiasi giocatori è 1' - self.desc_eng = 'The base distance from any 2 players is 1' + super().__init__("Agguato", "🛁") + self.desc = "La distanza base di tra 2 qualsiasi giocatori è 1" + self.desc_eng = "The base distance from any 2 players is 1" class Cecchino(CardEvent): def __init__(self): #TODO - super().__init__('Cecchino', '👁') - self.desc = 'Nel proprio turno i giocatori possono scartare 2 Bang assieme per sparare un bang a cui servono 2 mancato' - self.desc_eng = 'During their turn, players can discard 2 Bang! to shoot a bang that requires 2 missed' + super().__init__("Cecchino", "👁") + self.desc = "Nel proprio turno i giocatori possono scartare 2 Bang assieme per sparare un bang a cui servono 2 mancato" + self.desc_eng = "During their turn, players can discard 2 Bang! to shoot a bang that requires 2 missed" class DeadMan(CardEvent): def __init__(self): - super().__init__('Dead Man', '⚰️') - self.desc = 'Al proprio turno il giocatore che è morto per primo torna in vita con 2 vite e 2 carte' - self.desc_eng = 'The first player that died return back to life with 2 hp and 2 cards' + super().__init__("Dead Man", "⚰️") + self.desc = "Al proprio turno il giocatore che è morto per primo torna in vita con 2 vite e 2 carte" + self.desc_eng = "The first player that died return back to life with 2 hp and 2 cards" class FratelliDiSangue(CardEvent): def __init__(self):#TODO - super().__init__('Fratelli Di Sangue', '💉') - self.desc = 'All\'inizio del proprio turno i giocatori possono perdere 1 vita per darla a un altro giocatore' - self.desc_eng = 'At the begin of their turn, payers can lose 1 hp to give it to another player' + super().__init__("Fratelli Di Sangue", "💉") + self.desc = "All'inizio del proprio turno i giocatori possono perdere 1 vita per darla a un altro giocatore" + self.desc_eng = "At the begin of their turn, payers can lose 1 hp to give it to another player" class IlGiudice(CardEvent): def __init__(self): - super().__init__('Il Giudice', '👨‍⚖️') - self.desc = 'Non si possono equipaggiare carte a se stessi o agli altri' - self.desc_eng = 'You can\'t equip cards on your or other players' + super().__init__("Il Giudice", "👨‍⚖️") + self.desc = "Non si possono equipaggiare carte a se stessi o agli altri" + self.desc_eng = "You can't equip cards on your or other players" class Lazo(CardEvent): def __init__(self): - super().__init__('Lazo', '📿') - self.desc = 'Le carte equipaggiate non hanno effetto' - self.desc_eng = 'Cards in the equipment slot do not work' + super().__init__("Lazo", "📿") + self.desc = "Le carte equipaggiate non hanno effetto" + self.desc_eng = "Cards in the equipment slot do not work" class LeggeDelWest(CardEvent): def __init__(self): - super().__init__('Legge Del West', '⚖️') - self.desc = 'I giocatori mostrano la seconda carta che pescano e sono obbligati a usarla in quel turno (se possibile)' - self.desc_eng = 'Every player shows the second card that they draw and must use it in that round' + super().__init__("Legge Del West", "⚖️") + self.desc = "I giocatori mostrano la seconda carta che pescano e sono obbligati a usarla in quel turno (se possibile)" + self.desc_eng = "Every player shows the second card that they draw and must use it in that round" class LiquoreForte(CardEvent): def __init__(self): - super().__init__('Liquore Forte', '🥃') - self.desc = 'I giocatori possono evitare di pescare per recuperare 1 vita (clicca sulla carta evento per farlo)' - self.desc_eng = 'Players can skip drawing to regain 1 HP (click on the event card to use)' + super().__init__("Liquore Forte", "🥃") + self.desc = "I giocatori possono evitare di pescare per recuperare 1 vita (clicca sulla carta evento per farlo)" + self.desc_eng = "Players can skip drawing to regain 1 HP (click on the event card to use)" class MinieraAbbandonata(CardEvent): def __init__(self):#TODO - super().__init__('Miniera Abbandonata', '⛏') - self.desc = 'I giocatori pescano dagli scarti e scartano in cima al mazzo' - self.desc_eng = 'Players draw from the discarded pile and discard to the deck' + super().__init__("Miniera Abbandonata", "⛏") + self.desc = "I giocatori pescano dagli scarti e scartano in cima al mazzo" + self.desc_eng = "Players draw from the discarded pile and discard to the deck" class PerUnPugnoDiCarte(CardEvent): def __init__(self):#TODO - super().__init__('Per Un Pugno Di Carte', '🎴') - self.desc = 'Il giocatore subisce tanti bang quante carte ha in mano' - self.desc_eng = 'On his turn the player is target of as many Bang as how many cards he has in his hand' + super().__init__("Per Un Pugno Di Carte", "🎴") + self.desc = "Il giocatore subisce tanti bang quante carte ha in mano" + self.desc_eng = "On his turn the player is target of as many Bang as how many cards he has in his hand" class Peyote(CardEvent): def __init__(self):#TODO - super().__init__('Peyote', '🌵') - self.desc = 'Invece che pescare il giocatore prova a indovinare il colore del seme, se lo indovina continua' - self.desc_eng = 'Instead of drawing, the player tries to guess the color of the suit, if he\'s right he repeats' + super().__init__("Peyote", "🌵") + self.desc = "Invece che pescare il giocatore prova a indovinare il colore del seme, se lo indovina continua" + self.desc_eng = "Instead of drawing, the player tries to guess the color of the suit, if he's right he repeats" class Ranch(CardEvent): def __init__(self):#TODO - super().__init__('Ranch', '🐮') - self.desc = 'Dopo aver pescato il giocatore può scartare quante carte vuole dalla mano e pescarne altrettante dal mazzo' - self.desc_eng = 'After drawing, the player can discard as many cards as he wants from his hand and draw as many from the deck' + super().__init__("Ranch", "🐮") + self.desc = "Dopo aver pescato il giocatore può scartare quante carte vuole dalla mano e pescarne altrettante dal mazzo" + self.desc_eng = "After drawing, the player can discard as many cards as he wants from his hand and draw as many from the deck" class Rimbalzo(CardEvent): def __init__(self):#TODO - super().__init__('Rimbalzo', '⏮') - self.desc = 'Il giocatore di turno può giocare bang contro le carte equipaggiate dagli altri giocatori, se non giocano mancato vengono scartate' - self.desc_eng = 'The player can play bang against the cards equipped by the other players, if they do not play miss they are discarded' + super().__init__("Rimbalzo", "⏮") + self.desc = "Il giocatore di turno può giocare bang contro le carte equipaggiate dagli altri giocatori, se non giocano mancato vengono scartate" + self.desc_eng = "The player can play bang against the cards equipped by the other players, if they do not play miss they are discarded" class RouletteRussa(CardEvent): def __init__(self):#TODO - super().__init__('Roulette Russa', '🇷🇺') - self.desc = 'A partire dallo sceriffo, ogni giocatore scarta 1 mancato, il primo che non lo fa perde 2 vite' - self.desc_eng = 'Starting from the sheriff, every player discards 1 missed, the first one that doesn\'t loses 2 HP' + super().__init__("Roulette Russa", "🇷🇺") + self.desc = "A partire dallo sceriffo, ogni giocatore scarta 1 mancato, il primo che non lo fa perde 2 vite" + self.desc_eng = "Starting from the sheriff, every player discards 1 missed, the first one that doesn't loses 2 HP" class Vendetta(CardEvent): def __init__(self): - super().__init__('Vendetta', '😤') - self.desc = 'Alla fine del proprio turno il giocatore estrae, se esce ♥️ gioca un altro turno' - self.desc_eng = 'When ending the turn, the player flips a card, if it\'s ♥️ he plays another turn' + super().__init__("Vendetta", "😤") + self.desc = "Alla fine del proprio turno il giocatore estrae, se esce ♥️ gioca un altro turno" + self.desc_eng = "When ending the turn, the player flips a card, if it's ♥️ he plays another turn" def get_all_events(): return [ @@ -107,7 +107,7 @@ def get_all_events(): LiquoreForte(), # MinieraAbbandonata(), # PerUnPugnoDiCarte(), - # Peyote(), + Peyote(), # Ranch(), # Rimbalzo(), # RouletteRussa(), diff --git a/backend/bang/players.py b/backend/bang/players.py index bfdea52..0e2d65a 100644 --- a/backend/bang/players.py +++ b/backend/bang/players.py @@ -146,6 +146,14 @@ class Player: self.sio.emit('notify_card', room=self.sid, data=mess) def notify_self(self): + if self.pending_action == PendingAction.DRAW and self.game.check_event(ce.Peyote): + self.available_cards = [{ + 'icon': '🔴' + },{ + 'icon': '⚫' + }] + self.is_drawing = True + self.pending_action = PendingAction.CHOOSE if isinstance(self.character, chars.CalamityJanet): if cs.Mancato(0, 0).name not in self.expected_response: self.expected_response.append(cs.Mancato(0, 0).name) @@ -486,6 +494,19 @@ class Player: while self.target_p == self.name or len(self.game.players[self.game.players_map[self.target_p]].hand) + len(self.game.players[self.game.players_map[self.target_p]].equipment) == 0: self.target_p = self.game.players[self.game.players_map[self.target_p]+1].name self.notify_self() + elif self.is_drawing and self.game.check_event(ce.Peyote): + self.is_drawing = False + card = self.game.deck.draw() + self.hand.append(card) + self.sio.emit('chat_message', room=self.game.name, data=f"_guess|{self.name}|{self.available_cards[card_index]['icon']}") + self.available_cards = [] + if card_index == card.suit%2: + self.sio.emit('chat_message', room=self.game.name, data=f"_guess_right|{self.name}") + self.pending_action = PendingAction.DRAW + else: + self.sio.emit('chat_message', room=self.game.name, data=f"_guess_wrong|{self.name}") + self.pending_action = PendingAction.PLAY + self.notify_self() # specifico per personaggio elif self.is_drawing and isinstance(self.character, chars.KitCarlson): self.hand.append(self.available_cards.pop(card_index)) diff --git a/frontend/src/i18n/en.json b/frontend/src/i18n/en.json index b8a782e..5b780f3 100644 --- a/frontend/src/i18n/en.json +++ b/frontend/src/i18n/en.json @@ -80,7 +80,10 @@ "special_bart_cassidy": "{0} received a compensation because he was injured.", "special_el_gringo": "{0} stole a card from {1} when he was was injured.", "special_calamity": "{0} played {1} as Bang! against {2}.", - "allroles": "In the game there are: {0}." + "allroles": "In the game there are: {0}.", + "guess": "{0} guesses {1}.", + "guess_right": "{0} was right.", + "guess_wrong": "{0} was wrong." }, "foc": { "leggedelwest": "He must play this card on this turn if possible." diff --git a/frontend/src/i18n/it.json b/frontend/src/i18n/it.json index 720945b..9eaa065 100644 --- a/frontend/src/i18n/it.json +++ b/frontend/src/i18n/it.json @@ -80,7 +80,10 @@ "special_bart_cassidy": "{0} ha ricevuto un risarcimento perchè è stato ferito.", "special_el_gringo": "{0} rubato una carta a {1} mentre veniva colpito.", "special_calamity": "{0} ha giovato {1} come un Bang! contro {2}.", - "allroles": "Nella partita ci sono: {0}." + "allroles": "Nella partita ci sono: {0}.", + "guess": "{0} pensa sia {1}.", + "guess_right": "{0} ha indovinato.", + "guess_wrong": "{0} ha sbagliato." }, "foc": { "leggedelwest": "Ed è obbligato a usarla nel suo turno, se possibile"