end of game role list shows role swaps / is ordered mostly alphabetically
TODO: also order !stats, !pstats, others; and maybe show villagers in end of game list
This commit is contained in:
parent
a7928399a7
commit
0a48c3ced4
@ -1443,28 +1443,45 @@ def stop_game(cli, winner = ""):
|
|||||||
|
|
||||||
roles_msg = []
|
roles_msg = []
|
||||||
|
|
||||||
lroles = list(var.ORIGINAL_ROLES.keys())
|
origroles = {} #nick based list of original roles
|
||||||
lroles.remove("wolf")
|
rolelist = copy.deepcopy(var.ORIGINAL_ROLES)
|
||||||
lroles.insert(0, "wolf") # picky, howl consistency
|
for role, playerlist in var.ORIGINAL_ROLES.items():
|
||||||
|
if role in var.TEMPLATE_RESTRICTIONS.keys():
|
||||||
for role in lroles:
|
|
||||||
if len(var.ORIGINAL_ROLES[role]) == 0 or role == var.DEFAULT_ROLE:
|
|
||||||
continue
|
continue
|
||||||
playersinrole = copy.copy(var.ORIGINAL_ROLES[role])
|
for p in playerlist:
|
||||||
for i in range(0, len(playersinrole)):
|
if p.startswith("(dced)"): # don't care about it here
|
||||||
if playersinrole[i].startswith("(dced)"): # don't care about it here
|
rolelist[role].remove(p)
|
||||||
playersinrole[i] = playersinrole[i][6:]
|
p = p[6:]
|
||||||
if len(playersinrole) == 2:
|
rolelist[role].append(p)
|
||||||
msg = "The {1} were \u0002{0[0]}\u0002 and \u0002{0[1]}\u0002."
|
if p in var.FINAL_ROLES and var.FINAL_ROLES[p] != role and (role != "amnesiac" or p in var.AMNESIACS):
|
||||||
roles_msg.append(msg.format(playersinrole, var.plural(role)))
|
origroles[p] = role
|
||||||
elif len(playersinrole) == 1:
|
rolelist[role].remove(p)
|
||||||
roles_msg.append("The {1} was \u0002{0[0]}\u0002.".format(playersinrole,
|
rolelist[var.FINAL_ROLES[p]].append(p)
|
||||||
role))
|
prev = False
|
||||||
|
for role in var.role_order():
|
||||||
|
if not rolelist[role]:
|
||||||
|
continue
|
||||||
|
playersformatted = []
|
||||||
|
for i in range(0, len(rolelist[role])):
|
||||||
|
p = rolelist[role][i]
|
||||||
|
#don't print default role, but if someone exchanged into villager, print what they were anyway
|
||||||
|
if role == var.DEFAULT_ROLE and p not in origroles:
|
||||||
|
continue
|
||||||
|
playersformatted.append("\u0002{0}\u0002".format(p))
|
||||||
|
if p in origroles:
|
||||||
|
playersformatted[-1] += " ({0}{1})".format("" if prev else "was ", origroles[p])
|
||||||
|
prev = True
|
||||||
|
if not playersformatted:
|
||||||
|
continue
|
||||||
|
if len(rolelist[role]) == 2:
|
||||||
|
msg = "The {1} were {0[0]} and {0[1]}."
|
||||||
|
roles_msg.append(msg.format(playersformatted, var.plural(role)))
|
||||||
|
elif len(rolelist[role]) == 1:
|
||||||
|
roles_msg.append("The {1} was {0[0]}.".format(playersformatted, role))
|
||||||
else:
|
else:
|
||||||
msg = "The {2} were {0}, and \u0002{1}\u0002."
|
msg = "The {2} were {0}, and {1}."
|
||||||
nickslist = ["\u0002"+x+"\u0002" for x in playersinrole[0:-1]]
|
roles_msg.append(msg.format(", ".join(playersformatted[0:-1]),
|
||||||
roles_msg.append(msg.format(", ".join(nickslist),
|
playersformatted[-1],
|
||||||
playersinrole[-1],
|
|
||||||
var.plural(role)))
|
var.plural(role)))
|
||||||
message = ""
|
message = ""
|
||||||
count = 0
|
count = 0
|
||||||
|
@ -171,9 +171,9 @@ ROLE_GUIDE = {# village roles
|
|||||||
# If every wolf role dies, the game ends and village wins and there are no remaining traitors, the game ends and villagers win
|
# If every wolf role dies, the game ends and village wins and there are no remaining traitors, the game ends and villagers win
|
||||||
WOLF_ROLES = ["wolf", "werecrow", "wolf cub"]
|
WOLF_ROLES = ["wolf", "werecrow", "wolf cub"]
|
||||||
# Access to wolfchat, and counted towards the # of wolves vs villagers when determining if a side has won
|
# Access to wolfchat, and counted towards the # of wolves vs villagers when determining if a side has won
|
||||||
WOLFCHAT_ROLES = ["wolf", "traitor", "werecrow", "hag", "wolf cub", "sorcerer"]
|
WOLFCHAT_ROLES = ["wolf", "werecrow", "wolf cub", "traitor", "hag", "sorcerer"]
|
||||||
# Wins with the wolves, even if the roles are not necessarily wolves themselves
|
# Wins with the wolves, even if the roles are not necessarily wolves themselves
|
||||||
WOLFTEAM_ROLES = ["wolf", "traitor", "werecrow", "hag", "wolf cub", "sorcerer", "minion", "cultist"]
|
WOLFTEAM_ROLES = ["wolf", "werecrow", "wolf cub", "traitor", "hag", "sorcerer", "minion", "cultist"]
|
||||||
# These roles never win as a team, only ever individually (either instead of or in addition to the regular winners)
|
# These roles never win as a team, only ever individually (either instead of or in addition to the regular winners)
|
||||||
TRUE_NEUTRAL_ROLES = ["crazed shaman", "fool", "jester", "monster", "clone"]
|
TRUE_NEUTRAL_ROLES = ["crazed shaman", "fool", "jester", "monster", "clone"]
|
||||||
# These are the roles that will NOT be used for when amnesiac turns, everything else is fair game!
|
# These are the roles that will NOT be used for when amnesiac turns, everything else is fair game!
|
||||||
@ -301,6 +301,13 @@ def get_templates(nick):
|
|||||||
|
|
||||||
return tpl
|
return tpl
|
||||||
|
|
||||||
|
def role_order():
|
||||||
|
templates = list(TEMPLATE_RESTRICTIONS.keys())
|
||||||
|
vils = [role for role in ROLE_GUIDE.keys() if role not in WOLFTEAM_ROLES+templates]
|
||||||
|
vils.sort()
|
||||||
|
return WOLFTEAM_ROLES + vils + templates
|
||||||
|
|
||||||
|
|
||||||
def break_long_message(phrases, joinstr = " "):
|
def break_long_message(phrases, joinstr = " "):
|
||||||
message = ""
|
message = ""
|
||||||
count = 0
|
count = 0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user