room limit to 10

This commit is contained in:
Alberto Xamin 2020-11-27 12:30:20 +01:00
parent 5bfa749423
commit 0e0f3271bb
No known key found for this signature in database
GPG Key ID: 4F026F48309500A2

View File

@ -41,8 +41,11 @@ class Game:
self.notify_room() self.notify_room()
def add_player(self, player: players.Player): def add_player(self, player: players.Player):
if player in self.players or len(self.players) >= 7: if player in self.players or len(self.players) >= 10:
return return
if len(self.players) > 7:
if 'dodge_city' not in self.expansions:
self.expansions.append('dodge_city')
player.join_game(self) player.join_game(self)
self.players.append(player) self.players.append(player)
print(f'Added player {player.name} to game') print(f'Added player {player.name} to game')
@ -89,7 +92,7 @@ class Game:
roles.Outlaw('Elimina il Vice 🎖, se non lo elimini tu elimina anche il Rinnegato') roles.Outlaw('Elimina il Vice 🎖, se non lo elimini tu elimina anche il Rinnegato')
] ]
elif len(self.players) >= 4: elif len(self.players) >= 4:
available_roles = [roles.Sheriff(), roles.Renegade(), roles.Outlaw(), roles.Outlaw(), roles.Vice(), roles.Outlaw(), roles.Vice()] available_roles = [roles.Sheriff(), roles.Renegade(), roles.Outlaw(), roles.Outlaw(), roles.Vice(), roles.Outlaw(), roles.Vice(), roles.Outlaw(), roles.Vice(), roles.Outlaw()]
available_roles = available_roles[:len(self.players)] available_roles = available_roles[:len(self.players)]
random.shuffle(available_roles) random.shuffle(available_roles)
for i in range(len(self.players)): for i in range(len(self.players)):