ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/Deliantra/Deliantra.pm
(Generate patch)

Comparing deliantra/Deliantra/Deliantra.pm (file contents):
Revision 1.81 by root, Tue Feb 6 22:27:44 2007 UTC vs.
Revision 1.82 by root, Tue Feb 6 23:53:26 2007 UTC

199 while (my ($k, $v) = each %attack_mask) { 199 while (my ($k, $v) = each %attack_mask) {
200 $ob->{"resist_$k"} = min 100, max -100, $ob->{"resist_$k"} + $value if $mask & $v; 200 $ob->{"resist_$k"} = min 100, max -100, $ob->{"resist_$k"} + $value if $mask & $v;
201 } 201 }
202} 202}
203 203
204my %MATERIAL = reverse
205 paper => 1,
206 iron => 2,
207 glass => 4,
208 leather => 8,
209 wood => 16,
210 organic => 32,
211 stone => 64,
212 cloth => 128,
213 adamant => 256,
214 liquid => 512,
215 tin => 1024,
216 bone => 2048,
217 ice => 4096,
218;
219
204# object as in "Object xxx", i.e. archetypes 220# object as in "Object xxx", i.e. archetypes
205sub normalize_object($) { 221sub normalize_object($) {
206 my ($ob) = @_; 222 my ($ob) = @_;
223
224 # convert material bitset to materialname, if possible
225 if (exists $ob->{material}) {
226 if (!$ob->{material}) {
227 delete $ob->{material};
228 } elsif (exists $ob->{materialname}) {
229 if ($MATERIAL{$ob->{material}} eq $ob->{materialname}) {
230 delete $ob->{material};
231 } else {
232 warn "object $ob->{_name} has both materialname ($ob->{materialname}) and material ($ob->{material}) set.\n";
233 delete $ob->{material}; # assume materilname is more specific and nuke material
234 }
235 } else {
236 if (my $name = $MATERIAL{$ob->{material}}) {
237 delete $ob->{material};
238 $ob->{materialname} = $name;
239 }
240 }
241 }
207 242
208 # nuke outdated or never supported fields 243 # nuke outdated or never supported fields
209 delete @$ob{qw( 244 delete @$ob{qw(
210 can_knockback can_parry can_impale can_cut can_dam_armour 245 can_knockback can_parry can_impale can_cut can_dam_armour
211 can_apply pass_thru can_pass_thru 246 can_apply pass_thru can_pass_thru

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines