From 55cc34df3ffa2491c362b2f8b731186eb8df3f9a Mon Sep 17 00:00:00 2001 From: nyuszika7h Date: Wed, 18 Sep 2013 20:14:52 +0200 Subject: [PATCH] Fix werecrow dying when wolf is shot dead at night Previously, if a wolf was shot dead at night, any werecrows that have observed were removed from the game without announcement, although they would remain voiced. For those who are curious, this is because lists are copied by reference on assignment in Python; any changes made on the variable you assigned the list to will be reflected in the original list. This can be avoided by making a shallow copy of the list using `list(x)` or `x[:]`. --- modules/wolfgame.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/wolfgame.py b/modules/wolfgame.py index 4856ceb..689a591 100644 --- a/modules/wolfgame.py +++ b/modules/wolfgame.py @@ -1391,7 +1391,7 @@ def transition_day(cli, gameid=0): var.LOGGER.logBare(victim, "KILLED") if victim in var.GUNNERS.keys() and var.GUNNERS[victim]: # victim had bullets! if random.random() < var.GUNNER_KILLS_WOLF_AT_NIGHT_CHANCE: - wc = var.ROLES["werecrow"] + wc = var.ROLES["werecrow"][:] for crow in wc: if crow in var.OBSERVED.keys(): wc.remove(crow)