started work on better localization

will save data
This commit is contained in:
Alberto 2021-01-24 12:27:49 +01:00
parent 7400315235
commit 72d5900898
No known key found for this signature in database
GPG Key ID: 4F026F48309500A2
12 changed files with 512 additions and 89 deletions

View File

@ -348,5 +348,14 @@ def holyday_special(sid, data):
ses: Player = sio.get_session(sid)
ses.holyday_special(data)
# @sio.event
# def get_cards(sid, data):
# # if data == None or data == '':
# import bang.cards as c
# sio.emit('cards_info', data=json.dumps(c.get_starting_deck(['dodge_city']), default=lambda o: o.__dict__))
# # else:
# # import bang.expansions.dodge_city.cards as c
# # sio.emit('cards_info', data=json.dumps(c.get_starting_deck(), default=lambda o: o.__dict__))
if __name__ == '__main__':
eventlet.wsgi.server(eventlet.listen(('', 5001)), app)

View File

@ -90,8 +90,8 @@ class Barile(Card):
super().__init__(suit, 'Barile', number, is_equipment=True)
self.icon = '🛢'
self.alt_text = "♥️=😅"
self.desc = "Quando sei bersagliato da un Bang puoi estrarre la prima carta dalla cima del mazzo, se la carta estratta è del seme Cuori allora vale come un Mancato"
self.desc_eng = "When someone plays a Bang against you. You can flip the first card from the deck, if the suit is Hearts then it counts as a Missed card"
# self.desc = "Quando sei bersagliato da un Bang puoi estrarre la prima carta dalla cima del mazzo, se la carta estratta è del seme Cuori allora vale come un Mancato"
# self.desc_eng = "When someone plays a Bang against you. You can flip the first card from the deck, if the suit is Hearts then it counts as a Missed card"
class Dinamite(Card):
@ -99,8 +99,8 @@ class Dinamite(Card):
super().__init__(suit, 'Dinamite', number, is_equipment=True)
self.icon = '🧨'
self.alt_text = "2-9♠ = 🤯"
self.desc = "Giocando la Dinamite, posizionala davanti a te, resterà innocua per un intero giro. All'inizio del prossimo turno prima di pescare e prima di una eventuale estrazione (es. Prigione), estrai una carta dalla cima del mazzo. Se esce una carta tra il 2 il 9 di picche (compresi) allora la dinamite esplode: perdi 3 vite e scarta la carta, altrimenti passa la dinamite al giocatore successivo, il quale estrarà a sua volta dopo che tu avrai passato il tuo turno"
self.desc_eng = "When playing Dynamite, place it in front of you, it will remain harmless for a whole round. At the beginning of the next turn before drawing and before any card flip (eg Prison), flip a card from the top of the deck. If a card is between 2 and 9 of spades (inclusive) then the dynamite explodes: you lose 3 lives and discard the card, otherwise pass the dynamite to the next player, who will draw in turn after you have ended your turn"
# self.desc = "Giocando la Dinamite, posizionala davanti a te, resterà innocua per un intero giro. All'inizio del prossimo turno prima di pescare e prima di una eventuale estrazione (es. Prigione), estrai una carta dalla cima del mazzo. Se esce una carta tra il 2 il 9 di picche (compresi) allora la dinamite esplode: perdi 3 vite e scarta la carta, altrimenti passa la dinamite al giocatore successivo, il quale estrarà a sua volta dopo che tu avrai passato il tuo turno"
# self.desc_eng = "When playing Dynamite, place it in front of you, it will remain harmless for a whole round. At the beginning of the next turn before drawing and before any card flip (eg Prison), flip a card from the top of the deck. If a card is between 2 and 9 of spades (inclusive) then the dynamite explodes: you lose 3 lives and discard the card, otherwise pass the dynamite to the next player, who will draw in turn after you have ended your turn"
class Mirino(Card):
@ -108,8 +108,8 @@ class Mirino(Card):
super().__init__(suit, 'Mirino', number, is_equipment=True, sight_mod=1)
self.icon = '🔎'
self.alt_text = "-1"
self.desc = "Tu vedi gli altri giocatori a distanza -1"
self.desc_eng = "You see the other players at distance -1"
# self.desc = "Tu vedi gli altri giocatori a distanza -1"
# self.desc_eng = "You see the other players at distance -1"
class Mustang(Card):
@ -117,16 +117,16 @@ class Mustang(Card):
super().__init__(suit, 'Mustang', number, is_equipment=True, vis_mod=1)
self.icon = '🐎'
self.alt_text = "+1"
self.desc = "Gli altri giocatori ti vedono a distanza +1"
self.desc_eng = "The other players see you at distance +1"
# self.desc = "Gli altri giocatori ti vedono a distanza +1"
# self.desc_eng = "The other players see you at distance +1"
class Prigione(Card):
def __init__(self, suit, number):
super().__init__(suit, 'Prigione', number, is_equipment=True)
self.icon = ''
self.desc = "Equipaggia questa carta a un altro giocatore, tranne lo Sceriffo. Il giocatore scelto all'inizio del suo turno, prima di pescare dovrà estrarre: se esce Cuori scarta questa carta e gioca normalmente il turno, altrimenti scarta questa carta e salta il turno"
self.desc_eng = "Equip this card to another player, except the Sheriff. The player chosen at the beginning of his turn, must flip a card before drawing: if it's Hearts, discard this card and play the turn normally, otherwise discard this card and skip the turn"
# self.desc = "Equipaggia questa carta a un altro giocatore, tranne lo Sceriffo. Il giocatore scelto all'inizio del suo turno, prima di pescare dovrà estrarre: se esce Cuori scarta questa carta e gioca normalmente il turno, altrimenti scarta questa carta e salta il turno"
# self.desc_eng = "Equip this card to another player, except the Sheriff. The player chosen at the beginning of his turn, must flip a card before drawing: if it's Hearts, discard this card and play the turn normally, otherwise discard this card and skip the turn"
self.need_target = True
self.alt_text = "♥️= 🆓"
@ -144,8 +144,8 @@ class Remington(Card):
super().__init__(suit, 'Remington', number,
is_equipment=True, is_weapon=True, range=3)
self.icon = '🔫'
self.desc = "Puoi sparare a un giocatore che sia distante 3 o meno"
self.desc_eng = "You can shoot another player at distance 3 or less"
# self.desc = "Puoi sparare a un giocatore che sia distante 3 o meno"
# self.desc_eng = "You can shoot another player at distance 3 or less"
class RevCarabine(Card):
@ -153,8 +153,8 @@ class RevCarabine(Card):
super().__init__(suit, 'Rev. Carabine', number,
is_equipment=True, is_weapon=True, range=4)
self.icon = '🔫'
self.desc = "Puoi sparare a un giocatore che sia distante 4 o meno"
self.desc_eng = "You can shoot another player at distance 4 or less"
# self.desc = "Puoi sparare a un giocatore che sia distante 4 o meno"
# self.desc_eng = "You can shoot another player at distance 4 or less"
class Schofield(Card):
@ -162,8 +162,8 @@ class Schofield(Card):
super().__init__(suit, 'Schofield', number,
is_equipment=True, is_weapon=True, range=2)
self.icon = '🔫'
self.desc = "Puoi sparare a un giocatore che sia distante 2 o meno"
self.desc_eng = "You can shoot another player at distance 2 or less"
# self.desc = "Puoi sparare a un giocatore che sia distante 2 o meno"
# self.desc_eng = "You can shoot another player at distance 2 or less"
class Volcanic(Card):
@ -171,8 +171,8 @@ class Volcanic(Card):
super().__init__(suit, 'Volcanic', number,
is_equipment=True, is_weapon=True, range=1)
self.icon = '🔫'
self.desc = "Puoi sparare a un giocatore che sia distante 1 o meno, tuttavia puoi giocare quanti bang vuoi"
self.desc_eng = "You can shoot another player at distance 1 or less, however you no longer have the limit of 1 Bang"
# self.desc = "Puoi sparare a un giocatore che sia distante 1 o meno, tuttavia puoi giocare quanti bang vuoi"
# self.desc_eng = "You can shoot another player at distance 1 or less, however you no longer have the limit of 1 Bang"
class Winchester(Card):
@ -180,16 +180,16 @@ class Winchester(Card):
super().__init__(suit, 'Winchester', number,
is_equipment=True, is_weapon=True, range=5)
self.icon = '🔫'
self.desc = "Puoi sparare a un giocatore che sia distante 5 o meno"
self.desc_eng = "You can shoot another player at distance 5 or less"
# self.desc = "Puoi sparare a un giocatore che sia distante 5 o meno"
# self.desc_eng = "You can shoot another player at distance 5 or less"
class Bang(Card):
def __init__(self, suit, number):
super().__init__(suit, 'Bang!', number)
self.icon = '💥'
self.desc = "Spara a un giocatore a distanza raggiungibile. Se non hai armi la distanza di default è 1"
self.desc_eng = "Shoot a player in sight. If you do not have weapons, your is sight is 1"
# self.desc = "Spara a un giocatore a distanza raggiungibile. Se non hai armi la distanza di default è 1"
# self.desc_eng = "Shoot a player in sight. If you do not have weapons, your is sight is 1"
self.need_target = True
def play_card(self, player, against, _with=None):
@ -215,8 +215,8 @@ class Birra(Card):
def __init__(self, suit, number):
super().__init__(suit, 'Birra', number)
self.icon = '🍺'
self.desc = "Gioca questa carta per recuperare un punto vita. Non puoi andare oltre al limite massimo del tuo personaggio. Se stai per perdere l'ultimo punto vita puoi giocare questa carta anche nel turno dell'avversario. La birra non ha più effetto se ci sono solo due giocatori"
self.desc_eng = "Play this card to regain a life point. You cannot heal more than your character's maximum limit. If you are about to lose your last life point, you can also play this card on your opponent's turn. Beer no longer takes effect if there are only two players"
# self.desc = "Gioca questa carta per recuperare un punto vita. Non puoi andare oltre al limite massimo del tuo personaggio. Se stai per perdere l'ultimo punto vita puoi giocare questa carta anche nel turno dell'avversario. La birra non ha più effetto se ci sono solo due giocatori"
# self.desc_eng = "Play this card to regain a life point. You cannot heal more than your character's maximum limit. If you are about to lose your last life point, you can also play this card on your opponent's turn. Beer no longer takes effect if there are only two players"
def play_card(self, player, against, _with=None):
import bang.expansions.high_noon.card_events as ceh
@ -240,8 +240,8 @@ class CatBalou(Card):
def __init__(self, suit, number):
super().__init__(suit, 'Cat Balou', number)
self.icon = '💃'
self.desc = "Fai scartare una carta a un qualsiasi giocatore, scegli a caso dalla mano, oppure fra quelle che ha in gioco"
self.desc_eng = "Choose and discard a card from any other player."
# self.desc = "Fai scartare una carta a un qualsiasi giocatore, scegli a caso dalla mano, oppure fra quelle che ha in gioco"
# self.desc_eng = "Choose and discard a card from any other player."
self.need_target = True
def play_card(self, player, against, _with=None):
@ -262,8 +262,8 @@ class Diligenza(Card):
super().__init__(suit, 'Diligenza', number)
self.icon = '🚡'
self.alt_text = "🎴🎴"
self.desc = "Pesca 2 carte dalla cima del mazzo"
self.desc_eng = "Draw 2 cards from the deck."
# self.desc = "Pesca 2 carte dalla cima del mazzo"
# self.desc_eng = "Draw 2 cards from the deck."
def play_card(self, player, against, _with=None):
player.sio.emit('chat_message', room=player.game.name,
@ -278,8 +278,8 @@ class Duello(Card):
super().__init__(suit, 'Duello', number)
self.need_target = True
self.icon = '⚔️'
self.desc = "Gioca questa carta contro un qualsiasi giocatore. A turno, cominciando dal tuo avversario, potete scartare una carta Bang!, il primo giocatore che non lo fa perde 1 vita"
self.desc_eng = "Play this card against any player. In turn, starting with your opponent, you can discard a Bang! Card, the first player who does not do so loses 1 life."
# self.desc = "Gioca questa carta contro un qualsiasi giocatore. A turno, cominciando dal tuo avversario, potete scartare una carta Bang!, il primo giocatore che non lo fa perde 1 vita"
# self.desc_eng = "Play this card against any player. In turn, starting with your opponent, you can discard a Bang! Card, the first player who does not do so loses 1 life."
def play_card(self, player, against, _with=None):
if against != None:
@ -293,8 +293,8 @@ class Emporio(Card):
def __init__(self, suit, number):
super().__init__(suit, 'Emporio', number)
self.icon = '🏪'
self.desc = "Scopri dal mazzo tante carte quanto il numero di giocatori vivi, a turno, partendo da te, scegliete una carta e aggiungetela alla vostra mano"
self.desc_eng = "Put on the table N cards from the deck, where N is the number of alive players, in turn, starting with you, choose a card and add it to your hand"
# self.desc = "Scopri dal mazzo tante carte quanto il numero di giocatori vivi, a turno, partendo da te, scegliete una carta e aggiungetela alla vostra mano"
# self.desc_eng = "Put on the table N cards from the deck, where N is the number of alive players, in turn, starting with you, choose a card and add it to your hand"
def play_card(self, player, against, _with=None):
super().play_card(player, against=against)
@ -306,8 +306,8 @@ class Gatling(Card):
def __init__(self, suit, number):
super().__init__(suit, 'Gatling', number)
self.icon = '🛰'
self.desc = "Spara a tutti gli altri giocatori"
self.desc_eng = "Shoot all the other players"
# self.desc = "Spara a tutti gli altri giocatori"
# self.desc_eng = "Shoot all the other players"
self.alt_text = "👥💥"
def play_card(self, player, against, _with=None):
@ -320,8 +320,8 @@ class Indiani(Card):
def __init__(self, suit, number):
super().__init__(suit, 'Indiani!', number)
self.icon = '🏹'
self.desc = "Tutti gli altri giocatori devono scartare un Bang! o perdere una vita"
self.desc_eng = "All the other players must discard a Bang! or lose 1 Health Point"
# self.desc = "Tutti gli altri giocatori devono scartare un Bang! o perdere una vita"
# self.desc_eng = "All the other players must discard a Bang! or lose 1 Health Point"
def play_card(self, player, against, _with=None):
super().play_card(player, against=against)
@ -333,8 +333,8 @@ class Mancato(Card):
def __init__(self, suit, number):
super().__init__(suit, 'Mancato!', number)
self.icon = '😅'
self.desc = "Usa questa carta per annullare un bang"
self.desc_eng = "Use this card to cancel the effect of a bang"
# self.desc = "Usa questa carta per annullare un bang"
# self.desc_eng = "Use this card to cancel the effect of a bang"
def play_card(self, player, against, _with=None):
import bang.characters as chars
@ -359,8 +359,8 @@ class Panico(Card):
super().__init__(suit, 'Panico!', number, range=1)
self.icon = '😱'
self.need_target = True
self.desc = "Pesca una carta da un giocatore a distanza 1, scegli a caso dalla mano, oppure fra quelle che ha in gioco"
self.desc_eng = "Steal a card from a player at distance 1"
# self.desc = "Pesca una carta da un giocatore a distanza 1, scegli a caso dalla mano, oppure fra quelle che ha in gioco"
# self.desc_eng = "Steal a card from a player at distance 1"
def play_card(self, player, against, _with=None):
if against != None and (len(player.game.get_player_named(against).hand) + len(player.game.get_player_named(against).equipment)) > 0:
@ -377,8 +377,8 @@ class Panico(Card):
class Saloon(Card):
def __init__(self, suit, number):
super().__init__(suit, 'Saloon', number)
self.desc = "Tutti i giocatori recuperano un punto vita compreso chi gioca la carta"
self.desc_eng = "Everyone heals 1 Health point"
# self.desc = "Tutti i giocatori recuperano un punto vita compreso chi gioca la carta"
# self.desc_eng = "Everyone heals 1 Health point"
self.icon = '🍻'
self.alt_text = "👥🍺"
@ -394,8 +394,8 @@ class Saloon(Card):
class WellsFargo(Card):
def __init__(self, suit, number):
super().__init__(suit, 'WellsFargo', number)
self.desc = "Pesca 3 carte dalla cima del mazzo"
self.desc_eng = "Draw 3 cards from the deck"
# self.desc = "Pesca 3 carte dalla cima del mazzo"
# self.desc_eng = "Draw 3 cards from the deck"
self.icon = '💸'
self.alt_text = "🎴🎴🎴"

View File

@ -17,8 +17,8 @@ class Pugno(Card):
super().__init__(suit, 'Pugno!', number, range=1)
self.icon = '👊'
self.alt_text = "1🔎 💥"
self.desc = "Spara a un giocatore a distanza 1"
self.desc_eng = "Shoot a player at distance 1"
# self.desc = "Spara a un giocatore a distanza 1"
# self.desc_eng = "Shoot a player at distance 1"
self.need_target = True
def play_card(self, player, against, _with=None):
@ -33,8 +33,8 @@ class Schivata(Mancato):
super().__init__(suit, number)
self.name = 'Schivata'
self.icon = '🙅‍♂️'
self.desc += " e poi pesca una carta"
self.desc_eng += " and then draw a card."
# self.desc += " e poi pesca una carta"
# self.desc_eng += " and then draw a card."
self.alt_text = "😅 | 🎴"
def play_card(self, player, against, _with=None):
@ -48,8 +48,8 @@ class RagTime(Panico):
def __init__(self, suit, number):
Card.__init__(self, suit, 'Rag Time', number)
self.icon = '🎹'
self.desc = "Ruba 1 carta da un giocatore a prescindere dalla distanza"
self.desc_eng = "Steal a card from another player at any distance"
# self.desc = "Ruba 1 carta da un giocatore a prescindere dalla distanza"
# self.desc_eng = "Steal a card from another player at any distance"
self.need_target = True
self.need_with = True
self.alt_text = '2🃏 | 👤😱'
@ -66,8 +66,8 @@ class Rissa(CatBalou):
super().__init__(suit, number)
self.name = 'Rissa'
self.icon = '🥊'
self.desc = "Fai scartare una carta a tutti gli altri giocatori, scegli a caso dalla mano, oppure fra quelle che hanno in gioco"
self.desc_eng = "Choose a card to discard from the hand/equipment of all the other players"
# self.desc = "Fai scartare una carta a tutti gli altri giocatori, scegli a caso dalla mano, oppure fra quelle che hanno in gioco"
# self.desc_eng = "Choose a card to discard from the hand/equipment of all the other players"
self.need_with = True
self.need_target = False
self.alt_text = '2🃏 | 👤💃'
@ -88,8 +88,8 @@ class SpringField(Card):
def __init__(self, suit, number):
super().__init__(suit, 'Springfield', number)
self.icon = '🌵'
self.desc = "Spara a un giocatore a prescindere dalla distanza"
self.desc_eng = "Shoot a player at any distance"
# self.desc = "Spara a un giocatore a prescindere dalla distanza"
# self.desc_eng = "Shoot a player at any distance"
self.need_target = True
self.need_with = True
self.alt_text = '2🃏 | 👤💥'
@ -106,8 +106,8 @@ class Tequila(Card):
def __init__(self, suit, number):
super().__init__(suit, 'Tequila', number)
self.icon = '🍹'
self.desc = "Fai recuperare 1 vita a un giocatore a tua scelta, anche te stesso"
self.desc_eng = "Heal 1 HP to a player of your choice (can be you)"
# self.desc = "Fai recuperare 1 vita a un giocatore a tua scelta, anche te stesso"
# self.desc_eng = "Heal 1 HP to a player of your choice (can be you)"
self.need_target = True
self.can_target_self = True
self.need_with = True
@ -126,8 +126,8 @@ class Whisky(Card):
def __init__(self, suit, number):
super().__init__(suit, 'Whisky', number)
self.icon = '🥃'
self.desc = "Gioca questa carta per recuperare fino a 2 punti vita"
self.desc_eng = "Heal 2 HP"
# self.desc = "Gioca questa carta per recuperare fino a 2 punti vita"
# self.desc_eng = "Heal 2 HP"
self.need_with = True
self.alt_text = '2🃏 | 🍺🍺'
@ -215,8 +215,8 @@ class Derringer(Pugnale):
self.name = 'Derringer'
self.icon = '🚬'
self.alt_text += ' 🎴'
self.desc += ' e poi pesca una carta'
self.desc_eng += ' and then draw a card.'
# self.desc += ' e poi pesca una carta'
# self.desc_eng += ' and then draw a card.'
def play_card(self, player, against, _with=None):
if self.can_be_used_now:
@ -237,8 +237,8 @@ class Borraccia(Card):
def __init__(self, suit, number):
super().__init__(suit, 'Borraccia', number)
self.icon = '🍼'
self.desc = 'Recupera 1 vita'
self.desc_eng = 'Regain 1 HP'
# self.desc = 'Recupera 1 vita'
# self.desc_eng = 'Regain 1 HP'
self.alt_text = "🍺"
self.usable_next_turn = True
self.can_be_used_now = False
@ -318,8 +318,8 @@ class Conestoga(Panico):
def __init__(self, suit, number):
Card.__init__(self, suit, 'Conestoga', number)
self.icon = "🏕"
self.desc = "Ruba 1 carta da un giocatore a prescindere dalla distanza"
self.desc_eng = "Steal a card from another player at any distance"
# self.desc = "Ruba 1 carta da un giocatore a prescindere dalla distanza"
# self.desc_eng = "Steal a card from another player at any distance"
self.alt_text = "👤😱"
self.need_target = True
self.usable_next_turn = True
@ -362,7 +362,7 @@ class FucileDaCaccia(Card):
def __init__(self, suit, number):
super().__init__(suit, 'Fucile Da Caccia', number)
self.icon = '🌂'
self.desc = "Spara a un giocatore a prescindere dalla distanza"
# self.desc = "Spara a un giocatore a prescindere dalla distanza"
self.alt_text = "👤💥"
self.need_target = True
self.usable_next_turn = True

View File

@ -51,9 +51,9 @@ export default {
room(data) {
this.isInLobby = true;
if (data.password)
this.$router.replace({path:'game', query: { code: data.name, pwd: data.password }})
this.$router.replace({path:'game', query: { code: data.name, pwd: data.password }}).catch(()=>{});
else
this.$router.replace({path:'game', query: { code: data.name }})
this.$router.replace({path:'game', query: { code: data.name }}).catch(()=>{});
},
},
methods: {

View File

@ -1,6 +1,6 @@
<template>
<div :class="{ card: true, equipment: card.is_equipment, character:card.is_character, back:card.is_back, 'usable-next-turn':card.usable_next_turn}">
<h4>{{card.name}}</h4>
<h4>{{cardName}}</h4>
<div class="emoji">{{card.icon}}</div>
<div class="alt_text">{{card.alt_text}}</div>
<div class="suit">{{number}}{{suit}}</div>
@ -14,6 +14,13 @@ export default {
card: Object
},
computed: {
cardName(){
console.log(this.$t(`cards.${this.card.name}.name`))
if (this.$t(`cards.${this.card.name}.name`) !== `cards.${this.card.name}.name`) {
return this.$t(`cards.${this.card.name}.name`)
}
return this.card.name
},
suit() {
if (this.card && !isNaN(this.card.suit)) {
let x = ['♦️','♣️','♥️','♠️']

View File

@ -44,7 +44,10 @@ export default {
},
methods: {
showDesc(card) {
if (card.desc)
this.desc = (this.$i18n.locale=='it'?card.desc:card.desc_eng)
else
this.desc = this.$t(`cards.${card.name}.desc`)
}
},
mounted() {

View File

@ -16,7 +16,7 @@
<card v-if="previousScrap" :card="previousScrap" style="top: 1.5pt;right: -1.5pt;"/>
<card v-else :card="card" class="back" style="opacity:0"/>
<card v-if="lastScrap" :card="lastScrap" :key="lastScrap.name+lastScrap.number" class="last-scrap" @click.native="action('scrap')"
@pointerenter.native="desc=($i18n.locale=='it'?lastScrap.desc:lastScrap.desc_eng)" @pointerleave.native="desc=''" />
@pointerenter.native="setdesc" @pointerleave.native="desc=''" />
</div>
</div>
<transition name="list">
@ -99,6 +99,12 @@ export default {
if (this.pending_action !== false) {
this.$socket.emit('draw', 'event')
}
},
setdesc() {
if (this.lastScrap.desc)
this.desc = (this.$i18n.locale=='it'?this.lastScrap.desc:this.lastScrap.desc_eng)
else
this.desc = this.$t(`cards.${this.lastScrap.name}.desc`)
}
},
watch: {

View File

@ -37,7 +37,10 @@ export default {
},
methods: {
showDesc(card) {
if (card.desc)
this.desc = (this.$i18n.locale=='it'?card.desc:card.desc_eng)
else
this.desc = this.$t(`cards.${card.name}.desc`)
},
submit(e) {
e.preventDefault();

View File

@ -68,6 +68,7 @@
</template>
<script>
import Vue from 'vue'
import PrettyCheck from 'pretty-checkbox-vue/check'
import Card from '@/components/Card.vue'
import Chooser from './Chooser.vue'
@ -132,6 +133,7 @@ export default {
this.started = true;
},
players_update(data) {
if (Vue.config.devtools)
console.log(data)
this.players = data
},
@ -141,7 +143,25 @@ export default {
this.$router.push('/')
}
this.username = username
// this.$socket.emit('get_cards', 'dodge_city')
},
// cards_info(data) {
// data = JSON.parse(data)
// let bigthing = {}
// let bigthing_eng = {}
// data.forEach(x => {
// bigthing[x.name] = {
// name:x.name,
// desc:x.desc,
// }
// bigthing_eng[x.name] = {
// name:x.name,
// desc:x.desc_eng,
// }
// })
// console.log(JSON.stringify(bigthing))
// console.log(JSON.stringify(bigthing_eng))
// },
change_username() {
this.hasToSetUsername = true
},
@ -182,6 +202,7 @@ export default {
return null;
},
playersTable() {
if (Vue.config.devtools)
console.log('update players')
return this.players.map((x,i) => {
let offsetAngle = 360.0 / this.players.length
@ -197,6 +218,7 @@ export default {
},
methods: {
is_toggled_expansion(ex) {
if (Vue.config.devtools)
console.log(ex+' '+ this.expansions+ (this.expansions.indexOf(ex) !== -1))
return this.expansions.indexOf(ex) !== -1
},
@ -241,9 +263,11 @@ export default {
this.$socket.emit('start_game')
},
choose(player_name) {
if (Vue.config.devtools)
console.log('choose from' + player_name)
this.target_p = player_name
let pl = this.players.filter(x=>x.name === player_name)[0]
if (Vue.config.devtools)
console.log(pl)
let arr = []
for (let i=0; i<pl.ncards; i++)
@ -258,12 +282,14 @@ export default {
},
chooseCard(card) {
this.$socket.emit('choose', this.chooseCards.indexOf(card))
if (Vue.config.devtools)
console.log(card + ' ' + this.chooseCards.indexOf(card))
this.chooseCards = []
this.hasToChoose = false
this.target_p = ''
},
drawFromPlayer(name) {
if (Vue.config.devtools)
console.log(name)
this.$socket.emit('draw', name)
},
@ -282,6 +308,7 @@ export default {
}
},
mounted() {
if (Vue.config.devtools)
console.log('mounted lobby')
if (!this.$route.query.code)
return this.$router.push('/')

View File

@ -13,7 +13,7 @@
</transition-group>
<transition-group v-if="lives > 0 || is_ghost" name="list" tag="div" style="margin: 0 0 0 10pt; display:flex;">
<Card v-for="card in equipment" v-bind:key="card.name+card.number" :card="card"
@pointerenter.native="desc=($i18n.locale=='it'?card.desc:card.desc_eng)" @pointerleave.native="desc=''"
@pointerenter.native="setDesc(card)" @pointerleave.native="desc=''"
@click.native="play_card(card, true)" :class="{'cant-play':((eventCard && eventCard.name == 'Lazo') || !card.can_be_used_now)}"/>
</transition-group>
</div>
@ -29,7 +29,7 @@
<transition-group name="list" tag="div" :class="{hand:true, 'play-cards':pending_action===2}">
<Card v-for="card in handComputed" v-bind:key="card.name+card.number" :card="card"
@click.native="play_card(card, false)"
@pointerenter.native="hint=($i18n.locale=='it'?card.desc:card.desc_eng)" @pointerleave.native="hint=''"
@pointerenter.native="setHint(card)" @pointerleave.native="hint=''"
:class="{'cant-play':card.cantBePlayed}"/>
</transition-group>
</div>
@ -279,6 +279,18 @@ export default {
this.sidWantsScrapForHealth = false
}
},
setDesc(card) {
if (card.desc)
this.desc = (this.$i18n.locale=='it'?card.desc:card.desc_eng)
else
this.desc = this.$t(`cards.${card.name}.desc`)
},
setHint(card) {
if (card.desc)
this.hint = (this.$i18n.locale=='it'?card.desc:card.desc_eng)
else
this.hint = this.$t(`cards.${card.name}.desc`)
},
holydayScrapAdd(c) {
this.scrapHand.push(this.hand.indexOf(c))
},

View File

@ -28,7 +28,7 @@
"flip_card": "▶️ Flip a card",
"draw_cards": "▶️ Draw you cards from the deck",
"play_cards": "▶️ Play your cards",
"respond_card":"▶️ Respond to the card",
"respond_card": "▶️ Respond to the card",
"wait": "⏸ Wait",
"choose_cards": "▶️ Choose a card",
"take_dmg": "Take damage",
@ -46,17 +46,17 @@
"choose_rimbalzo_player": "Choose the target of the bang",
"choose_rimbalzo_card": "Choose the card to discard the bang to",
"emporio_others": "{0} is choosing which card to get from the General Store",
"you_died":"YOU DIED",
"spectate":"SPECTATE",
"you_win":"YOU WON",
"you_lose":"YOU LOST",
"you_died": "YOU DIED",
"spectate": "SPECTATE",
"you_win": "YOU WON",
"you_lose": "YOU LOST",
"special_ability": "SPECIAL ABILITY",
"discard": "DISCARD",
"to_regain_1_hp": "TO REGAIN 1 HP",
"play_your_turn": "PLAY YOUR TURN",
"you_are": "You are",
"did_pick_as": "picked this as second card",
"blackjack_special":"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",
@ -114,5 +114,183 @@
"disconnect_bot": "Replace players that disconnect with bots",
"your_turn": "Play your turn!",
"your_response": "Respond!",
"your_choose": "Choose a card!"
"your_choose": "Choose a card!",
"cards": {
"Barile": {
"name": "Barrel",
"desc": "When someone plays a Bang against you. You can flip the first card from the deck, if the suit is Hearts then it counts as a Missed card"
},
"Dinamite": {
"name": "Dynamite",
"desc": "When playing Dynamite, place it in front of you, it will remain harmless for a whole round. At the beginning of the next turn before drawing and before any card flip (eg Prison), flip a card from the top of the deck. If a card is between 2 and 9 of spades (inclusive) then the dynamite explodes: you lose 3 lives and discard the card, otherwise pass the dynamite to the next player, who will draw in turn after you have ended your turn"
},
"Mirino": {
"name": "Scope",
"desc": "You see the other players at distance -1"
},
"Mustang": {
"name": "Mustang",
"desc": "The other players see you at distance +1"
},
"Prigione": {
"name": "Prison",
"desc": "Equip this card to another player, except the Sheriff. The player chosen at the beginning of his turn, must flip a card before drawing: if it's Hearts, discard this card and play the turn normally, otherwise discard this card and skip the turn"
},
"Remington": {
"name": "Remington",
"desc": "You can shoot another player at distance 3 or less"
},
"Rev. Carabine": {
"name": "Rev. Carabine",
"desc": "You can shoot another player at distance 4 or less"
},
"Schofield": {
"name": "Schofield",
"desc": "You can shoot another player at distance 2 or less"
},
"Volcanic": {
"name": "Volcanic",
"desc": "You can shoot another player at distance 1 or less, however you no longer have the limit of 1 Bang"
},
"Winchester": {
"name": "Winchester",
"desc": "You can shoot another player at distance 5 or less"
},
"Bang!": {
"name": "Bang!",
"desc": "Shoot a player in sight. If you do not have weapons, your is sight is 1"
},
"Birra": {
"name": "Beer",
"desc": "Play this card to regain a life point. You cannot heal more than your character's maximum limit. If you are about to lose your last life point, you can also play this card on your opponent's turn. Beer no longer takes effect if there are only two players"
},
"Cat Balou": {
"name": "Cat Balou",
"desc": "Choose and discard a card from any other player."
},
"Diligenza": {
"name": "Stagecoach",
"desc": "Draw 2 cards from the deck."
},
"Duello": {
"name": "Duel",
"desc": "Play this card against any player. In turn, starting with your opponent, you can discard a Bang! Card, the first player who does not do so loses 1 life."
},
"Emporio": {
"name": "General Store",
"desc": "Put on the table N cards from the deck, where N is the number of alive players, in turn, starting with you, choose a card and add it to your hand"
},
"Gatling": {
"name": "Gatling",
"desc": "Shoot all the other players"
},
"Indiani!": {
"name": "Indians!",
"desc": "All the other players must discard a Bang! or lose 1 Health Point"
},
"Mancato!": {
"name": "Missed!",
"desc": "Use this card to cancel the effect of a bang"
},
"Panico!": {
"name": "Panic!",
"desc": "Steal a card from a player at distance 1"
},
"Saloon": {
"name": "Saloon",
"desc": "Everyone heals 1 Health point"
},
"WellsFargo": {
"name": "WellsFargo",
"desc": "Draw 3 cards from the deck"
},
"Binocolo": {
"name": "Binocular",
"desc": "You see the other players at distance -1"
},
"Riparo": {
"name": "Hidoeut",
"desc": "The other players see you at distance +1"
},
"Pugno!": {
"name": "Fist!",
"desc": "Shoot a player at distance 1"
},
"Rag Time": {
"name": "Rag Time",
"desc": "Steal a card from another player at any distance"
},
"Rissa": {
"name": "Brawl",
"desc": "Choose a card to discard from the hand/equipment of all the other players"
},
"Schivata": {
"name": "Dodge",
"desc": "Use this card to cancel the effect of a bang and then draw a card."
},
"Springfield": {
"name": "Springfield",
"desc": "Shoot a player at any distance"
},
"Tequila": {
"name": "Tequila",
"desc": "Heal 1 HP to a player of your choice (can be you)"
},
"Whisky": {
"name": "Whisky",
"desc": "Heal 2 HP"
},
"Bibbia": {
"name": "Bible",
"desc": "Use this card to cancel the effect of a bang and then draw a card."
},
"Cappello": {
"name": "Ten Gallon Hat",
"desc": "Use this card to cancel the effect of a bang"
},
"Placca Di Ferro": {
"name": "Iron Plate",
"desc": "Use this card to cancel the effect of a bang"
},
"Sombrero": {
"name": "Sombrero",
"desc": "Use this card to cancel the effect of a bang"
},
"Pugnale": {
"name": "Knife",
"desc": "Shoot a player at distance 1"
},
"Derringer": {
"name": "Derringer",
"desc": "Shoot a player at distance 1 and then draw a card."
},
"Borraccia": {
"name": "Canteen",
"desc": "Regain 1 HP"
},
"Can Can": {
"name": "Can Can",
"desc": "Choose and discard a card from any other player."
},
"Conestoga": {
"name": "Conestoga",
"desc": "Steal a card from another player at any distance"
},
"Fucile Da Caccia": {
"name": "Buffalo Rifle",
"desc": "Shoot a player at any distance"
},
"Pony Express": {
"name": "Pony Express",
"desc": "Draw 3 cards from the deck"
},
"Pepperbox": {
"name": "Pepperbox",
"desc": "Shoot a player in sight. If you do not have weapons, your is sight is 1"
},
"Howitzer": {
"name": "Howitzer",
"desc": "Shoot all the other players"
}
}
}

View File

@ -114,5 +114,183 @@
"disconnect_bot": "Sostituisci i giocatori che si disconnettono con bot",
"your_turn": "È il tuo turno!",
"your_response": "Rispondi!",
"your_choose": "Scegli una carta!"
"your_choose": "Scegli una carta!",
"cards": {
"Barile": {
"name": "Barile",
"desc": "Quando sei bersagliato da un Bang puoi estrarre la prima carta dalla cima del mazzo, se la carta estratta è del seme Cuori allora vale come un Mancato"
},
"Dinamite": {
"name": "Dinamite",
"desc": "Giocando la Dinamite, posizionala davanti a te, resterà innocua per un intero giro. All'inizio del prossimo turno prima di pescare e prima di una eventuale estrazione (es. Prigione), estrai una carta dalla cima del mazzo. Se esce una carta tra il 2 il 9 di picche (compresi) allora la dinamite esplode: perdi 3 vite e scarta la carta, altrimenti passa la dinamite al giocatore successivo, il quale estrarà a sua volta dopo che tu avrai passato il tuo turno"
},
"Mirino": {
"name": "Mirino",
"desc": "Tu vedi gli altri giocatori a distanza -1"
},
"Mustang": {
"name": "Mustang",
"desc": "Gli altri giocatori ti vedono a distanza +1"
},
"Prigione": {
"name": "Prigione",
"desc": "Equipaggia questa carta a un altro giocatore, tranne lo Sceriffo. Il giocatore scelto all'inizio del suo turno, prima di pescare dovrà estrarre: se esce Cuori scarta questa carta e gioca normalmente il turno, altrimenti scarta questa carta e salta il turno"
},
"Remington": {
"name": "Remington",
"desc": "Puoi sparare a un giocatore che sia distante 3 o meno"
},
"Rev. Carabine": {
"name": "Rev. Carabine",
"desc": "Puoi sparare a un giocatore che sia distante 4 o meno"
},
"Schofield": {
"name": "Schofield",
"desc": "Puoi sparare a un giocatore che sia distante 2 o meno"
},
"Volcanic": {
"name": "Volcanic",
"desc": "Puoi sparare a un giocatore che sia distante 1 o meno, tuttavia puoi giocare quanti bang vuoi"
},
"Winchester": {
"name": "Winchester",
"desc": "Puoi sparare a un giocatore che sia distante 5 o meno"
},
"Bang!": {
"name": "Bang!",
"desc": "Spara a un giocatore a distanza raggiungibile. Se non hai armi la distanza di default è 1"
},
"Birra": {
"name": "Birra",
"desc": "Gioca questa carta per recuperare un punto vita. Non puoi andare oltre al limite massimo del tuo personaggio. Se stai per perdere l'ultimo punto vita puoi giocare questa carta anche nel turno dell'avversario. La birra non ha più effetto se ci sono solo due giocatori"
},
"Cat Balou": {
"name": "Cat Balou",
"desc": "Fai scartare una carta a un qualsiasi giocatore, scegli a caso dalla mano, oppure fra quelle che ha in gioco"
},
"Diligenza": {
"name": "Diligenza",
"desc": "Pesca 2 carte dalla cima del mazzo"
},
"Duello": {
"name": "Duello",
"desc": "Gioca questa carta contro un qualsiasi giocatore. A turno, cominciando dal tuo avversario, potete scartare una carta Bang!, il primo giocatore che non lo fa perde 1 vita"
},
"Emporio": {
"name": "Emporio",
"desc": "Scopri dal mazzo tante carte quanto il numero di giocatori vivi, a turno, partendo da te, scegliete una carta e aggiungetela alla vostra mano"
},
"Gatling": {
"name": "Gatling",
"desc": "Spara a tutti gli altri giocatori"
},
"Indiani!": {
"name": "Indiani!",
"desc": "Tutti gli altri giocatori devono scartare un Bang! o perdere una vita"
},
"Mancato!": {
"name": "Mancato!",
"desc": "Usa questa carta per annullare un bang"
},
"Panico!": {
"name": "Panico!",
"desc": "Pesca una carta da un giocatore a distanza 1, scegli a caso dalla mano, oppure fra quelle che ha in gioco"
},
"Saloon": {
"name": "Saloon",
"desc": "Tutti i giocatori recuperano un punto vita compreso chi gioca la carta"
},
"WellsFargo": {
"name": "WellsFargo",
"desc": "Pesca 3 carte dalla cima del mazzo"
},
"Binocolo": {
"name": "Binocolo",
"desc": "Tu vedi gli altri giocatori a distanza -1"
},
"Riparo": {
"name": "Riparo",
"desc": "Gli altri giocatori ti vedono a distanza +1"
},
"Pugno!": {
"name": "Pugno!",
"desc": "Spara a un giocatore a distanza 1"
},
"Rag Time": {
"name": "Rag Time",
"desc": "Ruba 1 carta da un giocatore a prescindere dalla distanza"
},
"Rissa": {
"name": "Rissa",
"desc": "Fai scartare una carta a tutti gli altri giocatori, scegli a caso dalla mano, oppure fra quelle che hanno in gioco"
},
"Schivata": {
"name": "Schivata",
"desc": "Usa questa carta per annullare un bang e poi pesca una carta"
},
"Springfield": {
"name": "Springfield",
"desc": "Spara a un giocatore a prescindere dalla distanza"
},
"Tequila": {
"name": "Tequila",
"desc": "Fai recuperare 1 vita a un giocatore a tua scelta, anche te stesso"
},
"Whisky": {
"name": "Whisky",
"desc": "Gioca questa carta per recuperare fino a 2 punti vita"
},
"Bibbia": {
"name": "Bibbia",
"desc": "Usa questa carta per annullare un bang e poi pesca una carta"
},
"Cappello": {
"name": "Cappello",
"desc": "Usa questa carta per annullare un bang"
},
"Placca Di Ferro": {
"name": "Placca Di Ferro",
"desc": "Usa questa carta per annullare un bang"
},
"Sombrero": {
"name": "Sombrero",
"desc": "Usa questa carta per annullare un bang"
},
"Pugnale": {
"name": "Pugnale",
"desc": "Spara a un giocatore a distanza 1"
},
"Derringer": {
"name": "Derringer",
"desc": "Spara a un giocatore a distanza 1 e poi pesca una carta"
},
"Borraccia": {
"name": "Borraccia",
"desc": "Recupera 1 vita"
},
"Can Can": {
"name": "Can Can",
"desc": "Fai scartare una carta a un qualsiasi giocatore, scegli a caso dalla mano, oppure fra quelle che ha in gioco"
},
"Conestoga": {
"name": "Conestoga",
"desc": "Ruba 1 carta da un giocatore a prescindere dalla distanza"
},
"Fucile Da Caccia": {
"name": "Fucile Da Caccia",
"desc": "Spara a un giocatore a prescindere dalla distanza"
},
"Pony Express": {
"name": "Pony Express",
"desc": "Pesca 3 carte dalla cima del mazzo"
},
"Pepperbox": {
"name": "Pepperbox",
"desc": "Spara a un giocatore a distanza raggiungibile. Se non hai armi la distanza di default è 1"
},
"Howitzer": {
"name": "Howitzer",
"desc": "Spara a tutti gli altri giocatori"
}
}
}