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.24 by root, Wed Aug 30 05:15:05 2006 UTC vs.
Revision 1.29 by root, Fri Sep 8 17:33:55 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}
51 $pl->{neko_next_cast} = time + 40 + rand 60; 51 $pl->{neko_next_cast} = time + 40 + rand 60;
52 52
53 # so heal her 53 # so heal her
54 my $spell = cf::object::new "spell_heal"; 54 my $spell = cf::object::new "spell_heal";
55 55
56 $spell->set_sp (0); # makes casting work 56 $spell->stats->sp (0); # makes casting work
57 $spell->set_gp (0); # on unholy/nomagic ground 57 $spell->stats->grace (0); # on unholy/nomagic ground
58 58
59 $spell->set_hp (0); 59 $spell->stats->hp (0);
60 $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
61 $spell->set_food (50); # fill food 61 $spell->stats->food (50); # fill food
62 $spell->set_last_sp (100); # fill sp 62 $spell->last_sp (100); # fill sp
63 $spell->set_last_grace (100); # fill gr 63 $spell->last_grace (100); # fill gr
64 $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);
65 65
66 $pl->message ("(Neko-san makes strange noises)"); 66 $pl->message ("(Neko-san makes strange noises)");
67 $pl->cast_spell ($self, $dir, $spell); 67 $pl->cast_spell ($self, $dir, $spell);
68 68
69 $spell->free; 69 $spell->free;
72 } else { 72 } else {
73 # check for fish in his inv and steal it 73 # check for fish in his inv and steal it
74 if (my $fish = (grep $_->archetype->name eq "fishfood", $pl->inv)[0]) { 74 if (my $fish = (grep $_->archetype->name eq "fishfood", $pl->inv)[0]) {
75 # add force 75 # add force
76 my $gave_fish = cf::object::new "force"; 76 my $gave_fish = cf::object::new "force";
77 $gave_fish->set_slaying ("schmorp-neko-gave-fish"); 77 $gave_fish->slaying ("schmorp-neko-gave-fish");
78 $gave_fish->set_speed (0); 78 $gave_fish->speed (0);
79 $gave_fish->insert_ob_in_ob ($pl); 79 $gave_fish->insert_ob_in_ob ($pl);
80 80
81 # remove fish 81 # remove fish
82 $fish->remove; 82 $fish->remove;
83 $fish->free; 83 $fish->free;
105} 105}
106 106
107sub on_attack { 107sub on_attack {
108 my ($self, $hitter) = @_; 108 my ($self, $hitter) = @_;
109 109
110 if ($hitter->type == cf::PLAYER) {
110 if ($hitter->{neko_last_attack} < time - 300) { 111 if ($hitter->{neko_last_attack} < time - 300) {
111 $hitter->{neko_attack} = 0; 112 $hitter->{neko_attack} = 0;
112 } 113 }
113 114
114 $hitter->{neko_last_attack} = time; 115 $hitter->{neko_last_attack} = time;
115 $hitter->{neko_attack}++ 116 $hitter->{neko_attack}++
116 or ext::schmorp_irc::do_notice "Neko-san was attacked by ". $hitter->name . "!\n"; 117 or ext::schmorp_irc::do_notice "Neko-san was attacked by ". $hitter->name . "!\n";
117 118
118 $hitter->message ("Meoow! (Please do not hurt me)") 119 $hitter->message ("Meoow! (Please do not hurt me)")
119 if !($hitter->{neko_attack} & 15); 120 if !($hitter->{neko_attack} & 15);
120 121
121 if ($hitter->{neko_attack} > 512) { 122 if ($hitter->{neko_attack} > 512) {
122 $hitter->{neko_attack} -= 128; 123 $hitter->{neko_attack} -= 128;
123 $hitter->message ("Neko-san is suddenly gone!"); 124 $hitter->message ("Neko-san is suddenly gone!");
124 teleport $hitter, "/scorn/misc/scorn_illusions", 15, 7; 125 teleport $hitter, "/scorn/misc/scorn_illusions", 15, 7;
125 $hitter->message ("You hear strange noises all around you..."); 126 $hitter->message ("You hear strange noises all around you...");
126 $hitter->message ("You feel dumb."); 127 $hitter->message ("You feel dumb.");
128 }
129 } else {
130 $hitter->hp (-1);
131 $hitter->kill_object;
127 } 132 }
128 133
129 cf::override; 134 cf::override;
130} 135}
131 136
132sub on_listen { 137sub on_say {
133 my ($event, $ob, $who, $msg) = @_; 138 my ($self, $pl, $msg) = @_;
134 139
135 cf::LOG cf::llevDebug, sprintf "QBERT [Neko-fon] %s: %s\n", $who->name, $msg;
136 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);
137} 141}
138 142
139cf::register_attachment "Nekosan", package => __PACKAGE__; 143cf::register_attachment "Nekosan", package => __PACKAGE__;
140 144

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines