Merge pull request #39 from jacob1/master

This commit is contained in:
nyuszika7h 2014-07-02 07:34:29 +02:00
commit 14aca5ee64

View File

@ -1364,7 +1364,6 @@ def begin_day(cli):
# Reset nighttime variables
var.KILLS = {} # nicknames of kill victim
var.GUARDED = ""
var.KILLER = "" # nickname of who chose the victim
var.SEEN = [] # list of seers that have had visions
var.OBSERVED = {} # those whom werecrows have observed
@ -1466,15 +1465,19 @@ def transition_day(cli, gameid=0):
var.LOGGER.logBare(victim, "WOLVESVICTIM", *[y for x,y in var.KILLS.items() if x == victim])
for crow, target in iter(var.OBSERVED.items()):
if ((target in list(var.HVISITED.keys()) and var.HVISITED[target]) or # if var.HVISITED[target] is None, harlot visited self
target in var.SEEN+list(var.GUARDED.keys())):
target in var.SEEN or (target in list(var.GUARDED.keys()) and var.GUARDED[target])):
pm(cli, crow, ("As the sun rises, you conclude that \u0002{0}\u0002 was not in "+
"bed all night, and you fly back to your house.").format(target))
else:
pm(cli, crow, ("As the sun rises, you conclude that \u0002{0}\u0002 was sleeping "+
"all night long, and you fly back to your house.").format(target))
if victim in var.GUARDED.values():
message.append(("\u0002{0}\u0002 was attacked by the wolves last night, but luckily, the "+
"guardian angel was on duty.").format(victim))
for gangel in var.ROLES["guardian angel"]:
if var.GUARDED.get(gangel) == victim:
dead.append(gangel)
message.append(("\u0002{0}\u0002 sacrificed their life to the wolves to "+
"guard that of another").format(gangel))
break
victim = ""
elif not victim:
message.append(random.choice(var.NO_VICTIMS_MESSAGES) +
@ -1921,12 +1924,13 @@ def guard(cli, nick, rest):
return
victim = pl[pll.index(target)]
if victim == nick:
pm(cli, nick, "You may not guard yourself.")
return
var.GUARDED[nick] = victim
pm(cli, nick, "You are protecting \u0002{0}\u0002 tonight. Farewell!".format(var.GUARDED[nick]))
pm(cli, var.GUARDED[nick], "You can sleep well tonight, for a guardian angel is protecting you.")
var.LOGGER.logBare(var.GUARDED[nick], "GUARDED", nick)
var.GUARDED[nick] = None
pm(cli, nick, "You have chosen not to guard anyone tonight.")
else:
var.GUARDED[nick] = victim
pm(cli, nick, "You are protecting \u0002{0}\u0002 tonight. Farewell!".format(var.GUARDED[nick]))
pm(cli, var.GUARDED[nick], "You can sleep well tonight, for a guardian angel is protecting you.")
var.LOGGER.logBare(var.GUARDED[nick], "GUARDED", nick)
chk_nightdone(cli)