1
Fork 0
mirror of https://github.com/RYGhub/royal-mifia.git synced 2024-11-25 07:04:18 +00:00

Round Robin può ora essere giocato con qualsiasi numero di giocatori

This commit is contained in:
Steffo 2017-12-28 19:32:24 +01:00
parent fe459cd1d6
commit 4c25f5247a
WARNING! Although there is a key with this ID in the database it does not verify this commit! This commit is SUSPICIOUS.
GPG key ID: C27544372FBB445D

72
main.py
View file

@ -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.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() self.endconfig()
elif preset == "oneofall": elif preset == "oneofall":
unassignedplayers = len(self.players)
self.roleconfig = { self.roleconfig = {
"Mifioso": 1, "Mifioso": 0,
"Investigatore": 1, "Investigatore": 0,
"Corrotto": 1, "Corrotto": 0,
"Angelo": 1, "Angelo": 0,
"Terrorista": 1, "Terrorista": 0,
"Derek": 1, "Derek": 0,
"Disastro": 1, "Disastro": 0,
"Mamma": 1, "Mamma": 0,
"Stagista": 1, "Stagista": 0,
"SignoreDelCaos": 0, "SignoreDelCaos": 0,
"Servitore": 0, "Servitore": 0,
"Vigilante": 1 "Vigilante": 0
} }
unassignedplayers = len(self.players) - 9 while True:
availableroles = list() if unassignedplayers > 1:
while unassignedplayers > 0: self.roleconfig["Mifioso"] += 1
if len(availableroles) == 0: else:
availableroles = rolepriority.copy() break
availableroles.remove(SignoreDelCaos) if unassignedplayers > 1:
availableroles.remove(Servitore) self.roleconfig["Investigatore"] += 1
random.shuffle(availableroles) else:
self.roleconfig[availableroles.pop().__name__] += 1 break
unassignedplayers -= 1 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.votingmifia = False
self.message(s.preset_oneofall_selected) self.message(s.preset_oneofall_selected)
self.endconfig() self.endconfig()