1 |
#! perl |
2 |
|
3 |
# archetype nekosan |
4 |
|
5 |
use Data::Dumper; |
6 |
|
7 |
sub teleport { |
8 |
my ($pl, $map, $x, $y) = @_; |
9 |
|
10 |
my $portal = cf::object::new ("exit"); |
11 |
|
12 |
$portal->set_slaying ($map); |
13 |
$portal->set_hp ($x); |
14 |
$portal->set_sp ($y); |
15 |
|
16 |
$portal->apply ($pl); |
17 |
|
18 |
$portal->free; |
19 |
} |
20 |
|
21 |
sub on_move { |
22 |
my ($data) = @_; |
23 |
|
24 |
if (my $pl = $data->{who}->nearest_player) { |
25 |
my ($d, undef, undef, $dir, undef) = $data->{who}->rangevector ($pl); |
26 |
|
27 |
$dir = $dir % 8 + 1 unless $d > 1.5; |
28 |
|
29 |
$data->{who}->move ($dir); |
30 |
} |
31 |
|
32 |
1 |
33 |
} |
34 |
|
35 |
sub on_attack { |
36 |
my ($data) = @_; |
37 |
|
38 |
$data->{activator}{neko_attack}++ |
39 |
or cf::LOG cf::llevDebug, sprintf "QBERT Neko-san was attacked by %s!\n", $data->{activator}->name; |
40 |
|
41 |
$data->{activator}->message ("Meoow! (Please do not hurt me)") |
42 |
if !($data->{activator}{neko_attack} & 15); |
43 |
|
44 |
if ($data->{activator}{neko_attack} > 512) { |
45 |
$data->{activator}{neko_attack} -= 128; |
46 |
$data->{activator}->message ("Neko-san is suddenly gone!"); |
47 |
teleport $data->{activator}, "/scorn/misc/scorn_illusions", 15, 7; |
48 |
$data->{activator}->message ("You hear strange noises all around you..."); |
49 |
$data->{activator}->message ("You feel dumb."); |
50 |
} |
51 |
|
52 |
1 |
53 |
} |
54 |
|
55 |
sub on_say { |
56 |
my ($data) = @_; |
57 |
|
58 |
cf::LOG cf::llevDebug, sprintf "QBERT [Neko-fon] %s: %s\n", $data->{activator}->name, $data->{message}; |
59 |
|
60 |
0 |
61 |
} |
62 |
|