#! perl # archetype nekosan use Data::Dumper; sub teleport { my ($pl, $map, $x, $y) = @_; my $portal = cf::object::new ("exit"); $portal->set_slaying ($map); $portal->set_hp ($x); $portal->set_sp ($y); $portal->apply ($pl); $portal->free; } sub on_move { my ($data) = @_; if (my $pl = $data->{who}->nearest_player) { if ($pl->exp >= 200000) { my (undef, undef, undef, $dir, undef) = $data->{who}->direction ($pl); $data->{who}->move ($data->{who}, $dir); } } 1 } sub on_attack { my ($data) = @_; $data->{activator}{neko_attack}++ or cf::LOG cf::llevDebug, sprintf "QBERT Neko-san was attacked by %s!", $data->{activator}->name; $data->{activator}->message ("Meoow! (You are hurting me)") if !($data->{activator}{neko_attack} & 15); if ($data->{activator}{neko_attack} > 256) { $data->{activator}->message ("Neko-san is suddenly gone!"); teleport $data->{activator}, "/scorn/misc/scorn_illusions", 15, 7; $data->{activator}->message ("You hear strange noises all around you..."); $data->{activator}->message ("You feel dumb."); } 1 } sub on_say { my ($data) = @_; cf::LOG cf::llevDebug, "QBERT [Neko-fon] $data->{message}"; 0 }