… | |
… | |
164 | |
164 | |
165 | sub analyze { |
165 | sub analyze { |
166 | my ($sk, $chdl, $pl, $input_level) = @_; |
166 | my ($sk, $chdl, $pl, $input_level) = @_; |
167 | |
167 | |
168 | my $hadunid = 0; |
168 | my $hadunid = 0; |
|
|
169 | my $found = 0; |
169 | for ($chdl->grep_by_type (cf::RING, cf::AMULET)) { |
170 | for ($chdl->grep_by_type (cf::RING, cf::AMULET)) { |
170 | if (!$_->flag (cf::FLAG_IDENTIFIED) && $_->need_identify) { |
171 | if (!$_->flag (cf::FLAG_IDENTIFIED) && $_->need_identify) { |
171 | $hadunid = 1; |
172 | $hadunid = 1; |
172 | next; |
173 | next; |
173 | } |
174 | } |
|
|
175 | $found = 1; |
174 | my $r = Jeweler::Object->new (object => $_); |
176 | my $r = Jeweler::Object->new (object => $_); |
175 | my $msg = $r->analyze ($sk, $pl, $input_level); |
177 | my $msg = $r->analyze ($sk, $pl, $input_level); |
176 | $pl->message ($r->to_string . ": " . $msg); |
178 | $pl->message ($r->to_string . ": " . $msg); |
177 | if ($pl->flag (cf::FLAG_WIZ)) { |
179 | if ($pl->flag (cf::FLAG_WIZ)) { |
178 | $r->wiz_analyze ($pl); |
180 | $r->wiz_analyze ($pl); |
179 | } |
181 | } |
180 | } |
182 | } |
181 | $pl->message ("You couldn't identify the other rings and not analyze them!") |
183 | $pl->message ("You couldn't identify the other rings and not analyze them!") |
182 | if $hadunid; |
184 | if $hadunid; |
|
|
185 | $pl->message ("You couldn't find anything in the bench to analyse!") |
|
|
186 | unless $found; |
183 | } |
187 | } |
184 | |
188 | |
185 | # this function converts metals/minerals into a raw ring (of adornment) |
189 | # this function converts metals/minerals into a raw ring (of adornment) |
186 | sub simple_converter { |
190 | sub simple_converter { |
187 | my ($pl, $ingred, $chdl, $conv) = @_; |
191 | my ($pl, $ingred, $chdl, $conv) = @_; |
… | |
… | |
659 | $exp -= $subexp; |
663 | $exp -= $subexp; |
660 | $exp = max ($exp, 0); |
664 | $exp = max ($exp, 0); |
661 | |
665 | |
662 | } else { |
666 | } else { |
663 | # the experience bonus here is to make level 1 rings give you at least |
667 | # the experience bonus here is to make level 1 rings give you at least |
664 | # 100 exp points when making them. This also makes leveling in the |
668 | # 200 exp points when making them. This also makes leveling in the |
665 | # first few levels a bit easier. (probably until around level 5-6). |
669 | # first few levels a bit easier. (probably until around level 5-6). |
666 | my $expbonus = cf::level_to_min_exp (2) / 10; |
670 | my $expbonus = cf::level_to_min_exp (2) / 5; |
667 | # this bonus should also only be given for _new_ rings and not for merged |
671 | # this bonus should also only be given for _new_ rings and not for merged |
668 | # ones - to prevent infinite exp making. |
672 | # ones - to prevent infinite exp making. |
669 | $exp += $expbonus; |
673 | $exp += $expbonus; |
670 | } |
674 | } |
671 | |
675 | |
… | |
… | |
715 | if (defined $costs) { |
719 | if (defined $costs) { |
716 | my $desc = ""; |
720 | my $desc = ""; |
717 | my $lvl = $self->power_to_level (\$desc); |
721 | my $lvl = $self->power_to_level (\$desc); |
718 | my $scosts = $self->calc_value_from_cost ($costs); |
722 | my $scosts = $self->calc_value_from_cost ($costs); |
719 | |
723 | |
720 | $pl->message ("costs: " . (join (', ', map { "$_: " . sprintf "%.2f", $costs->{$_} } keys %$costs)) . " (".($scosts / 5000)." royalties)"); |
724 | $pl->message ("costs: " |
|
|
725 | . (join ', ', map { "$_: " . sprintf "%.2f", $costs->{$_} } keys %$costs) |
|
|
726 | . " (" |
|
|
727 | . ($scosts / "platinacoin"->cf::arch::find->value) |
|
|
728 | . " platinum)"); |
721 | $pl->message ("level: " . $desc); |
729 | $pl->message ("level: $desc"); |
722 | } else { |
730 | } else { |
723 | $pl->message ("level: impossible to make, due to impossible resistancy configuration"); |
731 | $pl->message ("level: impossible to make, due to impossible resistancy configuration"); |
724 | } |
732 | } |
725 | } |
733 | } |
726 | |
734 | |