From 4c25f5247ac6100275f518bab4eb5f815613c3aa Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Thu, 28 Dec 2017 19:32:24 +0100 Subject: [PATCH] =?UTF-8?q?Round=20Robin=20pu=C3=B2=20ora=20essere=20gioca?= =?UTF-8?q?to=20con=20qualsiasi=20numero=20di=20giocatori?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.py | 72 +++++++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 52 insertions(+), 20 deletions(-) diff --git a/main.py b/main.py index e535b6c..521045d 100644 --- a/main.py +++ b/main.py @@ -354,30 +354,62 @@ class Game: self.message(s.preset_classic_selected.format(mifioso=self.roleconfig["Mifioso"], investigatore=self.roleconfig["Investigatore"], angelo=self.roleconfig["Angelo"], royal=len(self.players) - self.roleconfig["Mifioso"] - self.roleconfig["Investigatore"] - self.roleconfig["Angelo"], royalmenouno=len(self.players) - self.roleconfig["Mifioso"] - self.roleconfig["Investigatore"] - self.roleconfig["Angelo"] - 1)) self.endconfig() elif preset == "oneofall": + unassignedplayers = len(self.players) self.roleconfig = { - "Mifioso": 1, - "Investigatore": 1, - "Corrotto": 1, - "Angelo": 1, - "Terrorista": 1, - "Derek": 1, - "Disastro": 1, - "Mamma": 1, - "Stagista": 1, + "Mifioso": 0, + "Investigatore": 0, + "Corrotto": 0, + "Angelo": 0, + "Terrorista": 0, + "Derek": 0, + "Disastro": 0, + "Mamma": 0, + "Stagista": 0, "SignoreDelCaos": 0, "Servitore": 0, - "Vigilante": 1 + "Vigilante": 0 } - unassignedplayers = len(self.players) - 9 - availableroles = list() - while unassignedplayers > 0: - if len(availableroles) == 0: - availableroles = rolepriority.copy() - availableroles.remove(SignoreDelCaos) - availableroles.remove(Servitore) - random.shuffle(availableroles) - self.roleconfig[availableroles.pop().__name__] += 1 - unassignedplayers -= 1 + while True: + if unassignedplayers > 1: + self.roleconfig["Mifioso"] += 1 + else: + break + if unassignedplayers > 1: + self.roleconfig["Investigatore"] += 1 + else: + break + if unassignedplayers > 1: + self.roleconfig["Corrotto"] += 1 + else: + break + if unassignedplayers > 1: + self.roleconfig["Angelo"] += 1 + else: + break + if unassignedplayers > 1: + self.roleconfig["Terrorista"] += 1 + else: + break + if unassignedplayers > 1: + self.roleconfig["Derek"] += 1 + else: + break + if unassignedplayers > 1: + self.roleconfig["Disastro"] += 1 + else: + break + if unassignedplayers > 1: + self.roleconfig["Mamma"] += 1 + else: + break + if unassignedplayers > 1: + self.roleconfig["Stagista"] += 1 + else: + break + if unassignedplayers > 1: + self.roleconfig["Vigilante"] += 1 + else: + break self.votingmifia = False self.message(s.preset_oneofall_selected) self.endconfig()