From ba5de67e4a2736fcf79ae0621b030e2d5c87eae3 Mon Sep 17 00:00:00 2001 From: Elijah Perrault Date: Tue, 19 Apr 2011 20:23:37 -0600 Subject: [PATCH] Werewolf: Fixed a GUARD issue and made it possible to VISIT yourself. --- doc/CHANGELOG | 1 + modules/Werewolf.pm | 17 +++++++++++------ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/doc/CHANGELOG b/doc/CHANGELOG index 645a96c..3b98900 100644 --- a/doc/CHANGELOG +++ b/doc/CHANGELOG @@ -3,6 +3,7 @@ Auto IRC Bot 3.0: Change Log 3.0 Indev =============================================================================== + * Werewolf: Fixed a GUARD issue and made it possible to VISIT yourself. * Possibly fixed a rare fatal error. * Werewolf: Rewrote WAIT to be more decent. * Werewolf: Wounded villagers are now excluded from winning villager count. diff --git a/modules/Werewolf.pm b/modules/Werewolf.pm index 5a7579b..cce3bb8 100644 --- a/modules/Werewolf.pm +++ b/modules/Werewolf.pm @@ -8,7 +8,7 @@ use feature qw(switch); use API::Std qw(cmd_add cmd_del trans hook_add hook_del timer_add timer_del trans conf_get has_priv match_user); use API::IRC qw(privmsg notice cmode); our ($GAME, $PGAME, $GAMECHAN, $GAMETIME, %PLAYERS, %NICKS, @STATIC, $PHASE, $SEEN, $VISIT, $GUARD, %KILL, %WKILL, %LYNCH, %SPOKE, %WARN, $LVOTEN, @SHOT, - $BULLETS, $DETECTED, $WAIT, $WAITED); + $BULLETS, $DETECTED, $WAIT, $WAITED, $FM); my $FCHAR = (conf_get('fantasy_pf'))[0][0]; # Initialization subroutine. @@ -887,7 +887,7 @@ sub cmd_wolf { # They can only protect one person per round. if ($GUARD) { - privmsg($src->{svr}, $src->{nick}, "You are already protecting \2$NICKS{$VISIT}\2."); + privmsg($src->{svr}, $src->{nick}, "You are already protecting \2$NICKS{$GUARD}\2."); return; } @@ -945,7 +945,10 @@ sub cmd_wolf { # They can only visit one person per round. if ($VISIT) { - privmsg($src->{svr}, $src->{nick}, "You are already spending the night with \2$NICKS{$VISIT}\2!"); + my $friend; + if ($VISIT eq 1) { $friend = 'at home' } + else { $friend = "with $NICKS{$VISIT}" } + privmsg($src->{svr}, $src->{nick}, "You are already spending the night \2$friend\2!"); return; } @@ -961,10 +964,12 @@ sub cmd_wolf { return; } - # They can't sleep with themselves. + # Check if they've selected themselves. if (lc $argv[1] eq lc $src->{nick}) { - privmsg($src->{svr}, $src->{nick}, 'You cannot sleep with yourself!'); - return; + privmsg($src->{svr}, $src->{nick}, 'You have chosen to stay home for the night.'); + $VISIT = 1; + _chknight(); + return 1; } # All good, set variables and stuff.