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