From 638b6b77427b8fae00b20cec67d3c7b0134493a6 Mon Sep 17 00:00:00 2001 From: jcao219 Date: Mon, 1 Aug 2011 12:20:44 -0500 Subject: [PATCH] now after gunner shoots, there is a check for game-end conditions (too many wounded that there is parity) --- wolfgame.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/wolfgame.py b/wolfgame.py index c5a2746..8a93707 100644 --- a/wolfgame.py +++ b/wolfgame.py @@ -630,6 +630,8 @@ def chk_win(cli): chan = botconfig.CHANNEL lpl = len(var.list_players()) + if var.PHASE == "day": + lpl -= len(var.WOUNDED) if lpl == 0: cli.msg(chan, "No more players remaining. Game ended.") reset(cli) @@ -956,6 +958,12 @@ def transition_day(cli, gameid=0): var.PHASE = "day" var.GOATED = False chan = botconfig.CHANNEL + + # Reset daytime variables + var.VOTES = {} + var.INVESTIGATED = [] + var.WOUNDED = [] + var.DAY_START_TIME = datetime.now() if not len(var.SEEN)+len(var.ACTED_WOLVES) and var.FIRST_NIGHT and var.ROLES["seer"]: cli.msg(botconfig.CHANNEL, ("\u0002{0}\u0002, a \u0002wolf\u0002, and \u0002{1}\u0002, a \u0002seer\u0002 "+ @@ -965,12 +973,6 @@ def transition_day(cli, gameid=0): if not del_player(cli, x, True): return - # Reset daytime variables - var.VOTES = {} - var.INVESTIGATED = [] - var.WOUNDED = [] - var.DAY_START_TIME = datetime.now() - td = var.DAY_START_TIME - var.NIGHT_START_TIME var.NIGHT_START_TIME = None var.NIGHT_TIMEDELTA += td @@ -1225,6 +1227,7 @@ def shoot(cli, nick, chan, rest): if victim not in var.WOUNDED: var.WOUNDED.append(victim) chk_decision(cli) + chk_win(cli) elif rand <= chances[0] + chances[1]: cli.msg(chan, "\u0002{0}\u0002 is a lousy shooter. S/He missed!".format(nick)) else: