… | |
… | |
219 | } |
219 | } |
220 | |
220 | |
221 | my $archvalsum = $ingred->value ($ingr_grp, $srcarchname); |
221 | my $archvalsum = $ingred->value ($ingr_grp, $srcarchname); |
222 | $ingred->remove ($ingr_grp, $srcarchname); |
222 | $ingred->remove ($ingr_grp, $srcarchname); |
223 | |
223 | |
224 | my $outarchval = cf::arch::find ($outarch)->clone->value; |
224 | my $outarchval = cf::arch::find ($outarch)->value; |
225 | |
225 | |
226 | my $nrof = int ($archvalsum / (($outarchval || 1000) * $outarchvalfact)); |
226 | my $nrof = int ($archvalsum / (($outarchval || 1000) * $outarchvalfact)); |
227 | if ($nrof) { |
227 | if ($nrof) { |
228 | # XXX: yes, i know what i'm doing here, i don't set nrof, but it didn't work somehow (pls. chek sometimes) |
228 | # XXX: yes, i know what i'm doing here, i don't set nrof, but it didn't work somehow (pls. chek sometimes) |
229 | for (1..$nrof) { |
229 | for (1..$nrof) { |
… | |
… | |
238 | if ($xp_sum) { |
238 | if ($xp_sum) { |
239 | $pl->ob->message ("You got $xp_sum xp by making $nrof ${outarch}s"); |
239 | $pl->ob->message ("You got $xp_sum xp by making $nrof ${outarch}s"); |
240 | $pl->ob->change_exp ($xp_sum, "jeweler", cf::SK_EXP_SKILL_ONLY); |
240 | $pl->ob->change_exp ($xp_sum, "jeweler", cf::SK_EXP_SKILL_ONLY); |
241 | } |
241 | } |
242 | } else { |
242 | } else { |
243 | $pl->ob->message ("You fail to make something, propably you used not enough source material?"); |
243 | $pl->ob->message ("You fail to make something, probably you used not enough source material?"); |
244 | } |
244 | } |
245 | } |
245 | } |
246 | |
246 | |
247 | |
247 | |
248 | package Jeweler::CauldronHandler; |
248 | package Jeweler::CauldronHandler; |
… | |
… | |
664 | my $emarch = cf::arch::find 'emerald'; |
664 | my $emarch = cf::arch::find 'emerald'; |
665 | my $saarch = cf::arch::find 'sapphire'; |
665 | my $saarch = cf::arch::find 'sapphire'; |
666 | my $pearch = cf::arch::find 'pearl'; |
666 | my $pearch = cf::arch::find 'pearl'; |
667 | my $ruarch = cf::arch::find 'ruby'; |
667 | my $ruarch = cf::arch::find 'ruby'; |
668 | my $diarch = cf::arch::find 'gem'; |
668 | my $diarch = cf::arch::find 'gem'; |
669 | my $value = $emarch->clone->value * $costs->{emerald} |
669 | my $value = $emarch->value * $costs->{emerald} |
670 | + $saarch->clone->value * $costs->{sapphire} |
670 | + $saarch->value * $costs->{sapphire} |
671 | + $pearch->clone->value * $costs->{pearl} |
671 | + $pearch->value * $costs->{pearl} |
672 | + $ruarch->clone->value * $costs->{ruby} |
672 | + $ruarch->value * $costs->{ruby} |
673 | + $diarch->clone->value * $costs->{gem}; |
673 | + $diarch->value * $costs->{gem}; |
674 | |
674 | |
675 | $value |
675 | $value |
676 | } |
676 | } |
677 | |
677 | |
678 | sub wiz_analyze { |
678 | sub wiz_analyze { |
… | |
… | |
796 | sub to_object { |
796 | sub to_object { |
797 | my ($self) = @_; |
797 | my ($self) = @_; |
798 | |
798 | |
799 | my $obj = cf::object::new $self->{hash}->{arch}; |
799 | my $obj = cf::object::new $self->{hash}->{arch}; |
800 | |
800 | |
801 | $obj->item_power ($self->power_to_level); # there have to be strings attached! |
801 | $obj->item_power (floor ($self->power_to_level / 3)); # there have to be strings attached! |
802 | |
802 | |
803 | $obj->face ($self->{hash}{face}); |
803 | $obj->face ($self->{hash}{face}); |
804 | |
804 | |
805 | my $stats = $obj->stats; |
805 | my $stats = $obj->stats; |
806 | |
806 | |
… | |
… | |
1030 | my $saarch = cf::arch::find 'sapphire'; |
1030 | my $saarch = cf::arch::find 'sapphire'; |
1031 | my $pearch = cf::arch::find 'pearl'; |
1031 | my $pearch = cf::arch::find 'pearl'; |
1032 | my $ruarch = cf::arch::find 'ruby'; |
1032 | my $ruarch = cf::arch::find 'ruby'; |
1033 | my $diarch = cf::arch::find 'gem'; |
1033 | my $diarch = cf::arch::find 'gem'; |
1034 | |
1034 | |
1035 | my $sumvalue = $diarch->clone->value * $diamonds; |
1035 | my $sumvalue = $diarch->value * $diamonds; |
1036 | |
1036 | |
1037 | $cost->{emerald} += ceil $sumvalue * $stat_split->[0] / max 1, $emarch->clone->value; |
1037 | $cost->{emerald} += ceil $sumvalue * $stat_split->[0] / max 1, $emarch->value; |
1038 | $cost->{sapphire} += ceil $sumvalue * $stat_split->[1] / max 1, $saarch->clone->value; |
1038 | $cost->{sapphire} += ceil $sumvalue * $stat_split->[1] / max 1, $saarch->value; |
1039 | $cost->{pearl} += ceil $sumvalue * $stat_split->[2] / max 1, $pearch->clone->value; |
1039 | $cost->{pearl} += ceil $sumvalue * $stat_split->[2] / max 1, $pearch->value; |
1040 | $cost->{ruby} += ceil $sumvalue * $stat_split->[3] / max 1, $ruarch->clone->value; |
1040 | $cost->{ruby} += ceil $sumvalue * $stat_split->[3] / max 1, $ruarch->value; |
1041 | $cost->{gem} += ceil $sumvalue * $stat_split->[4] / max 1, $diarch->clone->value; |
1041 | $cost->{gem} += ceil $sumvalue * $stat_split->[4] / max 1, $diarch->value; |
1042 | } |
1042 | } |
1043 | |
1043 | |
1044 | package Jeweler::Util; |
1044 | package Jeweler::Util; |
1045 | |
1045 | |
1046 | use strict; |
1046 | use strict; |