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