diff options
author | doy <doy@tozt.net> | 2008-12-18 01:31:39 -0500 |
---|---|---|
committer | doy <doy@tozt.net> | 2008-12-18 01:31:39 -0500 |
commit | e22e2f020901f440cda7ad6c5beb9236a89ec613 (patch) | |
tree | 76efcce7fa67fe762fd77ed639f3bf29b2101655 /lib/Bot/Games.pm | |
parent | 76c44fb3db64dbd3db5465213febacd755cd944f (diff) | |
download | bot-games-e22e2f020901f440cda7ad6c5beb9236a89ec613.tar.gz bot-games-e22e2f020901f440cda7ad6c5beb9236a89ec613.zip |
allow games to output things each turn, and at game end
Diffstat (limited to 'lib/Bot/Games.pm')
-rw-r--r-- | lib/Bot/Games.pm | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/Bot/Games.pm b/lib/Bot/Games.pm index ef2a17d..d5969e2 100644 --- a/lib/Bot/Games.pm +++ b/lib/Bot/Games.pm @@ -40,8 +40,13 @@ sub said { return "Unknown command $action for game $game_name."; } - $game->turn($args{who}, $action); - delete $self->active_games->{$game_name} if $game->is_over; + my $output = $game->turn($args{who}, $action); + if (my $end_msg = $game->is_over) { + $self->say(%args, body => $output); + $output = $end_msg; + delete $self->active_games->{$game_name}; + } + return $output; } sub valid_game { |