… | |
… | |
107 | } |
107 | } |
108 | |
108 | |
109 | sub on_attack { |
109 | sub on_attack { |
110 | my ($event, $ob, $who) = @_; |
110 | my ($event, $ob, $who) = @_; |
111 | |
111 | |
|
|
112 | if ($who->{neko_last_attack} < time - 300) { |
|
|
113 | $who->{neko_attack} = 0; |
|
|
114 | } |
|
|
115 | |
|
|
116 | $who->{neko_last_attack} = time; |
112 | $who->{neko_attack}++ |
117 | $who->{neko_attack}++ |
113 | or cf::LOG cf::llevDebug, sprintf "QBERT Neko-san was attacked by %s!\n", $who->name; |
118 | or cf::LOG cf::llevDebug, sprintf "QBERT Neko-san was attacked by %s!\n", $who->name; |
114 | |
119 | |
115 | $who->message ("Meoow! (Please do not hurt me)") |
120 | $who->message ("Meoow! (Please do not hurt me)") |
116 | if !($who->{neko_attack} & 15); |
121 | if !($who->{neko_attack} & 15); |