From 6913832c971895c6ae9ea12b8146ff984c56a1fb Mon Sep 17 00:00:00 2001 From: Alberto Xamin Date: Sun, 31 Jan 2021 16:49:38 +0100 Subject: [PATCH 1/6] started working on help --- frontend/src/components/Help.vue | 132 +++++++++++++++++++++++++++++++ frontend/src/router/index.js | 5 ++ 2 files changed, 137 insertions(+) create mode 100644 frontend/src/components/Help.vue diff --git a/frontend/src/components/Help.vue b/frontend/src/components/Help.vue new file mode 100644 index 0000000..5e86465 --- /dev/null +++ b/frontend/src/components/Help.vue @@ -0,0 +1,132 @@ + + + \ No newline at end of file diff --git a/frontend/src/router/index.js b/frontend/src/router/index.js index 0ce5d3b..e9dcde0 100644 --- a/frontend/src/router/index.js +++ b/frontend/src/router/index.js @@ -9,6 +9,11 @@ const routes = [ name: 'Game', component: () => import(/* webpackChunkName: "game" */ '../components/Lobby.vue') }, + { + path: '/help', + name: 'Help', + component: () => import(/* webpackChunkName: "helep" */ '../components/Help.vue') + }, { path: '/', name: 'Home', From 2e218763a7f70c2b903f035086fc4d6598bd9052 Mon Sep 17 00:00:00 2001 From: Alberto Xamin Date: Sun, 31 Jan 2021 17:18:29 +0100 Subject: [PATCH 2/6] more help info --- frontend/src/components/Help.vue | 72 ++++++++++++++++---------------- 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/frontend/src/components/Help.vue b/frontend/src/components/Help.vue index 5e86465..5a81d7f 100644 --- a/frontend/src/components/Help.vue +++ b/frontend/src/components/Help.vue @@ -7,16 +7,16 @@

Ruoli

Turni

-

Si inizia sempre dallo Sceriffo, e il gioco prosegue in senso orario, i turni sono divisi in 3 fasi.

+

Si inizia sempre dallo Sceriffo ⭐️, e il gioco prosegue in senso orario, i turni sono divisi in 3 fasi.

    -
  1. Pesca 2 carte

  2. -
  3. Gioca un numero qualsiasi di carte

  4. +
  5. Pesca 2 carte ⏬️

  6. +
  7. Gioca un numero qualsiasi di carte ▶️

  8. Scarta le carte in eccesso

Pescare le carte

@@ -29,36 +29,36 @@

Giocare le carte

-Now you may play cards to help yourself or hurt the other players, trying -to eliminate them. You can only play cards during your turn (exception: -Missed! and Beer, see below). You are not forced to play cards during this -phase. You can play any number of cards; there are only three limitations: -• you can play only 1 BANG! card per turn; -(this applies only to BANG! cards, not to cards with the symbol ) -• you can have only 1 copy of any one card in play; -(one card is a copy of another if they have the same name) -• you can have only 1 weapon in play. -(when you play a new weapon, discard the one you have in play) -Example. If you put a Barrel in play, you cannot play another one, since you -would end up having two copies of the same card in front of you. -There are two types of cards: brown-bordered cards (= play and discard) and -blue-bordered cards (= weapons and other objects). -Brown-bordered cards are played by putting -them directly into the discard pile and applying -the effect described with text or with symbols on -the cards (illustrated in the next paragraphs). -Blue-bordered cards are played face up in front -of you (exception: Jail). Blue cards in front of -you are hence defined to be “in play”. The effect -of these cards lasts until they are discarded or -removed somehow (e.g. through the play of a Cat -Balou), or a special event occurs (e.g. in the case of Dynamite). There -is no limit on the cards you can have in front of you provided that they do -not share the same name. -

Scartare

-

Quando hai terminato di giocare le tue carte, ovvero quando non vuoi o non puoi giocare altre carte, devi scartare le carte che eccedono il tuo numero di vite attuali. -Dopodichè passi il turno al giocatore successivo cliccando su termina turno.

+

Puoi giocare le tue carte per te oppure per recare danno agli altri giocatori cercando di eliminarli.

+

Puoi giocare le carte solo nel tuo turno. Ad eccezzione delle carte usate come risposta tipo i mancato 😅️.

+

Non sei obblicato a giocare carte.

+

Ci sono solo 3 limitazioni:

+ +

Scartare

+

Quando hai terminato di giocare le tue carte, ovvero quando non vuoi o non puoi giocare altre carte, devi scartare le carte che eccedono il tuo numero di vite attuali. + Dopodichè passi il turno al giocatore successivo cliccando su termina turno.

+

Distanza

+

La distanza viene calcolata automaticamente dal gioco e corrisponde al percorso minimo tra la sinistra e la destra del giocatore.

+

La morte di un giocatore

+

Quando perdi l'ultimo punto vita e non hai una birra 🍺️ in mano, muori. Le tue carte vengono scartate e il tuo ruolo rivelato a tutti.

+

Penalità e ricompense

+
    +
  • Se lo sceriffo ⭐️ uccide un vice perde tutte le carte in mano e in gioco davanti a se.

  • +
  • Chiunque uccida un fuorilegge 🐺️ pesca 3 carte dal mazzo (anche altri fuorilegge 🐺️).

  • +
+

Fine del gioco

+

Il gioco termina quando una delle seguenti condizioni si verifica:

+
    +
  • Lo sceriffo ⭐️ muore. Se il rinnegato 🦅️ è l'ultimo giocatore in vita vince, altrimenti vincono i fuorilegge.

  • +
  • Tutti i fuorilegge 🐺️ e i rinnegati 🦅️ sono morti. In tal caso vincono lo sceriffo ⭐️ e i vice 🎖️.

  • +
+

Le carte

+ diff --git a/frontend/src/components/Player.vue b/frontend/src/components/Player.vue index d0205d0..bda14c5 100644 --- a/frontend/src/components/Player.vue +++ b/frontend/src/components/Player.vue @@ -6,7 +6,7 @@ + @pointerenter.native="setDesc(character)" @pointerleave.native="desc=''"/> ❤️ 💀 @@ -161,8 +161,8 @@ export default { } }, self_vis(vis) { - console.log('received visibility update') - console.log(vis) + // console.log('received visibility update') + // console.log(vis) this.playersDistances = JSON.parse(vis) }, notify_card(mess) { diff --git a/frontend/src/i18n/en.json b/frontend/src/i18n/en.json index 0c0b768..92417fb 100644 --- a/frontend/src/i18n/en.json +++ b/frontend/src/i18n/en.json @@ -292,6 +292,130 @@ "Howitzer": { "name": "Howitzer", "desc": "Shoot all the other players" + }, + "Bart Cassidy": { + "name": "Bart Cassidy", + "desc": "Each time he is hurt, he draws a card" + }, + "Black Jack": { + "name": "Black Jack", + "desc": "At the beginning of his turn, when he has to draw, he shows everyone the second card, if it is Hearts or Diamonds he draws a third card without showing it" + }, + "Calamity Janet": { + "name": "Calamity Janet", + "desc": "She can use the Missed! as Bang! and the other way around" + }, + "El Gringo": { + "name": "El Gringo", + "desc": "Each time he is hurt, he draws a card from the hand of the attacking player" + }, + "Jesse Jones": { + "name": "Jesse Jones", + "desc": "When he has to draw his cards, he may draw the first card from the hand of another player" + }, + "Jourdonnais": { + "name": "Jourdonnais", + "desc": "He plays as he had a Barrel always active, if he equips another Barrel, he can flip 2 cards" + }, + "Kit Carlson": { + "name": "Kit Carlson", + "desc": "When he has to draw, he peeks 3 cards and chooses 2, putting the other card on the top of the deck" + }, + "Lucky Duke": { + "name": "Lucky Duke", + "desc": "Every time he has to flip a card, he can flip 2 times" + }, + "Paul Regret": { + "name": "Paul Regret", + "desc": "The other players see him at distance +1" + }, + "Pedro Ramirez": { + "name": "Pedro Ramirez", + "desc": "When he has to draw, he may pick the first card from the discarded cards" + }, + "Rose Doolan": { + "name": "Rose Doolan", + "desc": "She sees the other players at distance -1" + }, + "Sid Ketchum": { + "name": "Sid Ketchum", + "desc": "He can discard 2 cards to regain 1HP" + }, + "Slab The Killer": { + "name": "Slab The Killer", + "desc": "To dodge his Bang! cards other players need 2 Missed!" + }, + "Suzy Lafayette": { + "name": "Suzy Lafayette", + "desc": "Whenever she has an empty hand, she draws a card" + }, + "Vulture Sam": { + "name": "Vulture Sam", + "desc": "When a player dies, he gets all the cards in the dead's hand and equipments" + }, + "Willy The Kid": { + "name": "Willy The Kid", + "desc": "He doesn't have limits to the amounts of bang he can use" + }, + "Pixie Pete": { + "name": "Pixie Pete", + "desc": "He draws 3 cards instead of 2" + }, + "Tequila Joe": { + "name": "Tequila Joe", + "desc": "When he plays Beer, he regains 2 Health Points" + }, + "Greg Digger": { + "name": "Greg Digger", + "desc": "Whenever a player dies, he regains up to 2 lives" + }, + "Herb Hunter": { + "name": "Herb Hunter", + "desc": "Whenever a player dies, he draws 2 cards" + }, + "Elena Fuente": { + "name": "Elena Fuente", + "desc": "She can use any card of her hand as missed" + }, + "Bill Noface": { + "name": "Bill Noface", + "desc": "Draw 1 card + 1 card for each wound he has" + }, + "Molly Stark": { + "name": "Molly Stark", + "desc": "When she uses a card from her hand outside her turn, she draws a card." + }, + "Apache Kid": { + "name": "Apache Kid", + "desc": "Cards of diamonds ♦️ played against him, do no have effect (doesn't work in duels)." + }, + "Sean Mallory": { + "name": "Sean Mallory", + "desc": "He can keep up to 10 cards in his hand when ending the turn." + }, + "Belle Star": { + "name": "Belle Star", + "desc": "During her turn the green cards of the other players do not work." + }, + "Vera Custer": { + "name": "Vera Custer", + "desc": "Before drawing, she may choose the special ability on another alive player. This ability is used until next turn." + }, + "Chuck Wengam": { + "name": "Chuck Wengam", + "desc": "On his turn he may decide to lose 1 HP to draw 2 cards from the deck." + }, + "Pat Brennan": { + "name": "Pat Brennan", + "desc": "Instead of drawing he can steal a card from the equipment of another player." + }, + "José Delgrado": { + "name": "José Delgrado", + "desc": "He can discard a blue card to draw 2 cards." + }, + "Doc Holyday": { + "name": "Doc Holyday", + "desc": "He can discard 2 cards to play a bang." } }, "help": { @@ -315,7 +439,7 @@ "playerdeath": "The death of a player", "playingcards": "Play the cards", "playingdmg": "You can play your cards for yourself or to harm other players by trying to eliminate them.", - "playingduringturn": "You can only play the cards on your turn. \nWith the exception of cards used as an answer such as Missed 😅️.", + "playingduringturn": "You can only play the cards on your turn. To play cards, click on the cards from you hand.\nWith the exception of cards used as an answer such as Missed 😅️.", "playingifyouwant": "You are not required to play cards.", "playlimit": "There are only 3 limitations:", "playonlyonebang": "You can only play 1 Bang! \nper turn (refers only to cards named Bang!)", @@ -333,6 +457,8 @@ "renegade": "Renegade", "vice": "Deputy", "outlaw": "Outlaw", - "sheriff": "Sheriff" + "sheriff": "Sheriff", + "allcharacters": "All characters", + "gotoallcharacters": "Jump to all characters" } } diff --git a/frontend/src/i18n/it.json b/frontend/src/i18n/it.json index 00eed4e..f987a78 100644 --- a/frontend/src/i18n/it.json +++ b/frontend/src/i18n/it.json @@ -292,6 +292,130 @@ "Howitzer": { "name": "Howitzer", "desc": "Spara a tutti gli altri giocatori" + }, + "Bart Cassidy": { + "name": "Bart Cassidy", + "desc": "Ogni volta che viene ferito, pesca una carta" + }, + "Black Jack": { + "name": "Black Jack", + "desc": "All'inizio del suo turno, quando deve pescare, mostra a tutti la seconda carta, se è Cuori o Quadri pesca una terza carta senza farla vedere" + }, + "Calamity Janet": { + "name": "Calamity Janet", + "desc": "Può usare i Mancato! come Bang! e viceversa" + }, + "El Gringo": { + "name": "El Gringo", + "desc": "Ogni volta che perde un punto vita pesca una carta dalla mano del giocatore responsabile ma solo se il giocatore in questione ha carte in mano (una carta per ogni punto vita)" + }, + "Jesse Jones": { + "name": "Jesse Jones", + "desc": "All'inizio del suo turno, quando deve pescare, può prendere la prima carta a caso dalla mano di un giocatore e la seconda dal mazzo" + }, + "Jourdonnais": { + "name": "Jourdonnais", + "desc": "Gioca come se avesse un Barile sempre attivo, nel caso in cui metta in gioco un Barile 'Reale' può estrarre due volte" + }, + "Kit Carlson": { + "name": "Kit Carlson", + "desc": "All'inizio del suo turno, quando deve pescare, pesca tre carte, ne sceglie due da tenere in mano e la rimanente la rimette in cima la mazzo" + }, + "Lucky Duke": { + "name": "Lucky Duke", + "desc": "Ogni volta che deve estrarre, prende due carte dal mazzo, sceglie una delle due carte per l'estrazione, infine le scarta entrambe" + }, + "Paul Regret": { + "name": "Paul Regret", + "desc": "Gioca come se avesse una Mustang sempre attiva, nel caso in cui metta in gioco una Mustang 'Reale' l'effetto si somma tranquillamente" + }, + "Pedro Ramirez": { + "name": "Pedro Ramirez", + "desc": "All'inizio del suo turno, quando deve pescare, può prendere la prima carta dalla cima degli scarti e la seconda dal mazzo" + }, + "Rose Doolan": { + "name": "Rose Doolan", + "desc": "Gioca come se avesse un Mirino sempre attivo, nel caso in cui metta in gioco una Mirino 'Reale' l'effetto si somma tranquillamente" + }, + "Sid Ketchum": { + "name": "Sid Ketchum", + "desc": "Può scartare due carte per recuperare un punto vita anche più volte di seguito a patto di avere carte da scartare, può farlo anche nel turno dell'avversario se starebbe per morire" + }, + "Slab The Killer": { + "name": "Slab The Killer", + "desc": "Per evitare i suoi Bang servono due Mancato, un eventuale barile vale solo come un Mancato" + }, + "Suzy Lafayette": { + "name": "Suzy Lafayette", + "desc": "Appena rimane senza carte in mano pesca immediatamente una carta dal mazzo" + }, + "Vulture Sam": { + "name": "Vulture Sam", + "desc": "Quando un personaggio viene eliminato prendi tutte le carte di quel giocatore e aggiungile alla tua mano, sia le carte in mano che quelle in gioco" + }, + "Willy The Kid": { + "name": "Willy The Kid", + "desc": "Questo personaggio può giocare quanti bang vuole nel suo turno" + }, + "Pixie Pete": { + "name": "Pixie Pete", + "desc": "All'inizio del turno pesca 3 carte invece che 2" + }, + "Tequila Joe": { + "name": "Tequila Joe", + "desc": "Se gioca la carta Birra recupera 2 vite invece che una sola" + }, + "Greg Digger": { + "name": "Greg Digger", + "desc": "Quando un giocatore muore, recupera fino a 2 vite" + }, + "Herb Hunter": { + "name": "Herb Hunter", + "desc": "Quando un giocatore muore, pesca 2 carte" + }, + "Elena Fuente": { + "name": "Elena Fuente", + "desc": "Può usare una carta qualsiasi nella sua mano come mancato" + }, + "Bill Noface": { + "name": "Bill Noface", + "desc": "All'inizio del turno pesca 1 carta + 1 carta per ogni ferita che ha" + }, + "Molly Stark": { + "name": "Molly Stark", + "desc": "Quando usa volontariamente una carta che ha in mano, fuori dal suo turno, ne ottiene un'altra dal mazzo" + }, + "Apache Kid": { + "name": "Apache Kid", + "desc": "Le carte di quadri ♦️ giocate contro di lui non hanno effetto (non vale durante i duelli)" + }, + "Sean Mallory": { + "name": "Sean Mallory", + "desc": "Quando finisce il suo turno può tenere fino a 10 carte in mano" + }, + "Belle Star": { + "name": "Belle Star", + "desc": "Nel suo turno le carte verdi degli altri giocatori non hanno effetto." + }, + "Vera Custer": { + "name": "Vera Custer", + "desc": "Prima di pescare le sue carte può scegliere l'abilità speciale di un altro giocatore fino al prossimo turno." + }, + "Chuck Wengam": { + "name": "Chuck Wengam", + "desc": "Durante il suo turno può perdere una vita per pescare 2 carte dal mazzo." + }, + "Pat Brennan": { + "name": "Pat Brennan", + "desc": "Invece di pescare può prendere una carta dall'equipaggiamento di un altro giocatore." + }, + "José Delgrado": { + "name": "José Delgrado", + "desc": "Può scartare una carta blu per pescare 2 carte." + }, + "Doc Holyday": { + "name": "Doc Holyday", + "desc": "Nel suo turno può scartare 2 carte per fare un bang." } }, "help": { @@ -308,7 +432,7 @@ "drawinstructions": "Per pescare le carte dovrai cliccare sul mazzo quando vedi questa animazione.", "playingcards": "Giocare le carte", "playingdmg": "Puoi giocare le tue carte per te oppure per recare danno agli altri giocatori cercando di eliminarli.", - "playingduringturn": "Puoi giocare le carte solo nel tuo turno. Ad eccezzione delle carte usate come risposta tipo i mancato 😅️.", + "playingduringturn": "Puoi giocare le carte solo nel tuo turno. Per giocarle, clicca sulle carte nella tua mano.\nAd eccezzione delle carte usate come risposta tipo i mancato 😅️. ", "playingifyouwant": "Non sei obblicato a giocare carte.", "playlimit": "Ci sono solo 3 limitazioni:", "playonlyonebang": "Puoi giocare 1 solo Bang! per turno (si riferisce solo alle carte con nome Bang!)", @@ -333,6 +457,8 @@ "sheriff": "Sceriffo", "outlaw": "Fuorilegge", "renegade": "Rinnegato", - "vice": "Vice" + "vice": "Vice", + "gotoallcharacters": "Visualizza tutti i personaggi", + "allcharacters": "Tutti i personaggi" } } From b90749ebf6ccfb376666d8fd30d613077ab56ec3 Mon Sep 17 00:00:00 2001 From: Alberto Xamin Date: Mon, 1 Feb 2021 15:30:28 +0100 Subject: [PATCH 5/6] button for getting help and animated chat --- frontend/src/App.vue | 30 ++++++++++++++++++++++-------- frontend/src/components/Chat.vue | 13 +++++++++++-- frontend/src/components/Help.vue | 3 ++- 3 files changed, 35 insertions(+), 11 deletions(-) diff --git a/frontend/src/App.vue b/frontend/src/App.vue index 94daed0..b423414 100644 --- a/frontend/src/App.vue +++ b/frontend/src/App.vue @@ -7,14 +7,18 @@

{{$t("warning")}}

{{$t("connection_error")}}

- + +
+ + +

@@ -29,14 +33,17 @@ From e6f34402985b0f905f973564092c712f2b2d0c49 Mon Sep 17 00:00:00 2001 From: Alberto Xamin Date: Mon, 1 Feb 2021 16:58:33 +0100 Subject: [PATCH 6/6] fix small quirks --- backend/bang/game.py | 4 ++-- frontend/src/components/Card.vue | 5 +++-- frontend/src/components/Chat.vue | 10 ++++++++-- frontend/src/components/Deck.vue | 6 +++--- frontend/src/components/Lobby.vue | 4 ++-- frontend/src/components/Menu.vue | 4 ++-- frontend/src/components/Player.vue | 4 ++-- frontend/src/i18n/en.json | 16 ++++++++++++++-- frontend/src/i18n/it.json | 14 +++++++++++++- 9 files changed, 49 insertions(+), 18 deletions(-) diff --git a/backend/bang/game.py b/backend/bang/game.py index da83947..5d2da93 100644 --- a/backend/bang/game.py +++ b/backend/bang/game.py @@ -104,9 +104,9 @@ class Game: for k in range(self.players[i].max_lives): self.players[i].hand.append(self.deck.draw()) self.players[i].notify_self() - current_roles = [type(x.role).__name__ for x in self.players] + current_roles = [x.role.name for x in self.players] random.shuffle(current_roles) - current_roles = str({x:current_roles.count(x) for x in current_roles}).replace('{','').replace('}','') + current_roles = '|'.join([x + '|' + str(current_roles.count(x)) for x in current_roles]) self.sio.emit('chat_message', room=self.name, data=f'_allroles|{current_roles}') self.play_turn() diff --git a/frontend/src/components/Card.vue b/frontend/src/components/Card.vue index 43c8db0..0fb4876 100644 --- a/frontend/src/components/Card.vue +++ b/frontend/src/components/Card.vue @@ -12,12 +12,13 @@ export default { name: 'Card', props: { - card: Object + card: Object, + donotlocalize: Boolean }, computed: { cardName(){ // console.log(this.$t(`cards.${this.card.name}.name`)) - if (this.$t(`cards.${this.card.name}.name`) !== `cards.${this.card.name}.name`) { + if (!this.donotlocalize && this.$t(`cards.${this.card.name}.name`) !== `cards.${this.card.name}.name`) { return this.$t(`cards.${this.card.name}.name`) } return this.card.name diff --git a/frontend/src/components/Chat.vue b/frontend/src/components/Chat.vue index 7b3708a..17bf7b1 100644 --- a/frontend/src/components/Chat.vue +++ b/frontend/src/components/Chat.vue @@ -5,7 +5,7 @@

{{msg.text}}

-

.

+

.

@@ -34,7 +34,7 @@ export default { }), sockets: { chat_message(msg) { - console.log(msg) + // console.log(msg) if ((typeof msg === "string") && msg.indexOf('_') === 0) { let params = msg.split('|') let type = params.shift().substring(1) @@ -42,6 +42,12 @@ export default { params[1] = this.$t(`cards.${params[1]}.name`) } else if (type === "choose_character"){ params.push(this.$t(`cards.${params[1]}.desc`)) + } else if (type === "allroles") { + params.forEach((p,i)=>{ + if (i%2 === 0) { + params[i] = this.$t(`cards.${params[i]}.name`) + } + }) } this.messages.push({text:this.$t(`chat.${type}`, params)}); if (type == 'turn' && params[0] == this.username) { diff --git a/frontend/src/components/Deck.vue b/frontend/src/components/Deck.vue index 9fb672a..6262936 100644 --- a/frontend/src/components/Deck.vue +++ b/frontend/src/components/Deck.vue @@ -1,7 +1,7 @@