1
Fork 0
mirror of https://github.com/RYGhub/royal-mifia.git synced 2025-02-16 13:24:06 +00:00

Do not delete game if there aren't enough players

This commit is contained in:
Steffo 2016-08-10 15:09:34 +02:00
parent 8ba213cdd8
commit 2978f1a2c8

16
main.py
View file

@ -469,13 +469,17 @@ class Game:
def endconfig(self, bot):
"""Fine della fase di config, inizio assegnazione ruoli"""
self.phase = 'Voting'
try:
self.assignroles(bot)
except IndexError:
self.message(bot, s.error_not_enough_players)
self.endgame()
# Controlla che ci siano abbastanza giocatori per avviare la partita
requiredplayers = 0
for selectedrole in rolepriority:
requiredplayers += self.roleconfig[selectedrole.__name__]
# Se non ce ne sono abbastanza, torna alla fase di join
if requiredplayers > len(self.players):
self.phase = 'Join'
self.configstep = 0
else:
self.phase = 'Voting'
self.assignroles(bot)
self.message(bot, s.roles_assigned_successfully)
def endgame(self):