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.1 by root, Wed Feb 8 04:32:42 2006 UTC vs.
Revision 1.10 by root, Fri Feb 17 19:36:36 2006 UTC

1#! perl 1#! perl
2 2
3# /var/crossfire/unique-items/world@world_105_115.v00 3# archetype nekosan
4
5# arch neko
6# face neko.115
7# friendly 1
8# unaggressive 1
9# level 200
10# hp 10000
11# exp 1
12# wc -120
13# ac -120
14# wis 100
15# str 100
16# dex 100
17# con 100
18# int 100
19# pow 100
20# cha 100
21# hitback 0
22# reflect_missile 1
23# reflect_spells 1
24# resist_death 100
25# resist_physical 100
26# resist_magic 100
27# resist_fire 100
28# resist_electricity 100
29# resist_cold 100
30# resist_confusion 100
31# resist_acid 100
32# resist_drain 100
33# resist_weaponmagic 100
34# resist_ghosthit 100
35# resist_poison 100
36# resist_slow 100
37# resist_paralyze 100
38# resist_fear 100
39# resist_deplete 100
40# resist_turn_undead 100
41# resist_death 100
42# resist_chaos 100
43# resist_blind 100
44# resist_holyword 100
45# resist_godpower 100
46# x 4
47# y 37
48# speed_left -0.699994
49# direction 5
50# unique 1
51# sleep 0
52# arch event_say
53# title perl
54# slaying schmorp-neko
55# end
56# arch event_attack
57# title perl
58# slaying schmorp-neko
59# end
60# arch event_move
61# title perl
62# slaying schmorp-neko
63# end
64# end
65 4
66use Data::Dumper; 5use Data::Dumper;
67 6
68sub teleport { 7sub teleport {
69 my ($pl, $map, $x, $y) = @_; 8 my ($pl, $map, $x, $y) = @_;
70 9
71 my $portal = cf::object::new ("exit"); 10 my $portal = cf::object::new "exit";
72 11
73 $portal->set_slaying ($map); 12 $portal->set_slaying ($map);
74 $portal->set_hp ($x); 13 $portal->set_hp ($x);
75 $portal->set_sp ($y); 14 $portal->set_sp ($y);
76 15
81 20
82sub on_move { 21sub on_move {
83 my ($data) = @_; 22 my ($data) = @_;
84 23
85 if (my $pl = $data->{who}->nearest_player) { 24 if (my $pl = $data->{who}->nearest_player) {
86 my (undef, undef, undef, $dir, undef) = $data->{who}->direction ($pl); 25 my ($d, undef, undef, $dir, undef) = $data->{who}->rangevector ($pl);
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
77 $dir = $dir % 8 + 1 unless $d > 1.5;
78 }
79
87 $data->{who}->move ($data->{who}, $dir); 80 $data->{who}->move ($dir);
88 } 81 }
89 82
90 1 83 1
91} 84}
92 85
93sub on_attack { 86sub on_attack {
94 my ($data) = @_; 87 my ($data) = @_;
95 88
89 $data->{activator}{neko_attack}++
96 cf::LOG cf::llevDebug, sprintf "QBERT Neko-san was attacked by %s!", $data->{activator}->name; 90 or cf::LOG cf::llevDebug, sprintf "QBERT Neko-san was attacked by %s!\n", $data->{activator}->name;
97 91
98 $data->{activator}->message ("Neko-san is suddenly gone!"); 92 $data->{activator}->message ("Meoow! (Please do not hurt me)")
99 teleport $data->{activator}, "/scorn/misc/scorn_illusions", 15, 7; 93 if !($data->{activator}{neko_attack} & 15);
100 $data->{activator}->message ("You hear strange noises all around you...");
101 $data->{activator}->message ("You feel dumb.");
102 94
95 if ($data->{activator}{neko_attack} > 512) {
96 $data->{activator}{neko_attack} -= 128;
97 $data->{activator}->message ("Neko-san is suddenly gone!");
98 teleport $data->{activator}, "/scorn/misc/scorn_illusions", 15, 7;
99 $data->{activator}->message ("You hear strange noises all around you...");
100 $data->{activator}->message ("You feel dumb.");
103 0 101 }
102
103 1
104} 104}
105 105
106sub on_say { 106sub on_say {
107 my ($data) = @_; 107 my ($data) = @_;
108 108
109 cf::LOG cf::llevDebug, "QBERT [Neko-fon] $data->{message}"; 109 cf::LOG cf::llevDebug, sprintf "QBERT [Neko-fon] %s: %s\n", $data->{activator}->name, $data->{message};
110 110
111 0 111 0
112} 112}
113 113

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines