fix stuff

This commit is contained in:
Alberto Xamin 2020-11-24 23:43:07 +01:00
parent f59cdbd574
commit 55618e4370
No known key found for this signature in database
GPG Key ID: 4F026F48309500A2
4 changed files with 4 additions and 3 deletions

View File

@ -17,7 +17,7 @@ games: List[Game] = []
online_players = 0
def advertise_lobbies():
sio.emit('lobbies', room='lobby', data=[{'name': g.name, 'players': len(g.players)} for g in games if not g.started])
sio.emit('lobbies', room='lobby', data=[{'name': g.name, 'players': len(g.players)} for g in games if not g.started and len(g.players) < 7])
@sio.event
def connect(sid, environ):

View File

@ -23,7 +23,7 @@ class Game:
self.waiting_for = 0
def add_player(self, player: players.Player):
if player in self.players:
if player in self.players or len(self.players) >= 7:
return
player.join_game(self)
self.players.append(player)

View File

@ -440,6 +440,7 @@ class Player:
if isinstance(self.hand[i], cards.Birra):
self.lives += 1
self.game.deck.scrap(self.hand.pop(i))
self.sio.emit('chat_message', room=self.game.name, data=f'{self.name} ha usato una birra per recuperare una vita.')
break
self.mancato_needed = 0
self.notify_self()

View File

@ -17,7 +17,7 @@ class Sheriff(Role):
self.max_players = 1
self.icon = '⭐️'
def on_player_death(self, alive_players: list, initial_players: int):
def on_player_death(self, alive_players: list, initial_players: int, dead_role=None, attacker_role=None):
if initial_players == 3 and len(alive_players) == 1:
return True
elif initial_players != 3 and not any([isinstance(p.role, Outlaw) or isinstance(p.role, Renegade) for p in alive_players]):