Error in case of 11th join (game started)
Added a maximum of 10 player as specified in UNO official rules. This also prevents a deck empty error in case too much players have joined the game.
This commit is contained in:
parent
30b6680e6b
commit
687b72edf1
1 changed files with 4 additions and 1 deletions
|
@ -23,7 +23,7 @@ import logging
|
|||
from game import Game
|
||||
from player import Player
|
||||
from errors import (AlreadyJoinedError, LobbyClosedError, NoGameInChatError,
|
||||
NotEnoughPlayersError)
|
||||
NotEnoughPlayersError, MaxPlayersError)
|
||||
|
||||
|
||||
class GameManager(object):
|
||||
|
@ -69,6 +69,9 @@ class GameManager(object):
|
|||
if not game.open:
|
||||
raise LobbyClosedError()
|
||||
|
||||
if game.started and len(game.players) == 10:
|
||||
raise MaxPlayersError()
|
||||
|
||||
if user.id not in self.userid_players:
|
||||
self.userid_players[user.id] = list()
|
||||
|
||||
|
|
Loading…
Reference in a new issue