add descriptions and wait handle death

This commit is contained in:
Alberto Xamin 2020-12-25 17:13:20 +01:00
parent ab25d38a99
commit 9777742e08
No known key found for this signature in database
GPG Key ID: 4F026F48309500A2
6 changed files with 30 additions and 24 deletions

View File

@ -22,7 +22,7 @@ class DeadMan(CardEvent):
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 = "The first player that died return back to life with 2 hp and 2 cards"
self.desc_eng = "The first player that died returns back to life with 2 hp and 2 cards"
class FratelliDiSangue(CardEvent):
def __init__(self):

View File

@ -5,67 +5,67 @@ class Benedizione(CardEvent):
def __init__(self):
super().__init__("Benedizione", "🙏")
self.desc = "Tutte le carte sono considerate di cuori ♥️"
self.desc_eng = ""
self.desc_eng = "All cards are of hearts ♥️"
class Maledizione(CardEvent):
def __init__(self):
super().__init__("Maledizione", "🤬")
self.desc = "Tutte le carte sono considerate di picche ♠"
self.desc_eng = ""
self.desc_eng = "All cards are of spades ♠"
class Sbornia(CardEvent):
def __init__(self):
super().__init__("Sbornia", "🥴")
self.desc = "I personaggi perdono le loro abilità speciali"
self.desc_eng = ""
self.desc_eng = "The characters lose their special abilities"
class Sete(CardEvent):
def __init__(self):
super().__init__("Sete", "🥵")
self.desc = "I giocatori pescano 1 carta in meno nella loro fase 1"
self.desc_eng = ""
self.desc_eng = "Players only draw 1 card at the start of their turn"
class IlTreno(CardEvent):
def __init__(self):
super().__init__("Il Treno", "🚂")
self.desc = "I giocatori pescano 1 carta extra nella loro fase 1"
self.desc_eng = ""
self.desc_eng = "Players draw 1 extra card"
class IlReverendo(CardEvent):
def __init__(self):
super().__init__("Il Reverendo", "⛪️")
self.desc = "Non si possono giocare le carte Birra"
self.desc_eng = ""
self.desc_eng = "Beers can't be played"
class IlDottore(CardEvent):
def __init__(self):
super().__init__("Il Dottore", "👨‍⚕️")
self.desc = "Il/i giocatore/i con meno vite ne recupera/no una"
self.desc_eng = ""
self.desc_eng = "The player with the least amount of HP gets healed 1"
class Sermone(CardEvent):
def __init__(self):
super().__init__("Sermone", "✝️")
self.desc = "I giocatori non possono giocare Bang! durante il loro turno"
self.desc_eng = ""
self.desc_eng = "Players can't play Bang! during their turn"
class Sparatoria(CardEvent):
def __init__(self):
super().__init__("Sparatoria", "🔫🔫")
self.desc = "Il limite di Bang! per turno è 2 invece che 1"
self.desc_eng = ""
self.desc_eng = "The turn Bang! limit is 2"
class CorsaAllOro(CardEvent):
def __init__(self):
super().__init__("Corsa All'Oro", "🌟")
self.desc = "Si gioca per un intero giro in senso antiorario, tuttavia gli effetti delle carte rimangono invariati"
self.desc_eng = ""
self.desc_eng = "Turns are played counter clockwise"
class IDalton(CardEvent):
def __init__(self):
super().__init__("I Dalton", "🙇‍♂️")
self.desc = "Chi ha carte blu in gioco ne scarta 1 a sua scelta"
self.desc_eng = ""
self.desc_eng = "Players that have blue cards equipped, discard 1 of those card of their choice"
class Manette(CardEvent):
def __init__(self):
@ -83,7 +83,7 @@ class CittaFantasma(CardEvent):
def __init__(self):
super().__init__("Città Fantasma", "👻")
self.desc = "Tutti i giocatori morti tornano in vita al proprio turno, non possono morire e pescano 3 carte invece che 2. Quando terminano il turno tornano morti."
self.desc_eng = ""
self.desc_eng = "All dead players come back to life in their turn, they can't die and draw 3 cards instead of 2. When they end their turn the die."
class MezzogiornoDiFuoco(CardEvent):
def __init__(self):

View File

@ -36,6 +36,7 @@ class Game:
self.bot_speed = 1.5
self.incremental_turn = 0
self.did_resuscitate_deadman = False
self.is_handling_death = False
def notify_room(self, sid=None):
if len([p for p in self.players if p.character == None]) != 0 or sid:
@ -244,18 +245,18 @@ class Game:
elif self.is_russian_roulette_on and self.check_event(ce.RouletteRussa):
pls = self.get_alive_players()
if did_lose:
pl = pls[(pls.index(self.players[self.turn]) + self.player_bangs) % len(pls)]
target_pl = pls[(pls.index(self.players[self.turn]) + self.player_bangs) % len(pls)]
print('stop roulette')
pl.lives -= 1
pl.notify_self()
target_pl.lives -= 1
target_pl.notify_self()
self.is_russian_roulette_on = False
self.players[self.turn].play_turn()
else:
self.player_bangs += 1
pl = pls[(pls.index(self.players[self.turn]) + self.player_bangs) % len(pls)]
print(f'next in line {pl.name}')
if pl.get_banged(self.deck.event_cards[0]):
pl.notify_self()
target_pl = pls[(pls.index(self.players[self.turn]) + self.player_bangs) % len(pls)]
print(f'next in line {target_pl.name}')
if target_pl.get_banged(self.deck.event_cards[0]):
target_pl.notify_self()
else:
self.responders_did_respond_resume_turn(did_lose=True)
else:
@ -383,6 +384,7 @@ class Game:
def player_death(self, player: pl.Player, disconnected=False):
if not player in self.players or player.is_ghost: return
self.is_handling_death = True
import bang.expansions.dodge_city.characters as chd
print(player.attacker)
if player.attacker and player.attacker in self.players and isinstance(player.attacker.role, roles.Sheriff) and isinstance(player.role, roles.Vice):
@ -473,7 +475,7 @@ class Game:
herb[0].hand.append(self.deck.draw(True))
herb[0].hand.append(self.deck.draw(True))
herb[0].notify_self()
self.is_handling_death = False
if corpse.is_my_turn:
self.next_turn()
@ -484,6 +486,7 @@ class Game:
self.players = [p for p in self.players if not p.is_bot]
print(self.players)
self.started = False
self.is_handling_death = False
self.waiting_for = 0
self.incremental_turn = 0
for p in self.players:

View File

@ -516,7 +516,7 @@ class Player:
return s
def play_card(self, hand_index: int, against=None, _with=None):
if not self.is_my_turn or self.pending_action != PendingAction.PLAY:
if not self.is_my_turn or self.pending_action != PendingAction.PLAY or self.game.is_handling_death:
return
if not (0 <= hand_index < len(self.hand) + len(self.equipment)):
return
@ -662,7 +662,8 @@ class Player:
if self.game.check_event(ceh.Sete): pickable_stop = 2
if self.game.check_event(ceh.IlTreno): pickable_stop = 0
if len(self.available_cards) == pickable_stop:
self.game.deck.put_on_top(self.available_cards.pop())
if len(self.available_cards) > 0:
self.game.deck.put_on_top(self.available_cards.pop())
self.is_drawing = False
self.pending_action = PendingAction.PLAY
self.notify_self()
@ -787,7 +788,7 @@ class Player:
if len(equipments) == 0:
return False
else:
self.sio.emit('chat_message', room=self.game.name, data=f"_dalton|{self.name}")
self.choose_text = 'choose_dalton'
self.pending_action = PendingAction.CHOOSE
self.available_cards = equipments
return True

View File

@ -40,6 +40,7 @@
"choose_card_to_get": "Choose a card",
"choose_guess": "Guess the color of the suit",
"choose_ranch": "Choose the cards to replace",
"choose_dalton": "Choose which equipment to discard",
"choose_fratelli_di_sangue": "Choose who you want to donate one of your lives",
"choose_cecchino": "Choose who to shoot",
"choose_rimbalzo_player": "Choose the target of the bang",

View File

@ -40,6 +40,7 @@
"choose_card_to_get": "Scegli che carta pescare",
"choose_guess": "Indovina il colore del seme",
"choose_ranch": "Scegli le carte da sostituire",
"choose_dalton": "Scegli che equipaggiamento scartare",
"choose_fratelli_di_sangue": "Scegli a chi donare una delle tue vite",
"choose_cecchino": "Scegli contro chi sparare",
"choose_rimbalzo_player": "Scegli contro chi scartare il bang",