From 30b3e826a02ce5420fe00ae84b28e861cbb2fc26 Mon Sep 17 00:00:00 2001 From: Alberto Xamin Date: Sat, 7 Jan 2023 12:03:23 +0000 Subject: [PATCH] add shotgun --- backend/bang/expansions/the_valley_of_shadows/cards.py | 3 +-- backend/bang/players.py | 4 ++++ frontend/src/components/Player.vue | 2 +- frontend/src/i18n/en.json | 3 ++- frontend/src/i18n/it.json | 3 ++- 5 files changed, 10 insertions(+), 5 deletions(-) diff --git a/backend/bang/expansions/the_valley_of_shadows/cards.py b/backend/bang/expansions/the_valley_of_shadows/cards.py index 8c90d0b..b212d7f 100644 --- a/backend/bang/expansions/the_valley_of_shadows/cards.py +++ b/backend/bang/expansions/the_valley_of_shadows/cards.py @@ -56,7 +56,6 @@ class Shotgun(Card): def __init__(self, suit, number): super().__init__(suit, 'Shotgun', number, is_equipment=True, is_weapon=True, range=1) self.icon = '🔫' # Ogni volta che colpisci un giocatore deve scartare una carta - #TODO class Taglia(Card): def __init__(self, suit, number): @@ -196,7 +195,7 @@ def get_starting_deck() -> List[Card]: Fantasma(Suit.SPADES, 10), # Lemat(Suit.DIAMONDS, 4), SerpenteASonagli(Suit.HEARTS, 7), - # Shotgun(Suit.SPADES, 'K'), + Shotgun(Suit.SPADES, 'K'), # Taglia(Suit.CLUBS, 9), UltimoGiro(Suit.DIAMONDS, 8), Tomahawk(Suit.DIAMONDS, 'A'), diff --git a/backend/bang/players.py b/backend/bang/players.py index 269e3b5..28fe61b 100644 --- a/backend/bang/players.py +++ b/backend/bang/players.py @@ -1152,6 +1152,10 @@ class Player: self.sio.emit('chat_message', room=self.game.name, data=f'_special_el_gringo|{self.name}|{self.attacker.name}') self.attacker.notify_self() + if self.attacker and len(self.hand) > 0 and any((isinstance(c, tvosc.Shotgun) for c in self.attacker.equipment)): + c = self.hand.pop(randrange(0, len(self.hand))) + self.game.deck.scrap(c, True) + self.sio.emit('chat_message', room=self.game.name, data=f'_shotgun_scrap|{self.name}|{c.name}') if self.attacker and 'gold_rush' in self.game.expansions: if (isinstance(self.attacker, Player)): self.attacker.gold_nuggets += 1 diff --git a/frontend/src/components/Player.vue b/frontend/src/components/Player.vue index c673afd..f29f459 100644 --- a/frontend/src/components/Player.vue +++ b/frontend/src/components/Player.vue @@ -54,7 +54,7 @@ - + diff --git a/frontend/src/i18n/en.json b/frontend/src/i18n/en.json index 6f362d2..e0e00b9 100644 --- a/frontend/src/i18n/en.json +++ b/frontend/src/i18n/en.json @@ -132,7 +132,8 @@ "UnionPacific": "{0} played Union Pacific and draws 4 cards from the deck", "use_special": "{0} used the special ability of their character ({1})", "gold_rush_pay_discard": "{0} discarded {2} from {1}.", - "choose_emporio": "{0} has chosen {1} from General Store." + "choose_emporio": "{0} has chosen {1} from General Store.", + "shotgun_scrap": "When the shotgun hit {0} a card flew away from his hand ({1})" }, "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 a90b083..0a84ce6 100644 --- a/frontend/src/i18n/it.json +++ b/frontend/src/i18n/it.json @@ -132,7 +132,8 @@ "UnionPacific": "{0} ha giocato Union Pacific e ha pescato 4 carte.", "use_special": "{0} ha usato l'abilità speciale del suo personaggio ({1})", "gold_rush_pay_discard": "{0} ha fatto scartare {2} a {1}.", - "choose_emporio": "{0} ha scelto {1} da Emporio." + "choose_emporio": "{0} ha scelto {1} da Emporio.", + "shotgun_scrap": "Quando lo shotgun ha colpito {0} gli ha tolto una carta ({1})" }, "foc": { "leggedelwest": "Ed è obbligato a usarla nel suo turno, se possibile"