diff options
author | doy <doy@tozt.net> | 2009-01-23 22:52:14 -0500 |
---|---|---|
committer | doy <doy@tozt.net> | 2009-01-23 22:52:14 -0500 |
commit | cd5e21bb6036d410017c3b863c5ffb4d9270bcb6 (patch) | |
tree | c90e18a23d61be46ae2a9a7cba1903609fe56c49 | |
parent | 14160c23b5a8d26fa47e08075b214200ebf04897 (diff) | |
download | bot-games-cd5e21bb6036d410017c3b863c5ffb4d9270bcb6.tar.gz bot-games-cd5e21bb6036d410017c3b863c5ffb4d9270bcb6.zip |
make turn use augment/inner so that the after modifier in the base class works
-rw-r--r-- | lib/Bot/Games/Game.pm | 2 | ||||
-rw-r--r-- | lib/Bot/Games/Game/24.pm | 2 | ||||
-rw-r--r-- | lib/Bot/Games/Game/Ghostlike.pm | 4 |
3 files changed, 4 insertions, 4 deletions
diff --git a/lib/Bot/Games/Game.pm b/lib/Bot/Games/Game.pm index ec82bd7..e0f4a2d 100644 --- a/lib/Bot/Games/Game.pm +++ b/lib/Bot/Games/Game.pm @@ -44,7 +44,7 @@ has is_over => ( command => 1, ); -sub turn { "Games must provide a turn method" } +sub turn { inner() || "Games must provide a turn method" } after turn => sub { shift->last_turn_time(DateTime->now) }; __PACKAGE__->meta->make_immutable; diff --git a/lib/Bot/Games/Game/24.pm b/lib/Bot/Games/Game/24.pm index cbe0edc..63221f3 100644 --- a/lib/Bot/Games/Game/24.pm +++ b/lib/Bot/Games/Game/24.pm @@ -23,7 +23,7 @@ sub init { return $self->generate_24; } -sub turn { +augment turn => sub { my $self = shift; my ($player, $expr) = @_; diff --git a/lib/Bot/Games/Game/Ghostlike.pm b/lib/Bot/Games/Game/Ghostlike.pm index 2505ddf..35d0101 100644 --- a/lib/Bot/Games/Game/Ghostlike.pm +++ b/lib/Bot/Games/Game/Ghostlike.pm @@ -51,7 +51,7 @@ around state => sub { return $self->$orig($state); }; -sub turn { +augment turn => sub { my $self = shift; my ($player, $state) = @_; @@ -71,7 +71,7 @@ sub turn { $self->current_player($self->next_player); return $self->state($state); -} +}; command challenge => sub { my $self = shift; |