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.72 by root, Mon Sep 4 17:58:51 2006 UTC vs.
Revision 1.79 by elmex, Fri Jan 5 14:17:49 2007 UTC

4 4
5=cut 5=cut
6 6
7package Crossfire; 7package Crossfire;
8 8
9our $VERSION = '0.9'; 9our $VERSION = '0.96';
10 10
11use strict; 11use strict;
12 12
13use base 'Exporter'; 13use base 'Exporter';
14 14
33 JSON::Syck::Dump $_[0] 33 JSON::Syck::Dump $_[0]
34} 34}
35 35
36our $LIB = $ENV{CROSSFIRE_LIBDIR}; 36our $LIB = $ENV{CROSSFIRE_LIBDIR};
37 37
38our $VARDIR = $ENV{HOME} ? "$ENV{HOME}/.crossfire" : File::Spec->tmpdir . "/crossfire"; 38our $VARDIR = $ENV{HOME} ? "$ENV{HOME}/.crossfire"
39 : $ENV{AppData} ? "$ENV{APPDATA}/crossfire"
40 : File::Spec->tmpdir . "/crossfire";
39 41
40mkdir $VARDIR, 0777; 42mkdir $VARDIR, 0777;
41 43
42sub TILESIZE (){ 32 } 44sub TILESIZE (){ 32 }
43 45
193 195
194sub _add_resist($$$) { 196sub _add_resist($$$) {
195 my ($ob, $mask, $value) = @_; 197 my ($ob, $mask, $value) = @_;
196 198
197 while (my ($k, $v) = each %attack_mask) { 199 while (my ($k, $v) = each %attack_mask) {
198 $ob->{"resist_$k"} += $value if $mask & $v; 200 $ob->{"resist_$k"} = min 100, max -100, $ob->{"resist_$k"} + $value if $mask & $v;
199 } 201 }
200} 202}
201 203
202# object as in "Object xxx", i.e. archetypes 204# object as in "Object xxx", i.e. archetypes
203sub normalize_object($) { 205sub normalize_object($) {
288 slaying => delete $ob->{"event_${event}"}, 290 slaying => delete $ob->{"event_${event}"},
289 name => delete $ob->{"event_${event}_options"}, 291 name => delete $ob->{"event_${event}_options"},
290 }; 292 };
291 } 293 }
292 } 294 }
295
296 # some archetypes had "+3" instead of the canonical "3", so fix
297 $ob->{dam} *= 1 if exists $ob->{dam};
293 298
294 $ob 299 $ob
295} 300}
296 301
297# arch as in "arch xxx", ie.. objects 302# arch as in "arch xxx", ie.. objects
597 my ($a) = @_; 602 my ($a) = @_;
598 603
599 my $o = $ARCH{$a->{_name}} 604 my $o = $ARCH{$a->{_name}}
600 or return; 605 or return;
601 606
602 my $face = $FACE{$a->{face} || $o->{face} || "blank.111"} 607 my $face = $FACE{$a->{face} || $o->{face} || "blank.111"};
608 unless ($face) {
609 $face = $FACE{"blank.x11"}
603 or (warn "no face data found for arch '$a->{_name}'"), return; 610 or (warn "no face data found for arch '$a->{_name}'"), return;
611 }
604 612
605 if ($face->{w} > 1 || $face->{h} > 1) { 613 if ($face->{w} > 1 || $face->{h} > 1) {
606 # bigface 614 # bigface
607 return (0, 0, $face->{w} - 1, $face->{h} - 1); 615 return (0, 0, $face->{w} - 1, $face->{h} - 1);
608 616

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines