… | |
… | |
209 | my $plan = $ingred->get_plan; |
209 | my $plan = $ingred->get_plan; |
210 | |
210 | |
211 | if ($plan) { |
211 | if ($plan) { |
212 | my @ring = $ingred->get_ring; |
212 | my @ring = $ingred->get_ring; |
213 | |
213 | |
|
|
214 | if (!@ring) { |
|
|
215 | # actually the algorithm cant |
|
|
216 | $pl->message ("You slap yourself, you forgot the jewelery!"); |
|
|
217 | return; |
|
|
218 | |
214 | if ((@ring > 1) || ($ring[0]->nrof > 1)) { |
219 | } elsif ((@ring > 1) || (grep { $_->nrof > 1 } @ring)) { |
215 | # actually the algorithm cant handle more than one improvement at a time |
220 | # actually the algorithm cant handle more than one improvement at a time |
216 | $pl->message ("You can't manage to improve more than one thing at a time!"); |
221 | $pl->message ("You can't manage to improve more than one thing at a time!"); |
217 | return; |
222 | return; |
218 | |
|
|
219 | } elsif (@ring < 1) { |
|
|
220 | # actually the algorithm cant |
|
|
221 | $pl->message ("You slap yourself, you forgot the jewelery!"); |
|
|
222 | return; |
|
|
223 | |
|
|
224 | } else { |
223 | } else { |
225 | my $ringo = Jeweler::Object->new (object => $ring[0]); |
224 | my $ringo = Jeweler::Object->new (object => $ring[0]); |
226 | my $iring = $ingred->improve_ring_by_plan ($plan, $ringo); |
225 | my $iring = $ingred->improve_ring_by_plan ($plan, $ringo); |
227 | my $c1 = $ringo->calc_costs; |
226 | my $c1 = $ringo->calc_costs; |
228 | my $c2 = $iring->calc_costs; |
227 | my $c2 = $iring->calc_costs; |