From 7d18a3b90209dfc52e21797ae70781c2ae499f07 Mon Sep 17 00:00:00 2001 From: skizzerz Date: Mon, 16 Feb 2015 23:39:27 -0600 Subject: [PATCH] Alpha tweaks - Fix bug when using bite and not specifying a victim where victim was None and thus trying to get their role resulted in a KeyError - Forward params from bite onwards to kill so you no longer need to do both (although you can still bite one person and kill someone else if you REALLY wanted to for some reason... it still won't work though) - If the bite failed for any reason (including if they targeted lycan who just instantly turns), refund the bite so the alpha wolf can try again after a wolf dies again during the day. --- modules/wolfgame.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/modules/wolfgame.py b/modules/wolfgame.py index b45150a..5f20829 100644 --- a/modules/wolfgame.py +++ b/modules/wolfgame.py @@ -2910,6 +2910,9 @@ def transition_day(cli, gameid=0): bywolves.remove(target) onlybywolves.remove(target) killers[target].remove("@wolves") + else: + # bite was unsuccessful, let them try again + var.ALPHA_WOLVES.remove(alpha) var.BITE_PREFERENCES = {} @@ -4342,14 +4345,17 @@ def bite_cmd(cli, nick, chan, rest): return victim = get_victim(cli, nick, re.split(" +",rest)[0], False) - - vrole = var.get_role(victim) + vrole = None + # also mark the victim as the kill target + if victim: + kill(cli, nick, chan, rest) if var.ANGRY_WOLVES: if not victim: pm(cli, nick, "Please choose who to bite by specifying their nick.") return + vrole = var.get_role(victim) if vrole in var.WOLFCHAT_ROLES: pm(cli, nick, "You may not bite other wolves.") return