Browse Source

finished adding the ability to start with daytime

master
jcao219 14 years ago
parent
commit
381649d18f
  1. 1
      var.py
  2. 13
      wolfgame.py

1
var.py

@ -66,6 +66,7 @@ def list_players_and_roles():
get_role = lambda plyr: list_players_and_roles()[plyr] get_role = lambda plyr: list_players_and_roles()[plyr]
def del_player(pname): def del_player(pname):
prole = get_role(pname) prole = get_role(pname)
ROLES[prole].remove(pname) ROLES[prole].remove(pname)

13
wolfgame.py

@ -477,6 +477,14 @@ hook("kick")(lambda cli, nick, *rest: leave(cli, "kick", nick))
def begin_day(cli): def begin_day(cli):
chan = botconfig.CHANNEL 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. "+ cli.msg(chan, ("The villagers must now vote for whom to lynch. "+
'Use "!lynch <nick>" to cast your vote. 3 votes '+ 'Use "!lynch <nick>" to cast your vote. 3 votes '+
'are required to lynch.')) 'are required to lynch.'))
@ -497,6 +505,8 @@ def transition_day(cli):
var.WOUNDED = [] var.WOUNDED = []
var.DAY_START_TIME = datetime.now() var.DAY_START_TIME = datetime.now()
if not var.NIGHT_START_TIME: 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) begin_day(cli)
return return
@ -864,7 +874,7 @@ def transition_night(cli):
daydur_msg = "" 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 td = var.NIGHT_START_TIME - var.DAY_START_TIME
var.DAY_START_TIME = None var.DAY_START_TIME = None
var.DAY_TIMEDELTA += td var.DAY_TIMEDELTA += td
@ -1073,7 +1083,6 @@ def start(cli, nick, chan, rest):
var.DAY_START_TIME = None var.DAY_START_TIME = None
var.NIGHT_START_TIME = None var.NIGHT_START_TIME = None
if not chk_win(cli):
if not var.START_WITH_DAY: if not var.START_WITH_DAY:
transition_night(cli) transition_night(cli)
else: else:

Loading…
Cancel
Save