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.21 by root, Fri Aug 25 15:24:54 2006 UTC vs.
Revision 1.22 by root, Sun Aug 27 15:23:30 2006 UTC

1#! perl 1#! perl
2#CONVERSION: NONE
3 2
4# archetype nekosan 3# archetype nekosan
5
6use Data::Dumper;
7 4
8sub teleport { 5sub teleport {
9 my ($pl, $map, $x, $y) = @_; 6 my ($pl, $map, $x, $y) = @_;
10 7
11 my $portal = cf::object::new "exit"; 8 my $portal = cf::object::new "exit";
35 32
36 $pl 33 $pl
37} 34}
38 35
39sub on_move { 36sub on_move {
40 my ($event, $who) = @_; 37 my ($self, $enemy) = @_;
38 #warn "move<@_>\n";#d#
41 39
42 if (my $pl = find_target_player $who) { 40 if (my $pl = find_target_player $self) {
43 my ($d, undef, undef, $dir, undef) = $who->rangevector ($pl); 41 my ($d, undef, undef, $dir, undef) = $self->rangevector ($pl);
44 42
45 if ($d < 1.5) { 43 if ($d < 1.5) {
46 if (grep $_->type == cf::FORCE && $_->slaying eq "schmorp-neko-gave-fish", $pl->inv) { 44 if (grep $_->type == cf::FORCE && $_->slaying eq "schmorp-neko-gave-fish", $pl->inv) {
47 # she likes us! 45 # she likes us!
48 if ($pl->{neko_next_pester} < time) { 46 if ($pl->{neko_next_pester} < time) {
65 $spell->set_last_sp (100); # fill sp 63 $spell->set_last_sp (100); # fill sp
66 $spell->set_last_grace (100); # fill gr 64 $spell->set_last_grace (100); # fill gr
67 $spell->set_attacktype (cf::AT_CONFUSION | cf::AT_POISON | cf::AT_BLIND | cf::AT_DISEASE); 65 $spell->set_attacktype (cf::AT_CONFUSION | cf::AT_POISON | cf::AT_BLIND | cf::AT_DISEASE);
68 66
69 $pl->message ("(Neko-san makes strange noises)"); 67 $pl->message ("(Neko-san makes strange noises)");
70 $pl->cast_spell ($who, $dir, $spell); 68 $pl->cast_spell ($self, $dir, $spell);
71 69
72 $spell->free; 70 $spell->free;
73 } 71 }
74 72
75 } else { 73 } else {
99 97
100 # circular movement 98 # circular movement
101 $dir = $dir % 8 + 1 unless $d > 1.5; 99 $dir = $dir % 8 + 1 unless $d > 1.5;
102 } 100 }
103 101
104 $who->move ($dir); 102 $self->move ($dir);
105 } 103 }
106 104
107 1 105 cf::override;
108} 106}
109 107
110sub on_attack { 108sub on_attack {
111 my ($event, $ob, $who) = @_; 109 my ($self) = @_;
110 #warn "attack<@_>\n";#d#
112 111
113 if ($who->{neko_last_attack} < time - 300) { 112 if ($self->{neko_last_attack} < time - 300) {
114 $who->{neko_attack} = 0; 113 $self->{neko_attack} = 0;
115 } 114 }
116 115
117 $who->{neko_last_attack} = time; 116 $self->{neko_last_attack} = time;
118 $who->{neko_attack}++ 117 $self->{neko_attack}++
119 or ext::schmorp_irc::do_notice "Neko-san was attacked by ". $who->name . "!\n"; 118 or ext::schmorp_irc::do_notice "Neko-san was attacked by ". $self->name . "!\n";
120 119
121 $who->message ("Meoow! (Please do not hurt me)") 120 $self->message ("Meoow! (Please do not hurt me)")
122 if !($who->{neko_attack} & 15); 121 if !($self->{neko_attack} & 15);
123 122
124 if ($who->{neko_attack} > 512) { 123 if ($self->{neko_attack} > 512) {
125 $who->{neko_attack} -= 128; 124 $self->{neko_attack} -= 128;
126 $who->message ("Neko-san is suddenly gone!"); 125 $self->message ("Neko-san is suddenly gone!");
127 teleport $who, "/scorn/misc/scorn_illusions", 15, 7; 126 teleport $self, "/scorn/misc/scorn_illusions", 15, 7;
128 $who->message ("You hear strange noises all around you..."); 127 $self->message ("You hear strange noises all around you...");
129 $who->message ("You feel dumb."); 128 $self->message ("You feel dumb.");
130 } 129 }
131 130
132 1 131 cf::override;
133} 132}
134 133
135sub on_say { 134sub on_listen {
136 my ($event, $ob, $who, $msg) = @_; 135 my ($event, $ob, $who, $msg) = @_;
137 136
138 cf::LOG cf::llevDebug, sprintf "QBERT [Neko-fon] %s: %s\n", $who->name, $msg; 137 cf::LOG cf::llevDebug, sprintf "QBERT [Neko-fon] %s: %s\n", $who->name, $msg;
139 ext::schmorp_irc::do_notice (sprintf "[Neko-fon] %s: %s\n", $who->name, $msg); 138 ext::schmorp_irc::do_notice (sprintf "[Neko-fon] %s: %s\n", $who->name, $msg);
140} 139}
141 140
141cf::register_attachment "Nekosan", package => __PACKAGE__;
142

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines