… | |
… | |
44 | my @ring = $ingred->get_ring; |
44 | my @ring = $ingred->get_ring; |
45 | my @rings = map { Jeweler::Object->new (object => $_) } @ring; |
45 | my @rings = map { Jeweler::Object->new (object => $_) } @ring; |
46 | |
46 | |
47 | if (@rings < 2) { |
47 | if (@rings < 2) { |
48 | $pl->message ("You slap yourself, you forgot to put at least 2 jeweles in!"); |
48 | $pl->message ("You slap yourself, you forgot to put at least 2 jeweles in!"); |
|
|
49 | return; |
49 | } |
50 | } |
50 | |
51 | |
51 | my $ring = shift @rings; |
52 | my $ring = shift @rings; |
52 | $ring->improve_by_ring (@rings); |
53 | $ring->improve_by_ring (@rings); |
53 | |
54 | |
… | |
… | |
71 | } |
72 | } |
72 | |
73 | |
73 | my $ch = $ring->get_chance_perc ($sk); |
74 | my $ch = $ring->get_chance_perc ($sk); |
74 | my $succ = 0; |
75 | my $succ = 0; |
75 | my $r = cf::random_roll (0, 100, $pl, cf::PREFER_HIGH); |
76 | my $r = cf::random_roll (0, 100, $pl, cf::PREFER_HIGH); |
76 | if ($r <= $ch) { |
77 | if ($r <= $ch or $pl->get_flag (cf::FLAG_WIZ)) { |
|
|
78 | my $lvl = max ($ring->power_to_level, 1); |
|
|
79 | my $exp = (cf::level_to_min_exp ($lvl) - cf::level_to_min_exp ($lvl - 1)) / 100; |
|
|
80 | $pl->change_exp ($exp, "jeweler", cf::SK_EXP_SKILL_ONLY); |
77 | $pl->message ("You succeed."); |
81 | $pl->message ("You succeed and get $exp experience."); |
78 | } else { |
82 | } else { |
79 | $pl->message ("You fail!"); |
83 | $pl->message ("You fail!"); |
80 | $ring->negate; |
84 | $ring->negate; |
81 | } |
85 | } |
82 | $chdl->put ($ring->to_object); |
86 | $chdl->put ($ring->to_object); |
… | |
… | |
135 | my @ring = $ingred->get_ring; |
139 | my @ring = $ingred->get_ring; |
136 | |
140 | |
137 | if ((@ring > 1) || ($ring[0]->nrof > 1)) { |
141 | if ((@ring > 1) || ($ring[0]->nrof > 1)) { |
138 | # actually the algorithm cant handle more than one improvement at a time |
142 | # actually the algorithm cant handle more than one improvement at a time |
139 | $pl->message ("You can't manage to improve more than one thing at a time!"); |
143 | $pl->message ("You can't manage to improve more than one thing at a time!"); |
|
|
144 | return; |
140 | |
145 | |
141 | } elsif (@ring < 1) { |
146 | } elsif (@ring < 1) { |
142 | # actually the algorithm cant |
147 | # actually the algorithm cant |
143 | $pl->message ("You slap yourself, you forgot the jewelery!"); |
148 | $pl->message ("You slap yourself, you forgot the jewelery!"); |
|
|
149 | return; |
144 | |
150 | |
145 | } else { |
151 | } else { |
146 | my $ringo = Jeweler::Object->new (object => $ring[0]); |
152 | my $ringo = Jeweler::Object->new (object => $ring[0]); |
147 | my $iring = $ingred->improve_ring_by_plan ($plan, $ringo); |
153 | my $iring = $ingred->improve_ring_by_plan ($plan, $ringo); |
148 | my $c1 = $ringo->calc_costs; |
154 | my $c1 = $ringo->calc_costs; |