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

Comparing deliantra/maps/perl/Jeweler.pm (file contents):
Revision 1.7 by elmex, Tue Sep 12 15:48:17 2006 UTC vs.
Revision 1.8 by elmex, Tue Sep 12 17:03:02 2006 UTC

718 718
719 $stats->$_ ($self->{hash}{stat}{lc $_}) 719 $stats->$_ ($self->{hash}{stat}{lc $_})
720 for qw/Str Dex Con Wis Cha Int Pow/; 720 for qw/Str Dex Con Wis Cha Int Pow/;
721 721
722 for (@Jeweler::RESISTS) { 722 for (@Jeweler::RESISTS) {
723 $obj->resistance ($_, $self->{hash}->{resist}->{$_}); 723 $obj->set_resistance ($_, $self->{hash}->{resist}->{$_});
724 } 724 }
725 725
726 $obj->flag (cf::FLAG_IDENTIFIED, 1); 726 $obj->flag (cf::FLAG_IDENTIFIED, 1);
727 727
728 return $obj; 728 return $obj;
734 734
735 my $maxlevel = Jeweler::getcfg (maxlevels => 'stat_level'); 735 my $maxlevel = Jeweler::getcfg (maxlevels => 'stat_level');
736 my $maxstat = Jeweler::getcfg (maximprovements => 'stats'); 736 my $maxstat = Jeweler::getcfg (maximprovements => 'stats');
737 737
738 my $stat_cnt = scalar (grep { $_ > 0 } values %$stats); 738 my $stat_cnt = scalar (grep { $_ > 0 } values %$stats);
739 my $stat_sum = sum (values %$stats); 739 my $stat_sum = sum (values %$stats); # also count the negative stats!
740 my $level = int (($maxlevel / $maxstat) * $stat_sum); 740 my $level = int (($maxlevel / $maxstat) * $stat_sum);
741 741
742 ($level, $stat_cnt) 742 ($level, $stat_cnt)
743} 743}
744 744

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines