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