fix crash in games with traitor / wolf cub

This commit is contained in:
jacob1 2015-09-04 18:39:41 -04:00
parent 3eb437fad6
commit 028c5c9ae2

View File

@ -2546,6 +2546,11 @@ def chk_win_conditions(lpl, lwolves, lcubs, lrealwolves, lmonsters, ltraitors, l
winner = "wolves" winner = "wolves"
elif lrealwolves == 0: elif lrealwolves == 0:
chk_traitor(cli) chk_traitor(cli)
# update variables for recursive call (this shouldn't happen when checking 'random' role attribution, where it would probably fail)
lwolves = len(var.list_players(var.WOLFCHAT_ROLES))
lcubs = len(var.ROLES.get("wolf cub", ()))
lrealwolves = len(var.list_players(var.WOLF_ROLES - {"wolf cub"}))
ltraitors = len(var.ROLES.get("traitor", ()))
return chk_win_conditions(lpl, lwolves, lcubs, lrealwolves, lmonsters, ltraitors, lpipers, cli, end_game) return chk_win_conditions(lpl, lwolves, lcubs, lrealwolves, lmonsters, ltraitors, lpipers, cli, end_game)
event = Event("chk_win", {"winner": winner, "message": message}) event = Event("chk_win", {"winner": winner, "message": message})