… | |
… | |
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}->rangevector ($pl); |
25 | my ($d, undef, undef, $dir, undef) = $data->{who}->rangevector ($pl); |
|
|
26 | |
|
|
27 | $dir = $dir % 8 + 1 unless $d > 1.5; |
|
|
28 | |
26 | $data->{who}->move ($dir); |
29 | $data->{who}->move ($dir); |
27 | } |
30 | } |
28 | |
31 | |
29 | 1 |
32 | 1 |
30 | } |
33 | } |
… | |
… | |
33 | my ($data) = @_; |
36 | my ($data) = @_; |
34 | |
37 | |
35 | $data->{activator}{neko_attack}++ |
38 | $data->{activator}{neko_attack}++ |
36 | or cf::LOG cf::llevDebug, sprintf "QBERT Neko-san was attacked by %s!\n", $data->{activator}->name; |
39 | or cf::LOG cf::llevDebug, sprintf "QBERT Neko-san was attacked by %s!\n", $data->{activator}->name; |
37 | |
40 | |
38 | $data->{activator}->message ("Meoow! (You are hurting me)") |
41 | $data->{activator}->message ("Meoow! (Please do not hurt me)") |
39 | if !($data->{activator}{neko_attack} & 15); |
42 | if !($data->{activator}{neko_attack} & 15); |
40 | |
43 | |
41 | if ($data->{activator}{neko_attack} > 256) { |
44 | if ($data->{activator}{neko_attack} > 512) { |
|
|
45 | $data->{activator}{neko_attack} -= 128; |
42 | $data->{activator}->message ("Neko-san is suddenly gone!"); |
46 | $data->{activator}->message ("Neko-san is suddenly gone!"); |
43 | teleport $data->{activator}, "/scorn/misc/scorn_illusions", 15, 7; |
47 | teleport $data->{activator}, "/scorn/misc/scorn_illusions", 15, 7; |
44 | $data->{activator}->message ("You hear strange noises all around you..."); |
48 | $data->{activator}->message ("You hear strange noises all around you..."); |
45 | $data->{activator}->message ("You feel dumb."); |
49 | $data->{activator}->message ("You feel dumb."); |
46 | } |
50 | } |
… | |
… | |
49 | } |
53 | } |
50 | |
54 | |
51 | sub on_say { |
55 | sub on_say { |
52 | my ($data) = @_; |
56 | my ($data) = @_; |
53 | |
57 | |
54 | cf::LOG cf::llevDebug, "QBERT [Neko-fon] $data->{message}\n"; |
58 | cf::LOG cf::llevDebug, sprintf "QBERT [Neko-fon] %s: %s\n", $data->{activator}->name, $data->{message}; |
55 | |
59 | |
56 | 0 |
60 | 0 |
57 | } |
61 | } |
58 | |
62 | |