--- deliantra/maps/perl/schmorp-neko.ext 2006/08/25 15:24:54 1.21 +++ deliantra/maps/perl/schmorp-neko.ext 2006/08/27 15:23:30 1.22 @@ -1,10 +1,7 @@ #! perl -#CONVERSION: NONE # archetype nekosan -use Data::Dumper; - sub teleport { my ($pl, $map, $x, $y) = @_; @@ -37,10 +34,11 @@ } sub on_move { - my ($event, $who) = @_; + my ($self, $enemy) = @_; + #warn "move<@_>\n";#d# - if (my $pl = find_target_player $who) { - my ($d, undef, undef, $dir, undef) = $who->rangevector ($pl); + if (my $pl = find_target_player $self) { + my ($d, undef, undef, $dir, undef) = $self->rangevector ($pl); if ($d < 1.5) { if (grep $_->type == cf::FORCE && $_->slaying eq "schmorp-neko-gave-fish", $pl->inv) { @@ -67,7 +65,7 @@ $spell->set_attacktype (cf::AT_CONFUSION | cf::AT_POISON | cf::AT_BLIND | cf::AT_DISEASE); $pl->message ("(Neko-san makes strange noises)"); - $pl->cast_spell ($who, $dir, $spell); + $pl->cast_spell ($self, $dir, $spell); $spell->free; } @@ -101,41 +99,44 @@ $dir = $dir % 8 + 1 unless $d > 1.5; } - $who->move ($dir); + $self->move ($dir); } - 1 + cf::override; } sub on_attack { - my ($event, $ob, $who) = @_; + my ($self) = @_; + #warn "attack<@_>\n";#d# - if ($who->{neko_last_attack} < time - 300) { - $who->{neko_attack} = 0; + if ($self->{neko_last_attack} < time - 300) { + $self->{neko_attack} = 0; } - $who->{neko_last_attack} = time; - $who->{neko_attack}++ - or ext::schmorp_irc::do_notice "Neko-san was attacked by ". $who->name . "!\n"; - - $who->message ("Meoow! (Please do not hurt me)") - if !($who->{neko_attack} & 15); - - if ($who->{neko_attack} > 512) { - $who->{neko_attack} -= 128; - $who->message ("Neko-san is suddenly gone!"); - teleport $who, "/scorn/misc/scorn_illusions", 15, 7; - $who->message ("You hear strange noises all around you..."); - $who->message ("You feel dumb."); + $self->{neko_last_attack} = time; + $self->{neko_attack}++ + or ext::schmorp_irc::do_notice "Neko-san was attacked by ". $self->name . "!\n"; + + $self->message ("Meoow! (Please do not hurt me)") + if !($self->{neko_attack} & 15); + + if ($self->{neko_attack} > 512) { + $self->{neko_attack} -= 128; + $self->message ("Neko-san is suddenly gone!"); + teleport $self, "/scorn/misc/scorn_illusions", 15, 7; + $self->message ("You hear strange noises all around you..."); + $self->message ("You feel dumb."); } - 1 + cf::override; } -sub on_say { +sub on_listen { my ($event, $ob, $who, $msg) = @_; cf::LOG cf::llevDebug, sprintf "QBERT [Neko-fon] %s: %s\n", $who->name, $msg; ext::schmorp_irc::do_notice (sprintf "[Neko-fon] %s: %s\n", $who->name, $msg); } +cf::register_attachment "Nekosan", package => __PACKAGE__; +