ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/maps/perl/schmorp-neko.ext
(Generate patch)

Comparing deliantra/maps/perl/schmorp-neko.ext (file contents):
Revision 1.15 by root, Sat Mar 25 04:47:56 2006 UTC vs.
Revision 1.22 by root, Sun Aug 27 15:23:30 2006 UTC

1#! perl 1#! perl
2 2
3# archetype nekosan 3# archetype nekosan
4
5use Data::Dumper;
6 4
7sub teleport { 5sub teleport {
8 my ($pl, $map, $x, $y) = @_; 6 my ($pl, $map, $x, $y) = @_;
9 7
10 my $portal = cf::object::new "exit"; 8 my $portal = cf::object::new "exit";
34 32
35 $pl 33 $pl
36} 34}
37 35
38sub on_move { 36sub on_move {
39 my ($data) = @_; 37 my ($self, $enemy) = @_;
38 #warn "move<@_>\n";#d#
40 39
41 if (my $pl = find_target_player $data->{who}) { 40 if (my $pl = find_target_player $self) {
42 my ($d, undef, undef, $dir, undef) = $data->{who}->rangevector ($pl); 41 my ($d, undef, undef, $dir, undef) = $self->rangevector ($pl);
43 42
44 if ($d < 1.5) { 43 if ($d < 1.5) {
45 if (grep $_->type == cf::FORCE && $_->slaying eq "schmorp-neko-gave-fish", $pl->inv) { 44 if (grep $_->type == cf::FORCE && $_->slaying eq "schmorp-neko-gave-fish", $pl->inv) {
46 # she likes us! 45 # she likes us!
47 if ($pl->{neko_next_pester} < time) { 46 if ($pl->{neko_next_pester} < time) {
64 $spell->set_last_sp (100); # fill sp 63 $spell->set_last_sp (100); # fill sp
65 $spell->set_last_grace (100); # fill gr 64 $spell->set_last_grace (100); # fill gr
66 $spell->set_attacktype (cf::AT_CONFUSION | cf::AT_POISON | cf::AT_BLIND | cf::AT_DISEASE); 65 $spell->set_attacktype (cf::AT_CONFUSION | cf::AT_POISON | cf::AT_BLIND | cf::AT_DISEASE);
67 66
68 $pl->message ("(Neko-san makes strange noises)"); 67 $pl->message ("(Neko-san makes strange noises)");
69 $pl->cast_spell ($data->{who}, $dir, $spell); 68 $pl->cast_spell ($self, $dir, $spell);
70 69
71 $spell->free; 70 $spell->free;
72 } 71 }
73 72
74 } else { 73 } else {
98 97
99 # circular movement 98 # circular movement
100 $dir = $dir % 8 + 1 unless $d > 1.5; 99 $dir = $dir % 8 + 1 unless $d > 1.5;
101 } 100 }
102 101
103 $data->{who}->move ($dir); 102 $self->move ($dir);
104 } 103 }
105 104
106 1 105 cf::override;
107} 106}
108 107
109sub on_attack { 108sub on_attack {
110 my ($data) = @_; 109 my ($self) = @_;
110 #warn "attack<@_>\n";#d#
111 111
112 $data->{activator}{neko_attack}++ 112 if ($self->{neko_last_attack} < time - 300) {
113 or cf::LOG cf::llevDebug, sprintf "QBERT Neko-san was attacked by %s!\n", $data->{activator}->name; 113 $self->{neko_attack} = 0;
114
115 $data->{activator}->message ("Meoow! (Please do not hurt me)")
116 if !($data->{activator}{neko_attack} & 15);
117
118 if ($data->{activator}{neko_attack} > 512) {
119 $data->{activator}{neko_attack} -= 128;
120 $data->{activator}->message ("Neko-san is suddenly gone!");
121 teleport $data->{activator}, "/scorn/misc/scorn_illusions", 15, 7;
122 $data->{activator}->message ("You hear strange noises all around you...");
123 $data->{activator}->message ("You feel dumb.");
124 } 114 }
125 115
116 $self->{neko_last_attack} = time;
117 $self->{neko_attack}++
118 or ext::schmorp_irc::do_notice "Neko-san was attacked by ". $self->name . "!\n";
119
120 $self->message ("Meoow! (Please do not hurt me)")
121 if !($self->{neko_attack} & 15);
122
123 if ($self->{neko_attack} > 512) {
124 $self->{neko_attack} -= 128;
125 $self->message ("Neko-san is suddenly gone!");
126 teleport $self, "/scorn/misc/scorn_illusions", 15, 7;
127 $self->message ("You hear strange noises all around you...");
128 $self->message ("You feel dumb.");
126 1 129 }
130
131 cf::override;
127} 132}
128 133
129sub on_say { 134sub on_listen {
130 my ($data) = @_; 135 my ($event, $ob, $who, $msg) = @_;
131 136
132 cf::LOG cf::llevDebug, sprintf "QBERT [Neko-fon] %s: %s\n", $data->{activator}->name, $data->{message}; 137 cf::LOG cf::llevDebug, sprintf "QBERT [Neko-fon] %s: %s\n", $who->name, $msg;
138 ext::schmorp_irc::do_notice (sprintf "[Neko-fon] %s: %s\n", $who->name, $msg);
133} 139}
134 140
141cf::register_attachment "Nekosan", package => __PACKAGE__;
142

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines