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.22 by root, Sun Aug 27 15:23:30 2006 UTC vs.
Revision 1.27 by root, Wed Aug 30 08:36:08 2006 UTC

31 } 31 }
32 32
33 $pl 33 $pl
34} 34}
35 35
36sub on_move { 36sub on_monster_move {
37 my ($self, $enemy) = @_; 37 my ($self, $enemy) = @_;
38 #warn "move<@_>\n";#d#
39 38
40 if (my $pl = find_target_player $self) { 39 if (my $pl = find_target_player $self) {
41 my ($d, undef, undef, $dir, undef) = $self->rangevector ($pl); 40 my ($d, undef, undef, $dir, undef) = $self->rangevector ($pl);
42 41
43 if ($d < 1.5) { 42 if ($d < 1.5) {
104 103
105 cf::override; 104 cf::override;
106} 105}
107 106
108sub on_attack { 107sub on_attack {
109 my ($self) = @_; 108 my ($self, $hitter) = @_;
110 #warn "attack<@_>\n";#d#
111 109
110 if ($hitter->type == cf::PLAYER) {
112 if ($self->{neko_last_attack} < time - 300) { 111 if ($hitter->{neko_last_attack} < time - 300) {
113 $self->{neko_attack} = 0; 112 $hitter->{neko_attack} = 0;
114 } 113 }
115 114
116 $self->{neko_last_attack} = time; 115 $hitter->{neko_last_attack} = time;
117 $self->{neko_attack}++ 116 $hitter->{neko_attack}++
118 or ext::schmorp_irc::do_notice "Neko-san was attacked by ". $self->name . "!\n"; 117 or ext::schmorp_irc::do_notice "Neko-san was attacked by ". $hitter->name . "!\n";
119 118
120 $self->message ("Meoow! (Please do not hurt me)") 119 $hitter->message ("Meoow! (Please do not hurt me)")
121 if !($self->{neko_attack} & 15); 120 if !($hitter->{neko_attack} & 15);
122 121
123 if ($self->{neko_attack} > 512) { 122 if ($hitter->{neko_attack} > 512) {
124 $self->{neko_attack} -= 128; 123 $hitter->{neko_attack} -= 128;
125 $self->message ("Neko-san is suddenly gone!"); 124 $hitter->message ("Neko-san is suddenly gone!");
126 teleport $self, "/scorn/misc/scorn_illusions", 15, 7; 125 teleport $hitter, "/scorn/misc/scorn_illusions", 15, 7;
127 $self->message ("You hear strange noises all around you..."); 126 $hitter->message ("You hear strange noises all around you...");
128 $self->message ("You feel dumb."); 127 $hitter->message ("You feel dumb.");
128 }
129 } else {
130 $hitter->hp (-1);
131 $hitter->kill_object;
129 } 132 }
130 133
131 cf::override; 134 cf::override;
132} 135}
133 136
134sub on_listen { 137sub on_say {
135 my ($event, $ob, $who, $msg) = @_; 138 my ($self, $pl, $msg) = @_;
136 139
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); 140 ext::schmorp_irc::do_notice (sprintf "[Neko-fon] %s: %s\n", $pl->ob->name, $msg);
139} 141}
140 142
141cf::register_attachment "Nekosan", package => __PACKAGE__; 143cf::register_attachment "Nekosan", package => __PACKAGE__;
142 144

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines