From 1adcd0323bf8f202c915aa6ee7f13f21c66e801d Mon Sep 17 00:00:00 2001 From: Elijah Perrault Date: Wed, 13 Apr 2011 14:45:06 -0600 Subject: [PATCH] Werewolf: Fixed a bug causing double lynches occasionally. --- doc/CHANGELOG | 1 + modules/Werewolf.pm | 10 ++++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/doc/CHANGELOG b/doc/CHANGELOG index a025004..011f215 100644 --- a/doc/CHANGELOG +++ b/doc/CHANGELOG @@ -3,6 +3,7 @@ Auto IRC Bot 3.0: Change Log 3.0 Indev =============================================================================== + * Werewolf: Fixed a bug causing double lynches occasionally. * Werewolf: One bug fix and multiple bullets. * Werewolf: Fixed timeout bug. * Werewolf: Fixed various warnings. diff --git a/modules/Werewolf.pm b/modules/Werewolf.pm index 096b8eb..d4418cb 100644 --- a/modules/Werewolf.pm +++ b/modules/Werewolf.pm @@ -1204,7 +1204,7 @@ sub _judgment { # Kill him/her! my ($gsvr, $gchan) = split '/', $GAMECHAN; privmsg($gsvr, $gchan, "The villagers, after much debate, finally decide on lynching \2$NICKS{$nick}\2, who turned out to be... a \2"._getrole($nick, 2)."\2."); - my $ri = _player_del($nick); + my $ri = _player_del($nick, 1); # Initialize nighttime. if ($ri) { _init_night() } @@ -1276,7 +1276,7 @@ sub _getrole { # Delete a player. sub _player_del { - my ($player) = @_; + my ($player, $judgment) = @_; my ($gsvr, $gchan) = split '/', $GAMECHAN; # Devoice them. @@ -1307,8 +1307,10 @@ sub _player_del { # Update LVOTEN. if ($LVOTEN) { $LVOTEN-- } - # Call lynch management. - if ($PHASE) { if ($PHASE eq 'd') { _lynchmng() } } + # Call lynch management IF judgment did not call us. + if ($PHASE and !$judgment) { + if ($PHASE eq 'd') { _lynchmng() } + } # Check for winning conditions. if (!$PGAME) {