fix stuff
This commit is contained in:
parent
f59cdbd574
commit
55618e4370
@ -17,7 +17,7 @@ games: List[Game] = []
|
|||||||
online_players = 0
|
online_players = 0
|
||||||
|
|
||||||
def advertise_lobbies():
|
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
|
@sio.event
|
||||||
def connect(sid, environ):
|
def connect(sid, environ):
|
||||||
|
@ -23,7 +23,7 @@ class Game:
|
|||||||
self.waiting_for = 0
|
self.waiting_for = 0
|
||||||
|
|
||||||
def add_player(self, player: players.Player):
|
def add_player(self, player: players.Player):
|
||||||
if player in self.players:
|
if player in self.players or len(self.players) >= 7:
|
||||||
return
|
return
|
||||||
player.join_game(self)
|
player.join_game(self)
|
||||||
self.players.append(player)
|
self.players.append(player)
|
||||||
|
@ -440,6 +440,7 @@ class Player:
|
|||||||
if isinstance(self.hand[i], cards.Birra):
|
if isinstance(self.hand[i], cards.Birra):
|
||||||
self.lives += 1
|
self.lives += 1
|
||||||
self.game.deck.scrap(self.hand.pop(i))
|
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
|
break
|
||||||
self.mancato_needed = 0
|
self.mancato_needed = 0
|
||||||
self.notify_self()
|
self.notify_self()
|
||||||
|
@ -17,7 +17,7 @@ class Sheriff(Role):
|
|||||||
self.max_players = 1
|
self.max_players = 1
|
||||||
self.icon = '⭐️'
|
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:
|
if initial_players == 3 and len(alive_players) == 1:
|
||||||
return True
|
return True
|
||||||
elif initial_players != 3 and not any([isinstance(p.role, Outlaw) or isinstance(p.role, Renegade) for p in alive_players]):
|
elif initial_players != 3 and not any([isinstance(p.role, Outlaw) or isinstance(p.role, Renegade) for p in alive_players]):
|
||||||
|
Loading…
Reference in New Issue
Block a user