diff --git a/backend/bang/expansions/fistful_of_cards/card_events.py b/backend/bang/expansions/fistful_of_cards/card_events.py index 7a09cb2..528d3b3 100644 --- a/backend/bang/expansions/fistful_of_cards/card_events.py +++ b/backend/bang/expansions/fistful_of_cards/card_events.py @@ -9,101 +9,101 @@ class Agguato(CardEvent): def __init__(self): super().__init__('Agguato', '🛁') self.desc = 'La distanza base di tra 2 qualsiasi giocatori è 1' - self.desc_eng = '' + 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 = '' + 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):#TODO + 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 = '' + 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 = '' + 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 = '' + 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 = '' + self.desc_eng = 'Cards in the equipment slot do not work' class LeggeDelWest(CardEvent): - def __init__(self):#TODO + 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 = '' + 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):#TODO super().__init__('Liquore Forte', '🥃') self.desc = 'I giocatori possono evitare di pescare per recuperare 1 vita' - self.desc_eng = '' + self.desc_eng = 'Players can skip drawing to regain 1 HP' 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 = '' + 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 = '' + 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 = '' + 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 = '' + 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 = '' + 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 = '' + 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 = '' + self.desc_eng = 'When ending the turn, the player flips a card, if it\'s ♥️ he plays another turn' def get_all_events(): return [ Agguato(), # Cecchino(), - # DeadMan(), + DeadMan(), # FratelliDiSangue(), IlGiudice(), Lazo(), - # LeggeDelWest(), + LeggeDelWest(), # LiquoreForte(), # MinieraAbbandonata(), # PerUnPugnoDiCarte(), diff --git a/backend/bang/game.py b/backend/bang/game.py index 187ac8c..dbe8308 100644 --- a/backend/bang/game.py +++ b/backend/bang/game.py @@ -220,6 +220,12 @@ class Game: def play_turn(self): if isinstance(self.players[self.turn].role, roles.Sheriff): self.deck.flip_event() + if self.check_event(ce.DeadMan) and len(self.dead_players) > 0: + self.players.append(self.dead_players.pop(0)) + self.players[-1].lives = 2 + self.players[-1].hand.append(self.deck.draw()) + self.players[-1].hand.append(self.deck.draw()) + self.players[-1].notify_self() self.players[self.turn].play_turn() def next_turn(self): @@ -353,7 +359,7 @@ class Game: def get_visible_players(self, player: players.Player): i = self.players.index(player) sight = player.get_sight() - mindist = 99 if self.check_event(ce.Agguato) else 1 + mindist = 99 if not self.check_event(ce.Agguato) else 1 return [{ 'name': self.players[j].name, 'dist': min([abs(i - j), (i+ abs(j-len(self.players))), (j+ abs(i-len(self.players))), mindist]) + self.players[j].get_visibility() - (player.get_sight(countWeapon=False)-1), diff --git a/backend/bang/players.py b/backend/bang/players.py index 8996653..de65549 100644 --- a/backend/bang/players.py +++ b/backend/bang/players.py @@ -130,14 +130,15 @@ class Player: else: self.set_character(available[randrange(0, len(available))].name) - def notify_card(self, player, card): + def notify_card(self, player, card, message=''): try: card = card.__dict__ except: pass mess = { 'player': player.name, - 'card': card + 'card': card, + 'message':message } print('notifying card') self.sio.emit('notify_card', room=self.sid, data=mess) @@ -331,11 +332,11 @@ class Player: for i in range(2): card: cs.Card = self.game.deck.draw() self.hand.append(card) - if i == 1 and isinstance(self.character, chars.BlackJack): + if i == 1 and isinstance(self.character, chars.BlackJack) or self.game.check_event(ce.LeggeDelWest): for p in self.game.players: if p != self: - p.notify_card(self, card) - if card.suit == cs.Suit.HEARTS or card.suit == cs.Suit.DIAMONDS: + p.notify_card(self, card, 'blackjack_special' if isinstance(self.character, chars.BlackJack) else 'foc.leggedelwest') + if card.suit == cs.Suit.HEARTS or card.suit == cs.Suit.DIAMONDS and isinstance(self.character, chars.BlackJack): self.hand.append(self.game.deck.draw()) if isinstance(self.character, chd.PixiePete): self.hand.append(self.game.deck.draw()) @@ -430,8 +431,6 @@ class Player: print(self.name, 'is playing ', card, ' against:', against, ' with:', _with) did_play_card = False event_blocks_card = (self.game.check_event(ce.IlGiudice) and (card.is_equipment or (card.usable_next_turn and not card.can_be_used_now))) or (self.game.check_event(ce.Lazo) and card.usable_next_turn and card.can_be_used_now) - print('giudice', self.game.check_event(ce.IlGiudice), 'and', card.is_equipment, 'or (', card.usable_next_turn ,'and' ,not card.can_be_used_now) - print('lazo', (self.game.check_event(ce.Lazo) and card.usable_next_turn and card.can_be_used_now)) if not(against != None and isinstance(self.game.get_player_named(against).character, chd.ApacheKid) and card.suit == cs.Suit.DIAMONDS) and not event_blocks_card: did_play_card = card.play_card(self, against, withCard) if not card.is_equipment and not card.usable_next_turn or event_blocks_card: diff --git a/frontend/src/components/Player.vue b/frontend/src/components/Player.vue index 2b28fc9..63c3016 100644 --- a/frontend/src/components/Player.vue +++ b/frontend/src/components/Player.vue @@ -40,7 +40,7 @@ - + diff --git a/frontend/src/i18n/en.json b/frontend/src/i18n/en.json index 515f63d..b8a782e 100644 --- a/frontend/src/i18n/en.json +++ b/frontend/src/i18n/en.json @@ -48,7 +48,7 @@ "play_your_turn": "PLAY YOUR TURN", "you_are": "You are", "did_pick_as": "picked this as second card", - "if_card_red":"If the card is diamonds or hearts, he picks another card.", + "blackjack_special":"If the card is diamonds or hearts, he picks another card.", "choose_scarp_card_to": "CHOOSE WHICH CARD TO DISCARD TO USE", "pick_a_card": "FLIP A CARD", "to_defend_from": "TO DEFEND YOURSELF FROM", @@ -82,6 +82,9 @@ "special_calamity": "{0} played {1} as Bang! against {2}.", "allroles": "In the game there are: {0}." }, + "foc": { + "leggedelwest": "He must play this card on this turn if possible." + }, "mods": "Modifiers", "mod_comp": "Competitive mode (disables automatic take damage)", "disconnect_bot": "Replace players that disconnect with bots", diff --git a/frontend/src/i18n/it.json b/frontend/src/i18n/it.json index 8cec599..720945b 100644 --- a/frontend/src/i18n/it.json +++ b/frontend/src/i18n/it.json @@ -48,7 +48,7 @@ "play_your_turn": "GIOCA IL TUO TURNO", "you_are": "Tu sei", "did_pick_as": "ha pescato come seconda carta", - "if_card_red": "Se la carta è cuori o quadri ne pesca un'altra", + "blackjack_special": "Se la carta è cuori o quadri ne pesca un'altra", "choose_scarp_card_to": "SCEGLI CHE CARTA SCARTARE PER USARE", "pick_a_card": "ESTRAI UNA CARTA", "to_defend_from": "PER DIFENDERTI DA", @@ -82,6 +82,9 @@ "special_calamity": "{0} ha giovato {1} come un Bang! contro {2}.", "allroles": "Nella partita ci sono: {0}." }, + "foc": { + "leggedelwest": "Ed è obbligato a usarla nel suo turno, se possibile" + }, "mods": "Modificatori", "mod_comp": "Modalità competitiva (disattiva il prendi danno automatico)", "disconnect_bot": "Sostituisci i giocatori che si disconnettono con bot",