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

Comparing deliantra/maps/perl/schmorp-neko.ext (file contents):
Revision 1.9 by root, Fri Feb 17 15:21:21 2006 UTC vs.
Revision 1.10 by root, Fri Feb 17 19:36:36 2006 UTC

5use Data::Dumper; 5use Data::Dumper;
6 6
7sub teleport { 7sub teleport {
8 my ($pl, $map, $x, $y) = @_; 8 my ($pl, $map, $x, $y) = @_;
9 9
10 my $portal = cf::object::new ("exit"); 10 my $portal = cf::object::new "exit";
11 11
12 $portal->set_slaying ($map); 12 $portal->set_slaying ($map);
13 $portal->set_hp ($x); 13 $portal->set_hp ($x);
14 $portal->set_sp ($y); 14 $portal->set_sp ($y);
15 15
22 my ($data) = @_; 22 my ($data) = @_;
23 23
24 if (my $pl = $data->{who}->nearest_player) { 24 if (my $pl = $data->{who}->nearest_player) {
25 my ($d, undef, undef, $dir, undef) = $data->{who}->rangevector ($pl); 25 my ($d, undef, undef, $dir, undef) = $data->{who}->rangevector ($pl);
26 26
27 if ($d < 1.5) {
28 if (grep $_->type == cf::FORCE && $_->slaying eq "schmorp-neko-gave-fish", $pl->inv) {
29 # she likes us!
30 if ($pl->{neko_fish} < time) {
31 $pl->{neko_fish} = time + 120 + rand 300;
32 $pl->message ("Purr. (Purr)");
33 }
34
35 # so heal her
36 my $spell = cf::object::new "spell_heal";
37
38 $spell->set_hp (0);
39 $spell->set_dam (0); # normal hp heal (none to aovid message)
40 $spell->set_food (999); # fill food
41 $spell->set_last_sp (9999); # fill sp
42 $spell->set_last_grace (9999); # fill gr
43 $spell->set_attacktype (cf::AT_CONFUSION | cf::AT_POISON | cf::AT_BLIND | cf::AT_DISEASE);
44
45 if ($data->{who}->cast_spell ($data->{who}, $dir, $spell)) {
46 $pl->message ("... (Neko-san makes strange noises)");
47 }
48
49 $spell->free;
50
51 } else {
52 # check for fish in his inv and steal it
53 if (my $fish = (grep $_->archetype->name eq "fishfood", $pl->inv)[0]) {
54 # add force
55 my $gave_fish = cf::object::new "force";
56 $gave_fish->set_slaying ("schmorp-neko-gave-fish");
57 $gave_fish->set_speed (0);
58 $gave_fish->insert_ob_in_ob ($pl);
59
60 # remove fish
61 $fish->remove;
62 $fish->free;
63
64 # be nice
65 $pl->message ("Meoww! (Thank you)");
66
67 } else {
68 # pester user
69 if ($pl->{neko_fish} < time) {
70 $pl->{neko_fish} = time + 60 + rand 300;
71 $pl->message ("Meow. (Please bring me fish)");
72 }
73 }
74 }
75
76 # circular movement
27 $dir = $dir % 8 + 1 unless $d > 1.5; 77 $dir = $dir % 8 + 1 unless $d > 1.5;
78 }
28 79
29 $data->{who}->move ($dir); 80 $data->{who}->move ($dir);
30 } 81 }
31 82
32 1 83 1

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines