ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/ext/schmorp-neko.ext
(Generate patch)

Comparing deliantra/server/ext/schmorp-neko.ext (file contents):
Revision 1.8 by root, Sun May 4 08:55:52 2008 UTC vs.
Revision 1.9 by root, Thu Apr 22 12:50:24 2010 UTC

3# archetype nekosan 3# archetype nekosan
4 4
5sub find_target_player { 5sub find_target_player {
6 my ($obj) = @_; 6 my ($obj) = @_;
7 7
8 my ($time, $pl) = (time + 120, undef); 8 my ($time, $pl) = (AE::now + 120, undef);
9 9
10 for (map $_->ob, cf::player::list) { 10 for (map $_->ob, cf::player::list) {
11 next unless $obj->on_same_map_as ($_); 11 next unless $obj->on_same_map_as ($_);
12 12
13 my $ptime = List::Util::max $_->{neko_next_pester}, $_->{neko_next_cast}; 13 my $ptime = List::Util::max $_->{neko_next_pester}, $_->{neko_next_cast};
26 my ($d, undef, undef, $dir, undef) = $self->rangevector ($pl); 26 my ($d, undef, undef, $dir, undef) = $self->rangevector ($pl);
27 27
28 if ($d < 1.5) { 28 if ($d < 1.5) {
29 if (grep $_->type == cf::FORCE && $_->slaying eq "schmorp-neko-gave-fish", $pl->inv) { 29 if (grep $_->type == cf::FORCE && $_->slaying eq "schmorp-neko-gave-fish", $pl->inv) {
30 # she likes us! 30 # she likes us!
31 if ($pl->{neko_next_pester} < time) { 31 if ($pl->{neko_next_pester} < AE::now) {
32 $pl->{neko_next_pester} = time + 120 + rand 300; 32 $pl->{neko_next_pester} = AE::now + 120 + cf::rndm 300;
33 $pl->message ("Purr. (Purr)"); 33 $pl->message ("Purr. (Purr)");
34 } 34 }
35 35
36 if ($pl->{neko_next_cast} < time) { 36 if ($pl->{neko_next_cast} < AE::now) {
37 $pl->{neko_next_cast} = time + 40 + rand 60; 37 $pl->{neko_next_cast} = AE::now + 40 + cf::rndm 60;
38 38
39 # so heal her 39 # so heal her
40 my $spell = cf::object::new "spell_heal"; 40 my $spell = cf::object::new "spell_heal";
41 41
42 $spell->stats->sp (0); # makes casting work 42 $spell->stats->sp (0); # makes casting work
70 # be nice 70 # be nice
71 $pl->message ("Meoww! (Thank you)"); 71 $pl->message ("Meoww! (Thank you)");
72 72
73 } else { 73 } else {
74 # pester user 74 # pester user
75 if ($pl->{neko_next_pester} < time) { 75 if ($pl->{neko_next_pester} < AE::now) {
76 $pl->{neko_next_pester} = time + 60 + rand 300; 76 $pl->{neko_next_pester} = AE::now + 60 + cf::rndm 300;
77 $pl->message ("Meow. (Please bring me fish)"); 77 $pl->message ("Meow. (Please bring me fish)");
78 } 78 }
79 } 79 }
80 } 80 }
81 81
91 91
92sub on_attack { 92sub on_attack {
93 my ($self, $hitter) = @_; 93 my ($self, $hitter) = @_;
94 94
95 if ($hitter->type == cf::PLAYER) { 95 if ($hitter->type == cf::PLAYER) {
96 if ($hitter->{neko_last_attack} < time - 300) { 96 if ($hitter->{neko_last_attack} < AE::now - 300) {
97 $hitter->{neko_attack} = 0; 97 $hitter->{neko_attack} = 0;
98 } 98 }
99 99
100 $hitter->{neko_last_attack} = time; 100 $hitter->{neko_last_attack} = AE::now;
101 $hitter->{neko_attack}++ 101 $hitter->{neko_attack}++
102 or ext::irc::do_notice "Neko-san was attacked by ". $hitter->name . "!\n"; 102 or ext::irc::do_notice "Neko-san was attacked by ". $hitter->name . "!\n";
103 103
104 $hitter->message ("Meoow! (Please do not hurt me)") 104 $hitter->message ("Meoow! (Please do not hurt me)")
105 if !($hitter->{neko_attack} & 15); 105 if !($hitter->{neko_attack} & 15);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines