… | |
… | |
20 | |
20 | |
21 | sub on_move { |
21 | sub on_move { |
22 | my ($data) = @_; |
22 | my ($data) = @_; |
23 | |
23 | |
24 | if (my $pl = $data->{who}->nearest_player) { |
24 | if (my $pl = $data->{who}->nearest_player) { |
25 | my (undef, undef, undef, $dir, undef) = $data->{who}->direction ($pl); |
25 | my (undef, undef, undef, $dir, undef) = $data->{who}->rangevector ($pl); |
26 | $data->{who}->move ($data->{who}, $dir); |
26 | $data->{who}->move ($dir); |
27 | } |
27 | } |
28 | |
28 | |
29 | 1 |
29 | 1 |
30 | } |
30 | } |
31 | |
31 | |
32 | sub on_attack { |
32 | sub on_attack { |
33 | my ($data) = @_; |
33 | my ($data) = @_; |
34 | |
34 | |
35 | $data->{activator}{neko_attack}++ |
35 | $data->{activator}{neko_attack}++ |
36 | or cf::LOG cf::llevDebug, sprintf "QBERT Neko-san was attacked by %s!", $data->{activator}->name; |
36 | or cf::LOG cf::llevDebug, sprintf "QBERT Neko-san was attacked by %s!\n", $data->{activator}->name; |
37 | |
37 | |
38 | $data->{activator}->message ("Meoow! (You are hurting me)") |
38 | $data->{activator}->message ("Meoow! (You are hurting me)") |
39 | if !($data->{activator}{neko_attack} & 15); |
39 | if !($data->{activator}{neko_attack} & 15); |
40 | |
40 | |
41 | if ($data->{activator}{neko_attack} > 256) { |
41 | if ($data->{activator}{neko_attack} > 256) { |
… | |
… | |
49 | } |
49 | } |
50 | |
50 | |
51 | sub on_say { |
51 | sub on_say { |
52 | my ($data) = @_; |
52 | my ($data) = @_; |
53 | |
53 | |
54 | cf::LOG cf::llevDebug, "QBERT [Neko-fon] $data->{message}"; |
54 | cf::LOG cf::llevDebug, "QBERT [Neko-fon] $data->{message}\n"; |
55 | |
55 | |
56 | 0 |
56 | 0 |
57 | } |
57 | } |
58 | |
58 | |