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.22 by root, Sun Aug 27 15:23:30 2006 UTC vs.
Revision 1.30 by root, Sun Sep 10 16:45:17 2006 UTC

5sub teleport { 5sub teleport {
6 my ($pl, $map, $x, $y) = @_; 6 my ($pl, $map, $x, $y) = @_;
7 7
8 my $portal = cf::object::new "exit"; 8 my $portal = cf::object::new "exit";
9 9
10 $portal->set_slaying ($map); 10 $portal->slaying ($map);
11 $portal->set_hp ($x); 11 $portal->stats->hp ($x);
12 $portal->set_sp ($y); 12 $portal->stats->sp ($y);
13 13
14 $portal->apply ($pl); 14 $portal->apply ($pl);
15 15
16 $portal->free; 16 $portal->free;
17} 17}
31 } 31 }
32 32
33 $pl 33 $pl
34} 34}
35 35
36sub on_move { 36sub on_monster_move {
37 my ($self, $enemy) = @_; 37 my ($self, $enemy) = @_;
38 #warn "move<@_>\n";#d#
39 38
40 if (my $pl = find_target_player $self) { 39 if (my $pl = find_target_player $self) {
41 my ($d, undef, undef, $dir, undef) = $self->rangevector ($pl); 40 my ($d, undef, undef, $dir, undef) = $self->rangevector ($pl);
42 41
43 if ($d < 1.5) { 42 if ($d < 1.5) {
52 $pl->{neko_next_cast} = time + 40 + rand 60; 51 $pl->{neko_next_cast} = time + 40 + rand 60;
53 52
54 # so heal her 53 # so heal her
55 my $spell = cf::object::new "spell_heal"; 54 my $spell = cf::object::new "spell_heal";
56 55
57 $spell->set_sp (0); # makes casting work 56 $spell->stats->sp (0); # makes casting work
58 $spell->set_gp (0); # on unholy/nomagic ground 57 $spell->stats->grace (0); # on unholy/nomagic ground
59 58
60 $spell->set_hp (0); 59 $spell->stats->hp (0);
61 $spell->set_dam (($pl->maxhp - $pl->hp) * 0.5); # normal hp heal 60 $spell->stats->dam (($pl->stats->maxhp - $pl->stats->hp) * 0.5); # normal hp heal
62 $spell->set_food (50); # fill food 61 $spell->stats->food (50); # fill food
63 $spell->set_last_sp (100); # fill sp 62 $spell->last_sp (100); # fill sp
64 $spell->set_last_grace (100); # fill gr 63 $spell->last_grace (100); # fill gr
65 $spell->set_attacktype (cf::AT_CONFUSION | cf::AT_POISON | cf::AT_BLIND | cf::AT_DISEASE); 64 $spell->attacktype (cf::AT_CONFUSION | cf::AT_POISON | cf::AT_BLIND | cf::AT_DISEASE);
66 65
67 $pl->message ("(Neko-san makes strange noises)"); 66 $pl->message ("(Neko-san makes strange noises)");
68 $pl->cast_spell ($self, $dir, $spell); 67 $pl->cast_spell ($self, $dir, $spell);
69 68
70 $spell->free; 69 $spell->free;
71 } 70 }
72 71
73 } else { 72 } else {
74 # check for fish in his inv and steal it 73 # check for fish in his inv and steal it
75 if (my $fish = (grep $_->archetype->name eq "fishfood", $pl->inv)[0]) { 74 if (my $fish = (grep $_->arch->name eq "fishfood", $pl->inv)[0]) {
76 # add force 75 # add force
77 my $gave_fish = cf::object::new "force"; 76 my $gave_fish = cf::object::new "force";
78 $gave_fish->set_slaying ("schmorp-neko-gave-fish"); 77 $gave_fish->slaying ("schmorp-neko-gave-fish");
79 $gave_fish->set_speed (0); 78 $gave_fish->speed (0);
80 $gave_fish->insert_ob_in_ob ($pl); 79 $gave_fish->insert_ob_in_ob ($pl);
81 80
82 # remove fish 81 # remove fish
83 $fish->remove; 82 $fish->remove;
84 $fish->free; 83 $fish->free;
104 103
105 cf::override; 104 cf::override;
106} 105}
107 106
108sub on_attack { 107sub on_attack {
109 my ($self) = @_; 108 my ($self, $hitter) = @_;
110 #warn "attack<@_>\n";#d#
111 109
110 if ($hitter->type == cf::PLAYER) {
112 if ($self->{neko_last_attack} < time - 300) { 111 if ($hitter->{neko_last_attack} < time - 300) {
113 $self->{neko_attack} = 0; 112 $hitter->{neko_attack} = 0;
114 } 113 }
115 114
116 $self->{neko_last_attack} = time; 115 $hitter->{neko_last_attack} = time;
117 $self->{neko_attack}++ 116 $hitter->{neko_attack}++
118 or ext::schmorp_irc::do_notice "Neko-san was attacked by ". $self->name . "!\n"; 117 or ext::schmorp_irc::do_notice "Neko-san was attacked by ". $hitter->name . "!\n";
119 118
120 $self->message ("Meoow! (Please do not hurt me)") 119 $hitter->message ("Meoow! (Please do not hurt me)")
121 if !($self->{neko_attack} & 15); 120 if !($hitter->{neko_attack} & 15);
122 121
123 if ($self->{neko_attack} > 512) { 122 if ($hitter->{neko_attack} > 512) {
124 $self->{neko_attack} -= 128; 123 $hitter->{neko_attack} -= 128;
125 $self->message ("Neko-san is suddenly gone!"); 124 $hitter->message ("Neko-san is suddenly gone!");
126 teleport $self, "/scorn/misc/scorn_illusions", 15, 7; 125 teleport $hitter, "/scorn/misc/scorn_illusions", 15, 7;
127 $self->message ("You hear strange noises all around you..."); 126 $hitter->message ("You hear strange noises all around you...");
128 $self->message ("You feel dumb."); 127 $hitter->message ("You feel dumb.");
128 }
129 } else {
130 $hitter->hp (-1);
131 $hitter->kill_object;
129 } 132 }
130 133
131 cf::override; 134 cf::override;
132} 135}
133 136
134sub on_listen { 137sub on_say {
135 my ($event, $ob, $who, $msg) = @_; 138 my ($self, $pl, $msg) = @_;
136 139
137 cf::LOG cf::llevDebug, sprintf "QBERT [Neko-fon] %s: %s\n", $who->name, $msg;
138 ext::schmorp_irc::do_notice (sprintf "[Neko-fon] %s: %s\n", $who->name, $msg); 140 ext::schmorp_irc::do_notice (sprintf "[Neko-fon] %s: %s\n", $pl->ob->name, $msg);
139} 141}
140 142
141cf::register_attachment "Nekosan", package => __PACKAGE__; 143cf::register_attachment "Nekosan", package => __PACKAGE__;
142 144

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines