… | |
… | |
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) { |
230 | $chdl->put (my $ob = cf::object::new $outarch); |
230 | $chdl->put (my $ob = cf::object::new $outarch); |
231 | $ob->set_animation (cf::rndm $ob->num_animations); |
231 | $ob->set_animation (cf::rndm $ob->num_animations) |
|
|
232 | if ($ob->type == cf::RING); |
232 | $ob->flag (cf::FLAG_IDENTIFIED, 1); |
233 | $ob->flag (cf::FLAG_IDENTIFIED, 1); |
233 | } |
234 | } |
234 | |
235 | |
235 | my $xp_sum = ($xp_gain * $nrof); |
236 | my $xp_sum = ($xp_gain * $nrof); |
236 | |
237 | |
… | |
… | |
328 | cf::POTION => 'potions', |
329 | cf::POTION => 'potions', |
329 | cf::SCROLL => 'scrolls', |
330 | cf::SCROLL => 'scrolls', |
330 | ); |
331 | ); |
331 | |
332 | |
332 | for ($self->{cauldron}->inv) { |
333 | for ($self->{cauldron}->inv) { |
|
|
334 | if (!$_->flag (cf::FLAG_IDENTIFIED) && $_->need_identify) { |
|
|
335 | die "unidentified"; |
333 | if ($_->flag (cf::FLAG_CURSED) || $_->flag (cf::FLAG_DAMNED)) { |
336 | } elsif ($_->flag (cf::FLAG_CURSED) || $_->flag (cf::FLAG_DAMNED)) { |
334 | die "cursed"; |
337 | die "cursed"; |
335 | } |
338 | } |
336 | |
339 | |
337 | if (my $k = $type_to_key{$_->type}) { |
340 | if (my $k = $type_to_key{$_->type}) { |
338 | push @{$ingreds->{$k}}, $_; |
341 | push @{$ingreds->{$k}}, $_; |
… | |
… | |
624 | my $self = bless { }, $class; |
627 | my $self = bless { }, $class; |
625 | |
628 | |
626 | $self->ring_or_ammy_to_hash ($arg{object}); |
629 | $self->ring_or_ammy_to_hash ($arg{object}); |
627 | |
630 | |
628 | $self; |
631 | $self; |
|
|
632 | } |
|
|
633 | |
|
|
634 | sub has_resist { |
|
|
635 | my ($self, $resistnam, $resistval) = @_; |
|
|
636 | my $resnum = $REV_RESMAP{uc $resistnam}; |
|
|
637 | if (defined ($resistval)) { |
|
|
638 | return 1 if $self->{hash}->{resist}->{$resnum} == $resistval; |
|
|
639 | } else { |
|
|
640 | return 1 if $self->{hash}->{resist}->{$resnum}; |
|
|
641 | } |
|
|
642 | return undef; |
629 | } |
643 | } |
630 | |
644 | |
631 | sub analyze { |
645 | sub analyze { |
632 | my ($self, $sk, $pl) = @_; |
646 | my ($self, $sk, $pl) = @_; |
633 | |
647 | |
… | |
… | |
764 | sub to_object { |
778 | sub to_object { |
765 | my ($self) = @_; |
779 | my ($self) = @_; |
766 | |
780 | |
767 | my $obj = cf::object::new $self->{hash}->{arch}; |
781 | my $obj = cf::object::new $self->{hash}->{arch}; |
768 | |
782 | |
|
|
783 | $obj->item_power ($self->power_to_level); # there have to be strings attached! |
|
|
784 | |
769 | $obj->face ($self->{hash}{face}); |
785 | $obj->face ($self->{hash}{face}); |
770 | |
786 | |
771 | my $stats = $obj->stats; |
787 | my $stats = $obj->stats; |
772 | |
788 | |
773 | $stats->hp ($self->{hash}{spec}{regen}); |
789 | $stats->hp ($self->{hash}{spec}{regen}); |