ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/ext/jeweler.ext
(Generate patch)

Comparing deliantra/server/ext/jeweler.ext (file contents):
Revision 1.11 by root, Sat May 19 00:11:11 2007 UTC vs.
Revision 1.12 by elmex, Tue Jul 31 09:40:15 2007 UTC

50 my @rings = map { Jeweler::Object->new (object => $_) } @ring; 50 my @rings = map { Jeweler::Object->new (object => $_) } @ring;
51 51
52 @rings >= 2 52 @rings >= 2
53 or return $pl->reply (undef, "You slap yourself, you forgot to put at least 2 jewels in!"); 53 or return $pl->reply (undef, "You slap yourself, you forgot to put at least 2 jewels in!");
54 54
55 my $input_level; 55 my $input_level = 0;
56 my $value; 56 my $value;
57 for (@rings) { 57 for (@rings) {
58 $input_level = max ($_->power_to_level, $input_level); 58 $input_level = max ($_->power_to_level, $input_level);
59 $value += $_->{hash}->{value}; 59 $value += $_->{hash}->{value};
60 } 60 }
61 61
62 my $ring = shift @rings; 62 my $ring = shift @rings;
63 $ring->improve_by_ring (@rings); 63 $ring->improve_by_ring (@rings);
64 64
65 if ($do_analyze) { 65 if ($do_analyze) {
66 $pl->reply (undef, "You want to make a " . $ring->to_string . ": " . $ring->analyze ($sk, $pl)); 66 $pl->reply (undef, "You want to make a " . $ring->to_string . ": " . $ring->analyze ($sk, $pl, $input_level));
67 $ring->wiz_analyze ($pl) 67 $ring->wiz_analyze ($pl)
68 if $pl->flag (cf::FLAG_WIZ); 68 if $pl->flag (cf::FLAG_WIZ);
69 return; 69 return;
70 } 70 }
71 71
86 86
87 my $make_status; 87 my $make_status;
88 my $exp; 88 my $exp;
89 89
90 if ($r <= $ch or $pl->flag (cf::FLAG_WIZ)) { 90 if ($r <= $ch or $pl->flag (cf::FLAG_WIZ)) {
91 my $lvl = max ($ring->power_to_level, 1); 91 $exp = $ring->projected_exp ($input_level);
92 $exp =
93 (cf::level_to_min_exp ($lvl) - cf::level_to_min_exp ($lvl - 1))
94 / (10 + max ($lvl - 1, 0)); # 10 + level times making such a ring
95 # should get you to the rings level at least.
96
97 if (defined $input_level) {
98 my $subexp =
99 (cf::level_to_min_exp ($input_level)
100 - cf::level_to_min_exp ($input_level - 1))
101 / (10 + max ($input_level - 1, 0)); # see above for comment
102
103 $exp -= $subexp;
104 $exp = max ($exp, 0);
105
106 } else {
107 # the experience bonus here is to make level 1 rings give you at least
108 # 100 exp points when making them. This also makes leveling in the
109 # first few levels a bit easier. (probably until around level 5-6).
110 my $expbonus = cf::level_to_min_exp (2) / 10;
111 # this bonus should also only be given for _new_ rings and not for merged
112 # ones - to prevent infinite exp making.
113 $exp += $expbonus;
114 }
115 92
116 $pl->change_exp ($exp, "jeweler", cf::SK_EXP_SKILL_ONLY); 93 $pl->change_exp ($exp, "jeweler", cf::SK_EXP_SKILL_ONLY);
117 $pl->message ("You succeed and get $exp experience points."); 94 $pl->message ("You succeed and get $exp experience points.");
118 $make_status = "succeeded"; 95 $make_status = "succeeded";
119 96
252 my $iring = $ingred->improve_ring_by_plan ($plan, $ringo); 229 my $iring = $ingred->improve_ring_by_plan ($plan, $ringo);
253 my $c1 = $ringo->calc_costs; 230 my $c1 = $ringo->calc_costs;
254 my $c2 = $iring->calc_costs; 231 my $c2 = $iring->calc_costs;
255 my $value = $iring->calc_value_from_cost ($c2); 232 my $value = $iring->calc_value_from_cost ($c2);
256 233
234 if ((not defined $c1) || (not defined $c2)) {
235 $pl->message ("The jewel has or will become a resistancy above 99%,\n"
236 ."that is completly impossible to make!");
237 return;
238 }
239
257 my %keys; 240 my %keys;
258 my %cdiff; 241 my %cdiff;
259 for (keys %$c1, keys %$c2) { $keys{$_} = 1 } 242 for (keys %$c1, keys %$c2) { $keys{$_} = 1 }
260 for (keys %keys) { $cdiff{$_} = $c2->{$_} - $c1->{$_}; } 243 for (keys %keys) { $cdiff{$_} = $c2->{$_} - $c1->{$_}; }
261 244

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines