dead man legge del west

This commit is contained in:
Alberto Xamin 2020-12-18 18:13:13 +01:00
parent 7f4fc29196
commit add2ce9da6
No known key found for this signature in database
GPG Key ID: 4F026F48309500A2
6 changed files with 41 additions and 30 deletions

View File

@ -9,101 +9,101 @@ class Agguato(CardEvent):
def __init__(self): def __init__(self):
super().__init__('Agguato', '🛁') super().__init__('Agguato', '🛁')
self.desc = 'La distanza base di tra 2 qualsiasi giocatori è 1' 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): class Cecchino(CardEvent):
def __init__(self): #TODO def __init__(self): #TODO
super().__init__('Cecchino', '👁') 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 = '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): class DeadMan(CardEvent):
def __init__(self):#TODO def __init__(self):
super().__init__('Dead Man', '⚰️') 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 = '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): class FratelliDiSangue(CardEvent):
def __init__(self):#TODO def __init__(self):#TODO
super().__init__('Fratelli Di Sangue', '💉') 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 = '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): class IlGiudice(CardEvent):
def __init__(self): def __init__(self):
super().__init__('Il Giudice', '👨‍⚖️') super().__init__('Il Giudice', '👨‍⚖️')
self.desc = 'Non si possono equipaggiare carte a se stessi o agli altri' 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): class Lazo(CardEvent):
def __init__(self): def __init__(self):
super().__init__('Lazo', '📿') super().__init__('Lazo', '📿')
self.desc = 'Le carte equipaggiate non hanno effetto' 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): class LeggeDelWest(CardEvent):
def __init__(self):#TODO def __init__(self):
super().__init__('Legge Del West', '⚖️') 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 = '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): class LiquoreForte(CardEvent):
def __init__(self):#TODO def __init__(self):#TODO
super().__init__('Liquore Forte', '🥃') super().__init__('Liquore Forte', '🥃')
self.desc = 'I giocatori possono evitare di pescare per recuperare 1 vita' 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): class MinieraAbbandonata(CardEvent):
def __init__(self):#TODO def __init__(self):#TODO
super().__init__('Miniera Abbandonata', '') super().__init__('Miniera Abbandonata', '')
self.desc = 'I giocatori pescano dagli scarti e scartano in cima al mazzo' 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): class PerUnPugnoDiCarte(CardEvent):
def __init__(self):#TODO def __init__(self):#TODO
super().__init__('Per Un Pugno Di Carte', '🎴') super().__init__('Per Un Pugno Di Carte', '🎴')
self.desc = 'Il giocatore subisce tanti bang quante carte ha in mano' 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): class Peyote(CardEvent):
def __init__(self):#TODO def __init__(self):#TODO
super().__init__('Peyote', '🌵') super().__init__('Peyote', '🌵')
self.desc = 'Invece che pescare il giocatore prova a indovinare il colore del seme, se lo indovina continua' 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): class Ranch(CardEvent):
def __init__(self):#TODO def __init__(self):#TODO
super().__init__('Ranch', '🐮') super().__init__('Ranch', '🐮')
self.desc = 'Dopo aver pescato il giocatore può scartare quante carte vuole dalla mano e pescarne altrettante dal mazzo' 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): class Rimbalzo(CardEvent):
def __init__(self):#TODO def __init__(self):#TODO
super().__init__('Rimbalzo', '') 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 = '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): class RouletteRussa(CardEvent):
def __init__(self):#TODO def __init__(self):#TODO
super().__init__('Roulette Russa', '🇷🇺') 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 = '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): class Vendetta(CardEvent):
def __init__(self): def __init__(self):
super().__init__('Vendetta', '😤') super().__init__('Vendetta', '😤')
self.desc = 'Alla fine del proprio turno il giocatore estrae, se esce ♥️ gioca un altro turno' 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(): def get_all_events():
return [ return [
Agguato(), Agguato(),
# Cecchino(), # Cecchino(),
# DeadMan(), DeadMan(),
# FratelliDiSangue(), # FratelliDiSangue(),
IlGiudice(), IlGiudice(),
Lazo(), Lazo(),
# LeggeDelWest(), LeggeDelWest(),
# LiquoreForte(), # LiquoreForte(),
# MinieraAbbandonata(), # MinieraAbbandonata(),
# PerUnPugnoDiCarte(), # PerUnPugnoDiCarte(),

View File

@ -220,6 +220,12 @@ class Game:
def play_turn(self): def play_turn(self):
if isinstance(self.players[self.turn].role, roles.Sheriff): if isinstance(self.players[self.turn].role, roles.Sheriff):
self.deck.flip_event() 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() self.players[self.turn].play_turn()
def next_turn(self): def next_turn(self):
@ -353,7 +359,7 @@ class Game:
def get_visible_players(self, player: players.Player): def get_visible_players(self, player: players.Player):
i = self.players.index(player) i = self.players.index(player)
sight = player.get_sight() 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 [{ return [{
'name': self.players[j].name, '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), '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),

View File

@ -130,14 +130,15 @@ class Player:
else: else:
self.set_character(available[randrange(0, len(available))].name) self.set_character(available[randrange(0, len(available))].name)
def notify_card(self, player, card): def notify_card(self, player, card, message=''):
try: try:
card = card.__dict__ card = card.__dict__
except: except:
pass pass
mess = { mess = {
'player': player.name, 'player': player.name,
'card': card 'card': card,
'message':message
} }
print('notifying card') print('notifying card')
self.sio.emit('notify_card', room=self.sid, data=mess) self.sio.emit('notify_card', room=self.sid, data=mess)
@ -331,11 +332,11 @@ class Player:
for i in range(2): for i in range(2):
card: cs.Card = self.game.deck.draw() card: cs.Card = self.game.deck.draw()
self.hand.append(card) 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: for p in self.game.players:
if p != self: if p != self:
p.notify_card(self, card) 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: 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()) self.hand.append(self.game.deck.draw())
if isinstance(self.character, chd.PixiePete): if isinstance(self.character, chd.PixiePete):
self.hand.append(self.game.deck.draw()) self.hand.append(self.game.deck.draw())
@ -430,8 +431,6 @@ class Player:
print(self.name, 'is playing ', card, ' against:', against, ' with:', _with) print(self.name, 'is playing ', card, ' against:', against, ' with:', _with)
did_play_card = False 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) 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: 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) did_play_card = card.play_card(self, against, withCard)
if not card.is_equipment and not card.usable_next_turn or event_blocks_card: if not card.is_equipment and not card.usable_next_turn or event_blocks_card:

View File

@ -40,7 +40,7 @@
<Chooser v-if="lives <= 0 && max_lives > 0" :text="$t('you_died')" :cancelText="$t('spectate')" :cancel="()=>{max_lives = 0}"/> <Chooser v-if="lives <= 0 && max_lives > 0" :text="$t('you_died')" :cancelText="$t('spectate')" :cancel="()=>{max_lives = 0}"/>
<Chooser v-if="win_status !== undefined" :text="win_status?$t('you_win'):$t('you_lose')" /> <Chooser v-if="win_status !== undefined" :text="win_status?$t('you_win'):$t('you_lose')" />
<Chooser v-if="show_role" :text="$t('you_are')" :cards="[my_role]" :hintText="($i18n.locale=='it'?my_role.goal:my_role.goal_eng)" :select="() => {show_role=false}" :cancel="() => {show_role=false}" :cancelText="$t('ok')" /> <Chooser v-if="show_role" :text="$t('you_are')" :cards="[my_role]" :hintText="($i18n.locale=='it'?my_role.goal:my_role.goal_eng)" :select="() => {show_role=false}" :cancel="() => {show_role=false}" :cancelText="$t('ok')" />
<Chooser v-if="notifycard" :key="notifycard.card" :text="`${notifycard.player} ${$t('did_pick_as')}:`" :cards="[notifycard.card]" :hintText="$t('if_card_red')" class="turn-notify-4s"/> <Chooser v-if="notifycard" :key="notifycard.card" :text="`${notifycard.player} ${$t('did_pick_as')}:`" :cards="[notifycard.card]" :hintText="$t(notifycard.message)" class="turn-notify-4s"/>
<Chooser v-if="!show_role && is_my_turn && pending_action < 2" :text="$t('play_your_turn')" :key="is_my_turn" class="turn-notify" /> <Chooser v-if="!show_role && is_my_turn && pending_action < 2" :text="$t('play_your_turn')" :key="is_my_turn" class="turn-notify" />
<Chooser v-if="!show_role && availableCharacters.length > 0" :text="$t('choose_character')" :cards="availableCharacters" :select="setCharacter"/> <Chooser v-if="!show_role && availableCharacters.length > 0" :text="$t('choose_character')" :cards="availableCharacters" :select="setCharacter"/>
<Chooser v-if="hasToPickResponse" :text="`${$t('pick_a_card')} ${attacker?($t('to_defend_from')+' '+attacker):''}`" :key="hasToPickResponse" class="turn-notify" /> <Chooser v-if="hasToPickResponse" :text="`${$t('pick_a_card')} ${attacker?($t('to_defend_from')+' '+attacker):''}`" :key="hasToPickResponse" class="turn-notify" />

View File

@ -48,7 +48,7 @@
"play_your_turn": "PLAY YOUR TURN", "play_your_turn": "PLAY YOUR TURN",
"you_are": "You are", "you_are": "You are",
"did_pick_as": "picked this as second card", "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", "choose_scarp_card_to": "CHOOSE WHICH CARD TO DISCARD TO USE",
"pick_a_card": "FLIP A CARD", "pick_a_card": "FLIP A CARD",
"to_defend_from": "TO DEFEND YOURSELF FROM", "to_defend_from": "TO DEFEND YOURSELF FROM",
@ -82,6 +82,9 @@
"special_calamity": "{0} played {1} as Bang! against {2}.", "special_calamity": "{0} played {1} as Bang! against {2}.",
"allroles": "In the game there are: {0}." "allroles": "In the game there are: {0}."
}, },
"foc": {
"leggedelwest": "He must play this card on this turn if possible."
},
"mods": "Modifiers", "mods": "Modifiers",
"mod_comp": "Competitive mode (disables automatic take damage)", "mod_comp": "Competitive mode (disables automatic take damage)",
"disconnect_bot": "Replace players that disconnect with bots", "disconnect_bot": "Replace players that disconnect with bots",

View File

@ -48,7 +48,7 @@
"play_your_turn": "GIOCA IL TUO TURNO", "play_your_turn": "GIOCA IL TUO TURNO",
"you_are": "Tu sei", "you_are": "Tu sei",
"did_pick_as": "ha pescato come seconda carta", "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", "choose_scarp_card_to": "SCEGLI CHE CARTA SCARTARE PER USARE",
"pick_a_card": "ESTRAI UNA CARTA", "pick_a_card": "ESTRAI UNA CARTA",
"to_defend_from": "PER DIFENDERTI DA", "to_defend_from": "PER DIFENDERTI DA",
@ -82,6 +82,9 @@
"special_calamity": "{0} ha giovato {1} come un Bang! contro {2}.", "special_calamity": "{0} ha giovato {1} come un Bang! contro {2}.",
"allroles": "Nella partita ci sono: {0}." "allroles": "Nella partita ci sono: {0}."
}, },
"foc": {
"leggedelwest": "Ed è obbligato a usarla nel suo turno, se possibile"
},
"mods": "Modificatori", "mods": "Modificatori",
"mod_comp": "Modalità competitiva (disattiva il prendi danno automatico)", "mod_comp": "Modalità competitiva (disattiva il prendi danno automatico)",
"disconnect_bot": "Sostituisci i giocatori che si disconnettono con bot", "disconnect_bot": "Sostituisci i giocatori che si disconnettono con bot",