1 |
elmex |
1.1 |
package GCE::AttrTypemap; |
2 |
|
|
|
3 |
|
|
=head1 NAME |
4 |
|
|
|
5 |
|
|
GCE::AttrTypemap - this package handles the arch types and their specialities |
6 |
|
|
|
7 |
|
|
=cut |
8 |
|
|
|
9 |
|
|
use Crossfire; |
10 |
|
|
|
11 |
|
|
use strict; |
12 |
|
|
|
13 |
|
|
my %MONSTERATTRS = ( |
14 |
|
|
dam => [ 'damage' ], |
15 |
|
|
wc => [ 'weapon class' ], |
16 |
|
|
armour => [ 'armour' ], |
17 |
|
|
ac => [ 'armour class' ], |
18 |
|
|
# XXX: Can these values really be set/overridden from a map??? |
19 |
|
|
speed => [ 'speed' ], |
20 |
|
|
level => [ 'level' ], |
21 |
|
|
int => [ 'find hidden/invis.' ], |
22 |
|
|
pow => [ 'spell regen' ], |
23 |
|
|
con => [ 'regeneration' ], |
24 |
|
|
wis => [ 'wakeup radius' ], |
25 |
|
|
sp => [ 'spell points' ], |
26 |
|
|
maxsp => [ 'max spell pts.' ], |
27 |
|
|
flying => [ 'flying flag' ], |
28 |
|
|
see_invisible => [ 'see invisible' ], |
29 |
|
|
can_see_in_dark => [ 'can see in dark' ], |
30 |
|
|
reflect_spell => [ 'reflect spells' ], |
31 |
|
|
can_pass_thru => [ 'can pass thru' ], |
32 |
|
|
one_hit => [ 'kamikaze attacks' ], |
33 |
|
|
run_away => [ 'morale' ], |
34 |
|
|
); |
35 |
|
|
|
36 |
|
|
# XXX: maybe add explanation and allowed values |
37 |
|
|
our %ARCHTYPES = ( |
38 |
|
|
40 => { # PLAYERMOVER |
39 |
|
|
attacktype => [ 'paralyze' ], |
40 |
|
|
maxsp => [ 'paralysis moves' ], |
41 |
|
|
move_type => [ 'move type' ], |
42 |
|
|
speed => [ 'speed' ], |
43 |
|
|
sp => [ 'direction' ], |
44 |
|
|
level => [ 'move monsters' ], |
45 |
|
|
lifesave => [ 'can be used up' ], |
46 |
|
|
hp => [ 'use up moves' ], |
47 |
|
|
race => [ 'affected' ], |
48 |
|
|
slaying => [ 'unaffected' ], |
49 |
|
|
subtype => [ 'affected fields' ], |
50 |
|
|
}, |
51 |
|
|
42 => { # CREATOR |
52 |
|
|
other_arch => [ 'create obj' ], |
53 |
|
|
connected => [ 'trigger' ], |
54 |
|
|
hp => [ 'max create cnt' ], |
55 |
|
|
lifesave => [ 'stay alive' ], |
56 |
|
|
slaying => [ 'name of created obj' ], |
57 |
|
|
level => [ 'level of created obj' ], |
58 |
|
|
}, |
59 |
|
|
65 => { # MOOD FLOOR |
60 |
|
|
last_sp => [ 'mood' ], |
61 |
|
|
}, |
62 |
|
|
83 => { # DUPLICATOR |
63 |
|
|
connected => [ 'connected'], |
64 |
|
|
other_arch => [ 'copy arch' ], |
65 |
|
|
level => [ 'copy cnt' ] |
66 |
|
|
}, |
67 |
|
|
55 => { # MARKER |
68 |
|
|
slaying => [ 'code' ], |
69 |
|
|
speed => [ 'mark speed' ], |
70 |
|
|
food => [ 'mark duration' ], |
71 |
|
|
name => [ 'code remove' ], |
72 |
|
|
}, |
73 |
|
|
51 => { # DETECTOR |
74 |
|
|
slaying => [ 'detect name' ], |
75 |
|
|
speed => [ 'sample speed' ], |
76 |
|
|
connected => [ 'connected' ], |
77 |
|
|
sp => [ 'sets buttons' ], |
78 |
|
|
hp => [ 'search inventory' ], |
79 |
|
|
}, |
80 |
|
|
64 => { # CHECK_INV |
81 |
|
|
slaying => [ 'detect name' ], |
82 |
|
|
race => [ 'detect arch' ], |
83 |
|
|
hp => [ 'match value' ], |
84 |
|
|
last_heal => [ 'remove obj' ], |
85 |
|
|
last_sp => [ 'negate match' ], |
86 |
|
|
connected => [ 'push value' ], |
87 |
|
|
no_pass => [ 'no pass' ], |
88 |
|
|
}, |
89 |
|
|
103 => { # CONVERTER |
90 |
|
|
other_arch => [ 'convert into' ], |
91 |
|
|
slaying => [ 'convert from' ], |
92 |
|
|
sp => [ 'into count' ], |
93 |
|
|
food => [ 'from count' ], |
94 |
|
|
}, |
95 |
|
|
112 => { # DIRECTOR |
96 |
|
|
sp => [ 'direction' ], |
97 |
|
|
race => [ 'affected' ], |
98 |
|
|
slaying => [ 'unaffected' ], |
99 |
|
|
subtype => [ 'affected fields' ], |
100 |
|
|
}, |
101 |
|
|
122 => { # CONTAINER |
102 |
|
|
container => [ 'max weight' ], |
103 |
|
|
Str => [ 'reduce %' ], # lowercase?? |
104 |
|
|
str => [ 'reduce %' ], |
105 |
|
|
}, |
106 |
|
|
generator => { # GENERATOR? |
107 |
|
|
other_arch => [ 'spawn arch' ], |
108 |
|
|
use_content_on_gen => [ 'spawn inv.' ], |
109 |
|
|
}, |
110 |
|
|
80 => { # MONSTER |
111 |
|
|
%MONSTERATTRS |
112 |
|
|
}, |
113 |
|
|
monster => { # MONSTER? equivalent to type 80 ?? |
114 |
|
|
%MONSTERATTRS |
115 |
|
|
} |
116 |
|
|
); |
117 |
|
|
|
118 |
|
|
|
119 |
|
|
sub detect_types { |
120 |
|
|
my ($arch) = @_; |
121 |
|
|
|
122 |
|
|
my $al_arch = $Crossfire::ARCH->{$arch->{_name}}; |
123 |
|
|
|
124 |
|
|
my @types; |
125 |
|
|
|
126 |
|
|
$al_arch->{type} and push @types, $al_arch->{type}; |
127 |
|
|
|
128 |
|
|
$al_arch->{generator} and push @types, 'generator'; |
129 |
|
|
$al_arch->{monster} and push @types, 'monster'; |
130 |
|
|
|
131 |
|
|
return @types; |
132 |
|
|
} |
133 |
|
|
|
134 |
|
|
sub get_attr_alias { |
135 |
|
|
my ($arch, $key) = @_; |
136 |
|
|
|
137 |
|
|
my @names; |
138 |
|
|
|
139 |
|
|
# XXX: is lowercasing key correct? |
140 |
|
|
|
141 |
|
|
for my $type (detect_types ($arch)) { |
142 |
|
|
|
143 |
|
|
if (defined $ARCHTYPES{$type} and exists $ARCHTYPES{$type}->{lc $key}) { |
144 |
|
|
my $name = $ARCHTYPES{$type}->{lc $key}->[0]; |
145 |
|
|
|
146 |
|
|
push @names, $name; |
147 |
|
|
} |
148 |
|
|
} |
149 |
|
|
|
150 |
|
|
@names or return $key; |
151 |
|
|
return ((join ",", @names) . " ($key)"); |
152 |
|
|
} |
153 |
|
|
|
154 |
|
|
sub interesting_fields { |
155 |
|
|
my ($arch) = @_; |
156 |
|
|
|
157 |
|
|
my %keys; |
158 |
|
|
|
159 |
|
|
for my $type (detect_types ($arch)) { |
160 |
|
|
|
161 |
|
|
for (keys %{$ARCHTYPES{$type} || {}}) { |
162 |
|
|
$keys{$_}++; |
163 |
|
|
} |
164 |
|
|
} |
165 |
|
|
|
166 |
|
|
return keys %keys; |
167 |
|
|
} |
168 |
|
|
|
169 |
|
|
|
170 |
|
|
=head1 AUTHOR |
171 |
|
|
|
172 |
|
|
Marc Lehmann <schmorp@schmorp.de> |
173 |
|
|
http://home.schmorp.de/ |
174 |
|
|
|
175 |
|
|
Robin Redeker <elmex@ta-sa.org> |
176 |
|
|
http://www.ta-sa.org/ |
177 |
|
|
|
178 |
|
|
=cut |
179 |
|
|
1; |