Browse Source

now after gunner shoots, there is a check for game-end conditions (too many wounded that there is parity)

master
jcao219 14 years ago
parent
commit
638b6b7742
  1. 15
      wolfgame.py

15
wolfgame.py

@ -630,6 +630,8 @@ def chk_win(cli): @@ -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): @@ -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): @@ -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): @@ -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:

Loading…
Cancel
Save