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