From c1a256c162feca70270d762881dfaa507a5c4225 Mon Sep 17 00:00:00 2001 From: jacob1 Date: Tue, 1 Jul 2014 23:11:52 -0400 Subject: [PATCH 1/2] GA dies when guarding, victims name not revealed --- modules/wolfgame.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/modules/wolfgame.py b/modules/wolfgame.py index b257aae..0f9f676 100644 --- a/modules/wolfgame.py +++ b/modules/wolfgame.py @@ -1451,8 +1451,12 @@ def transition_day(cli, gameid=0): 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) + From cba018b5c0a113b56c18e17ccb3485dd990da071 Mon Sep 17 00:00:00 2001 From: jacob1 Date: Wed, 2 Jul 2014 01:24:28 -0400 Subject: [PATCH 2/2] guardian angel can choose not to guard anyone at night --- modules/wolfgame.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/modules/wolfgame.py b/modules/wolfgame.py index 0f9f676..279926d 100644 --- a/modules/wolfgame.py +++ b/modules/wolfgame.py @@ -1342,7 +1342,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 @@ -1444,7 +1443,7 @@ 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: @@ -1903,12 +1902,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)