Browse Source

finished adding the ability to start with daytime

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

1
var.py

@ -66,6 +66,7 @@ def list_players_and_roles(): @@ -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)

21
wolfgame.py

@ -477,6 +477,14 @@ hook("kick")(lambda cli, nick, *rest: leave(cli, "kick", nick)) @@ -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 <nick>" to cast your vote. 3 votes '+
'are required to lynch.'))
@ -497,6 +505,8 @@ def transition_day(cli): @@ -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): @@ -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): @@ -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)

Loading…
Cancel
Save