From 381649d18f8c763eb5944831d0f28f268ddcd8c5 Mon Sep 17 00:00:00 2001 From: jcao219 Date: Fri, 8 Jul 2011 00:01:56 -0500 Subject: [PATCH] finished adding the ability to start with daytime --- var.py | 1 + wolfgame.py | 21 +++++++++++++++------ 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/var.py b/var.py index 385a7b6..e84c6b0 100644 --- a/var.py +++ b/var.py @@ -66,6 +66,7 @@ def list_players_and_roles(): get_role = lambda plyr: list_players_and_roles()[plyr] + def del_player(pname): prole = get_role(pname) ROLES[prole].remove(pname) diff --git a/wolfgame.py b/wolfgame.py index 5b5c14e..09fc50f 100644 --- a/wolfgame.py +++ b/wolfgame.py @@ -477,6 +477,14 @@ hook("kick")(lambda cli, nick, *rest: leave(cli, "kick", nick)) def begin_day(cli): chan = botconfig.CHANNEL + + # Reset nighttime variables + var.VICTIM = "" # nickname of kill victim + var.KILLER = "" # nickname of who chose the victim + var.SEEN = [] # list of seers that have had visions + var.OBSERVED = {} # those whom werecrows have observed + var.HVISITED = {} + cli.msg(chan, ("The villagers must now vote for whom to lynch. "+ 'Use "!lynch " to cast your vote. 3 votes '+ 'are required to lynch.')) @@ -497,6 +505,8 @@ def transition_day(cli): var.WOUNDED = [] var.DAY_START_TIME = datetime.now() if not var.NIGHT_START_TIME: + for plr in var.list_players(): + cli.msg(plr, "You are a \u0002{0}\u0002.".format(var.get_role(plr)) begin_day(cli) return @@ -864,7 +874,7 @@ def transition_night(cli): daydur_msg = "" - if var.NIGHT_TIMEDELTA: # transition from day + if var.NIGHT_TIMEDELTA or var.START_WITH_DAY: # transition from day td = var.NIGHT_START_TIME - var.DAY_START_TIME var.DAY_START_TIME = None var.DAY_TIMEDELTA += td @@ -1073,11 +1083,10 @@ def start(cli, nick, chan, rest): var.DAY_START_TIME = None var.NIGHT_START_TIME = None - if not chk_win(cli): - if not var.START_WITH_DAY: - transition_night(cli) - else: - transition_day(cli) + if not var.START_WITH_DAY: + transition_night(cli) + else: + transition_day(cli)